{"id":453,"date":"2011-10-15T23:42:28","date_gmt":"2011-10-15T23:42:28","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=453"},"modified":"2011-10-15T23:54:31","modified_gmt":"2011-10-15T23:54:31","slug":"securitytube-wireless-lan-security-megaprimer-notes-parts-1-to-4","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2011\/10\/securitytube-wireless-lan-security-megaprimer-notes-parts-1-to-4\/","title":{"rendered":"SecurityTube, Wireless Lan Security Megaprimer notes: parts 1 to 4"},"content":{"rendered":"<p>These are my notes on Parts 1 to 4 of the security tube wireless security videos <a href=\"http:\/\/www.securitytube.net\/groups?operation=view&#038;groupId=9\">here<\/a>.<\/p>\n<p>I&#8217;m using Backtrack verison 5 R1 whereas Vivek is using version 4. The only different so far is that mdk is on the path, so I can just type &#8220;mdk&#8221; to launch it.<\/p>\n<h2>Part 1<\/h2>\n<p>This is the wireless device used in all the videos:<\/p>\n<p>Alfa Networks AWUS036H USB Wifi device<\/p>\n<p>* Integrated into Braktrack<br \/>\n* Allows for packet sniffing<br \/>\n* Allows for packet injection<br \/>\n* 1W output<\/p>\n<p>Will also need a AP, two laptops. Some smartphones may be interesting.<\/p>\n<p>Install Backtrack (tutorials use Backtrack 4R2).<\/p>\n<p>Attached the USB Wifi device and connect to VirtualBox if you&#8217;re using that.<\/p>\n<h2>Part 2<\/h2>\n<p>0. Backtrack doesn&#8217;t startx, so type startx if you want it.<\/p>\n<p>1. Bring up the wifi card:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nifconfig wlan0 up\r\n<\/pre>\n<p>2. You need to create a monitor mode interface for monitoring:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nairmon-ng # without args shows cards\r\nairmon-ng start wlan0 # creates monitor interface\r\niwconfig # check that the card is in monitor mode\r\n<\/pre>\n<p>3. Load Wireshark (at a command prompt type &#8220;wireshark&#8221;).<\/p>\n<p>4. Start a capture, from the &#8220;Capture menu&#8221;: Capture->Interfaces->mon0 (start)<br \/>\n4.1 Note: Wireless card can only monitor one channel at a time.<br \/>\n4.2 Note: Different countries have different channels and allowed power levels.<\/p>\n<p>5. You can force card on to specific channel for example:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\niwconfig wlan0 channel 1\r\n<\/pre>\n<p>6. Some tools can hop between channels showing traffic, for example airodump:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nairodump-ng --band bg mon0\r\n<\/pre>\n<h2>Part 3: Beacon Frames<\/h2>\n<p>Three types of packets: Management, Control, Data (there are subtypes of these too)<br \/>\nYou can find a LOT of information here: 802.11 specs: http:\/\/standards.ieee.org\/about\/get\/802\/802.11.html<\/p>\n<p>Access points are configured with SSIDs. That&#8217;s a network name, used for discovery. SSID can be for one AP or multiple APs. To allow clients to find them access points broadcast &#8220;Beacon Frames&#8221;.<\/p>\n<p>1. Capturing Beacon frames with wireshark:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nifconfig wlan0 up      \r\nairmon-ng start wlan0\r\nwireshark&amp;amp;amp;amp;\r\n<\/pre>\n<p>2. Examine the beacon frame. Select a beacon frame in wireshark.<br \/>\n2.1 Look at Management frame header.<br \/>\n2.2 Note that there are &#8220;Fixed parameters&#8221; and &#8220;Tagged parameters&#8221;<br \/>\n2.3 &#8220;Fixed Parameters&#8221;: Look in &#8220;Capabilities Information&#8221;, it tells you if it&#8217;s an AP or not.<br \/>\n2.4 &#8220;Tagged Parameters&#8221;: note you can see supported rates and the device channel. Possibly encryption information.<\/p>\n<p>3. Attackers can inject their own beacon frames! We&#8217;re going to show you how.<\/p>\n<p>3.1 We&#8217;ll use MDK to create beacon frames. Type the following to get info on mdk:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmdk --help b # shows info about beacon flooding\r\n<\/pre>\n<p>To broadcast beacon frames, type the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmdk3 mon0 -b -n PWNEDSSID\r\n<\/pre>\n<p>You should be able to see the network PWNEDSSID on other devices!<\/p>\n<h2>Part 4: Dissecting AP-Client Connections<\/h2>\n<p>Note1: Vivek plays around a lot with wireshark filters in this video, some of it isn&#8217;t strictly required, but it gets you used to using filters.<\/p>\n<p>Note2: Make *SURE* you are filtering to\/from the correct MAC addresses. I found this partiuclarly important if you have a lot of Apple hardware around&#8230;<\/p>\n<p>0. Setup an open access, access point.<\/p>\n<p>1. We&#8217;re going to connect a smartphone or PC to this AP, so have a client ready.<\/p>\n<p>2. Make sure wifi is off on the smartphone\/PC.<\/p>\n<p>3. Set the channel of the Backtrack laptop wifi card to the same channel as the open access point, as follows:<br \/>\n3.1 As before, use airodump-ng mon0 to display the channel the AP is on.<br \/>\n3.2 As before, use iwconfig wlan0 channel <CHANNEL NUMBER> to change the card to that channel.<\/p>\n<p>4. Make a capture of the traffic using wireshark (as before).<\/p>\n<p>5. Filter for traffic not to\/from our access point and filter out beacon frames.<br \/>\n5.1 The filter will eventually read as (wlan.addr == ACCESSPOINTMAC) &#038;&#038; !(wan.fc.type_subtype == 0x08)<br \/>\n5.2 You can build this filter by pointing and clicking in wireshark:<br \/>\n    Open a beacon frame, under &#8220;802.11 Beacon frame&#8221; right click on &#8220;Source address&#8221;, select &#8220;apply as filter&#8221;->Selected<br \/>\n    Edit the filter box change &#8220;wlan.sa&#8221; to &#8220;wlan.addr&#8221;.<\/p>\n<p>    Under &#8220;IEEE 802.11 Beacon frame&#8221; select &#8220;Type\/Subtype&#8221;. Right click, select &#8220;apply as filter&#8221;->&#8221;and not selected&#8221;<\/p>\n<p>6. Attach the client smartphone\/laptop to the network.<\/p>\n<p>7. Add another address to the filter. This is the client address.<br \/>\n   7.1 remove the &#038;&#038; !(wan.fc.type_subtype == 0x08) portion of the filter.<br \/>\n   7.2 In the &#8220;IEEE 802.11&#8221; section of the packet select the MAC of the client and right click:<br \/>\n       &#8220;apply as filter&#8221;->&#8221;and selected&#8221;<\/p>\n<p>8. Remove the (wlan.addr == ACCESSPOINTMAC) part of the filter. Your filter should just read:<br \/>\n   (wlan.addr == CLIENTMAC), where CLIENTMAC is the mac address of your smartphone\/PC.<\/p>\n<p>9. Take a look at the packet trace in wireshark.<br \/>\n9.1 Find the first &#8220;Probe Request&#8221; from the smartphone\/PC.<br \/>\n9.2 Note that it&#8217;s a Broadcast packet.<br \/>\n9.3 Note that below that packet you can see a &#8220;Probe Response&#8221; coming from your access point.<br \/>\n9.4 Client may also send out &#8220;Probe Requests&#8221; to networks previously connected to.<\/p>\n<p>10. Add the access point mac to the filter. As before right click the access point address and select &#8220;apply as filter&#8221;->&#8221;add selected&#8221;.<br \/>\n    Change wlan.sa to wlan.addr.<\/p>\n<p>11. Scroll down a little, you should be able to find a packet labeled &#8220;Authentication&#8221; from your AP to the client.<br \/>\n11.1 Note that the Authentication packet from the client as &#8220;Authentication SEQ: 0x0001&#8221; and the reply has &#8220;SEQ: 0x0002&#8221;.<\/p>\n<p>12. Now we see the association packets.<br \/>\n12.1 Note that the client sends an &#8220;Association Request&#8221;<br \/>\n12.2 Note that the AP replies with an &#8220;Association Response&#8221;<\/p>\n<p>13. After that we should be able to see data packets, such as ARP requests etc.<\/p>\n<p>14. Vivek makes some interesting observations about the packet exchange, and wireless state machine:<\/p>\n<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_frames.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_frames.png\" alt=\"\" title=\"wireless_frames\" width=\"364\" height=\"274\" class=\"aligncenter size-full wp-image-455\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_frames.png 364w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_frames-300x225.png 300w\" sizes=\"auto, (max-width: 364px) 100vw, 364px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_statemachine.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_statemachine.png\" alt=\"\" title=\"wireless_statemachine\" width=\"348\" height=\"284\" class=\"aligncenter size-full wp-image-456\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_statemachine.png 348w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/10\/wireless_statemachine-300x244.png 300w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are my notes on Parts 1 to 4 of the security tube wireless security videos here. I&#8217;m using Backtrack verison 5 R1 whereas Vivek is using version 4. The only different so far is that mdk is on the path, so I can just type &#8220;mdk&#8221; to launch it. Part 1 This is the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[14,13,12,10,11],"class_list":["post-453","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-pentest","tag-security","tag-securitytube","tag-wifi","tag-wifiprimer"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-7j","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=453"}],"version-history":[{"count":5,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":459,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/453\/revisions\/459"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}