Hacking the future with USB HID

Nikhil Mittal
Session ID:
Session Classification:
Hacking the future with
USB HID
Nikhil “SamratAshok” Mittal
Hacker




Session ID:
Session Classification:
About Me
 SamratAshok
 Twitter - @nikhil_mitt
 Blog – http://labofapenetrationtester.blogspot.com
 Creator of Kautilya, Mareech and Nishang
 Interested in Offensive Information Security, new attack
  vectors and methodologies to pwn systems.
 Previous Talks
     Clubhack’10, Hackfest’11, Clubhack’11, Black hat Abu
      Dhabi’11, Black Hat Europe’12, Troopers’12, PHDays’12, Black
      Hat USA’12
 Upcoming Talks
     Talk at EUSecWest’12
     Training at GrrCON’12
Agenda
   Human Interface Devices
   Using HIDs in Penetration Tests
   HID of choice – Teensy++
   How we will use Teensy++?
   Windows Family
   Mac OS X Family
   Kautilya
   Attacks Demo (on Windows 8 and Mountain Lion )
   Comparison
   Future of Attacks
   Limitation
   Defense
   Conclusion


                            4
A typical Pen Test Scenario


 A client engagement comes with IP addresses.
 We need to complete the assignment in very
  restrictive time frame.
 Pressure is on us to deliver a “good” report with
  some high severity findings. (That “High” return
  inside a red colored box)
How the threats are Tested




   Vuln
                Exploit      Report
   Scan
 This is a best case scenario.
 Only lucky ones find that.
 Generally legacy Enterprise Applications or
  Business Critical applications are not upgraded
  and are the first targets.
 There is almost no fun doing it that way.
Some of us do it better




 Enum        Scan         Exploit   Report
Some of us do it even better




 Enum
                            Post
   +      Scan    Exploit          Report
                            Exp
 Intel
Why do we need to exploit?
 To gain access to the systems.
 This shows the real threat to clients that we can
  actually make an impact on their business. No
  more “so-what” 
 We can create reports with “High” Severity
  findings which bring $$$
What do we exploit?
 Memory Corruption bugs.
     Server side
     Client Side
   Mis-configurations
   Open file shares.
   Sticky slips.
   Man In The Middle (many types)
   Unsecured Dumpsters
   Humans
   <Audience>
Worse Scenario
 Many times we get some vulnerabilities but can’t
  exploit.
     No public exploits available.
     Not allowed on the system.
     Countermeasure blocking it.
     Exploit completed but no session was generated :P
Worst Scenario
 Hardened Systems
 Patches in place
 Countermeasures blocking scans and exploits
 Security incident monitoring and blocking
 No network access


 We need alternatives.
Need for new methods to break into systems

 Breaking into systems is not as easy as done in
  the movies.
 Those defending the systems have become
  smarter and it is getting harder to break into
  “secured” environments.
 Everyone is breaking into systems using the
  older ways, you need new ways to do it better.
Human Interface Devices
 Wikipedia – “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.”
 Mice, Keyboards and Joysticks are most
  common HID.
 What could go wrong?
Using HIDs in Penetration Tests
 Human Interface Devices are trusted by
  Operating Systems.
 Countermeasures like Anti Virus do not care for
  such devices.
 The way we use it, using HID for offensive
  security is equivalent to sitting in front of the
  target system as a user.
 The attack scenarios are large in number and
  may have severe impact.



                           16
HID of choice – Teensy++
 A USB Micro-controller device from pjrc.com
 Storage of about 130 KB.
 We will use Teensy ++ which is an updated
  version of Teensy.
 A cheap device, costs only $24.
 It uses an Atmel based
  processor.
HID of choice – Teensy++
 It could be used as Keyboard/Mouse/Joystick.
 The device is easily programmable using C or C
  type syntax using Arduino Development
  Environment with Teensyduino plugin.
 The device works with many Operating Systems.
 It is small in size.
How we will use Teensy++?
 As a programmable keyboard.
 We will program the device to do a defined set of
  activities when it is connected to a system.
 We will utilise the privileges of the currently
  logged in user and any higher privileges
  accessible to the user.
 Aim is to mimic a user sitting in front of the
  target.




                           19
Windows Family
 A user is notified when a new device is
  connected.
 It takes 20-25 seconds while the driver for the
  device gets loaded.
 A device can type really fast on Windows
  machine thanks to large USB keyboard buffer of
  Windows.
 If PowerShell is used some really powerful
  things could be done.



                         20
OS X Family
 A user is not notified if a USB device is
  connected.
 It takes 10-15 seconds while the device is
  detected and loaded.
 The device cannot type very fast.
 Built-in scripting languages make payloads
  powerful.




                          21
Kautilya
 It is a toolkit which aims to make HID more
  useful in Penetration Tests.
 Named after Chanakya a.k.a. Kautilya.
 Written in Ruby.
 It’s a menu drive program which let users select
  and customize payloads.
 Aims to make HID part of every Penetration
  tester’s tool chest.
 Contains payloads for Windows, Linux and OS
  X.
Payloads in Kautilya

 Payloads are tested on Teensy without SD Card.
 Pastebin is extensively used for uploads and
  downloads.
 Payloads are commands, powershell scripts or
  combination of both.
 Payload execution depends on privilege of user
  logged in when the device is plugged in.
Attacks Demo
(on Windows 8 and Mountain Lion )

 Let us have a look at three attacks on both
   Download and execute shellcode.
   Reverse shell using built-in features.
   DNS TXT Code Execution.




                            24
Comparison
Attribute                  Windows 8                   Mac OS X Mountain Lion

Detection or blocking of   Shows a balloon. Easy to    No information to user.
USB HIDs                   prevent installation of     Not easy to block a device.
                           removable devices using
                           Group policies.


Response to a very fast    Possible to send input      Delays must be introduced
keyboard input             really fast.                between the keyboard
                                                       inputs.

Trust on end user (as we   For sensitive functions a   Sudo is required for
are simulating one)        UAC prompt is shown.        sensitive functions.




                                       25
Pen Test Stories
Library Fun

 Internal PT for a large media house.
 The access to network was quite restrictive.
 The desktops at Library were left unattended
  many times.
 Teensy was plugged into one system with a
  sethc and utilman backdoor.
 Later in the evening the system was accessed
  and pwnage ensued.
Pen Test Stories
Breaking the perimeter

 A telecom company.
 A perimeter check for the firm was to be done.
 The Wireless rogue AP payload was used and
  Teensy was sold to the clients employees during
  lunch hours.
 Within couple of hours, we got a wireless
  network ready with an administrative user and a
  bind shell.
Pen Test Stories
Help by the Helpdesk
 A pharma company.
 A user’s data card was replcaed with a Teensy
  inside the data card’s cover.
 The payload selected was Keylogger.
 “Data card” obviously didn’t worked and multiple
  keyloggers were installed, for the user and the
  helpdesk.
 Helpdesk guys had access to almost everything
  in the environment and over a workday, it was
  over.
Limitations with Teensy
 Limited storage in Teensy. Resolved if you
  attach a SD card with Teensy.
 Inability to “read” from the system. You have to
  assume the responses of victim OS and there is
  only one way traffic.
 Inability to clear itself after a single run.
Limitations with Kautilya
 Many payloads need Administrative privilege.
 Lots of traffic to and from pastebin.
 Some times payloads are not stable.
 For payloads which use executables you
  manually need to convert and paste them to
  pastebin.
Future of Attacks
 Improvement in current payloads.
 Use some payloads as libraries so that they can
  be reused.
 More payloads for Non-Windows platform.
 Implementation of newer payloads.
 Reliable user activity detection.
Defence
 For Windows systems, use Group Policy to
  “Prevent Installation of Removable Devices”.
 For Mac OS X, udev rules may be used.
 Best defence is to physically block USB ports or
  lock the existing devices to the ports.




                         32
Conclusion
 USB HID attacks are real threats and here to
  stay.
 This is because Operating System trust itself
  and its users.
 Security ends with trust.




                         33
Thank You
 Questions?
 Insults?
 Feedback?

 Kautilya is available at
  http://code.google.com/p/kautilya/
 Follow me @nikhil_mitt
 http://labofapenetrationtester.blogspot.com/
1 of 34

Recommended

Metaploit by
MetaploitMetaploit
MetaploitAjinkya Pathak
2.8K views18 slides
aclpwn - Active Directory ACL exploitation with BloodHound by
aclpwn - Active Directory ACL exploitation with BloodHoundaclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundDirkjanMollema
11.5K views41 slides
Metasploit by
MetasploitMetasploit
Metasploithenelpj
3.8K views20 slides
Hacked? Pray that the Attacker used PowerShell by
Hacked? Pray that the Attacker used PowerShellHacked? Pray that the Attacker used PowerShell
Hacked? Pray that the Attacker used PowerShellNikhil Mittal
8.7K views43 slides
Catch Me If You Can: PowerShell Red vs Blue by
Catch Me If You Can: PowerShell Red vs BlueCatch Me If You Can: PowerShell Red vs Blue
Catch Me If You Can: PowerShell Red vs BlueWill Schroeder
7.8K views39 slides

More Related Content

What's hot

Forging Trusts for Deception in Active Directory by
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryNikhil Mittal
56.8K views36 slides
C2 Matrix A Comparison of Command and Control Frameworks by
C2 Matrix A Comparison of Command and Control FrameworksC2 Matrix A Comparison of Command and Control Frameworks
C2 Matrix A Comparison of Command and Control FrameworksJorge Orchilles
866 views20 slides
Building an Empire with PowerShell by
Building an Empire with PowerShellBuilding an Empire with PowerShell
Building an Empire with PowerShellWill Schroeder
22.3K views56 slides
Understanding NMAP by
Understanding NMAPUnderstanding NMAP
Understanding NMAPPhannarith Ou, G-CISO
8.2K views23 slides
Derbycon - The Unintended Risks of Trusting Active Directory by
Derbycon - The Unintended Risks of Trusting Active DirectoryDerbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active DirectoryWill Schroeder
35.8K views51 slides
Attacking AWS: the full cyber kill chain by
Attacking AWS: the full cyber kill chainAttacking AWS: the full cyber kill chain
Attacking AWS: the full cyber kill chainSecuRing
2.9K views51 slides

What's hot(20)

Forging Trusts for Deception in Active Directory by Nikhil Mittal
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active Directory
Nikhil Mittal56.8K views
C2 Matrix A Comparison of Command and Control Frameworks by Jorge Orchilles
C2 Matrix A Comparison of Command and Control FrameworksC2 Matrix A Comparison of Command and Control Frameworks
C2 Matrix A Comparison of Command and Control Frameworks
Jorge Orchilles866 views
Building an Empire with PowerShell by Will Schroeder
Building an Empire with PowerShellBuilding an Empire with PowerShell
Building an Empire with PowerShell
Will Schroeder22.3K views
Derbycon - The Unintended Risks of Trusting Active Directory by Will Schroeder
Derbycon - The Unintended Risks of Trusting Active DirectoryDerbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active Directory
Will Schroeder35.8K views
Attacking AWS: the full cyber kill chain by SecuRing
Attacking AWS: the full cyber kill chainAttacking AWS: the full cyber kill chain
Attacking AWS: the full cyber kill chain
SecuRing2.9K views
Client side attacks using PowerShell by Nikhil Mittal
Client side attacks using PowerShellClient side attacks using PowerShell
Client side attacks using PowerShell
Nikhil Mittal7.7K views
Here Be Dragons: The Unexplored Land of Active Directory ACLs by Andy Robbins
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Andy Robbins6.2K views
Metasploit seminar by henelpj
Metasploit seminarMetasploit seminar
Metasploit seminar
henelpj557 views
PowerShell for Practical Purple Teaming by Nikhil Mittal
PowerShell for Practical Purple TeamingPowerShell for Practical Purple Teaming
PowerShell for Practical Purple Teaming
Nikhil Mittal5.3K views
Introduction to Metasploit by GTU
Introduction to MetasploitIntroduction to Metasploit
Introduction to Metasploit
GTU298 views
Lateral Movement with PowerShell by kieranjacobsen
Lateral Movement with PowerShellLateral Movement with PowerShell
Lateral Movement with PowerShell
kieranjacobsen7K views
Adversary Emulation Workshop by prithaaash
Adversary Emulation WorkshopAdversary Emulation Workshop
Adversary Emulation Workshop
prithaaash273 views
Introduction to penetration testing by Nezar Alazzabi
Introduction to penetration testingIntroduction to penetration testing
Introduction to penetration testing
Nezar Alazzabi1.9K views

Viewers also liked

Owning windows 8 with human interface devices by
Owning windows 8 with human interface devicesOwning windows 8 with human interface devices
Owning windows 8 with human interface devicesNikhil Mittal
2.2K views26 slides
PowerShell for Penetration Testers by
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration TestersNikhil Mittal
36.2K views119 slides
Conceitos Ae by
Conceitos AeConceitos Ae
Conceitos AeFernando Botafogo
687 views29 slides
Ae rio 2011 prof. courtnay- publico by
Ae rio 2011   prof. courtnay- publicoAe rio 2011   prof. courtnay- publico
Ae rio 2011 prof. courtnay- publicoFernando Botafogo
527 views28 slides
AE Rio 2011 - Arquitetura da Informação organizacional by
AE Rio 2011 - Arquitetura da Informação organizacionalAE Rio 2011 - Arquitetura da Informação organizacional
AE Rio 2011 - Arquitetura da Informação organizacionalFernando Botafogo
442 views66 slides
Arquitetura.corporativa by
Arquitetura.corporativaArquitetura.corporativa
Arquitetura.corporativaEvolve Gestão Empresarial
3.5K views8 slides

Viewers also liked(13)

Owning windows 8 with human interface devices by Nikhil Mittal
Owning windows 8 with human interface devicesOwning windows 8 with human interface devices
Owning windows 8 with human interface devices
Nikhil Mittal2.2K views
PowerShell for Penetration Testers by Nikhil Mittal
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration Testers
Nikhil Mittal36.2K views
AE Rio 2011 - Arquitetura da Informação organizacional by Fernando Botafogo
AE Rio 2011 - Arquitetura da Informação organizacionalAE Rio 2011 - Arquitetura da Informação organizacional
AE Rio 2011 - Arquitetura da Informação organizacional
Fernando Botafogo442 views
Continuous intrusion: Why CI tools are an attacker’s best friends by Nikhil Mittal
Continuous intrusion: Why CI tools are an attacker’s best friendsContinuous intrusion: Why CI tools are an attacker’s best friends
Continuous intrusion: Why CI tools are an attacker’s best friends
Nikhil Mittal1.8K views
Aula 1. arquitetura organizacional.pptm by Claudio Parra
Aula 1.   arquitetura organizacional.pptmAula 1.   arquitetura organizacional.pptm
Aula 1. arquitetura organizacional.pptm
Claudio Parra3.1K views
Proposta de um Processo de Arquitetura Corporativa (Enterprise Architecture) by Rafael Targino
Proposta de um Processo de Arquitetura Corporativa (Enterprise Architecture)Proposta de um Processo de Arquitetura Corporativa (Enterprise Architecture)
Proposta de um Processo de Arquitetura Corporativa (Enterprise Architecture)
Rafael Targino3.3K views
Governança da Arquitetura Corporativa by Marcelo Sávio
Governança da Arquitetura CorporativaGovernança da Arquitetura Corporativa
Governança da Arquitetura Corporativa
Marcelo Sávio2.1K views
Powerpreter: Post Exploitation like a Boss by Nikhil Mittal
Powerpreter: Post Exploitation like a BossPowerpreter: Post Exploitation like a Boss
Powerpreter: Post Exploitation like a Boss
Nikhil Mittal8.7K views
Workshop: PowerShell for Penetration Testers by Nikhil Mittal
Workshop: PowerShell for Penetration TestersWorkshop: PowerShell for Penetration Testers
Workshop: PowerShell for Penetration Testers
Nikhil Mittal1.2K views
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It by Nikhil Mittal
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItAMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
Nikhil Mittal45K views

Similar to Hacking the future with USB HID

Teensy Programming for Everyone by
Teensy Programming for EveryoneTeensy Programming for Everyone
Teensy Programming for EveryoneNikhil Mittal
3.8K views56 slides
More fun using Kautilya by
More fun using KautilyaMore fun using Kautilya
More fun using KautilyaNikhil Mittal
2.5K views30 slides
Kautilya: Teensy beyond shell by
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shellNikhil Mittal
3K views48 slides
Mere Paas Teensy Hai (Nikhil Mittal) by
Mere Paas Teensy Hai (Nikhil Mittal)Mere Paas Teensy Hai (Nikhil Mittal)
Mere Paas Teensy Hai (Nikhil Mittal)ClubHack
780 views46 slides
Broken by design (Danny Fullerton) by
Broken by design (Danny Fullerton)Broken by design (Danny Fullerton)
Broken by design (Danny Fullerton)Hackfest Communication
850 views24 slides
The University Of Arizon Electrical And Computer Engineering by
The University Of Arizon Electrical And Computer EngineeringThe University Of Arizon Electrical And Computer Engineering
The University Of Arizon Electrical And Computer EngineeringAngel Ashford
4 views15 slides

Similar to Hacking the future with USB HID(20)

Teensy Programming for Everyone by Nikhil Mittal
Teensy Programming for EveryoneTeensy Programming for Everyone
Teensy Programming for Everyone
Nikhil Mittal3.8K views
More fun using Kautilya by Nikhil Mittal
More fun using KautilyaMore fun using Kautilya
More fun using Kautilya
Nikhil Mittal2.5K views
Kautilya: Teensy beyond shell by Nikhil Mittal
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shell
Nikhil Mittal3K views
Mere Paas Teensy Hai (Nikhil Mittal) by ClubHack
Mere Paas Teensy Hai (Nikhil Mittal)Mere Paas Teensy Hai (Nikhil Mittal)
Mere Paas Teensy Hai (Nikhil Mittal)
ClubHack780 views
The University Of Arizon Electrical And Computer Engineering by Angel Ashford
The University Of Arizon Electrical And Computer EngineeringThe University Of Arizon Electrical And Computer Engineering
The University Of Arizon Electrical And Computer Engineering
Angel Ashford4 views
Rajarshi Gupta at AI Frontiers : Security is AI’s biggest challenge, AI is Se... by AI Frontiers
Rajarshi Gupta at AI Frontiers : Security is AI’s biggest challenge, AI is Se...Rajarshi Gupta at AI Frontiers : Security is AI’s biggest challenge, AI is Se...
Rajarshi Gupta at AI Frontiers : Security is AI’s biggest challenge, AI is Se...
AI Frontiers735 views
The Top 10/20 Internet Security Vulnerabilities – A Primer by amiable_indian
The Top 10/20 Internet Security Vulnerabilities – A PrimerThe Top 10/20 Internet Security Vulnerabilities – A Primer
The Top 10/20 Internet Security Vulnerabilities – A Primer
amiable_indian7.9K views
Unix, Linux, And Windows Server Critique Essay by Sarah Michalak
Unix, Linux, And Windows Server Critique EssayUnix, Linux, And Windows Server Critique Essay
Unix, Linux, And Windows Server Critique Essay
Sarah Michalak2 views
Derby con 2014 by TonikJDK
Derby con 2014Derby con 2014
Derby con 2014
TonikJDK977 views
Dev and Blind - Attacking the weakest Link in IT Security by Mario Heiderich
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT Security
Mario Heiderich5.6K views
01_Metasploit - The Elixir of Network Security by Harish Chaudhary
01_Metasploit - The Elixir of Network Security01_Metasploit - The Elixir of Network Security
01_Metasploit - The Elixir of Network Security
Harish Chaudhary356 views
Avoid embarrassing press by designing secure IoT products with Misha Seltzer by Product of Things
Avoid embarrassing press by designing secure IoT products with Misha SeltzerAvoid embarrassing press by designing secure IoT products with Misha Seltzer
Avoid embarrassing press by designing secure IoT products with Misha Seltzer
Product of Things108 views
A pinguin as a bouncer... Open Source Security Solutions by B.A.
A pinguin as a bouncer... Open Source Security SolutionsA pinguin as a bouncer... Open Source Security Solutions
A pinguin as a bouncer... Open Source Security Solutions
B.A.499 views
Cyber Security and GDPR Made Easy by ChristoanSmit
Cyber Security and GDPR Made EasyCyber Security and GDPR Made Easy
Cyber Security and GDPR Made Easy
ChristoanSmit140 views
Rootkit Hunting & Compromise Detection by amiable_indian
Rootkit Hunting & Compromise DetectionRootkit Hunting & Compromise Detection
Rootkit Hunting & Compromise Detection
amiable_indian1.3K views
Building Trust Despite Digital Personal Devices by Javier González
Building Trust Despite Digital Personal DevicesBuilding Trust Despite Digital Personal Devices
Building Trust Despite Digital Personal Devices
Javier González648 views
Creating Havoc using Human Interface Device by Positive Hack Days
Creating Havoc using Human Interface DeviceCreating Havoc using Human Interface Device
Creating Havoc using Human Interface Device
Positive Hack Days1.2K views

Hacking the future with USB HID

  • 2. Hacking the future with USB HID Nikhil “SamratAshok” Mittal Hacker Session ID: Session Classification:
  • 3. About Me  SamratAshok  Twitter - @nikhil_mitt  Blog – http://labofapenetrationtester.blogspot.com  Creator of Kautilya, Mareech and Nishang  Interested in Offensive Information Security, new attack vectors and methodologies to pwn systems.  Previous Talks  Clubhack’10, Hackfest’11, Clubhack’11, Black hat Abu Dhabi’11, Black Hat Europe’12, Troopers’12, PHDays’12, Black Hat USA’12  Upcoming Talks  Talk at EUSecWest’12  Training at GrrCON’12
  • 4. Agenda  Human Interface Devices  Using HIDs in Penetration Tests  HID of choice – Teensy++  How we will use Teensy++?  Windows Family  Mac OS X Family  Kautilya  Attacks Demo (on Windows 8 and Mountain Lion )  Comparison  Future of Attacks  Limitation  Defense  Conclusion 4
  • 5. A typical Pen Test Scenario  A client engagement comes with IP addresses.  We need to complete the assignment in very restrictive time frame.  Pressure is on us to deliver a “good” report with some high severity findings. (That “High” return inside a red colored box)
  • 6. How the threats are Tested Vuln Exploit Report Scan
  • 7.  This is a best case scenario.  Only lucky ones find that.  Generally legacy Enterprise Applications or Business Critical applications are not upgraded and are the first targets.  There is almost no fun doing it that way.
  • 8. Some of us do it better Enum Scan Exploit Report
  • 9. Some of us do it even better Enum Post + Scan Exploit Report Exp Intel
  • 10. Why do we need to exploit?  To gain access to the systems.  This shows the real threat to clients that we can actually make an impact on their business. No more “so-what”   We can create reports with “High” Severity findings which bring $$$
  • 11. What do we exploit?  Memory Corruption bugs.  Server side  Client Side  Mis-configurations  Open file shares.  Sticky slips.  Man In The Middle (many types)  Unsecured Dumpsters  Humans  <Audience>
  • 12. Worse Scenario  Many times we get some vulnerabilities but can’t exploit.  No public exploits available.  Not allowed on the system.  Countermeasure blocking it.  Exploit completed but no session was generated :P
  • 13. Worst Scenario  Hardened Systems  Patches in place  Countermeasures blocking scans and exploits  Security incident monitoring and blocking  No network access  We need alternatives.
  • 14. Need for new methods to break into systems  Breaking into systems is not as easy as done in the movies.  Those defending the systems have become smarter and it is getting harder to break into “secured” environments.  Everyone is breaking into systems using the older ways, you need new ways to do it better.
  • 15. Human Interface Devices  Wikipedia – “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.”  Mice, Keyboards and Joysticks are most common HID.  What could go wrong?
  • 16. Using HIDs in Penetration Tests  Human Interface Devices are trusted by Operating Systems.  Countermeasures like Anti Virus do not care for such devices.  The way we use it, using HID for offensive security is equivalent to sitting in front of the target system as a user.  The attack scenarios are large in number and may have severe impact. 16
  • 17. HID of choice – Teensy++  A USB Micro-controller device from pjrc.com  Storage of about 130 KB.  We will use Teensy ++ which is an updated version of Teensy.  A cheap device, costs only $24.  It uses an Atmel based processor.
  • 18. HID of choice – Teensy++  It could be used as Keyboard/Mouse/Joystick.  The device is easily programmable using C or C type syntax using Arduino Development Environment with Teensyduino plugin.  The device works with many Operating Systems.  It is small in size.
  • 19. How we will use Teensy++?  As a programmable keyboard.  We will program the device to do a defined set of activities when it is connected to a system.  We will utilise the privileges of the currently logged in user and any higher privileges accessible to the user.  Aim is to mimic a user sitting in front of the target. 19
  • 20. Windows Family  A user is notified when a new device is connected.  It takes 20-25 seconds while the driver for the device gets loaded.  A device can type really fast on Windows machine thanks to large USB keyboard buffer of Windows.  If PowerShell is used some really powerful things could be done. 20
  • 21. OS X Family  A user is not notified if a USB device is connected.  It takes 10-15 seconds while the device is detected and loaded.  The device cannot type very fast.  Built-in scripting languages make payloads powerful. 21
  • 22. Kautilya  It is a toolkit which aims to make HID more useful in Penetration Tests.  Named after Chanakya a.k.a. Kautilya.  Written in Ruby.  It’s a menu drive program which let users select and customize payloads.  Aims to make HID part of every Penetration tester’s tool chest.  Contains payloads for Windows, Linux and OS X.
  • 23. Payloads in Kautilya  Payloads are tested on Teensy without SD Card.  Pastebin is extensively used for uploads and downloads.  Payloads are commands, powershell scripts or combination of both.  Payload execution depends on privilege of user logged in when the device is plugged in.
  • 24. Attacks Demo (on Windows 8 and Mountain Lion )  Let us have a look at three attacks on both  Download and execute shellcode.  Reverse shell using built-in features.  DNS TXT Code Execution. 24
  • 25. Comparison Attribute Windows 8 Mac OS X Mountain Lion Detection or blocking of Shows a balloon. Easy to No information to user. USB HIDs prevent installation of Not easy to block a device. removable devices using Group policies. Response to a very fast Possible to send input Delays must be introduced keyboard input really fast. between the keyboard inputs. Trust on end user (as we For sensitive functions a Sudo is required for are simulating one) UAC prompt is shown. sensitive functions. 25
  • 26. Pen Test Stories Library Fun  Internal PT for a large media house.  The access to network was quite restrictive.  The desktops at Library were left unattended many times.  Teensy was plugged into one system with a sethc and utilman backdoor.  Later in the evening the system was accessed and pwnage ensued.
  • 27. Pen Test Stories Breaking the perimeter  A telecom company.  A perimeter check for the firm was to be done.  The Wireless rogue AP payload was used and Teensy was sold to the clients employees during lunch hours.  Within couple of hours, we got a wireless network ready with an administrative user and a bind shell.
  • 28. Pen Test Stories Help by the Helpdesk  A pharma company.  A user’s data card was replcaed with a Teensy inside the data card’s cover.  The payload selected was Keylogger.  “Data card” obviously didn’t worked and multiple keyloggers were installed, for the user and the helpdesk.  Helpdesk guys had access to almost everything in the environment and over a workday, it was over.
  • 29. Limitations with Teensy  Limited storage in Teensy. Resolved if you attach a SD card with Teensy.  Inability to “read” from the system. You have to assume the responses of victim OS and there is only one way traffic.  Inability to clear itself after a single run.
  • 30. Limitations with Kautilya  Many payloads need Administrative privilege.  Lots of traffic to and from pastebin.  Some times payloads are not stable.  For payloads which use executables you manually need to convert and paste them to pastebin.
  • 31. Future of Attacks  Improvement in current payloads.  Use some payloads as libraries so that they can be reused.  More payloads for Non-Windows platform.  Implementation of newer payloads.  Reliable user activity detection.
  • 32. Defence  For Windows systems, use Group Policy to “Prevent Installation of Removable Devices”.  For Mac OS X, udev rules may be used.  Best defence is to physically block USB ports or lock the existing devices to the ports. 32
  • 33. Conclusion  USB HID attacks are real threats and here to stay.  This is because Operating System trust itself and its users.  Security ends with trust. 33
  • 34. Thank You  Questions?  Insults?  Feedback?  Kautilya is available at http://code.google.com/p/kautilya/  Follow me @nikhil_mitt  http://labofapenetrationtester.blogspot.com/