SlideShare a Scribd company logo
1 of 35
MOBILE APPLICATION SECURITY
TECHNOLOGIES
Mohamad Farhani
Mohamad.farhany@gmail.com
Core code
(HTML/Jav
aScript)
Web-based (Hybrid) Mobile Apps
 Business core code is developed in the
Web technologies, i.e., HTML/JavaScript
 Run in a web container in a native mobile app
1
Core code
(HTML/Jav
aScript)
Core code
(HTML/Jav
aScript)
Core code
(HTML/Jav
aScript)
Hybrid Apps –
Interaction with Mobile Device
2
Credit: www.xrgsystems.com
Hybrid App
Architecture
 Bridge code is
provided to allow
the access from
the web code
to the device
3
JavaScript Bridge in Web-based Apps
4
addJavascriptInterface(
new MyObject(),
"myinterface"); //core code in JavaScript
myinterface.sendSMS(..);
MyObject()
myinterface
Hybrid Mobile Frameworks
 The JavaScript Bridge is typically provided
automatically by hybrid mobile development
frameworks
 E.g., Cordova (PhoneGap), Ionic, Onsen, React Native, and
more than 70 others
 JavaScript Bridge APIs are provided through plugins
 Native implementations and JavaScript interfaces
5
Permission Model in Mobile
Apps
 Users can grant permissions for a mobile app
 to access the device resources such as geolocation, SMS, …
 Once a permission is granted (either static or dynamic),
there is no way to control how the app uses the
permissions
6
Permission in Web-based
Mobile Apps
 Any JavaScript code can access the exposed JavaScript
bridge APIs
7
MyObject()
myinterface
Local JavaScript
Third-party JavaScript
Security in Web-based Mobile
Apps
 Domain Whitelisting, e.g., in Cordova
 Allow code from some whitelisted domains can access
 Content Security Policy
 Limit the access of JavaScript code based on domain
8
These mechanisms are coarse-grained: Once an
access is granted, no more control on that
A Running Attack Scenario
 Third-party JavaScript code might
misuse the devices resources or
leak sensitive information via
phone-based channels, e.g., SMS
 These cannot be enforced by
whitelisted
or CSP
9
geolocation, sms
//Third-party JavaScript
var g = geolocation.getLocation();
sms.send(..,g); Allowed in
whitelisted
domains and CSP
The state-of-the-art
 Existing JavaScript security solutions
 Do not cover phone-related channels, e.g., sms
 Some hybrid app security solutions focus on a specific
platform, e.g., WebView in Android [Georgiev et al.,
WWW’15], [Tuncay et al., CCS’16]
 Some approaches modify the hybrid framework, e.g.,
PhoneGap [Georgiev et al., NDSS’15], [Jin et al., ISC’15]
 Few work can enforce principal-based policies for
mobile apps but do not protect the web environment,
e.g., [Georgiev et al., WWW’15]
10
Our Motivation
 Provide a framework to allow hybrid app developers to
define and enforce principal-based access control and
fine-grained policies
 Do not depend on a specific mobile platform
 Work with any hybrid frameworks
11
Outline
 Motivation
 Our Approach - HybridGuard
 Implementation
 Evaluation
 Concluding Remarks
12
Threat Model
 Hybrid Apps are legitimate and trusted by the users
 Permissions are granted
 Content Security Policy (CSP) is deployed to e.g., present
Cross-site Scripting Attacks
 In-scope threats - third-party JavaScript code, e.g.,
advertisements, allowed by the developers in CSP:
1. Benign but under the control of an attacker
2. Malicious by intentions
13
Our Approach
 Load a piece of JavaScript code under a principal name,
i.e.,:
 Replace the original JavaScript inclusion
<script src="http://third-party.com/script.js">
by our interface:
loadJSwithPrincipal("principal","http://third-
party.com/script.js")
 Wrap critical JavaScript APIs (Web APIs + JavaScript Bridge
APIs)
 Enforce policies based on caller’s principals
14
JavaScript Invocation
15
Our Approach –
Wrapping JavaScript APIs
16
Our Approach - HybridGuard
17
HybridGuard
18
Wrapping JavaScript
(Web/Bridge) APIs
19
sms.send(…);
orig_sms_send=sms.send;
sms.send = function(){
}
if (policyCheck(..))
execute(orig_sms_send,..);
else{..}
1. Keep the original reference
2. Redefine the reference
3. Check policy to control
the execution
Security code is injected
before any other JavaScript
code to monitor them
Principal Management and
Tracking
 Based on “run-to-completion” execution model of
JavaScript
 We maintain a shadow stack to track the execution of each
principal
 We catch dynamic generated code and event handlers
 Load these code under the same principal that generates them
20
Load and Run JavaScript Code
under A Principal
var
var makeFunction
runAs
shadowStack.push(“google”);
run(f);
shadowStack.pop();
flush_dynamic_content(“google”);
Principal Tracking Example
22
Principal-based Permission
 Wrap the JavaScript Bridge APIs
 Grant access to these APIs based on principal
 E.g.:
 "trusted" principal can have full access to all resources
 "local" principal can have access to resources A, B
 "remote" principal can have access to resources C
23
Principal-based Permission
Example
 Each resource
 Principal access
control
 Read
 Write
 Create
24
Stateful and Fine-grained
Security Policies
 Based on
 Behavior of the code
 Principal of the code
 E.g.:
 Disallow the sms.send if the untrusted principal has
accessed the geolocation API
25
More Fine-grained Policy Patterns
 Resource bounds Policy
 Limit the number of accesses to a resource
 E.g.,: limit the number of sms send
 Whitelist Policies
 A resource access is allowed only under some conditions
 E.g.,: allow sms send to some predefined receipts
 History-based Policies
 Policies depending on the previous execution status
 E.g.,: no SMS sending after contact list is read
 Any custom policies, e.g., preventing UI attacks
26
Complete Mediation
 Web APIs: We apply the secure wrapper
implementations for JavaScript in the literature
 Ensure that our monitor implementation is tamper-proof
from potentially malicious code
 JavaScript bridge APIs
 Direct access to native APIs is disallowed
 We rely on app developers to identify bridge APIs and wrap
them with our interface
27
HybridGuard Security
28
HybridGuard Security
 Unlabeled code always runs at the lowest privilege level
 A principal-tracking failure could lead to conservative
rejection, but never a policy violation
29
Evaluation
 We have performed a small-scale evaluation on around
10 Android hybrid apps from Google Play
 Decompile the code and inject our framework manually
 We developed several hybrid apps invoking various
plugins
 Our framework is integrated and tested on Android and iOS
30
Policy Examples on Resources
31
Tested Hybrid Apps and Policies
32
Concluding Remarks
 We present HybridGuard
 A robust framework to specify and enforce principal- based
and fine-grained security policies
 HybridGuard is developed in JavaScript
 can be deployed on various mobile platforms and hybrid
development frameworks without modifying them
 We provide a wide range security policies that the app
developer can use to mitigate potential attacks
33
Thank you!
Mohamad Farhani
Mohamad.farhany@gmail.com
MOBILE APPLICATION
SECURITY TECHNOLOGIES

More Related Content

Similar to Mobile appsecurity

A Two-Tier Sandbox Architecture for Untrusted JavaScript
A Two-Tier Sandbox Architecture for Untrusted JavaScriptA Two-Tier Sandbox Architecture for Untrusted JavaScript
A Two-Tier Sandbox Architecture for Untrusted JavaScriptPhú Phùng
 
Fine-grained policy enforcement for untrusted software
Fine-grained policy enforcement for untrusted softwareFine-grained policy enforcement for untrusted software
Fine-grained policy enforcement for untrusted softwarePhú Phùng
 
breaking-and-fixing-origin-based-access-control
breaking-and-fixing-origin-based-access-controlbreaking-and-fixing-origin-based-access-control
breaking-and-fixing-origin-based-access-controlMartin Georgiev
 
Web security: Securing Untrusted Web Content in Browsers
Web security: Securing Untrusted Web Content in BrowsersWeb security: Securing Untrusted Web Content in Browsers
Web security: Securing Untrusted Web Content in BrowsersPhú Phùng
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesBrad Hill
 
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...IBM Security
 
Null singapore - Mobile Security Essentials
Null singapore - Mobile Security EssentialsNull singapore - Mobile Security Essentials
Null singapore - Mobile Security EssentialsSven Schleier
 
WinJS at NYC Code Camp 2012
WinJS at NYC Code Camp 2012WinJS at NYC Code Camp 2012
WinJS at NYC Code Camp 2012Dmitri Artamonov
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Deborah Schalm
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...DevOps.com
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...DevOps for Enterprise Systems
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersPhú Phùng
 
Droidcon mobile security
Droidcon   mobile securityDroidcon   mobile security
Droidcon mobile securityJudy Ngure
 
Web Application Security for Continuous Delivery Pipelines
Web Application Security for Continuous Delivery PipelinesWeb Application Security for Continuous Delivery Pipelines
Web Application Security for Continuous Delivery PipelinesAvi Networks
 
Real world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMReal world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMGill Cleeren
 
Phonegap android angualr material design
Phonegap android angualr material designPhonegap android angualr material design
Phonegap android angualr material designSrinadh Kanugala
 
Application Security Guide for Beginners
Application Security Guide for Beginners Application Security Guide for Beginners
Application Security Guide for Beginners Checkmarx
 

Similar to Mobile appsecurity (20)

A Two-Tier Sandbox Architecture for Untrusted JavaScript
A Two-Tier Sandbox Architecture for Untrusted JavaScriptA Two-Tier Sandbox Architecture for Untrusted JavaScript
A Two-Tier Sandbox Architecture for Untrusted JavaScript
 
Fine-grained policy enforcement for untrusted software
Fine-grained policy enforcement for untrusted softwareFine-grained policy enforcement for untrusted software
Fine-grained policy enforcement for untrusted software
 
breaking-and-fixing-origin-based-access-control
breaking-and-fixing-origin-based-access-controlbreaking-and-fixing-origin-based-access-control
breaking-and-fixing-origin-based-access-control
 
Web security: Securing Untrusted Web Content in Browsers
Web security: Securing Untrusted Web Content in BrowsersWeb security: Securing Untrusted Web Content in Browsers
Web security: Securing Untrusted Web Content in Browsers
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...
Pinpointing Vulnerabilities in Android Applications like Finding a Needle in ...
 
Null singapore - Mobile Security Essentials
Null singapore - Mobile Security EssentialsNull singapore - Mobile Security Essentials
Null singapore - Mobile Security Essentials
 
WinJS at NYC Code Camp 2012
WinJS at NYC Code Camp 2012WinJS at NYC Code Camp 2012
WinJS at NYC Code Camp 2012
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
 
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
Leverage DevOps & Agile Development to Transform Your Application Testing Pro...
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsers
 
Droidcon mobile security
Droidcon   mobile securityDroidcon   mobile security
Droidcon mobile security
 
Web Application Security for Continuous Delivery Pipelines
Web Application Security for Continuous Delivery PipelinesWeb Application Security for Continuous Delivery Pipelines
Web Application Security for Continuous Delivery Pipelines
 
Owasp masvs spain 17
Owasp masvs spain 17Owasp masvs spain 17
Owasp masvs spain 17
 
Mobile Apps Develpment - A Comparison
Mobile Apps Develpment - A ComparisonMobile Apps Develpment - A Comparison
Mobile Apps Develpment - A Comparison
 
Real world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMReal world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVM
 
Phonegap android angualr material design
Phonegap android angualr material designPhonegap android angualr material design
Phonegap android angualr material design
 
Appsec XSS Case Study
Appsec XSS Case StudyAppsec XSS Case Study
Appsec XSS Case Study
 
Application Security Guide for Beginners
Application Security Guide for Beginners Application Security Guide for Beginners
Application Security Guide for Beginners
 

Recently uploaded

9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7Pooja Nehwal
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Pooja Nehwal
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Niamh verma
 
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝soniya singh
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceanilsa9823
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...wyqazy
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceanilsa9823
 

Recently uploaded (8)

9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
 
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
 

Mobile appsecurity

  • 1. MOBILE APPLICATION SECURITY TECHNOLOGIES Mohamad Farhani Mohamad.farhany@gmail.com
  • 2. Core code (HTML/Jav aScript) Web-based (Hybrid) Mobile Apps  Business core code is developed in the Web technologies, i.e., HTML/JavaScript  Run in a web container in a native mobile app 1 Core code (HTML/Jav aScript) Core code (HTML/Jav aScript) Core code (HTML/Jav aScript)
  • 3. Hybrid Apps – Interaction with Mobile Device 2 Credit: www.xrgsystems.com
  • 4. Hybrid App Architecture  Bridge code is provided to allow the access from the web code to the device 3
  • 5. JavaScript Bridge in Web-based Apps 4 addJavascriptInterface( new MyObject(), "myinterface"); //core code in JavaScript myinterface.sendSMS(..); MyObject() myinterface
  • 6. Hybrid Mobile Frameworks  The JavaScript Bridge is typically provided automatically by hybrid mobile development frameworks  E.g., Cordova (PhoneGap), Ionic, Onsen, React Native, and more than 70 others  JavaScript Bridge APIs are provided through plugins  Native implementations and JavaScript interfaces 5
  • 7. Permission Model in Mobile Apps  Users can grant permissions for a mobile app  to access the device resources such as geolocation, SMS, …  Once a permission is granted (either static or dynamic), there is no way to control how the app uses the permissions 6
  • 8. Permission in Web-based Mobile Apps  Any JavaScript code can access the exposed JavaScript bridge APIs 7 MyObject() myinterface Local JavaScript Third-party JavaScript
  • 9. Security in Web-based Mobile Apps  Domain Whitelisting, e.g., in Cordova  Allow code from some whitelisted domains can access  Content Security Policy  Limit the access of JavaScript code based on domain 8 These mechanisms are coarse-grained: Once an access is granted, no more control on that
  • 10. A Running Attack Scenario  Third-party JavaScript code might misuse the devices resources or leak sensitive information via phone-based channels, e.g., SMS  These cannot be enforced by whitelisted or CSP 9 geolocation, sms //Third-party JavaScript var g = geolocation.getLocation(); sms.send(..,g); Allowed in whitelisted domains and CSP
  • 11. The state-of-the-art  Existing JavaScript security solutions  Do not cover phone-related channels, e.g., sms  Some hybrid app security solutions focus on a specific platform, e.g., WebView in Android [Georgiev et al., WWW’15], [Tuncay et al., CCS’16]  Some approaches modify the hybrid framework, e.g., PhoneGap [Georgiev et al., NDSS’15], [Jin et al., ISC’15]  Few work can enforce principal-based policies for mobile apps but do not protect the web environment, e.g., [Georgiev et al., WWW’15] 10
  • 12. Our Motivation  Provide a framework to allow hybrid app developers to define and enforce principal-based access control and fine-grained policies  Do not depend on a specific mobile platform  Work with any hybrid frameworks 11
  • 13. Outline  Motivation  Our Approach - HybridGuard  Implementation  Evaluation  Concluding Remarks 12
  • 14. Threat Model  Hybrid Apps are legitimate and trusted by the users  Permissions are granted  Content Security Policy (CSP) is deployed to e.g., present Cross-site Scripting Attacks  In-scope threats - third-party JavaScript code, e.g., advertisements, allowed by the developers in CSP: 1. Benign but under the control of an attacker 2. Malicious by intentions 13
  • 15. Our Approach  Load a piece of JavaScript code under a principal name, i.e.,:  Replace the original JavaScript inclusion <script src="http://third-party.com/script.js"> by our interface: loadJSwithPrincipal("principal","http://third- party.com/script.js")  Wrap critical JavaScript APIs (Web APIs + JavaScript Bridge APIs)  Enforce policies based on caller’s principals 14
  • 17. Our Approach – Wrapping JavaScript APIs 16
  • 18. Our Approach - HybridGuard 17
  • 20. Wrapping JavaScript (Web/Bridge) APIs 19 sms.send(…); orig_sms_send=sms.send; sms.send = function(){ } if (policyCheck(..)) execute(orig_sms_send,..); else{..} 1. Keep the original reference 2. Redefine the reference 3. Check policy to control the execution Security code is injected before any other JavaScript code to monitor them
  • 21. Principal Management and Tracking  Based on “run-to-completion” execution model of JavaScript  We maintain a shadow stack to track the execution of each principal  We catch dynamic generated code and event handlers  Load these code under the same principal that generates them 20
  • 22. Load and Run JavaScript Code under A Principal var var makeFunction runAs shadowStack.push(“google”); run(f); shadowStack.pop(); flush_dynamic_content(“google”);
  • 24. Principal-based Permission  Wrap the JavaScript Bridge APIs  Grant access to these APIs based on principal  E.g.:  "trusted" principal can have full access to all resources  "local" principal can have access to resources A, B  "remote" principal can have access to resources C 23
  • 25. Principal-based Permission Example  Each resource  Principal access control  Read  Write  Create 24
  • 26. Stateful and Fine-grained Security Policies  Based on  Behavior of the code  Principal of the code  E.g.:  Disallow the sms.send if the untrusted principal has accessed the geolocation API 25
  • 27. More Fine-grained Policy Patterns  Resource bounds Policy  Limit the number of accesses to a resource  E.g.,: limit the number of sms send  Whitelist Policies  A resource access is allowed only under some conditions  E.g.,: allow sms send to some predefined receipts  History-based Policies  Policies depending on the previous execution status  E.g.,: no SMS sending after contact list is read  Any custom policies, e.g., preventing UI attacks 26
  • 28. Complete Mediation  Web APIs: We apply the secure wrapper implementations for JavaScript in the literature  Ensure that our monitor implementation is tamper-proof from potentially malicious code  JavaScript bridge APIs  Direct access to native APIs is disallowed  We rely on app developers to identify bridge APIs and wrap them with our interface 27
  • 30. HybridGuard Security  Unlabeled code always runs at the lowest privilege level  A principal-tracking failure could lead to conservative rejection, but never a policy violation 29
  • 31. Evaluation  We have performed a small-scale evaluation on around 10 Android hybrid apps from Google Play  Decompile the code and inject our framework manually  We developed several hybrid apps invoking various plugins  Our framework is integrated and tested on Android and iOS 30
  • 32. Policy Examples on Resources 31
  • 33. Tested Hybrid Apps and Policies 32
  • 34. Concluding Remarks  We present HybridGuard  A robust framework to specify and enforce principal- based and fine-grained security policies  HybridGuard is developed in JavaScript  can be deployed on various mobile platforms and hybrid development frameworks without modifying them  We provide a wide range security policies that the app developer can use to mitigate potential attacks 33

Editor's Notes

  1. , [Franzen et al., IMPS’11]