51
SOFTWARE TECHNIK Bytecode kennt keine Geheimnisse Eric Bodden Siegfried Rasthofer Steven Arzt Robert Hahn Max Kolhagen

Bytecode kennt keine Geheimnisse - Entwicklertag kennt keine Geheimnisse ... so, open the Amazon Cognito Console, select your identity pool, click Edit Identity Pool, specify your

Embed Size (px)

Citation preview

SOFTWARETECHNIK

Bytecode kenntkeine Geheimnisse

Eric BoddenSiegfried Rasthofer

Steven ArztRobert Hahn

Max Kolhagen

SOFTWARETECHNIK

2

IaaS PaaS

SaaS

??

SOFTWARETECHNIK

3

BaaS

SOFTWARETECHNIK

4

Sicher?

SOFTWARETECHNIK

5

SOFTWARETECHNIK

Agenda

• Einführung in BaaS

• Sicherheitsanalyse

• Unsere Entdeckungen

• Gegenmaßnahmen

• Wunschliste

6

← Festhalten!

SOFTWARETECHNIK

Backend-as-a-Service

7

BaaS SDK

Cloud

APP

SOFTWARETECHNIK

Backend-as-a-Service

8

SOFTWARETECHNIK

Backend-as-a-Service

9

User Administration

SOFTWARETECHNIK

10

DB connection

BaaS SDK

AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(“ACCESS_KEY_ID“, “SECRET_KEY“) );

SOFTWARETECHNIK

11

DB connectionAmazonS3Client s3Client = new AmazonS3Client(

new BasicAWSCredentials(“ACCESS_KEY_ID“, “SECRET_KEY“) );

BaaS SDK

“When you access AWS programmatically, you use an access key to verify your identity and the identity of your applications. An access key consists of an access key ID and a secret access key.

Anyone who has your access key has the same level of access to your AWS resources that you do.“ Source: http://docs.aws.amazon.com/

“ACCESS_KEY_ID“, “SECRET_KEY“

SOFTWARETECHNIK

12

DB connectionAmazonS3Client s3Client = new AmazonS3Client(

new BasicAWSCredentials(“ACCESS_KEY_ID“, “SECRET_KEY“) );

BaaS SDK

“…The AWS SDKs use your access keys to sign requests for you so that you don't have to handle the signing process…” http://docs.aws.amazon.com/

“…Secret access keys are, as the name implies, secrets, like your password…”

Jim Scharf Director, AWS Identity and Access Management

(username) (password)“ACCESS_KEY_ID“, “SECRET_KEY“

SOFTWARETECHNIK

IT-Security 101

13

Peter

“Hi, I am Peter”Identification

“My password is Secret123”Authentication

"I am allowed to access foo.txt”Authorization

Server

SOFTWARETECHNIK

=??

App-Authentisierungsmodell

14

App“Hi, I am app <Application ID>”Identification

“My <Secret Key> is in the app” ???Authentication

Server

SOFTWARETECHNIK

App-Authentisierungsmodell

15

Server

Peter

Howard

Peter?

Howard? Eve?

SOFTWARETECHNIK

Was Entwickler dazu sagen

16

[...]“The App-Secret key should be kept private - but when releasing the app they can be reversed by some guys. I want to know what is the best thing to encrypt, obfuscate or whatever to make this secure.“[...] (Source: stackoverflow.com)

“Few ideas, in my opinion only first one gives some guarantee: 1. Keep your secrets on some server on internet, and when needed just

grab them and use. 2. Put your secrets in jni code 3. use obfuscator 4. Put your secret key as last pixels of one of your image in assets “

(Source: stackoverflow.com)

Q:

R:

NO!!!!

SOFTWARETECHNIK

Sicherheitsanalyse

17

SOFTWARETECHNIK

Manual Pre-Analysis (here: Parse)

18

public void onCreate() { java.lang.String $S1, $S2; $S1 = “34lI1wgISkIUpTunWRAzXei20H3NAL7W6buKTe7e"; $S2 = “pB7OlNi0jsEp3fpJfq9wvHBoOWgaOQCSW98BF7e3"; staticinvoke <Parse: void initialize(Context, String, String)>(this, $S1, $S2); }

+

”Users” Table

SOFTWARETECHNIK

19

Ergebnisse der Voranalyse: • Konnten auf alle Records zugreifen • Nur wenige Entwickler nutzen überhaupt Obfuscation

SOFTWARETECHNIK

20

… auf geht’s, zur Massenanalyse!

SOFTWARETECHNIK

Massenanalyse

21

SOFTWARETECHNIK

22

Wie bekommen wir die genauen Strings aus den APKs?

SOFTWARETECHNIK

APK Informations-Extraktion

23

$S1 = “34lI1wgISkIUpTunWRAzXei20H3NAL7W6buKTe7e";$S2 = “pB7OlNi0jsEp3fpJfq9wvHBoOWgaOQCSW98BF7e3";staticinvoke <Parse: void initialize(Context, String, String)>(this, $S1, $S2);

1. API-Aufrufe identifizieren

2. Strings extrahieren:

Statisch Dynamisch Hybrid

SOFTWARETECHNIK

HARVESTER (Hybride Daten-Extraktion)

24

Harvesting Runtime Data in Android Applications for Identifying Malware and Enhancing Code Analysis Siegfried Rasthofer, Steven Arzt, Marc Miltenberger, Eric Bodden Technical Report, February 2015.

Hybrid

SOFTWARETECHNIK

Datenzugriff

25

“34lI1wgISkIUpTunWRAzXei20H3NAL7W6buKTe7e"

“pB7OlNi0jsEp3fpJfq9wvHBoOWgaOQCSW98BF7e3"

“CreditCardDataTable"

“ContactDataTable"

...

BaaS API

SOFTWARETECHNIK

Was wir gefunden haben…

SOFTWARETECHNIK

Ergebnisse Parse: Goldware

27

Infos zu Käufen

Ortungsdaten

Facebook-Infos - “Freunde” - Geblockte “Freunde”

KontaktdatenGültige

Emailadressen

Geburtstage Telefonnummern

FotosMeldungen zuAutounfällen

SOFTWARETECHNIK

Ergebnisse Parse: Malware

28

We know what you did this summer: Android Banking Trojan exposing its sins in the cloud Siegfried Rasthofer, Eric Bodden, Carlos Castillo, Alex Hinchliffe VirusBulletin 2015, AVAR 2015

Abgefangene SMS-nachrichten C&C Tasks

C&C KommandosEntwendete Daten

SOFTWARETECHNIK

Responsible Disclosure-Prozess – Parse (Facebook)

29

Vollzugriff auf 100 Tabellen Teilweiser Zugriff auf 32 Tabellen ( ~56 Mio Datensätze)

Facebook mit ein paar Beispielslogins kontaktiert

Facebook bestätigt Problem und fragt nach näheren Infos

Wir liefern alle Informationen an Facebook

28th April 2015

5th Mai 2015

18th Mai 2015

12th Nov 2015 Vollzugriff auf 99 Tabellen Teilweiser Zugriff auf 33 Tabellen

20th Mai 2015 Facebook leitet Infos weiter an Parse (welche wiederum - hoffentlich - die Entwickler kontaktierten)

SOFTWARETECHNIK

Ergebnisse Amazon

30

Server Backups Baby-Wachstumsdaten Fotos

SOFTWARETECHNIK

31

Private Nachrichten Lotterie-Daten Webseiten-Inhalte!

Ergebnisse Amazon

!!!

SOFTWARETECHNIK

Gegenmaßnahmen

SOFTWARETECHNIK

IT-Sicherheit 101: ACLs

33

Peter

Howard

Peter‘s stuff

Howard’s stuff

XX

SOFTWARETECHNIK

Recap: App-Authentisierung

34

Server

Peter

Howard

Peter?

Howard? Eve?

Access Key ID

Secret Key

SOFTWARETECHNIK

Zwei BaaS-Nutzungsszenarien

35

Authenticated User

Private DataUser

App

Public Data

Anonymous Users

SOFTWARETECHNIK

Two BaaS Usage Scenarios

36

Authenticated User

Anonymous Users

ACL

ACL

SOFTWARETECHNIK

ACLs in The App Security

37

Peter

Howard

Peter‘s stuff

Howard’s stuff

Anonymous UsersPublic stuff

X X

SOFTWARETECHNIK

Amazon Key Hierarchy (1)

38

SOFTWARETECHNIK

Amazon Key Hierarchy (2)

39

Root Account (AWS Account)

App1 Account App2 Account

Peter‘s Account Howard‘s Account

SOFTWARETECHNIK

Amazon Token Vending Machine

40

Beispiel verfügbar,mehr aber auch nicht

Erfordert Hosting. Tomcat, Elasticbeanstalk anyone?

SOFTWARETECHNIK

Amazon Token Vending Machine

41

Although you will need to use your AWS account credentials to deploy the TVM, we recommend that you do not run the TVM under your AWS account. Instead, create an IAM user and configure the TVM to use the credentials of this IAM user, which we will call the TVM user.

Brauchen also S3, TVM, IAM, Elastic Beanstalk…

SOFTWARETECHNIK

Und wie bekomme ich ACLs?

42

You would need to modify the provided samples in order to implement these user-specific policy objects. For more information about policy objects, see the Identity and Access Management (IAM) documentation

SOFTWARETECHNIK

Amazon Cognito

• Fertige Implementierung für Identity Management

Mit fertigem Nutzermanagement

Erlaubt “Anonyme Nutzer”

• Ziemlich neuer Dienst

Noch nicht weithin benutzt

43

So … let‘s try t

o

use it

SOFTWARETECHNIK

Amazon CognitoNote: If you created your identity pool before February 2015, you will need to reassociate your roles with your identity pool in order to use this constructor without the roles as parameters. To do so, open the Amazon Cognito Console, select your identity pool, click Edit Identity Pool, specify your authenticated and unauthenticated roles, and save the changes.

44

SOFTWARETECHNIK

Amazon Cognito

45

(1) Nutzer-Credentials (optional)

Amazon Cognito

(2) Temporäre AWS Credentials

S3(3) Temporäre AWS Credentials

SOFTWARETECHNIK

Und Parse.com…?

SOFTWARETECHNIK

Und Parse.com…?

http://blog.parse.com/announcements/moving-on/

SOFTWARETECHNIK

Unsere Wunschliste

SOFTWARETECHNIK

Was hilft?

49

Rechtliche VorschriftenBessere Doku Prüfungen / Alarme

SOFTWARETECHNIK

Takeaway Messages

• Wenn etwas zu schön klingt um wahr zu sein, dann ist es das in der Regel auch

• Sichere Cloud-Authentifizierung kostet

• Nichtbeachtung kann katastrophale Folgen haben: Datendiebstahl und -manipulation

Also: Sichert Eure Apps! Und fangt heute an!

(wir helfen gerne)

50

Prof. Dr. Eric BoddenFachgebiet SoftwaretechnikHeinz Nixdorf Institut Zukunftsmeile 1 33102 Paderborn

Telefon: +49 5251 60-3313 [email protected]

https://www.hni.uni-paderborn.de/swt/

https://blogs.uni-paderborn.de/sse/

SOFTWARETECHNIK

51