55
New Privacy in Android 11 and OWASP Mobile Security Albert Hsieh

New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

New Privacy in Android 11 and OWASP Mobile Security

Albert Hsieh

Page 2: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

OWASP現有大約200個開源免費專案

Page 4: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

OWASP.Mobile

Page 5: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

What’s new on Android 11

1. Scoped storage enforcement

2. One-time permissions

3. Permissions auto-reset

4. Background location access

5. Package visibility

6. Foreground service typeshttps://developer.android.com/preview/privacy

Page 6: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Is That Security Or Privacy?

保護可辨識個人之非公開資訊

Privacy保護所有資訊and more!

Security

Page 7: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Permissions

Page 8: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

How Powerful is Your Flashlight?

Page 9: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

https://www.zdnet.com/article/most-android-flashlight-

apps-request-an-absurd-number-of-permissions/

Permissions, Permissions Everywhere!

Page 10: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

One-time Permissions

Page 11: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Only this time!

Page 12: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Only this time!

Page 13: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Only this time!

Page 14: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Background Location Access

Page 15: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Foreground access (App is visible or running a Foreground Service with

Location type)

● ACCESS_COARSE_LOCATION

● ACCESS_FINE_LOCATION (accurate location)

Background access (i.e Geofence or WorkManager/AlarmManager in BG)

● ACCESS_BACKGROUND_LOCATION

Location Permission is specialit’s split in Foreground and Background access

Page 16: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Foreground location accessACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION

●On all versions, this requests foreground access.

●On pre-Android 10, background access is implied.

ActivityCompat.requestPermissions(

/* Activity */ this,

/* Request BG alone */ arrayOf(ACCESS_COARSE_LOCATION),

/* RequestCode */ 100

)

Page 17: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

RequestACCESS_BACKGROUND_LOCATION

At some pointACCESS_COARSE_LOCATION

My App

Target API level

'R'If show rational is true:

IN-CONTEXT UI (you define it)

Background location accessrequest incrementally only after Foreground has been granted

Page 18: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Permissions Auto-reset

Page 19: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Target API level

'R'Auto-reset permissions

Page 20: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Target API level

'R'Auto-reset permissions

Provide family safety

Sync data

Smart device connectivity app

Paired to companion devices

Settings.ACTION_APPLICATION_DETAILS_SETTINGS

Page 21: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Foreground Service Types

Page 22: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Companion device

Media Projection

Location

Foreground Service TypesAndroid 10

●Introduced the concept of types

Sync

Media Player

Phone Call

c

Enforced to ensure accountability for access

Page 23: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Foreground Service TypesAndroid 11

Target API level

'R'

<manifest>

...

<service ... android:foregroundServiceType="camera" />

</manifest>

Page 24: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Foreground Service TypesAndroid 11

Target API level

'R'

<manifest>

...

<service ... android:foregroundServiceType="camera|microphone" />

</manifest>

Page 25: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Package Visibility

Page 26: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Seeing all installed apps

packageManager.getInstalledPackages(0)

On Android 10 and older….

Page 27: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Default behavior

getPackageInfo("another.app", 0)

NameNotFoundException

'R'

Target API level

Page 28: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Query and interact with specific apps

Declare package names in <queries> element of manifest to ‘see’ specific apps.

<manifest><queries>

<package android:name="com.example.store" />

<package android:name="com.example.service" />

...</queries>...

</manifest>

Page 29: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Query and interact with apps based on intent filters

Declare intents in <queries> element to ‘see’ apps that handle certain intents.

<manifest>

<queries>

<intent>

<action android:name="android.intent.action.SEND" />

<data android:mimeType="image/jpeg" />

</intent>

</queries>

...

</manifest>

Page 30: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Interacting with all apps

●Shouldn’t be necessary for most apps.

●Available “Normal” permission that allows querying and interacting with all installed apps.

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES">

Look for Google Play to provide upcoming guidelines for apps that need this permission.

"Let us know your use cases” by Google….

Page 31: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Scoped Storage

Page 32: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Exactly the data that user wants to share and no more

Page 33: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

New in Android 11

Page 34: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

OWASP.Mobile

Page 35: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

OWASP.Mobile

https://owasp.org/www-project-mobile-security/

Page 36: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Secure Software Development Life Cycle (SSDLC)

M Top 10 MASVS MSTG Response

M Security ChklstHacking Playground

Page 37: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Mobile Application Security Verification Standard (MASVS)

• Forked from OWASP ASVS

• Best practices for security requirements

• Mobile-specific

• high-level

• OS-agnostic

Page 38: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Security Requirements

•V1: Architecture, Design and Threat Modeling•V2: Data Storage and Privacy•V3: Cryptography•V4: Authentication and Session Management•V5: Network Communication•V6: Platform Interaction•V7: Code Quality and Build Setting•V8: Resilience

Page 39: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Levels

MASVS-L1: all mobile apps.

MASVS-L2: apps handling sensitive data

and/or functionality.

MASVS-R: apps handling highly

sensitive data and may serve as a means

of protecting intellectual

property or tamper-proofing an app.

▪ L1 Alarm App

▪ L2 Health App

▪ L1+R Game App

▪ L2+R Banking App

Page 40: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V2: Data Storage and Privacy (part)

Page 41: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V3: Cryptography (part)

Page 42: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V5: Network Communication (part)

Page 43: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V5: Network Communication (part)

Page 44: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V6: Platform Interaction (part)

Page 45: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Yes, resilience!

RESILIENCE?

Page 46: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

V8: Resilience (part)

Page 47: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

HOW TO USE THE MASVS?

Bring Security to system requirement phase!

▸ As secure coding checklist▸ As security testing methodologies▸ For secure development training

Page 48: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

To Conclude….

Page 49: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Why do we need security?

Page 50: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

How much does that cost

Page 51: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Find the bugs earlier

Page 52: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Create fewer bugs

https://blog.parasoft.com/what-is-the-shift-left-approach-to-software-testing

Page 53: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

OWASP.Mobile

https://owasp.org/www-project-mobile-security/

Page 54: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

SHIFT LEFT!

M Top 10 MASVS MSTG Response

M Security ChklstHacking Playground

Shift Left for Security!

Page 55: New Privacy in Android 11 and OWASP Mobile Security · 2020. 8. 21. · OWASP Flagship Projects Tool Projects OWASP Amass OWASP CSRFGuard OWASP Defectdojo OWASP Dependency-Check OWASP

Thank you!