You Can Type, but You Cant Hide A Stealthy GPU-based Keylogger - - PowerPoint PPT Presentation

you can type but you can t hide
SMART_READER_LITE
LIVE PREVIEW

You Can Type, but You Cant Hide A Stealthy GPU-based Keylogger - - PowerPoint PPT Presentation

You Can Type, but You Cant Hide A Stealthy GPU-based Keylogger EUROSEC 2013 Evangelos Ladakis Lazaros Koromilas, Giorgos Vasiliadis, Sotiris Ioannidis, Michalis Polychronakis (FORTH-ICS) 1 Outline Background A GPU-Based keylogger


slide-1
SLIDE 1

You Can Type, but You Can’t Hide

A Stealthy GPU-based Keylogger EUROSEC 2013

Evangelos Ladakis Lazaros Koromilas, Giorgos Vasiliadis, Sotiris Ioannidis, Michalis Polychronakis (FORTH-ICS)

1

slide-2
SLIDE 2

Outline

 Background  A GPU-Based keylogger  Evaluation  Defenses 2

slide-3
SLIDE 3

Keyloggers

 Malware that records keystrokes

Types:

Hardware (devices plugged in keyboard) Software (user mode or kernel mode) User mode:

They use OS functionalities:

Character device files Linux OS

GetAsyncKeyState Windows OS

Kernel mode:

They implement “Hook” functions

 Can be detected by AVs/anti-malware software

3

slide-4
SLIDE 4

Motivation

 How can we hide the malicious code from

AVs/anti-malware software?

 Is it possible to use the GPU for building a

stealthier malware?

4

slide-5
SLIDE 5

General-Purpose Programming on GPUs (GPGPU)

 GPUs can be programmed for general purpose

computation

 Familiar API as C language extensions

 Existing GPGPU frameworks

 OpenCL (Universal Programming Language)  NVIDIA CUDA (For NVIDIA Graphics Cards)

 General-Purpose Programming is directly supported

by most commodity drivers/video cards

 A GPU-based keylogger will run without problems on most

systems

5

slide-6
SLIDE 6

Overall approach

  • Scan kernel’s memory to locate the keyboard

buffer

  • Remap the memory page of the buffer to user

space

  • Set the GPU to periodically read and scan them

for sensitive information (e.g., credit card numbers)

  • Unmap the memory in order to leave no traces

6

slide-7
SLIDE 7

Implementation

Step 1: Locate the keyboard buffer

  • Keyboard buffer dynamically changes address after system

rebooting or after unplugging and plugging back in the device

7

kernel module controller process memory scanner GPU code

start keylogger manipulate page table entries locate buffer scan pages

slide-8
SLIDE 8

Implementation

Scan the kernel memory using heuristics

8

Struct URB (USB Request Block) struct usb_device *dev ... void *transfer_buffer (actual keyboard buffer) dma addr t *transfer_dma ... u32 *transfer_buffer_length ... struct usb_device … char* product (descibes the device) “USB”, “keyboard” Must contains substrings *For proof of concept we scanned kernels memory with a kernel module

slide-9
SLIDE 9

Implementation

Step 2: Configure the GPU to constantly monitor

buffer contents for changes

9

kernel module controller process memory scanner GPU code

start keylogger manipulate page table entries locate buffer scan pages

slide-10
SLIDE 10

Implementation

  • The GPU driver allows DMA access ONLY to the host

process' address space

  • Only to memory regions allocated through a special CUDA

API call

  • Use a kernel module to remap the physical page of the

buffer to the user-level process' memory space

10

slide-11
SLIDE 11

Implementation

Step 3: Start GPU process & Capture keystrokes

11

kernel module controller process memory scanner GPU code

start keylogger manipulate page table entries locate buffer scan pages

slide-12
SLIDE 12

Implementation

  • Uninstall the module
  • Use polling to catch keystrokes
  • “wake up” GPU process periodically through the CPU

controller process

  • Simple state machine translates keystrokes into ASCII

characters

  • Store keystrokes into Video RAM

12

slide-13
SLIDE 13

Implementation

Step 4: Scan captured keystrokes for sensitive

information

  • GPU-based regular expression parser

13

Credit card Regular expresion

VISA ^4[0-9]{12}(?:[0-9]{3})?$ MasterCard ^5[1-5][0-9]{14}$ American Express ^3[47][0-9]{13}$ Diners Club ^3(?:0[0-5]|[68][0-9])[0-9]{11} $ Discover ^6(?:011|5[0-9]{2})[0-9]{12}$

slide-14
SLIDE 14

Evaluation

  • Ubuntu Linux 12.10 with kernel v3.5.0
  • Used CUDA 5.0 SDK
  • Executable less than 4 KB
  • Polling interval tradeoff:

Monitoring granularity vs. CPU/GPU utilization

 Low Frequency: might miss keystroke events  High frequency: might cause detectable CPU/GPU utilization

increase

14

slide-15
SLIDE 15

CPU Utilization

15

slide-16
SLIDE 16

CPU Utilization

16

Fastest Typists

slide-17
SLIDE 17

GPU Utilization

17

slide-18
SLIDE 18

GPU Utilization

18

Fastest Typists

slide-19
SLIDE 19

Possible Defenses

  • Monitoring GPU access patterns
  • Multiple/repeated DMAs from the GPU to system RAM
  • Monitoring GPU usage
  • Unexpected increased GPU usage

19

slide-20
SLIDE 20

Current Prototype Limitations

  • Requires a CPU process to control its execution
  • Future GPGPU SDKs might allow us to drop the CPU

controller process

  • Requires administrative privileges
  • For installing and using the module
  • However the control process runs in user-space
  • No kernel injection needed or data structure manipulation,

in order to hide

20

slide-21
SLIDE 21

Conclusion

  • GPUs offer new ways for robust and stealthy

malware

  • Presented a fully functional and stealthy GPU-

based keylogger

  • Low CPU and GPU usage
  • No Device Hooking
  • No traces left after exploitation
  • User Mode application. No kernel injection needed

21

slide-22
SLIDE 22

Thank you

22

slide-23
SLIDE 23

Locate the keyboard buffer

#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) for (i = 0; i < totalmem; i += 0x10) { struct urb *urbp = (struct urb *)__va(i); If ( ( (urbp->dev % 0x400) == 0) && ((urbp->transfer_dma % 0x20) == 0) && (urbp->transfer_buffer_length == 8) && (urbp->transfer_buffer != NULL) && strncmp(urbp->dev->product, "usb", 32) && strncmp(urbp->dev->product, "keyboard", 32)) { /* potential match * } }

23

slide-24
SLIDE 24

Related Work

 DMA Malware “DAGGER” by: Patrick Stewin

and Iurii Bystrovx

 Implemented in Intel's Manageability Engine (it is used

for remote Bios operations)

 GPU assisted malware by: Giorgos Vasiliadis,

Michalis Polychronakis and Sotiris Ioannidis

 GPU-based self-unpacking malware

24