Giter Club home page Giter Club logo

eviltwinframework's Introduction

EvilTwinFramework

A framework for pentesters that facilitates evil twin attacks as well as exploiting other wifi vulnerabilities

It uses hostapd-wpe to create the access point, so it is highly configurable.

It uses dnsmasq to run the dhcp and dns services.

It uses apache with help of dnsmasq to launch spoofed webpages as well as captive portals!

Packet sending and receiving is all done via Scapy!

Youtube Tutorials

I did a couple of video tutorials on the framework. Some basic use cases and a couple of actual demos.

Tutorial Playlist: https://www.youtube.com/watch?v=3HE4aVFF2Dc&list=PLwkyhOBmFMuo9sTQeVSh8IxDjtwsbYlQk New Youtube channel with more engineering endeavors: https://www.youtube.com/channel/UCBxzOQd2v9wWfiMDrf_RQ7A

Motivation

The Evil Twin Framework is meant to replace all existing Wi-Fi hacking tools by integrating all features necessary for Wi-Fi penetration testing in one framework. The 3 core features needed are:

Packet Sniffing

Packet Injection

Access Point Creation

All Wi-Fi attacks can be implemented with one or a combination of these core features. By having this platform it will always be possible to contribute with new Wi-Fi attacks that depend on these features.

Features

All Forms of Evil Twin AP

The Evil Twin Framework, with the help of hostapd can mimick any type of Wi-Fi Network. And by using the hostapd-wpe patch it is easy to get WPA-EAP credentials.

One can configure it as a catch-all honeypot to find out the encryption type of a network that was probed for.

One can even create a karma attack and mimick many networks with different ssids on the same Wi-Fi card (as long as it supports ap-mesh mode). This can be done manually, if you want different encryption types for different networks, or automatically. The automation works by sniffing for popular probe requests and then creating the most popular one according to how many virtual access points you Wi-Fi card supports.

Handshake and Credential Logging

As said before, with the help of hostapd-wpe WPA-EAP credential sniffing is easy!

You can also spoof DNS with dnsmasq and even create captive-portals to force browsers to your webpage!

You can sniff for WPA-Handshakes and even Half-WPA-Handshakes for ap-less password cracking!

Integrated Man-In-The-Middle

An Evil-Twin is nothing without a proper MITM arsenal!

The framework uses the mitmproxy library (https://mitmproxy.org/) to create a local proxy capable of custom Level3 packet manipulation! Some fun ones have already been implemented such as beef hook injection into someones webpage, download content replacement with other files (idea stolen from the Wi-Fi Pumpkin Project: https://github.com/P0cL4bs/WiFi-Pumpkin/). And my favorite: .exe file infection with PEInjector. PEInjector does a great job by seemlessly injecting a payload into an exe file without changing its size while at the same time obfuscating the payload to pass AV software.

You can easily contribute and/or make your own custom MITM packet manipulation and add it to the framework. More information will be in the wiki.

Wi-Fi Reconossaince

The framework is able to sniff for access points, probe requests and responses and associating them to Wi-Fi clients. You can also log all of this information.

Packet Injection

Packet Sniffing and Injection is all done via Scapy. This makes it possible to contribute with any feature that involves packet sniffing and custom packet assembly and injection.

For now the only packet injection feature is deauthentication packets since it is a nice thing to have when trying to catch WPA-Handshakes.

Spawners

Spawners are a great and easy way to use your custom tools in conjunction with the framework. Some tools have already been added since they make a lot of sense: Ettercap, Beef, MITMFramework and SSLStrip.

You can easily add your own, more information will be in the wiki.

Installation

Clone the project and run the setup file:

./setup

One of the MITM Plugins relies on peinjector service, this has to be installed manually following the instructions of the project.

https://github.com/JonDoNym/peinjector

Usage

First enter the ETF Console interface as root:

./etfconsole

For now there only is a console interface that is very easy to use and has tab completion! The whole thing will work according to the etf.conf file. You can view and change all configurations via de console, just type:

config <press double tab>

to list the modules available for configuration. While working on the console type:

listargs

to view the available parameters (here you can check if configurations are OK), then type:

set <parameter> <value>

to change it.

If a parameter is (dict) it means it is another configurable module within.

To start an access point make sure you have it configured correctly, type:

config airhost

check if everything is OK (use listargs)

config aplauncher

check if everything is OK (use listargs)

config dnsmasqhandler

check if everything is OK and start the access point

start airhost

You can also configure an access point by copying one that is nearby. Start scanning:

config airscanner

check if everything is OK (use listargs)

start airscanner

... wait ...

show sniffed_aps

This lists the sniffed access points with their ids

copy ap <id>

OR

show sniffed_probes

copy probe <id>

Then start the fake access point

start airhost

You can deauthenticate others from their network while running the acces point. To add access points or clients to be deauthenticated type:

show sniffed_aps

add aps <filter_string>

The filter_string follows an easy syntax, it goes:

<filter_keyword> <filter_args>

The args can be any of the column names listed in the table. The filter keywords are 'where' for inclusive filtering or 'only' for exclusive filtering, examples:

This will add the access point whose id is 5 to the deauthentication list (this is adding a single and specific AP):

add aps where id = 5

This will add the access point whose ssid is 'StarbucksWifi' to the deauthentication list:

add aps where ssid = StarbucksWifi

This will add the access point whose encryption type has 'wpa' OR 'opn' to the deauthentication list:

add aps where crypto = wpa, crypto = opn

This will add the access point whose ssid id 'freewifi' AND is on channel 6 to the deauthentication list:

add aps only ssid = freewifi, channel = 6

You can use the same interface for injecting packets while running the fake access point. You can check and set configurations with:

config airinjector

listargs

After all that run the Injector (which by default performs Deauthentication attack):

start airinjector

Same can be done when deleting from the deauth list with the 'del' command. The 'show' command can also be followed by a filter string

Contributors can program Plugins in python either for the airscanner or airhost or airdeauthor. Contributors can also code MITM scripts for mitmproxy.

eviltwinframework's People

Contributors

esser50k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eviltwinframework's Issues

Caffe-Latte attack does not seem to work.

So I tried to implement the caffe-latte attack in python with the help of scapy.

Fot those who are not familiar with the attack: it is a client side Wi-Fi attack and it is meant to recover WEP keys from clients.

I know WEP is not really used that much anymore but it would be nice to have a clear and readable python implementation of the attack.
In summary the attack goes like this:

  1. An attacker sets up a WEP access point with the same SSID as the network he wants to crack.
  2. Lets all client associate regardless of the wep key (since we dont know the real one)
  3. Once the client is associated it will try to assign itself an IP (after dhcp times out)
    4.The client sends out a gratuitous ARP packet, we catch it.
  4. We flip some of the encrypted bits corresponding to the last byte of the sender MAC and sender IP
  5. Apply crc32 to the bitmask used to flip the last bits
  6. Append that crc32 to the bitmask and XOR it with the contents of the actual packet. A new valid WEP encrypted ARP request packet should have been created.

For more details visit these links:
https://vimeo.com/23207363
https://vimeo.com/23214950

Now I'm finally going to guide you through how I tried implementing this and compare it to how aircrack-ng has this implemented in C.
The identification of the encrypted ARP packet is done correctly, since I know the key I can decrypt the packet and actually check.

First I get the encrypted wepdata and the ICV (which technically is also encrypted) like this:

wepdata = list(packet[Dot11WEP].wepdata)
original_icv = packet[Dot11WEP].icv

Then I create the bitmask and flip the bits at the index of the last byte of the sender MAC and IP.
The position is correct because I can decrypt the packet and check.
The way the crc32 is done could be wrong..

bitmask = list('\x00' * len(wepdata))
Flip bits of the bitmask corresponding to the last byte of sender MAC and IP respectively
bitmask[len(wepdata) - 11] = chr(randint(0, 255))
bitmask[len(wepdata) - 15] = chr(randint(0, 255))
Create crc32 checksum for the bitmask, the logical AND with only Fs turns it into a unsigned crc32
icv_patch = crc32("".join(bitmask)) & 0xffffffff

Then I XOR the results with the original content and put those value in the packet and send it.

flipped_result = [ chr( ord(wepdata[i]) ^ ord(bitmask[i]) ) for i in range(len(wepdata)) ]
patched_icv = icv_patch ^ original_icv
Put the results back in the packet
flipped_packet[Dot11WEP].wepdata = "".join(flipped_result)
flipped_packet[Dot11WEP].icv = patched_icv

What is wrong about this?

I attached 3 .pcap files. The captures encrypted_real_vs_replayed_arp and decrypted_real_vs_replayed_arp contain 2 packets each, one original and another modified packet (in encrypted form and decrypted form). These were from a wireshark capture and performing the caffe-latte attack with airbase-ng (it works and this is how packets should look).
The other capture called valid_vs_invalid shows two packets, one is the original ARP and the other is the modified ARP by the caffe-latte.py plugin. These packets were captured with scapy.
The WEP key is 12345 for simplicity if you want to analyze encrypted packets or so.

It seems that Wireshark can decrypt the modified packets from airbase-ng correctly but "refuses" to decrypt the modified packets from the caffe-latte plugin. Scapy however can decrypt those packets correctly. Clearly something is wrong about the way the packet is sent.
Here is the part of the wireshark code that decides if it is going to decrypt the packet or not:

/*
* Well, this packet should, in theory, have an ICV.
* Do we have the entire packet, and does it have enough data for
* the ICV?
/
if (reported_len < 4) {
/

* The packet is claimed not to even have enough data for a
* 4-byte ICV.
* Pretend it doesn't have an ICV.
/
;
} else if (len < reported_len) {
/

* The packet is claimed to have enough data for a 4-byte ICV,
* but we didn't capture all of the packet.
* Slice off the 4-byte ICV from the reported length, and trim
* the captured length so it's no more than the reported length;
* that will slice off what of the ICV, if any, is in the
* captured length.
/
reported_len -= 4;
if (len > reported_len)
len = reported_len;
} else {
/

* We have the entire packet, and it includes a 4-byte ICV.
* Slice it off, and put it into the tree.
*
* We only support decrypting if we have the the ICV.
*
* XXX - the ICV is encrypted; we're putting the encrypted
* value, not the decrypted value, into the tree.
*/
len -= 4;
reported_len -= 4;
can_decrypt = TRUE;
}

It looks like something is wrong with the size of the packet. But wireshark and scapy both tell me the total size is 86bytes which is the same as the packets from airbase-ng...

So here I reached the dead end.
What is wrong with my implementation of the caffe-latte attack?
captures.zip

Idea

Ok evil twin jams specific wifis and create a rogue access point with that name so victims can connect to it , and then prompt a credential webpage for user to insert their wifi password .
This concept does not have much success because victim will find suspicious , at least the young generation .

A better concept would be hacking the wpa source code to accept any password inserted on wifi with some exclusions , witch is if password is less than 6 characters , doing this then when victim connects to the rogue wifi access point their device is already sending the correct password , all that is needed is to tell wpa drivers to accept connection and parse that password to a file .

1

Hi! Here is my BTC Wallet address on LATOKEN:
1NdnMupY7s1UTeK3EtNH3LyjKJWDqAM29B

mitmf vs bettercap

Hi,

I see that you're using MITMf project as dependency, and it's no longer being updated for long time, and bettercap is good replacement, any plans to replace mitmf with bettercap?

Thanks

Script startup error on Kali Linux

I am trying to run ETF on kali it shows below error

Traceback (most recent call last):
File "./etfconsole.py,line 3, in
from termcolor import colored
ImportantError: No module named termcolor

I have already installed termcolor /use/lib/python3/dist-packages

I have tried to copy termcolor.py in "/use/lib/python2.7" but no luck.

Any solution to fix this issue.

Support for evil WPA twin

Does this framework support MITM on WPA APs where you know the shared key, allowing eavesdropping on encrypted 802.11 packets? It is not explicitly stated in the feature description.

Can´t install ETF

./setup.py
/usr/bin/env: ‘python’: No such file or directory

OS: ubuntu 22.04

error launching etfconsole

hi i'm getting this error:

[+] Found previous session from today. Loading it.
[+] Loading last session from 14/01/2018
[+] Loading session 'et'!
Traceback (most recent call last):
File "./etfconsole.py", line 645, in
console = ETFConsole(session_manager.get_command_history())
File "./etfconsole.py", line 35, in init
self.aircommunicator = AirCommunicator(self.configs["etf"]["aircommunicator"])
File "./core/AirCommunicator/aircommunicator.py", line 31, in init
self.air_host = AirHost(config["airhost"])
File "./core/AirCommunicator/airhost.py", line 28, in init
either by argument in the command line or in the etf.conf file")
etfexceptions.MissingConfigurationFileException: [-] Missing Configuration File:
dnsmasq and hostapd configuration files must be specified
either by argument in the command line or in the etf.conf file

updated*

noticed mitm was not installing due to phython3 hyperframe not installing. after installing all dependencies and mitm i'm facing the same issue as running wifi-pumpkin.

└──╼ $sudo ./etfconsole.py
Gtk-Message: Failed to load module "atk-bridge"
Traceback (most recent call last):
File "./etfconsole.py", line 17, in
from MITMCore.etfitm import EvilInTheMiddle
File "./core/MITMCore/etfitm.py", line 6, in
from MITMPlugins.beefinjector import BeEFInjector
File "./core/MITMCore/MITMPlugins/beefinjector.py", line 6, in
from mitmproxy.models import decoded
ImportError: No module named mitmproxy.models

scapy installation error

Hi, using Latest Kali 2 fresh install
in the end of the installation, I'm getting some like :

[+] Running scapy-com setup installation
running install
running build
running build_py
error: package directory 'scapy' does not exist
[+] Cleaning up the cloned folder after installation

is there anything particular I shall do to fix this ?

Regards

Replace os.system calls by something more platform independent.

There are a lot of calls to os.system that only work on Debian based distros. And a lot of calls to NetworkManager.

Calls to NetworkManager are just there to ignore Wi-Fi interfaces but this does not work for all distros and does not work in a VM or Docker.

Port Code to Python3

The framework uses old versions of some libraries because it is written in Python2. This used to be necessary since Scapy did not support Python3 yet, but it does now so it should be possible to update the frameworks base code.

No IP being distributed

I have my DHCP set up as follows:
gateway: 192.168.2.1
ip_range: 192.168.2.5 - 192.168.2.254
server: 8.8.8.8 8.8.4.4

but whenever I have a device connect to my AP it's not leased an IP
[+] New connected client on 'test'-> ip: None, mac: fc:a6:67:da:32:79 (None)

I'm using an ALPHA adapter as my wlan1 AP and my internal wireless card as connection to the internet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.