75
Hack your ATM with friend's Raspberry.Py Alexey Osipov Olga Kochetova

Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Embed Size (px)

DESCRIPTION

At all times there have been bad guys, who tried to steal money. ATM machines containing vast amounts of money have always been attractive targets. Until recently, criminals were only using physical weaknesses. Skimmers and shimmers for stealing magstripe-tracking data, fake pin pads and cameras for stealing pin codes, and even fake ATMs were created. Time passed and ATM software started to unify. Where there is unification, there are viruses. Trojan.Skimmer.*, Ploutus and other named or unnamed trojans. And what did we see on the public scene? Vendors started discussing the skimmers problem only after they were detected in the wild. As you remember, Barnaby Jack presented "Jackpotting Automated Teller Machines" at Black Hat USA 2010. He used some vulnerabilities in ATM software. He showed that malware, was injected into the OS of the ATM via bootable flash drive or via remote management TCP port. Barnaby Jack's work was based on assumptions that most vulnerabilities were concentrated in the host machine and that we can and should reuse software made by ATM vendors. And that's quite true, but... antiviruses, locked firmware upgrades, blocked USB connectors, and encrypted hard drives can mitigate such risks. But, what about connecting not to the host machine, but to devices themselves? What countermeasures exist, when we will try to impersonate ourselves as an ATM host? Hacking ATMs with small computer like Raspberry Pi should be impossible, but it isn't. The point of our presentation is to draw attention to the problem, which has existed for quite a long time. The problem is usage of common interfaces (like RS232 or USB) and protocols of communication from host machine to such devices as card readers, pin pads and/or dispenser units.

Citation preview

Page 1: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Hack your ATM with friend's Raspberry.Py

Alexey OsipovOlga Kochetova

Page 2: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Who are we?

• Positive Hack Days Team

• Authors of multiple articles and researches

• White hats

• CLUB-MATE addicts

• Just cool folks

Page 3: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Agenda

• Intro (little bit about ATM history)

• Old physical stuff (Skimmers and pin sniffers)

• Host based attacks (XFS vulnerabilities/insecurities)

• Device-specific attacks

• Demos

Page 4: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

INTRO (LITTLE BIT ABOUT ATM HISTORY)

Page 5: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

The 1st idea: no ATM – no cry

• 1939 – the 1st idea of ATM

• The City Bank of New York rejected it

• If you don’t have ATM, it can’t be hacked

Page 6: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

1967 – the world’s 1st ATM

Page 7: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Card&PIN&online&so on

Page 8: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Today we can use and investigate ATMs

Page 9: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

WHY WE ARE DOING IT?

Page 10: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

$#it happened

Page 11: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Banks are curious

Page 12: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

We are curious

Page 13: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

ATMs are hacked• Trojan.Skimers• Backdoor.Ploutus• Tyupkin• Another target attack• Undocumented

features• “Top secret” data is

online

Page 14: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

ATM Jackpotting by Barnaby Jack

• Remote controlled ATM with admin tools

• Firmware updates

• Dispense money

Page 15: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

OLD PHYSICAL STUFF (SKIMMERS AND PIN SNIFFERS)

Page 16: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

• Encrypted PIN Pad

Motorized hybrid card reader

What is inside

Page 17: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Motorized hybrid card reader

Card reader

Page 18: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Track2 is enough for transaction

Page 19: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

PAN = the 1st part of Track2

Page 20: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

• Skimming• Shoulder-surfing, hidden camera, mirrors• Fake PIN pad• Fake ATM

I need your PIN, your card and your cash

Page 21: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Like valid slots

Page 22: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

The most popular devices

Page 23: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Converted anti-skimming

Page 24: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

3D printing skimming

Page 25: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

via http://krebsonsecurity.com/

Fake ATM

Page 26: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Your money is not yours anymore

Page 27: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

HOW HARD TO GET INSIDE OF ATM?

Page 28: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Service zone- Plastic cover

- Single lock

- Safe for money- Steel + concrete

- Rotary code locks/electronic locks

- Two types of locks

ATM countermeasures

Page 29: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

How to get in

Page 30: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

How to get in

Page 31: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

How to get in

Page 32: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

ATM is locked

Page 33: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DEMO

Page 34: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

HARDWARE AND PREPARATIONS

Page 35: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Minimal price

- Small

- Capable of using multiple interfaces

Intent

Page 36: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Raspberry Pi- 2 USB ports- Ethernet

- USB-COM converter- Facedancer (kudos to Travis Goodspeed)- Wifi dongle- Battery =)

Hardware

Page 37: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- PWN Pi

- Python

- pySerial

- pyHID

- pyUSB

- TTWE framework (thx rvantonder)

Software

Page 38: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Raspberry Pi + Python + WiFi = bingo!

Our “malware” devices

Page 39: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

HOST BASED ATTACKS (XFS VULNERABILITIES)

Page 40: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

XFS insecurity

Network communicationWindows-based application

Configuration information

Unit #1

Service provider #1

Unit #2 Unit #3

Service provider #2 Service provider #3

Unit #4

Service provider #4

Unit #5 Unit #n

Service provider #5 Service provider #n

XFS API

XFS SPI

XFS manager

COM USB

Customer/Service mode

Page 41: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

XFS insecurity

Network communicationWindows-based application

Configuration information

Unit #1

Service provider #1

Unit #2 Unit #3

Service provider #2 Service provider #3

Unit #4

Service provider #4

Unit #5 Unit #n

Service provider #5 Service provider #n

XFS API

XFS SPI

XFS manager

COM USB

Customer/Service mode

Page 42: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

XFS, PIN Keypad device

PIN device

– Open mode and

secure mode read

data

– Export of key is not

available

Page 43: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

XFS, Identification Card Device

IDC device

– Read/write data

– Insert/eject/retain

cards

– EMV reader

Page 44: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Cash Dispenser Device– Cash withdrawal without authorization

– Cassette and cash control

– Software safe opening

XFS, Cash Dispenser Device

Page 45: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Authentication?

- Hard to get specification?

- Exclusive access to XFS manager/service provider?

XFS authentication

Page 46: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Authentication? What authentication?

- Hard to get specification? Freely available

- Exclusive access to XFS manager/service provider? Exists, but not intended to be used for security

XFS authentication

Page 47: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

• Early 2014 – 95% of ATMs run on Windows XP

• Support killed off in April

• >9000 vulnerabilities

Windows XP still alive

Page 48: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

So?

Page 49: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DEMO

Page 50: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DEVICE-SPECIFIC ATTACKS (PHYSICAL INTERFACES COM/USB)

Page 51: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

RS232 insecurity

Network communicationWindows-based application

Configuration information

Unit #1

Service provider #1

Unit #2 Unit #3

Service provider #2 Service provider #3

Unit #4

Service provider #4

Unit #5 Unit #n

Service provider #5 Service provider #n

XFS API

XFS SPI

XFS manager

COM USB

Customer/Service mode

Page 52: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DinosauRS232

• Standard interface

• No specific drivers

• No authorization

• Insecure proprietary protocols (just sniff and replay)

Page 53: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

• Direct device control– Command execution mitigating all host-based checks,

e.g. cash withdrawal without notes counter checks

– Execution of undocumented functions

– Intercept unmasked sensitive data

• Possibility of producing hardware sniffer, which can’t be detected by software means

Advantages

Page 54: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

• Protocols bloat

• Specific method of integrity control

• Short timeouts

• Endless polling

• New firmware version = new protocol

Difficulties

Page 55: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DEVICE-SPECIFIC ATTACKS (COM-PROTOCOLS)

Page 56: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- No good tools for analysis

- No flow control

- No host loss detection

- Packets- Fixed size

- Start/stop bytes

- Length prefix + data

Typical serial protocol

Page 57: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Life without wireshark

Page 58: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Typical data

02 30 XX XX XX

01 0102 00 03 00 04 00 05 00 06 00

10 03 42

Page 59: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Typical serial protocol

02 30 XX XX XX

01 0102 00 03 00 04 00 05 00 06 00

10 03 42

- 02 30 / 10 03 – start-stop sentinels

- XX XX– op-code

- XX – Unknown

- 01 01 … – data

- 42 – CRC8

Page 60: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Request insert card

- Acknowledge host about card inserted

- Issue 3 separate commands to read 3 tracks

- Issue additional commands for EMV communication

IDC device flow

Page 61: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Sniff all Track data

- Send to host fake information about inserted card

- Abuse services existent on ATM that don’t involve cash withdrawal

- Card to card transactions

- Payments

IDC device attacks

Page 62: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

PIN device flow

Page 63: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- If entering PIN/encryption keys- Authenticate host on currently used keys

- Send empty button press events

- Send PIN block to host

- If entering open string

- Send all button press events with button values to host

PIN device flow

Page 64: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

PIN MITM attack

Page 65: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Request open mode from PIN pad when user is going to insert PIN code

- Acknowledge host about button presses

- Send erroneous PIN block (we don’t know keys)

- Host refuses transaction, but attacker knows client PIN code

- Next transaction will be unmodified

PIN device MITM attacks

Page 66: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Restart/check device

- Dispense X notes from Y cassettes

- Open shutter

- Present notes to user

Dispenser device flow

Page 67: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

DEMO

Page 68: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- No more RS232 – no malicious control

- Any use of cryptography – is equal to good use of cryptography

- We regret informing you that we had decided to stop producing this model and warranties for our distributors been expired (c)

What big vendors think

Page 69: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

What we think

Page 70: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

HOW TO LIVE WITH ALL THIS?

Page 71: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Service zone is important

- Current methods of protection is not enough

- Using execution prevention software without OS patches – is wrong

Conclusions

Page 72: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

- Implement mutual authentication both for ATM computer and it’s devices

- Make peer review of XFS standard/communication protocols

- Service zone is as important as safe

- Trust environment is not about ATMs

Proposals

Page 73: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Alexander Tlyapov, @Rigmar

SCADAStrangeLove, @scadasl

And all other guys worth mentioning

Kudos

Page 74: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)

Alexey Osipov, @GiftsUngiven

Olga Kochetova, @_Endless_Quest_

Questions?

Page 75: Hack your ATM with friend's Raspberry.Py (Black Hat EU-2014)