Mobile App Security: Vulnerabilities in User and Session Authentication

 
A
p
p
C
r
a
c
k
e
r
:
W
i
d
e
s
p
r
e
a
d
 
V
u
l
n
e
r
a
b
i
l
i
t
i
e
s
 
i
n
 
U
s
e
r
 
a
n
d
S
e
s
s
i
o
n
 
A
u
t
h
e
n
t
i
c
a
t
i
o
n
 
i
n
 
M
o
b
i
l
e
 
A
p
p
s
 
Fangda Cai & Hao Chen, Shanghaitech University
Yuanyi Wu, Zhejiang Sci-Tech University
Yuan Zhang, Fudan University
 
Mobile Apps rely on networks
 
Threat: Eavesdropper
 
Threat: Man-In-The-Middle(MITM)
 
End-to-End Security : Protect apps from untrusted networks
 
Do app developers follow principle of end-to-end security?
 
Threat Model
 
Apps are benign, but potentially vulnerable
 
Users are benign, and may connect to untrusted/unencrypted
WiFi networks
 
Adversaries can only capture/modify traffic
 
Focus on apps in Chinese Android Market as the first step
 
Large Android user population
 
Users mainly download apps from Chinese App Market
 
Criteria of app selection
 
Baidu App Market
 
Top apps by number of downloads in each of the major categories
 
Apps from companies with huge market capitalization
 
76554MM$
 
231400MM$
 
277336MM$
 
249192MM$
 
40438MM$
 
( Data are gathered from NYSE, NASDAQ, HKEx in
   September of 2014 )
 
Session authentication: hijack the victim’s session
 
Focus on vulnerabilities in user and session authentication
 
User authentication: capture the victim user’s login credentials
 
Validate vulnerabilities: AppCracker
 
Describe vulnerabilities by mini-language designed in YAML format
 
Methodology
 
Find vulnerabilities: combine code analysis and app traffic analysis
 
Run in two modes: Passive mode, Active mode
App
Web
 
Server
AppCracker
App Server
 
WiFi Access Point
 
 
 
 
 
 
 
 
 
Diverse vulnerabilities
 
Passive Attacks
 
Active Attacks
 
Plaintext or Encoded Data
 
Encryption
 
Sessions
 
Message Integrity
 
Forged Certificate
 
Public key substitution
 
Passive Attack - Plaintext / Encoded Data
 
DianPing
 
POST http://180.153.132.65/ajax/json/account/loginapp
Host: m.dianping.com
...
username: shhtech@sina.com
password: shanghai
...
 
Vancl
 
POST http://119.254.112.81/user/login
Host: android-api.vancl.com
...
username: c2hodGVjaEBzaW5hLmNvbQ==
 (base64 of shhtech@sina.com)
...
password: c2hhbmdoYWk= 
(base64 of shanghai)
 
review businesses,
purchase discount gift certificates
 
online retailer
 
Passive Attack - Symmetric Key Encryption
 
Insecure key selection
 
Insecure key distribution
 
Insecure modes of operation
 
Iqiyi Video
 
org.qiyi.android.corejar.k.a.at
 
private static byte[] a = { 105, 113, 105, 121, 105, 49, 50, 51, 41, 40, 42, 0, 0, 0, 0, 0 };
paramString = paramString.getBytes();
SecretKeySpec localSecretKeySpec = new SecretKeySpec(a, "AES");
Cipher localCipher = Cipher.getInstance("
AES/ECB/PKCS7Padding
", "BC");
localCipher.init(1, localSecretKeySpec);
paramString = new String(org.qiyi.android.corejar.l.com1.b(localCipher.doFinal(paramString), 0), "utf-8");
 
Insecure key distribution
 
Iqiyi123)(*\x00\x00\x00\x00\x00
Insecure key selection
 
Insecure modes of operation
 
Passive Attack - Symmetric Key Encryption
 
video service
 
 
Passive Attack - Public Key Encryption
 
Tmall, online retailer
 
JuHuaSuan, group buying
 
Taobao,
 
online retail platform
App
App Server
 
Request a Public Key
Username
Password
 
Public Key
 
RSA encrypted
 
Home-grown login mechanisms of apps from Alibaba
 
1688, wholesale/procurement
 
login process
 
Passive Attack - Public Key Encryption
 
TMall
 
JuHuaSuan
 
1688
 
POST http://140.205.160.4/gw/com.taobao.client.sys.getapptoken/*/
pubKey: 98266…762829\n
3
,
 
GET http://140.205.160.4/gw/com.taobao.client.sys.getapptoken/*/?...
pubKey:  112888…883973\n
3
,
 
GET http://140.205.160.4/rest/api3.do?...
pubKey: 984813…981523\n
3
,
 
Modulus
 
Insecure key selection
 
Passive Attack - Sessions
 
Session ID in request body
 
YiHaoDian
online retailer
 
userToken: 9c68bf54-4ee3-46a3-8d3fa2f85e8a0372
Content-Length: 622
Host: interface.m.yhd.com
 
Passive Attack - Sessions
 
Session ID in cookie
 
HZ Bank
 
Cookie:
JSESSIONID=06F1JC…22YgYR!1329849507
 
PingAn Bank
 
Cookie:
BANKIDP=PAICPORTAL;
responseDataType=JSON;
JSESSIONID=J0jBKj…59GQDjT!-391559857;
BIGipServerIBANKIBP_little_core_test_Pool=491003052.32886.0000
 
 
Passive Attack – Message Integrity
 
Message authentication code
App
App Server
 
sign 
: fed1e14f08db04c3c2dacb767364fa27
v, t, imei, data, api, imsi, appkey
 
sign : 39f1feee53509ba42ac88e3c42989488
 
android.taobao.tutil.TaoApiSign.java
 
md5('&'.join(
appSecret
, md5(appKey), api, v, imei,
imsi, md5(data), t
))
 
Secret key, isn’t in the payload
 
Public Key
Username
Password
 
login process
 
 
. . .
appSecret
...
 
res/values/strings.xml
 
<stringname="appsecret">
756h;d8g:429d;57cf&lt;j8g5f
:f3:d&lt;d4
</string>
 
 
com.taobao.tao.util.Constants.java
 
public static String getAppsecret() {
        if (Constants.appsecret == null || "".equals(Constants.appsecret)) {
            String string = new String();
            
for (int i = 0; i < Constants.appsecretSigned.length(); ++i) {
                string += (char)(Constants.appsecretSigned.charAt(i) - i % 5);
            }
            
Constants.appsecret = string;
        }
        TaoLog.Logd("appkey", Constants.appsecret);
        return Constants.appsecret;
    }
 
 
Passive Attack – Message Integrity
 
Message authentication code
 
 
Passive Attack – Message Integrity
 
Attackers can compute correct MAC
App
App Server
 
sign 
: fed1e14f08db04c3c2dacb767364fa27
v, t, imei, data, api, imsi, appkey
 
sign : 39f1feee53509ba42ac88e3c42989488
 
android.taobao.tutil.TaoApiSign.java
 
md5('&'.join(
appSecret
, md5(appKey), api, v, imei,
imsi, md5(data), t
))
 
 
Public Key
Username
Password
 
login process
 
Passive Attack – Message Integrity
 
Obfuscated message authentication code
App
App Server
 
login process
 
JingDong
Online retailer
 
Body: username, md5(password)
 
URL Parameter: 
sign
, sv, st, functionId, uuid, …
 
libjdmobilesecurity.so
 
com.jingdong.app.Sign
public static native Map getSignMap(
 
Map paramMap, List, paramList);
 
username
md5(password)
functionId
uuid
 
sign
sv
st
 
Passive Attack – Message Integrity
 
Replay attack
 
Use the native method as an oracle
DB of victims’ login credentials
 
AppCracker
libjdmobilesecurity.so
 
jdtricker
 
Emulator
 
sign
, sv, st
 
functionId, body, uuid
App
App Server
 
username
md5(password)
sign
 
username
md5(password)
sign
 (valid)
Victim’s
Attacker’s
 
Active Attack - Forged Certificate
 
Most apps we examined using SSL accept self-signed certificate
 
This indicates they failed to verify
 
certificate authority is trusted
 
common name in certificate matches expected domain name
App
App Server
 
sign 
: fed1e14f08db04c3c2dacb767364fa27
v, t, imei, data, api, imsi, appkey
 
sign : 39f1feee53509ba42ac88e3c42989488
 
Active Attack - Public key substitution
 
Public Key e.g. “95012…82397\n
65537
Username
Password
 
Taobao
 
 
login process
 
App
AppCracker
App Server
 
request a public key
 
forward the request
 
real-public-key
 
forged-public-key
store real public key to database
provide a forged one to Taobao
 
Active Attack - Public key substitution
 
Taobao
 
AppCracker has confirmed 100 top apps are vulnerable
 
Top apps from all categories
 
Login credentials can be stolen,
      sessions can be hijacked
 
Vulnerabilities are diverse
 
44 
of them are from companies whose market
capitalization is over 
1 billion 
US dollars
 
 
Lessons  learned
 
End-to-end security matters
 
Use standard cryptographic protocols
 
No place to hide in the app
 
Security through obscurity doesn’t work
 
Build security into apps from the beginning
 
Limitations and Future work
 
Consider an app vulnerable only after successfully attacked it
 
Rely on manual analysis to discover vulnerabilities of apps
 
Automation
Slide Note
Embed
Share

Mobile apps face widespread vulnerabilities in user and session authentication, posing threats like eavesdropping and man-in-the-middle attacks. End-to-end security is crucial to protect apps from untrusted networks. App developers must prioritize security measures to prevent unauthorized access to user data.

  • Mobile App Security
  • Authentication Vulnerabilities
  • End-to-End Security
  • Threat Modeling
  • Chinese Android Market

Uploaded on Sep 12, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. AppCracker AppCracker: : Widespread Vulnerabilities in User and Widespread Vulnerabilities in User and Session Authentication in Mobile Apps Session Authentication in Mobile Apps Fangda Cai & Hao Chen, Shanghaitech University Yuanyi Wu, Zhejiang Sci-Tech University Yuan Zhang, Fudan University

  2. Mobile Apps rely on networks

  3. Threat: Eavesdropper

  4. Threat: Man-In-The-Middle(MITM)

  5. End-to-End Security : Protect apps from untrusted networks

  6. Do app developers follow principle of end-to-end security?

  7. Threat Model Apps are benign, but potentially vulnerable Users are benign, and may connect to untrusted/unencrypted WiFi networks Adversaries can only capture/modify traffic

  8. Focus on apps in Chinese Android Market as the first step Large Android user population Users mainly download apps from Chinese App Market

  9. Criteria of app selection Baidu App Market Top apps by number of downloads in each of the major categories Apps from companies with huge market capitalization 76554MM$ 231400MM$ 277336MM$ 249192MM$ 40438MM$ ( Data are gathered from NYSE, NASDAQ, HKEx in September of 2014 )

  10. Focus on vulnerabilities in user and session authentication User authentication: capture the victim user s login credentials Session authentication: hijack the victim s session

  11. Methodology Find vulnerabilities: combine code analysis and app traffic analysis Validate vulnerabilities: AppCracker Describe vulnerabilities by mini-language designed in YAML format Run in two modes: Passive mode, Active mode App Server App Web Server AppCracker WiFiAccess Point

  12. Diverse vulnerabilities Passive Attacks Plaintext or Encoded Data Encryption Sessions Message Integrity Active Attacks Forged Certificate Public key substitution

  13. Passive Attack - Plaintext / Encoded Data POST http://180.153.132.65/ajax/json/account/loginapp Host: m.dianping.com ... username: shhtech@sina.com password: shanghai ... DianPing review businesses, purchase discount gift certificates POST http://119.254.112.81/user/login Host: android-api.vancl.com ... username: c2hodGVjaEBzaW5hLmNvbQ== (base64 of shhtech@sina.com) ... password: c2hhbmdoYWk= (base64 of shanghai) Vancl online retailer

  14. Passive Attack - Symmetric Key Encryption Insecure key selection Insecure key distribution Insecure modes of operation

  15. Passive Attack - Symmetric Key Encryption Iqiyi Video video service Insecure key distribution org.qiyi.android.corejar.k.a.at Iqiyi123)(*\x00\x00\x00\x00\x00 Insecure key selection private static byte[] a = { 105, 113, 105, 121, 105, 49, 50, 51, 41, 40, 42, 0, 0, 0, 0, 0 }; paramString = paramString.getBytes(); SecretKeySpec localSecretKeySpec = new SecretKeySpec(a, "AES"); Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); localCipher.init(1, localSecretKeySpec); paramString = new String(org.qiyi.android.corejar.l.com1.b(localCipher.doFinal(paramString), 0), "utf-8"); Insecure modes of operation

  16. Passive Attack - Public Key Encryption Home-grown login mechanisms of apps from Alibaba login process App App Server Request a Public Key Taobao, online retail platform Public Key Tmall, online retailer JuHuaSuan, group buying Username Password RSA encrypted 1688, wholesale/procurement

  17. Passive Attack - Public Key Encryption Insecure key selection POST http://140.205.160.4/gw/com.taobao.client.sys.getapptoken/*/ pubKey: 98266 762829\n3, Modulus TMall GET http://140.205.160.4/gw/com.taobao.client.sys.getapptoken/*/?... pubKey: 112888 883973\n3, JuHuaSuan GET http://140.205.160.4/rest/api3.do?... pubKey: 984813 981523\n3, 1688

  18. Passive Attack - Sessions Session ID in request body userToken: 9c68bf54-4ee3-46a3-8d3fa2f85e8a0372 Content-Length: 622 Host: interface.m.yhd.com YiHaoDian online retailer

  19. Passive Attack - Sessions Session ID in cookie Cookie: JSESSIONID=06F1JC 22YgYR!1329849507 HZ Bank Cookie: BANKIDP=PAICPORTAL; responseDataType=JSON; JSESSIONID=J0jBKj 59GQDjT!-391559857; BIGipServerIBANKIBP_little_core_test_Pool=491003052.32886.0000 PingAn Bank

  20. Passive Attack Message Integrity Message authentication code App App Server login process sign : fed1e14f08db04c3c2dacb767364fa27 v, t, imei, data, api, imsi, appkey android.taobao.tutil.TaoApiSign.java md5('&'.join( appSecret, md5(appKey), api, v, imei, imsi, md5(data), t )) Public Key sign : 39f1feee53509ba42ac88e3c42989488 Username Password Secret key, isn t in the payload

  21. Passive Attack Message Integrity Message authentication code com.taobao.tao.util.Constants.java . . . appSecret ... public static String getAppsecret() { if (Constants.appsecret == null || "".equals(Constants.appsecret)) { String string = new String(); for (int i = 0; i < Constants.appsecretSigned.length(); ++i) { string += (char)(Constants.appsecretSigned.charAt(i) - i % 5); } Constants.appsecret = string; } TaoLog.Logd("appkey", Constants.appsecret); return Constants.appsecret; } res/values/strings.xml <stringname="appsecret"> 756h;d8g:429d;57cf&lt;j8g5f :f3:d&lt;d4 </string>

  22. Passive Attack Message Integrity Attackers can compute correct MAC App App Server login process sign : fed1e14f08db04c3c2dacb767364fa27 v, t, imei, data, api, imsi, appkey android.taobao.tutil.TaoApiSign.java md5('&'.join( appSecret, md5(appKey), api, v, imei, imsi, md5(data), t )) Public Key sign : 39f1feee53509ba42ac88e3c42989488 Username Password

  23. Passive Attack Message Integrity Obfuscated message authentication code App App Server login process JingDong Online retailer Body: username, md5(password) URL Parameter: sign, sv, st, functionId, uuid, username md5(password) functionId uuid sign sv st com.jingdong.app.Sign public static native Map getSignMap( Map paramMap, List, paramList); libjdmobilesecurity.so

  24. Passive Attack Message Integrity Replay attack Use the native method as an oracle Victim s Attacker s username md5(password) sign username md5(password) sign (valid) AppCracker App App Server DB of victims login credentials Emulator sign, sv, st functionId, body, uuid jdtricker libjdmobilesecurity.so

  25. Active Attack - Forged Certificate Most apps we examined using SSL accept self-signed certificate This indicates they failed to verify certificate authority is trusted common name in certificate matches expected domain name

  26. Active Attack - Public key substitution Taobao App App Server login process sign : fed1e14f08db04c3c2dacb767364fa27 v, t, imei, data, api, imsi, appkey Public Key e.g. 95012 82397\n65537 sign : 39f1feee53509ba42ac88e3c42989488 Username Password

  27. Active Attack - Public key substitution Taobao App AppCracker App Server request a public key forward the request real-public-key forged-public-key Taobao encrypt password with forged public key AppCracker decrypt {????????}?????? ?????? re-encrypt it with real public key store real public key to database provide a forged one to Taobao {password}forged pubkey {password}real pubkey

  28. AppCracker has confirmed 100 top apps are vulnerable Top apps from all categories 44 of them are from companies whose market capitalization is over 1 billion US dollars Login credentials can be stolen, sessions can be hijacked Vulnerabilities are diverse

  29. Lessons learned End-to-end security matters Use standard cryptographic protocols No place to hide in the app Security through obscurity doesn t work Build security into apps from the beginning

  30. Limitations and Future work Consider an app vulnerable only after successfully attacked it Rely on manual analysis to discover vulnerabilities of apps Automation

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#