Tuesday, 10 January 2012

Cracking WPA/WPA2 easily using WPS Vulnerability

Just when you thought that WPA/WPA2 would be secure by setting a long enough password that is not a dictionary word, there is a vulnerability that has been exploited to crack the WPA/WPA2 key. Well to be exact the vulnerability is in the WPS (WiFi Protected Setup).  It is a bruteforce vulnerability to find the PIN for the WiFi Protected Setup. Since, once the PIN is cracker, the WPA/WPA2 key can be recovered.

It was discovered by Stefan Viehböck. Here's his excellent paper on the vulnerability :-  http://sviehb.files.wordpress.com/2011/12/viehboeck_wps.pdf

Anatomy of the WPS PIN BruteForce Attack Vulnerability :-

WPS was designed by the Wi-Fi Alliance in 2007, to enable users with little knowledge of traditional WiFi technology to configure WiFi networks. Various vendors have adopted this technology to make their products WiFi CERTIFIED for the WPS.

As intended to be, the WPS is not so secure and consist of some design and implementation flaws.

Part 1 :

For authentication, the WPS supported APs ask for a PIN that is mentioned on the back side of the router. Or else you also have the option of pressing a button on the router to connect and configure the device. Both of these require physical access of the device.

It is the same when an external user (who is not connected with the device) tries to configure it, the user just has to supply the PIN mentioned on the back of the device. The AP then supplies the external user with the WPA/WPA2 key. 

Configuration screen to access the AP through WPS :-



Form to enter the PIN mentioned on the back of the AP device :-




WPS PIN is mentioned on the backside of the AP device :-


 

Part 2 :

The vulnerability lies in the fact that an external user can bruteforce on the PIN number to connect to the AP, since there is no more layers of authentication apart from the PIN. Although, some devices support lockout after particular number of failed attempts, it is usually just for a short duration.


Part 3 :

The 8 bit PIN is divided into 2 parts as follows :-

 





Whenever the WPS authentication fails at any point, the AP will respond with an EAP-NACK message. The point at which the EAP-NACK message is received, determines if the 1st or 2nd part of the PIN is incorrect. This way the authentication attempts required are reduced from 10^8 (=100.000.000) to 10^3 (=11000)

Here is the flowchart for the BruteForce Methodology (courtesy Stefan Viehböck) :-  





Part 4 :

Time duration required :- Apparently, each authentication requires between 0.5 to 3 seconds to complete. So, if there is no blocking mechanism from the AP, at 1.3 seconds/attempt, we can try all possible PIN combinations in less than 4 hours.


Part 5 :

Mitigation :-
The best solution is to deactivate the WPS funtionality in your AP, although this may not always be possible.

This requires the vendors to implement sufficient lockout periods from the AP. Unfortunately, this would require a updating the firmware, not a very viable solution, so most APs would remain vulnerable to these attack.

Tuesday, 27 December 2011

Session Fixation Vulnerability on a Leading Bank's website

Session fixation vulnerabilities occur when:

    A web application authenticates a user without first invalidating the existing session ID, thereby continuing to use the session ID already associated with the user.
    An attacker is able to force a known session ID on a user so that, once the user authenticates, the attacker has access to the authenticated session.

In the generic exploit of session fixation vulnerabilities, an attacker creates a new session on a web application and records the associated session identifier. The attacker then causes the victim to authenticate against the server using the same session identifier, giving the attacker access to the user's account through the active session.

Furthermore, the issue described above is problematic for sites which issue a session identifier over HTTP and then redirect the user to a HTTPS login form. If the session identifier is not reissued upon authentication, the identifier may be eavesdropped and may be used by an attacker to hijack the session.


Summary :-

When an application does not renew its session cookie after a successful user authentication, it could be possible to find a session fixation vulnerability and force a user to utilize a cookie known by the attacker. In that case, an attacker could steal the user session (session hijacking).


Anatomy of a Session Fixation Attack :-

Step I :- Here is the request to the banking application



Step II :- The response from the application sets a cookie in the browser



Step III :- Modify the Session Id value in the Set-Cookie function. This will cause all of the subsequent requests from the browser to contain the modified Session Id.




Step IV :- Now when the same modified Session Id is sent in the request when the user tries to log into the application.



Step V :- Login successful with user supplied Session Id



The vulnerability has been reported to the bank, hope their response is quick.

Tuesday, 6 December 2011

Murder... Death... Kill... Whatever...

MDK3 is a WiFi tool that can be used for DOS Attack on APs or Beacon Flood among many other things. Now, MDK3 is available in BackTrack5. Here's the link to ASPj's website for MDK3.

MDK3 Features as listed on ASPj's Website :-
    Bruteforce MAC Filters
    Bruteforce hidden SSIDs (some small SSID wordlists included)
    Probe networks to check if they can hear you
    intelligent Authentication-DoS to freeze APs (with success checks)
    FakeAP - Beacon Flooding with channel hopping (can crash NetStumbler and some buggy drivers)
    Disconnect everything (aka AMOK-MODE) with Deauthentication and Disassociation packets
    WPA TKIP Denial-of-Service
    WDS Confusion - Shuts down large scale multi-AP installations

# mdk3 



BEACON FLOOD (FAKE AP)


First lets see the how the Beacon Flood (Fake AP) works.

There are 3 types of packets in 802.11 :-
 - Management
 - Control
 - Data

Beacon Frame is a subtype of Management Frames --> Subtype 8
Beacon Frames are broadcast frames which are sent out periodically by APs to broadcast their presence.

Everything is in plaintext inside a Beacon Frame. So, if we spoof a Beacon Frames, WiFi devices  in the vicinity will report a new AP.

# mdk3 --help b





The Beacon Flood will create a Fake Access Point in the sense that it starts broadcasting Beacon frames using your WiFi card. So, all of the clients in the vicinity will detect a new AP.

The reason for doing a Beacon Flood could be several. It can be used for the MITM attack, or also a DOS,
since creating a fake AP with an SSID that already exists in range, cause the crash of wifi driver and its
scanner in the victim.

List of APs in range :-



# airodump-ng mon0 -c 6                      ->  To find list of APs in range



# mdk3 mon0 b -n mogambo -a -c 6                    ->  Start Beacon Flood on Channel 6 on interface mon0 with SSID mogambo



The Fake AP appears in the list of APs in range :-