
drivers. That is the case, for example, of keyboards, 
mice and  game controllers. A  malicious USB  HID 
device  can  perform  operations  without  user’s 
knowledge or intervention. 
In order to illustrate the capability of malicious 
USB  devices,  this  paper  describes  an  approach  of 
reprogramming  the  USB  interface  of  an  Arduino 
Mega to act as an USB HID Keyboard. 
The Arduino Mega is a development board based 
around the ATmega2560 microcontroller running at 
16MHz. It has 54 digital input/output pins (of which 
15 can be used as PWM outputs), 16 analog inputs, 4 
UARTs (hardware serial ports), a USB connection, a 
power jack, an ICSP header, and a reset button.  
In  order  to  provide  the  USB  interface  for  the 
ATmega2560  microcontroller,  the  Arduino  board 
uses an auxiliary controller, the ATmega16U2, which 
converts USB signals coming from the computer to 
the first serial port of the ATmega2560. Similarly to 
the Atmega2560, the ATmega16U2 is also an AVR 
RISC-based  microcontroller,  but  with  USB 
capabilities. It has 16KB of ISP flash memory and is 
factory configured with a USB bootloader located in 
the  on-chip  flash  boot  section  of  the  controller  to 
support Device Firmware Upgrade (DFU). 
DFU mode can be enabled by sending a special 
USB  stream  to  the  controller.  Once  activated,  it 
allows  In-System  Programming  from  its  USB 
interface without any external programming device. 
Therefore, by just connecting the Arduino to a host 
computer, it is possible to reprogram the firmware of 
the ATmega16U2 controller. 
To create the malicious USB device mentioned, 
the ATmega16U2 was reprogrammed with an USB 
Keyboard  firmware.  This  firmware  allows  the 
ATmega16U2 to act as an HID Keyboard and send 
keystrokes  based  on  strings  stored  in  the 
ATmega16U2’s  flash.  The  strings  activate  special 
functions on the Operating System, and if carefully 
designed, can cause great harm. The keystrokes are 
sent so fast that each command is executed in less 
than a second. The strings created to demonstrate the 
device  targets Windows machines, and by sending 
key combinations it is able to open the Windows run 
dialog and write a batch script to disk. It then executes 
the batch script and finally opens notepad and writes 
continuously: “You have been hacked!”. 
This conceptual approach illustrates how easily an 
USB  device  can  be  reprogrammed  to  execute 
malicious  code.  Since  the  code  is  embedded  into 
device’s  flash  memory,  the  Operating  System  does 
not recognize it as a threat. From the OS perspective, 
it  is  extremely  difficult  to  analyse  and  remove 
malicious code embedded in a USB device.  
There  is  not  any  simple  solution  to  this.  Any 
protection  attempt  from  the  OS  would  basically 
interfere with the usefulness of USB, which makes it 
so  popular.  Apparently,  the  only  working  solution 
would  be  to  convince  manufacturers  to  disable 
firmware  update  at  the  factory,  so  that  the  device 
cannot be reprogrammed. 
4  CONCLUSIONS 
This  paper  described  in  total  eight  different 
approaches  of  hardware  attacks  targeting  software. 
Although the hardware and firmware modifications 
demonstrated in this paper are very specific to each 
device,  they  have  proven  very  efficient  against 
software protections. After all, the software must trust 
entirely  in  the  hardware  to  perform  its  operations, 
therefore,  if  the  hardware  has  been  tampered,  it 
becomes really challenging to regain control of the 
system. 
This  paper  also  demonstrated  how  to  create  a 
quick hardware attack by modifying the firmware of 
an USB device via DFU. By completely replacing the 
firmware of the USB device, it was possible to make 
it  behave  as  a  HID  keyboard  and  therefore  send 
malicious key strokes to the Operating System. 
REFERENCES 
Robert, J. and Chen, T. 2004. The Evolution of Viruses and 
Worms.  Statistics:  A  Series  of  Textbooks  and 
Monographs. (2004), 265-285. 
Sparks S. et al. 2009. A chipset level network backdoor. 
Proceedings  of  the  4th  International  Symposium  on 
Information, Computer, and Communications Security 
- ASIACCS '09. (2009). 
Zaddach, J. et al. 2013. Implementation and implications of 
a stealth hard-drive backdoor. Proceedings of the 29th 
Annual Computer Security Applications Conference on 
- ACSAC '13. (2013). 
Embleton, S. et al. 2008. SMM rootkits. Proceedings of the 
4th international conference on Security and privacy in 
communication networks - SecureComm '08. (2008). 
Sang, F. et al. 2010. Exploiting an I/OMMU vulnerability. 
2010 5th International  Conference on Malicious and 
Unwanted Software. (2010). 
Wang,  X.  et  al.  2012.  Software  exploitable  hardware 
Trojans  in  embedded  processor.  2012  IEEE 
International  Symposium  on  Defect  and  Fault 
Tolerance in VLSI and Nanotechnology Systems (DFT). 
(2012). 
A. Cui. et al. 2013. When firmware modifications attack: A 
case  study  of  embedded  exploitation.  2013  The 
Hardware-based Cyber Threats
265