Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing knownbeacons extension #825

Merged
merged 1 commit into from
Jan 5, 2018
Merged

Introducing knownbeacons extension #825

merged 1 commit into from
Jan 5, 2018

Conversation

sophron
Copy link
Member

@sophron sophron commented Dec 10, 2017

This PR introduces the "Known Beacons" attack. You can try it yourself with --knownbeacons or -kB. It is important to run this with roguehostapd installed.

In this attack we send a number of beacon frames of known (popular) WLANs with no encryption type (Open WLANs). By "popular", we mean WLANs with an ESSID that is either usual for multiple different setups or can be found in many places across the world.

Examples:

  • "Radisson_Guest", "Marriott_Guest", "hhonors", "Hilton Honors", "walmartwifi" are ESSIDs that exist in hotels and other places worldwide.
  • Fon-type networks where users share part of their bandwidth, so that they could connect to other members' hotspots.
  • "public", "airport", "test" and other ESSIDs that are common in different setups across the world.

Users that visited one of the above WLANs in the past using the default settings are most likely vulnerable to the "Known Beacons" attack. In my experience, all network managers are vulnerable except the one of Windows that, by default, won't automatically connect to Open WLANs.

This looks similar to the KARMA attack but it isn't. In KARMA attack, we exploit two different things: i) active scanning for networks the stations have associated with in the past and ii) the AUTO-CONNECT flag. The "Known Beacons" attack exploits only the AUTO-CONNECT flag.

Having said that, KARMA is getting less successful nowadays as network managers associate with an AP using the "passive scanning" method only. These network managers remain vulnerable to "Known Beacons" if the AUTO-CONNECT is enabled by default.

Of'course this attack will get better and better as we are increasing the size of the dictionary with the known ESSIDs. I believe the Wifiphisher community can help us with that :)

In the future, and when we fully migrate to roguehostapd, we may want to have this extension enabled by default. In my opinion, it significantly raises the chances of automatic association.

The implementation details are pretty straightforward. If you have any questions, feel free to ask me.

@anakin1028
Copy link
Collaborator

@sophron why do we need to create a new extension module? This attack is related to the Lure10 attack why don't we just add those beacons to the lure10 beacon file?

@sophron sophron changed the title [WIP] Introducing famousbeacons extension [WIP] Introducing knownbeacons extension Dec 11, 2017
@sophron
Copy link
Member Author

sophron commented Dec 13, 2017

@anakin1028 This is a new attack :) I just updated my first post.

@kinduff
Copy link

kinduff commented Dec 14, 2017

Would love to see this merged. Great contribution @sophron

@sophron
Copy link
Member Author

sophron commented Dec 22, 2017

@kinduff Thank you.

@anakin1028 @blackHatMonkey Can you have a look at the PR and let me know if you have any comments? We need this merged in the next few days.

@blackHatMonkey
Copy link
Member

@sophron Looks like an interesting approach but the effectiveness of it is to be seen.

@anakin1028
Copy link
Collaborator

functional test looks fine for me. From the sniffer I can see the spoofed beacons. After the commits are squashed I can help merge this :)

@sophron sophron force-pushed the famous-beacons branch 3 times, most recently from eb56383 to 684ca00 Compare January 4, 2018 01:07
@sophron
Copy link
Member Author

sophron commented Jan 4, 2018

I made a few improvements, including:

  1. I updated the dictionary with ~100 ESSIDs that can be found in large airports around the world
  2. I made the extension broadcast x beacon frames every y seconds to make sure that all frames are sent by scapy (i.e. avoid bottleneck) and that different network managers (clients) will successfully process them.

I believe it's ready. @anakin1028 or @blackHatMonkey you can merge this!

Copy link
Member

@blackHatMonkey blackHatMonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this is a good extension. Maybe we can also create a issue asking users to add the popular access point around them that are not included. It should have newbie friendly tag.

@@ -25,7 +25,7 @@ def __init__(self, shared_data):

:param self: A Lure10 object
:param data: Shared data from main engine
:type self: Deauthentication
:type self: Lure10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason you made these changes here. For sake of clarity this should be removed from this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main problem is whenever we make functional changes that are not described in a commit. If one of these irrelevant changes breaks the software we will have a hard trouble finding it. But this is only a typo change and I doubt it will introduce any issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough 😄.

self._full_pkt_list = self._get_known_beacons()


def _get_known_beacons(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring for this function is missing. We should probably add it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

addr1=constants.WIFI_BROADCAST,
addr2=bssid,
addr3=bssid)
frame_part_2 = dot11.Dot11Beacon(cap=0x2105)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add the 0x2105 in the constants for clarity.

# If INTERVAL seconds have passed...
if (time.time() - self._starttime > constants.KB_INTERVAL):
# Do a list shift
self._full_pkt_list = self._full_pkt_list[constants.KB_BUCKET_SIZE:] + \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use a round parenthesis instead of the backslash.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay as long as the line wraps properly and the code looks good.

first_essid = self._full_pkt_list[0][dot11.Dot11Elt].info.decode("utf8")
last_essid = self._full_pkt_list[constants.KB_BUCKET_SIZE-1][dot11.Dot11Elt].info.decode("utf8")

self._msg.append("Sending " + str(constants.KB_BUCKET_SIZE) + \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe using a formatted string is much cleaner here.

"""

# If INTERVAL seconds have passed...
if (time.time() - self._starttime > constants.KB_INTERVAL):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why this is needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because of the (2) addition that I mentioned above. We want to broadcast a specific number of beacons every number of seconds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cant you use sleep then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sleep() is forbidden within extensions. We run all extensions under a single thread. If we sleep() in one thread, it will pause the execution for all extensions.

@sophron
Copy link
Member Author

sophron commented Jan 4, 2018

Thanks for the review @blackHatMonkey. I pushed updates for most of your comments. Let me know if there's anything else.

@sophron
Copy link
Member Author

sophron commented Jan 4, 2018

And yes, feel free to open an issue that we ask the users to add known ESSIDs.

@blackHatMonkey
Copy link
Member

I can create the issue once this is merged.

@sophron sophron changed the title [WIP] Introducing knownbeacons extension Introducing knownbeacons extension Jan 5, 2018
@anakin1028 anakin1028 merged commit 60faf34 into master Jan 5, 2018
@sophron sophron deleted the famous-beacons branch January 5, 2018 01:50
@anakin1028
Copy link
Collaborator

Thanks @sophron~!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants