we are not there yet · towards https everywhere on android: we are not there yet andrea possemato,...

75
Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

Upload: others

Post on 19-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

Towards HTTPS Everywhere on Android: We Are Not There Yet

Andrea Possemato, Yanick Fratantonio

USENIX Security ‘20

1

Page 2: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY

2

Page 3: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY- Declarative XML configuration file to customize the network security settings without

modifying app code

3

Page 4: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY- Declarative XML configuration file to customize the network security settings without

modifying app code

3

- Cleartext traffic opt-out- Certificate pinning- Custom trust anchors

Page 5: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY- Declarative XML configuration file to customize the network security settings without

modifying app code

3

- Cleartext traffic opt-out- Certificate pinning- Custom trust anchors

- First version, introduced in Android 6.0 (API Level 23)- Only cleartext traffic opt-out

Page 6: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY- Declarative XML configuration file to customize the network security settings without

modifying app code

3

- Cleartext traffic opt-out- Certificate pinning- Custom trust anchors

- First version, introduced in Android 6.0 (API Level 23)- Only cleartext traffic opt-out

- Significantly extended in Android 7.0 (API Level 24)

Page 7: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <base-config cleartextTrafficPermitted="false" /></network-security-config>

4

Page 8: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <base-config cleartextTrafficPermitted="true" /> <domain-config cleartextTrafficPermitted="false">

<domain includeSubdomains="false">android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set>

</domain-config> </network-security-config>

5

Page 9: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <base-config cleartextTrafficPermitted="true" /> <domain-config cleartextTrafficPermitted="false">

<domain includeSubdomains="false">android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set>

</domain-config> </network-security-config>

5

Page 10: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <base-config cleartextTrafficPermitted="true" /> <domain-config cleartextTrafficPermitted="false">

<domain includeSubdomains="false">android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set>

</domain-config> </network-security-config>

5

Page 11: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <base-config cleartextTrafficPermitted="true" /> <domain-config cleartextTrafficPermitted="false">

<domain includeSubdomains="false">android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set>

</domain-config> </network-security-config>

5

Page 12: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXAMPLES<network-security-config> <debug-overrides> <trust-anchors> <certificates src="@raw/custom_cert"/> </trust-anchors> </debug-overrides></network-security-config>

6

Page 13: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

DEFAULTS - If no policy has been defined, the system applies a default one

- Defaults change according to the API Level

7

Page 14: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

DEFAULTS - If no policy has been defined, the system applies a default one

- Defaults change according to the API Level

- Default for API Level 28+ (Android 9)

<base-config cleartextTrafficPermitted="false"><trust -anchors>

<certificates src="system" /> </trust-anchors>

</base-config>

7

Page 15: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

DEFAULTS - If no policy has been defined, the system applies a default one

- Defaults change according to the API Level

- Default for API Level 28+ (Android 9)

<base-config cleartextTrafficPermitted="false"><trust -anchors>

<certificates src="system" /> </trust-anchors>

</base-config>

7

Page 16: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

DEFAULTS - If no policy has been defined, the system applies a default one

- Defaults change according to the API Level

- Default for API Level 28+ (Android 9)

<base-config cleartextTrafficPermitted="false"><trust -anchors>

<certificates src="system" /> </trust-anchors>

</base-config>

Cleartext protocols are not permitted!

7

Page 17: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

DEFAULTS - If no policy has been defined, the system applies a default one

- Defaults change according to the API Level

- Default for API Level 28+ (Android 9)

<base-config cleartextTrafficPermitted="false"><trust -anchors>

<certificates src="system" /> </trust-anchors>

</base-config>

- From Nov 2019, new Play Store policy: all apps/updates MUST target API Level 28+

Cleartext protocols are not permitted!

7

Page 18: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY WEAKNESSES

8

Page 19: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ALLOW CLEARTEXT

<network-security-config> <base-config cleartextTrafficPermitted=”true” /></network-security-config>

9

Page 20: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ALLOW CLEARTEXT

<network-security-config> <base-config cleartextTrafficPermitted=”true” /></network-security-config>

9

Page 21: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ALLOW CLEARTEXT

<network-security-config> <base-config cleartextTrafficPermitted=”true” /></network-security-config>

An attacker on the same WiFi network of the victim can inspect and modify apps’ unencrypted connections and data at will

9

Page 22: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

CERTIFICATE PINNING OVERRIDE<network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain>android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set> </domain-config> <trust-anchors> <certificates src="system" overridePins=”true” /> </trust-anchors></network-security-config>

10

Page 23: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

CERTIFICATE PINNING OVERRIDE<network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain>android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set> </domain-config> <trust-anchors> <certificates src="system" overridePins=”true” /> </trust-anchors></network-security-config>

10

Page 24: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

CERTIFICATE PINNING OVERRIDE<network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain>android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set> </domain-config> <trust-anchors> <certificates src="system" overridePins=”true” /> </trust-anchors></network-security-config>

This says: implement certificate pinning, so ‘trust connections only if they are signed by this certificate’

10

Page 25: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

CERTIFICATE PINNING OVERRIDE<network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain>android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set> </domain-config> <trust-anchors> <certificates src="system" overridePins=”true” /> </trust-anchors></network-security-config>

10

This says: implement certificate pinning, so ‘trust connections only if they are signed by this certificate’

Page 26: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

CERTIFICATE PINNING OVERRIDE<network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain>android.com</domain> <pin-set expiration="2020-12-12"> <pin digest="SHA-256">YZPgTZ+woNCCCIW3LH2CxQeLzB/1m42QcCTBSdgayjs=</pin> </pin-set> </domain-config> <trust-anchors> <certificates src="system" overridePins=”true” /> </trust-anchors></network-security-config>

This says: 'for standard CAs, ignore pinning specifications’

10

This says: implement certificate pinning, so ‘trust connections only if they are signed by this certificate’

Page 27: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

SILENT MAN-IN-THE-MIDDLE

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <trust-anchors> <certificates src="system"/> <certificates src="user"/> </trust-anchors></network-security-config>

11

Page 28: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

SILENT MAN-IN-THE-MIDDLE

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <trust-anchors> <certificates src="system"/> <certificates src="user"/> </trust-anchors></network-security-config>

11

Page 29: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

SILENT MAN-IN-THE-MIDDLE

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <trust-anchors> <certificates src="system"/> <certificates src="user"/> </trust-anchors></network-security-config>

This says: ‘for SSL/TLS, trust any CAs in the User and System KeyStore’

11

Page 30: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

SILENT MAN-IN-THE-MIDDLE

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <trust-anchors> <certificates src="system"/> <certificates src="user"/> </trust-anchors></network-security-config>

Attacker with physical access can install (silently) a custom CA in the User KeyStores

This says: ‘for SSL/TLS, trust any CAs in the User and System KeyStore’

11

Page 31: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

SILENT MAN-IN-THE-MIDDLE

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <trust-anchors> <certificates src="system"/> <certificates src="user"/> </trust-anchors></network-security-config>

Relevant for reverse engineering or stalkware/spouseware threat models!

This says: ‘for SSL/TLS, trust any CAs in the User and System KeyStore’

11

Attacker with physical access can install (silently) a custom CA in the User KeyStores

Page 32: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

LARGE SCALE ANALYSIS

12

Page 33: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ANALYSIS- Dataset of 125,419 apps

- First crawl: from June-July 2019 - Second crawl: from April-June 2020 (after Google forces all the apps to target API

Level >= 28+ and changes the defaults of the policy)

13

Page 34: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ANALYSIS- Dataset of 125,419 apps

- First crawl: from June-July 2019 - Second crawl: from April-June 2020 (after Google forces all the apps to target API

Level >= 28+ and changes the defaults of the policy)

- Analysis of the adoption of the Network Security Policy amongst apps

13

Page 35: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ANALYSIS- Dataset of 125,419 apps

- First crawl: from June-July 2019 - Second crawl: from April-June 2020 (after Google forces all the apps to target API

Level >= 28+ and changes the defaults of the policy)

- Analysis of the adoption of the Network Security Policy amongst apps

- Analysis of the policy to identify potential weaknesses

13

Page 36: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ANALYSIS- Dataset of 125,419 apps

- First crawl: from June-July 2019 - Second crawl: from April-June 2020 (after Google forces all the apps to target API

Level >= 28+ and changes the defaults of the policy)

- Analysis of the adoption of the Network Security Policy amongst apps

- Analysis of the policy to identify potential weaknesses

- Clustering on the different policies to highlight common patterns- Two policies belong to the same cluster if they contain the same nodes, attributes, and values,

in any order

13

Page 37: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY ADOPTION

- Dataset of 125,419 apps (June-July 2019)

14

Page 38: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY ADOPTION

- Dataset of 125,419 apps (June-July 2019)

14

- 16,332 apps (13% of the dataset) that do implement a policy- 7,605 of them (6% of the total) adopt the first version of the policy (Android 6.0)- 8,727 (6.95%) adopt the new version (Android 7.0)

Page 39: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Dataset of 108,542 apps (April-June 2020)- 16,877 apps were not available anymore on the Google Play Store

POLICY ADOPTION - EVOLUTION

15

Page 40: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Dataset of 108,542 apps (April-June 2020)- 16,877 apps were not available anymore on the Google Play Store

- 36,165 apps (33.3% of the dataset) that do implement a policy- 23,718 of the apps adopt the first version of the policy (Android 6.0)- 15,492 apps adopt the new version (Android 7.0)- 3,045 combined both the versions

-

POLICY ADOPTION - EVOLUTION

15

Page 41: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY WEAKNESSES- Cleartext:

- 67% of the apps still configure a Network Security Policy that permits cleartext traffic

16

Page 42: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY WEAKNESSES- Cleartext:

- 67% of the apps still configure a Network Security Policy that permits cleartext traffic -

- Certificate Pinning Override:- Only 102 apps define a Certificate Pinning strategy through the Network Security Policy- 9 apps specify one or more pin-set, but set the overridePins attribute to true, making the

various pin-set useless

16

Page 43: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY WEAKNESSES- Cleartext:

- 67% of the apps still configure a Network Security Policy that permits cleartext traffic

- Certificate Pinning Override:- Only 102 apps define a Certificate Pinning strategy through the Network Security Policy- 9 apps specify one or more pin-set, but set the overridePins attribute to true, making the

various pin-set useless

- Silent Man-In-The-Middle:- 1,159 apps specify a trust-anchors- 1,038 of them allow their SSL/TLS traffic to be potentially intercepted, since they trust the

certificates in the User KeyStore

16

Page 44: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

17

Page 45: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples

17

Page 46: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

17

Page 47: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

41 apps share this Policy

17

Page 48: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

41 apps share this Policy copied/pasted from StackOverflow

17

Page 49: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples

<domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config>

<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

41 apps share this Policy copied/pasted from StackOverflow

17

Page 50: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples

<domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config> 1,113 apps share this Policy

<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

41 apps share this Policy copied/pasted from StackOverflow

17

Page 51: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

POLICY CLUSTERING- We perform clustering to explore the dataset, and we found some 'interesting'

policies

- A couple of interesting examples

<domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config> 1,113 apps share this Policy

from Facebook ADS SDK

<domain>example.com</domain> <pin-set>

<pin digest="SHA-256">BB..(44 times)..BB</pin> </pin-set>

41 apps share this Policy copied/pasted from StackOverflow

17

Page 52: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ADS ECOSYSTEM

18

Page 53: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Dataset of 29 advertisement libraries

ANALYSIS - ADS ECOSYSTEM

19

Page 54: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Dataset of 29 advertisement libraries

ANALYSIS - ADS ECOSYSTEM

19

- Analysis of the developer documentation:- 12 libraries out of 29 asks the developer to enforce a Network Security Policy

Page 55: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Dataset of 29 advertisement libraries

ANALYSIS - ADS ECOSYSTEM

19

- Analysis of the developer documentation:- 12 libraries out of 29 asks the developer to enforce a Network Security Policy

- 11 libraries ask the developer to allow cleartext on the application

Page 56: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Impact of ad libraries on apps with cleartext configuration

ANALYSIS - ADS ECOSYSTEM

20

Page 57: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Impact of ad libraries on apps with cleartext configuration

- Extended analysis of both the datasets:- Policy analysis- LibScout to detect third-party libraries in the apps - We extended LibScout to support the profile for the 11 ad libraries

ANALYSIS - ADS ECOSYSTEM

20

Page 58: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Impact of ad libraries on apps with cleartext configuration

- Extended analysis of both the datasets:- Policy analysis- LibScout to detect third-party libraries in the apps - We extended LibScout to support the profile for the 11 ad libraries

- We used both detection systems provided by LibScout- Package name- Code similarity

ANALYSIS - ADS ECOSYSTEM

20

Page 59: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ADS ANALYSIS - RESULTS- 3,230 applications with Network Security Policy have an ad library

- Disclaimer: most of the libraries matches with LibScout were with “Package Name” similarity: the number of apps with ad libraries might be bigger

21

Page 60: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ADS ANALYSIS - RESULTS- 3,230 applications with Network Security Policy have an ad library

- Disclaimer: most of the libraries matches with LibScout were with “Package Name” similarity: the number of apps with ad libraries might be bigger

21

- Of these apps, 89% allow cleartext traffic

Page 61: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

ADS ANALYSIS - RESULTS- 3,230 applications with Network Security Policy have an ad library

- Disclaimer: most of the libraries matches with LibScout were with “Package Name” similarity: the number of apps with ad libraries might be bigger

21

- Of these apps, 89% allow cleartext traffic

- The remaining 11% do not allow cleartext connections:- They will not receive HTTP based advertisements (they might not work correctly)r

Page 62: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY LIMITATIONS

22

Page 63: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY LIMITATIONS

- In some scenarios like ads, the developer doesn't know which domains will be contacted

- No domain name- No protocol

23

Page 64: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- A very open and potentially weak policy is the only available option- Forbidding HTTP by default may not be possible

NETWORK SECURITY POLICY LIMITATIONS

23

- In some scenarios like ads, the developer doesn't know which domains will be contacted

- No domain name- No protocol

Page 65: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

NETWORK SECURITY POLICY EXTENSION

24

Page 66: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXTENSION

25

- The granularity of “domain name” is not the best abstraction layer for several use cases

Page 67: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

EXTENSION

25

- We propose an extension to the Network Security Policy, which allows a developer to bind a specific policy to a specific package name(s)

-

- The granularity of “domain name” is not the best abstraction layer for several use cases

Page 68: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- Fully backward compatible: act as a drop-in replacement of the old version

EXTENSION

25

- We propose an extension to the Network Security Policy, which allows a developer to bind a specific policy to a specific package name(s)

-

- The granularity of “domain name” is not the best abstraction layer for several use cases

Page 69: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <!-- the developer can define and use all the

nodes of the original policy -->

<package-config> <!-- introduced by our extension -->

<package name="com.adlib.unsafe" cleartextTrafficPermitted="true" /> </package-config>

</network-security-config>

EXTENSION

26

Page 70: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <!-- the developer can define and use all the

nodes of the original policy -->

<package-config> <!-- introduced by our extension -->

<package name="com.adlib.unsafe" cleartextTrafficPermitted="true" /> </package-config>

</network-security-config>

EXTENSION

26

Page 71: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

<network-security-config> <base-config cleartextTrafficPermitted="false" /> <!-- the developer can define and use all the

nodes of the original policy -->

<package-config> <!-- introduced by our extension -->

<package name="com.adlib.unsafe" cleartextTrafficPermitted="true" /> </package-config>

</network-security-config>

EXTENSION

Cleartext connections are allowed only if started from “com.adlib.unsafe”(Stack Introspection)

26

Page 72: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- We perform the first comprehensive study on the newly introduced Android Network Security Policy, identifying strengths and common pitfalls

TAKEAWAYS

27

Page 73: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- We perform the first comprehensive study on the newly introduced Android Network Security Policy, identifying strengths and common pitfalls

- We investigate the root causes leading to weak policies, and we found that third-party libraries might encourage unsafe practices

TAKEAWAYS

27

Page 74: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

- We perform the first comprehensive study on the newly introduced Android Network Security Policy, identifying strengths and common pitfalls.

- We investigate the root causes leading to weak policies, and we found that third-party libraries might encourage unsafe practices.

- We designed and implemented a drop-in extension on the actual Network Security Policy, that limits the impact of third-party libraries over the security of the policy

TAKEAWAYS

27

Page 75: We Are Not There Yet · Towards HTTPS Everywhere on Android: We Are Not There Yet Andrea Possemato, Yanick Fratantonio USENIX Security ‘20 1

QUESTIONS?Twitter: @_pox_

Email: [email protected] & Dataset: https://github.com/eurecom-s3/android_nsp

28