Backdooring X11 with class Matias Katz @matiaskatz - - PowerPoint PPT Presentation

backdooring x11 with class
SMART_READER_LITE
LIVE PREVIEW

Backdooring X11 with class Matias Katz @matiaskatz - - PowerPoint PPT Presentation

Backdooring X11 with class Matias Katz @matiaskatz matias@matiaskatz.com Andsec Security Conference End of November 2015 Buenos Aires, Argentina www.andsec.org An idea back in 1995... Locking a computer using hardware An idea back in


slide-1
SLIDE 1

Backdooring X11 with class

Matias Katz @matiaskatz matias@matiaskatz.com

slide-2
SLIDE 2

Andsec Security Conference End of November 2015 Buenos Aires, Argentina www.andsec.org

slide-3
SLIDE 3

An idea back in 1995...

Locking a computer using hardware

slide-4
SLIDE 4

An idea back in 1995...

2 steps: 1) Find a way to read a device 2) Find a way to lock a computer

slide-5
SLIDE 5

An idea back in 1995...

Step 1 Filesystem? NO UUID? YES

slide-6
SLIDE 6

Reading the device

2 steps: 1) “/dev/disk/by-id/” enrollment 2) Check if present each 0.1s

slide-7
SLIDE 7

Locking the computer

Step 2

DBUS

slide-8
SLIDE 8

Locking the computer

DBUS:

  • IPC software
  • Apps communication
  • SW and HW interruptions
slide-9
SLIDE 9

Locking the computer

DBUS:

  • Runs with privileges
  • Speaks directly to the kernel
  • Available in most X Display Managers
slide-10
SLIDE 10

Demo “locker.py”

slide-11
SLIDE 11

What else to do

  • Sound alarm
  • Email certain data
  • Power off
  • Delete private keys
  • Encrypt certain files
  • Shred entire disk
slide-12
SLIDE 12

And then I thought...

Can I unlock a computer using the same method?

slide-13
SLIDE 13

Generating a Backdoor

slide-14
SLIDE 14

Unlocking a computer

2 steps: 1) Find a way to unlock a computer 2) Trigger the unlock

slide-15
SLIDE 15

A good backdoor

2 main features: 1) Leave small traces 2) Have a stealth trigger

slide-16
SLIDE 16

Unlocking a computer

Unlocking computer leaving small traces: Binaries? NO Rootkits? NO OS features? YES

slide-17
SLIDE 17

Unlocking a computer

Unlocking computer leaving small traces:

DBUS :)

slide-18
SLIDE 18

Unlocking a computer

Stealth trigger to unlock:

  • Not checked by AVs
  • Execution without suspicion
  • Available in all computers
slide-19
SLIDE 19

Unlocking a computer

Stealth trigger to unlock: Keystrokes? NO Open port? NO Hardware? YES

slide-20
SLIDE 20

Hardware change

Stealth hardware trigger:

  • Respond while locked
  • OS must not interfere
  • Cannot be disruptive
slide-21
SLIDE 21

Hardware change

Network Connection? NO Screen brightness? NO Power input? NO

slide-22
SLIDE 22

So?

slide-23
SLIDE 23

Audio Jack :)

slide-24
SLIDE 24

Playing with audio jack

  • Mechanic detection
  • Notifies the OS
  • Who checks that?
slide-25
SLIDE 25

Playing with audio jack

2 steps: 1) Read “/proc/asound/card0/codec#0” 2) Check for changes

slide-26
SLIDE 26

Playing with audio jack

Demo “jack.py” (Warning: Playing with the audio jack could damage it)

slide-27
SLIDE 27

Playing with audio jack

Small problem: What if the victim wants to use the headphones?

slide-28
SLIDE 28

Playing with audio jack

Simple solution: Create a pattern

slide-29
SLIDE 29

Playing with audio jack

2 steps: 1) Set checks each 1s, like “01110” 2) Replicate that with the headphones

slide-30
SLIDE 30

Unlocking the computer

Demo “back2.2.py”

slide-31
SLIDE 31

The aftertaste

How to mitigate it?

  • Remove Dbus (nope)
  • Disable screen lock (ugly but ok)
  • Switch to a minimal XDM (ok)
slide-32
SLIDE 32

The aftertaste

Do you have to run it beforehand? YES (that's why it's called a “backdoor” :D)

slide-33
SLIDE 33

The aftertaste

Can it be persistent? YES (rc.local)

slide-34
SLIDE 34

The aftertaste

How big is it? 20 lines (dirty) 1 line (nice)

slide-35
SLIDE 35

The aftertaste

What's so good about it?

  • NO Opcodes
  • Undetectable
slide-36
SLIDE 36

The aftertaste

>>> import dbus >>> >>> import dbus Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named dbus >>>

slide-37
SLIDE 37

The aftertaste

Can you do it to 'root' ? YES (but...)

slide-38
SLIDE 38

The aftertaste

Can you do it on Windows ? YES

  • WinDBus
  • COM / RPC / DDE
slide-39
SLIDE 39

The aftertaste

Can you Shellshock it ?

HELL YEAH (however..)

(Thanks Chino for the idea and Nutrix for the help implementing)

slide-40
SLIDE 40

Backdooring X11 with class

Matias Katz @matiaskatz matias@matiaskatz.com