SlideShare a Scribd company logo
1 of 52
FROM JAVA TO ANDROID:
A SECURITY ANALYSIS
Pragati Ogal Rai
Mobile Technology Evangelist, PayPal
@pragatiogal @PayPalDev
www.ethos3.com
• Motorola JUIX Platform
• Motorola Linux Java Platform
• Android
Agenda
• Java 2 Security Model
• Android Security Model
• Summarize
JAVA 2 SECURITY MODEL
Java
• Developed by Sun Microsystems in the early 1990s
• Platform Independent – write once run anywhere!
• Compiled to byte code that runs on a Virtual Machine
• “Java is Secure”
Java 2 Security Model
• Language Security Features
• Platform Security
• Crypto APIs
• Authentication & Access Control APIs
• Secure Communication APIs
• Key Management APIs
JDK 1.0 Sandbox Model
• Very restricted model
• Local code is trusted
• Remote code is not trusted
JDK 1.1 Security Model
• Signed applet model
• Trusted code has privileges
• Untrusted code runs in sandbox
Java 2 Sandbox Model
• Fine grained access control
• Configurable Security Policy
• No built-in concept of trusted
local code
Security Policy File Example
// If the code is signed by ”Pragati", grant it read/write access to all files in /tmp/pragati
grant signedBy ”Pragati" {
permission java.io.FilePermission "/tmp/pragati/*", "read,write";
};
// If the code is signed by ”John", grant it read/write access to all files in /tmp/john
grant signedBy ”John" {
permission java.io.FilePermission "/tmp/john/*", "read,write”;
};
// Grant everyone the following permission:
grant {
permission java.io.FilePermission "/tmp/pragati/*", "read";
};
Protection Domains
Domain name “Pragati”
Pragati’s certificate
Read/write access to /temp/pragati/*
Domain name “John”
John’s certificate
Read/write access to /temp/john/*
Read access to /temp/pragati/*
…………..
Protection Domain = Code Source + Permission
Protection Domains
A domain conceptually encloses a set of classes whose instances
are granted the same set of permissions.
Java 2 Platform Security Model
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Java Language Security
• Programs cannot access arbitrary memory locations
• Variables cannot be used before initialization
• Access methods are strictly adhered to
• Entities declared final must not be changed
• Objects cannot be arbitrarily cast into other objects
• Array bounds must be checked on all array accesses
Java Compiler
Java Files (.java) Java Class Files (.class)
Compiler enforces language rules
Bytecode Verifier
Mini theorem prover
Enforces language rules
Delayed bytecode verification
Runtime binding
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Class Loader
Loads classes in namespace
Set permission for each class it loads
Link type checks for type safety
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Java APIs and Security Package
Classes in java.security package
Classes in security extensions
Basis for application signing
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Security Manager & Access Controller
Security manager exists for historical reasons
Access control to system resources
Policy enforcement
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Security manager exists for historical reasons
Access control to system resources
Policy enforcement
Default only for applets
Key Database
Create / verify digital signatures
Operating System
Remote Class Files Local Class FilesSigned Class Files
Bytecode Verifier
Class LoaderCore API Class Files
Core Java API
Security Package
Key Database
Security Manager
Access Controller
Java Sandbox
• Permissions
• Code Source
• Protection Domain
• Policy File
• Keystore
Java 2 Security Model
• All code runs in a sandbox
• All classes are loaded with full bytecode verification
• All classes are loaded with Java language features
• Signed classes verify the integrity and origination of Java
classes
• Security policy provides fine-grained access
• Crypto APIs
THE ANDROID STACK
Android
• Open Platform
• First phone based on Android came out in 2009
• 75% smartphone market share as of October1
1: idc.com
Android Security Model
• Platform Security
• Crypto APIs
• Secure Communication APIs
• Key Management APIs
Install Time User Consent
You control your phone!
Android Platform Architecture
http://developer.android.com
Linux Kernel
Unique UID and GID for each application at install time
Sharing can occur through component interactions
Linux Process Sandbox
Linux Kernel (Cont’d)
include/linux/android_aid.h
AID_NET_BT 3002 Can create Bluetooth Sockets
AID_INET 3003 Can create IPv4 and IPv6 Sockets
Middleware
• Libraries for code execution
• Libraries for services
• Take care of device specific issues
• Compiled to machine language
• Native and Java code
Java Virtual Machine?
• There is no JVM in Android platform
• No byte code is executed
• JAR file will not run on Android platform
Dalvik Virtual Machine
Dalvik Virtual Machine
• Dalvik does not align to Java SE or Java ME
• Library built on a subset of the Apache Harmony Java
• Highly optimized VM to support multiple VM instances
• Register based architecture
• Shared constant pool
• Executes Dalvik executables (.dex)
.dex File
Source
Files
Java
Compiler
JAR Tool
DX
Converter
Dalvik VM
Example.jar
A.class
B.class
Strings.xml
Icon.png
Example.jar
Classes.dex
Strings.xml
Icon.png
.dex File
imsciences.edu.pk
Dalvik optimizes class files
Dalvik Virtual Machine
• No security manager
• Permissions are enforced in OS and not in VM
• As of Android 2.2 Dalvik has a JIT compiler
• Dalvik Bytecode verification mainly for optimization
• GC for each VM instance
Android Application Structure
• Application is made of components
• Activity: Define screens
• Service: Background processing
• Broadcast Receiver: Mailbox for messages from other
applications
• Content Provider: Relational database for sharing information
Android Application Structure
• Applications communicate through Intents
• Secure RPC using Binder
• AndroidManifest.xml defines policy for application
Permission Protection Levels
• Normal
android.permission.VIBRATE
com.android.alarm.permission.SET_ALARM
• Dangerous
android.permission.SEND_SMS
android.permission.CALL_PHONE
• Signature
android.permission.FORCE_STOP_PACKAGES
android.permission.INJECT_EVENTS
• SignatureOrSystem
android.permission.ACCESS_USB
android.permission.SET_TIME
All components are secured by permissions
Developers can define their own permissions as well
Application Layer Security
• Permissions restrict component interaction
• Permission labels defined in AndroidManifest.xml
• Applications are self-signed; no CA required
• Signatures define persistence and authorship
Android Security Model
• Linux process sandbox
• Permission based component interaction
• Dalvik is not a security boundary
• All applications need to be signed
• Signature define persistence and authorship
• Install time security decisions
• Crypto APIs
SUMMARY
Vision
Protect host machine from malicious code
Optimization for mobile platform
Install Time Checking
Who are you?
What do you want to do?
Sandbox
Permissions + Code Sources +
Policy + keystore + Protection Domains
Linux Process Sandbox
Signature
Identity and Trust
Authorship and Persistence
Permissions
Enforced by VM
Enforced by OS
Protection Domain
Code Sources + Permissions
Process
Virtual Machine
VM is a security boundary
VM is NOT a security boundary
Security Enforcement
Applets v/s Applications
Native v/s Java code
No exceptions!
developer@paypal.com
@PayPalDev @pragatiogal
http://www.slideshare.net/pragatiogal
Thank you!

More Related Content

What's hot

What's hot (20)

Android Security
Android SecurityAndroid Security
Android Security
 
Permission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionPermission in Android Security: Threats and solution
Permission in Android Security: Threats and solution
 
Introduction to Android Development and Security
Introduction to Android Development and SecurityIntroduction to Android Development and Security
Introduction to Android Development and Security
 
6. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 26. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 2
 
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
 
Android Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android ApplicationsAndroid Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android Applications
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security Threats
 
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
 
CNIT 128 7. Attacking Android Applications (Part 2)
CNIT 128 7. Attacking Android Applications (Part 2)CNIT 128 7. Attacking Android Applications (Part 2)
CNIT 128 7. Attacking Android Applications (Part 2)
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
CNIT 128 6. Analyzing Android Applications (Part 3)
CNIT 128 6. Analyzing Android Applications (Part 3)CNIT 128 6. Analyzing Android Applications (Part 3)
CNIT 128 6. Analyzing Android Applications (Part 3)
 
CNIT 128 6. Analyzing Android Applications (Part 3 of 3)
CNIT 128 6. Analyzing Android Applications (Part 3 of 3)CNIT 128 6. Analyzing Android Applications (Part 3 of 3)
CNIT 128 6. Analyzing Android Applications (Part 3 of 3)
 
CNIT 128 7. Attacking Android Applications (Part 1)
CNIT 128 7. Attacking Android Applications (Part 1)CNIT 128 7. Attacking Android Applications (Part 1)
CNIT 128 7. Attacking Android Applications (Part 1)
 
CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)
 
Android Security
Android SecurityAndroid Security
Android Security
 
A Closer Look on C&C Panels
A Closer Look on C&C PanelsA Closer Look on C&C Panels
A Closer Look on C&C Panels
 
Introduction to Android Application Security Testing - 2nd Sep 2017
Introduction to Android Application Security Testing - 2nd Sep 2017Introduction to Android Application Security Testing - 2nd Sep 2017
Introduction to Android Application Security Testing - 2nd Sep 2017
 
CNIT 128 7. Attacking Android Applications (Part 3)
CNIT 128 7. Attacking Android Applications (Part 3)CNIT 128 7. Attacking Android Applications (Part 3)
CNIT 128 7. Attacking Android Applications (Part 3)
 
Security in Java
Security in JavaSecurity in Java
Security in Java
 
Andriod Pentesting and Malware Analysis
Andriod Pentesting and Malware AnalysisAndriod Pentesting and Malware Analysis
Andriod Pentesting and Malware Analysis
 

Viewers also liked

Android Development
Android DevelopmentAndroid Development
Android Development
Daksh Semwal
 
Supramodernismo europeo 2 parte
Supramodernismo europeo   2 parteSupramodernismo europeo   2 parte
Supramodernismo europeo 2 parte
Nayeli Padilla
 
Netlabs IT Diksha diploma for student who appeared for or cleared class 12
Netlabs IT Diksha diploma for student who appeared for or cleared class 12Netlabs IT Diksha diploma for student who appeared for or cleared class 12
Netlabs IT Diksha diploma for student who appeared for or cleared class 12
Netlabs ITS
 
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
dayhitenorio
 

Viewers also liked (20)

Android Development
Android DevelopmentAndroid Development
Android Development
 
project center in coimbatore
project center in coimbatoreproject center in coimbatore
project center in coimbatore
 
Quantified Self, Smart Grid und Smart Home mit UOMo & JSR 363 | Eclipse Dem...
Quantified Self, Smart Grid und Smart Home mit UOMo & JSR 363 | Eclipse Dem...Quantified Self, Smart Grid und Smart Home mit UOMo & JSR 363 | Eclipse Dem...
Quantified Self, Smart Grid und Smart Home mit UOMo & JSR 363 | Eclipse Dem...
 
Datos Voluntarios Palestina
Datos Voluntarios PalestinaDatos Voluntarios Palestina
Datos Voluntarios Palestina
 
FR - Visual Planning Présentation en francais
FR - Visual Planning Présentation en francaisFR - Visual Planning Présentation en francais
FR - Visual Planning Présentation en francais
 
Olimpiadas LONDRES 2012
Olimpiadas LONDRES 2012Olimpiadas LONDRES 2012
Olimpiadas LONDRES 2012
 
Optimisez votre référencement local
Optimisez votre référencement localOptimisez votre référencement local
Optimisez votre référencement local
 
Calidad y Acreditación
Calidad y AcreditaciónCalidad y Acreditación
Calidad y Acreditación
 
Supramodernismo europeo 2 parte
Supramodernismo europeo   2 parteSupramodernismo europeo   2 parte
Supramodernismo europeo 2 parte
 
Material Complementario para Apoyo a la Psicoeducacion
Material Complementario para Apoyo a la PsicoeducacionMaterial Complementario para Apoyo a la Psicoeducacion
Material Complementario para Apoyo a la Psicoeducacion
 
Netlabs IT Diksha diploma for student who appeared for or cleared class 12
Netlabs IT Diksha diploma for student who appeared for or cleared class 12Netlabs IT Diksha diploma for student who appeared for or cleared class 12
Netlabs IT Diksha diploma for student who appeared for or cleared class 12
 
La convergencia aún no ha llegado
La convergencia aún no ha llegadoLa convergencia aún no ha llegado
La convergencia aún no ha llegado
 
Progettare spazi e costruire community. Il codesign migliora gli esseri umani.
Progettare spazi e costruire community. Il codesign migliora gli esseri umani.Progettare spazi e costruire community. Il codesign migliora gli esseri umani.
Progettare spazi e costruire community. Il codesign migliora gli esseri umani.
 
Tours Cercano y Lejano Oriente 2013 y 2014. Mapaplus
Tours Cercano y Lejano Oriente 2013 y 2014. MapaplusTours Cercano y Lejano Oriente 2013 y 2014. Mapaplus
Tours Cercano y Lejano Oriente 2013 y 2014. Mapaplus
 
Presentación formación y coaching
Presentación formación y  coachingPresentación formación y  coaching
Presentación formación y coaching
 
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
El chocolate, integrantes campos, echeverria, seitz, tenorio (1)
 
PTEN_Nogo-2
PTEN_Nogo-2PTEN_Nogo-2
PTEN_Nogo-2
 
Tassazione Network Marketing e Breve spiegazione
Tassazione Network Marketing e Breve spiegazioneTassazione Network Marketing e Breve spiegazione
Tassazione Network Marketing e Breve spiegazione
 
Keynote presentation pt.1 at eAssessment Scotland 14: Viewing Summative Asses...
Keynote presentation pt.1 at eAssessment Scotland 14: Viewing Summative Asses...Keynote presentation pt.1 at eAssessment Scotland 14: Viewing Summative Asses...
Keynote presentation pt.1 at eAssessment Scotland 14: Viewing Summative Asses...
 
Prague2009
Prague2009Prague2009
Prague2009
 

Similar to From java to android a security analysis

Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)
Sri Prasanna
 
Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security Architecture
Ramesh Nagappan
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptx
HarshiniB11
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
veszpremimeetup
 
Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01
Santosh Sh
 
Android Architecture design programming with java
Android Architecture design programming with javaAndroid Architecture design programming with java
Android Architecture design programming with java
ssuser471dfb
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012
hakersinfo
 

Similar to From java to android a security analysis (20)

Mobile platform security models
Mobile platform security modelsMobile platform security models
Mobile platform security models
 
Android pen test basics
Android pen test basicsAndroid pen test basics
Android pen test basics
 
Hacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OSHacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OS
 
Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)
 
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitationDEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
 
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
 
Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security Architecture
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptx
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
 
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java Platform
 
Javantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin ToshevJavantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin Toshev
 
Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01Androidoverview 100405150711-phpapp01
Androidoverview 100405150711-phpapp01
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
Android Architecture design programming with java
Android Architecture design programming with javaAndroid Architecture design programming with java
Android Architecture design programming with java
 
Embedded Fest 2019. Володимир Шанойло. High FIVE: Samsung integrity protectio...
Embedded Fest 2019. Володимир Шанойло. High FIVE: Samsung integrity protectio...Embedded Fest 2019. Володимир Шанойло. High FIVE: Samsung integrity protectio...
Embedded Fest 2019. Володимир Шанойло. High FIVE: Samsung integrity protectio...
 
CNIT 128 7. Attacking Android Applications (Part 3)
CNIT 128 7. Attacking Android Applications (Part 3)CNIT 128 7. Attacking Android Applications (Part 3)
CNIT 128 7. Attacking Android Applications (Part 3)
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
 
Implementing Trusted Endpoints in the Mobile World
Implementing Trusted Endpoints in the Mobile WorldImplementing Trusted Endpoints in the Mobile World
Implementing Trusted Endpoints in the Mobile World
 

More from Pragati Rai

Mobile Commerce: A Security Perspective
Mobile Commerce: A Security PerspectiveMobile Commerce: A Security Perspective
Mobile Commerce: A Security Perspective
Pragati Rai
 
Enhancing your mobile commerce apps with eBay Inc.
Enhancing your mobile commerce apps with eBay Inc.Enhancing your mobile commerce apps with eBay Inc.
Enhancing your mobile commerce apps with eBay Inc.
Pragati Rai
 

More from Pragati Rai (13)

Hard problems in mobile commerce
Hard problems in mobile commerceHard problems in mobile commerce
Hard problems in mobile commerce
 
Mobile Commerce: A Security Perspective
Mobile Commerce: A Security PerspectiveMobile Commerce: A Security Perspective
Mobile Commerce: A Security Perspective
 
Be Your Own Technology Brand Ambassador
Be Your Own Technology Brand AmbassadorBe Your Own Technology Brand Ambassador
Be Your Own Technology Brand Ambassador
 
Mobile Payments revolution
Mobile Payments revolutionMobile Payments revolution
Mobile Payments revolution
 
Android securitybyexample
Android securitybyexampleAndroid securitybyexample
Android securitybyexample
 
The basics of mobile payments
The basics of mobile paymentsThe basics of mobile payments
The basics of mobile payments
 
How are mobile devices changing face of payments?
How are mobile devices changing face of payments?How are mobile devices changing face of payments?
How are mobile devices changing face of payments?
 
Mobile payments 101
Mobile payments 101Mobile payments 101
Mobile payments 101
 
Enhancing your mobile commerce apps with eBay Inc.
Enhancing your mobile commerce apps with eBay Inc.Enhancing your mobile commerce apps with eBay Inc.
Enhancing your mobile commerce apps with eBay Inc.
 
New Security Considerations for Mobile Commerce
New Security Considerations for Mobile CommerceNew Security Considerations for Mobile Commerce
New Security Considerations for Mobile Commerce
 
Amphion Forum: Understanding Android Secuity
Amphion Forum: Understanding Android SecuityAmphion Forum: Understanding Android Secuity
Amphion Forum: Understanding Android Secuity
 
Understanding Mobile payments
Understanding Mobile paymentsUnderstanding Mobile payments
Understanding Mobile payments
 
Mobile Ecosystem
Mobile EcosystemMobile Ecosystem
Mobile Ecosystem
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

From java to android a security analysis

  • 1. FROM JAVA TO ANDROID: A SECURITY ANALYSIS Pragati Ogal Rai Mobile Technology Evangelist, PayPal @pragatiogal @PayPalDev
  • 2. www.ethos3.com • Motorola JUIX Platform • Motorola Linux Java Platform • Android
  • 3. Agenda • Java 2 Security Model • Android Security Model • Summarize
  • 5. Java • Developed by Sun Microsystems in the early 1990s • Platform Independent – write once run anywhere! • Compiled to byte code that runs on a Virtual Machine • “Java is Secure”
  • 6. Java 2 Security Model • Language Security Features • Platform Security • Crypto APIs • Authentication & Access Control APIs • Secure Communication APIs • Key Management APIs
  • 7. JDK 1.0 Sandbox Model • Very restricted model • Local code is trusted • Remote code is not trusted
  • 8. JDK 1.1 Security Model • Signed applet model • Trusted code has privileges • Untrusted code runs in sandbox
  • 9. Java 2 Sandbox Model • Fine grained access control • Configurable Security Policy • No built-in concept of trusted local code
  • 10. Security Policy File Example // If the code is signed by ”Pragati", grant it read/write access to all files in /tmp/pragati grant signedBy ”Pragati" { permission java.io.FilePermission "/tmp/pragati/*", "read,write"; }; // If the code is signed by ”John", grant it read/write access to all files in /tmp/john grant signedBy ”John" { permission java.io.FilePermission "/tmp/john/*", "read,write”; }; // Grant everyone the following permission: grant { permission java.io.FilePermission "/tmp/pragati/*", "read"; };
  • 11. Protection Domains Domain name “Pragati” Pragati’s certificate Read/write access to /temp/pragati/* Domain name “John” John’s certificate Read/write access to /temp/john/* Read access to /temp/pragati/* ………….. Protection Domain = Code Source + Permission
  • 12. Protection Domains A domain conceptually encloses a set of classes whose instances are granted the same set of permissions.
  • 13. Java 2 Platform Security Model Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller
  • 14. Java Language Security • Programs cannot access arbitrary memory locations • Variables cannot be used before initialization • Access methods are strictly adhered to • Entities declared final must not be changed • Objects cannot be arbitrarily cast into other objects • Array bounds must be checked on all array accesses
  • 15. Java Compiler Java Files (.java) Java Class Files (.class) Compiler enforces language rules
  • 16. Bytecode Verifier Mini theorem prover Enforces language rules Delayed bytecode verification Runtime binding Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller
  • 17. Class Loader Loads classes in namespace Set permission for each class it loads Link type checks for type safety Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller
  • 18. Java APIs and Security Package Classes in java.security package Classes in security extensions Basis for application signing Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller
  • 19. Security Manager & Access Controller Security manager exists for historical reasons Access control to system resources Policy enforcement Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller Security manager exists for historical reasons Access control to system resources Policy enforcement Default only for applets
  • 20. Key Database Create / verify digital signatures Operating System Remote Class Files Local Class FilesSigned Class Files Bytecode Verifier Class LoaderCore API Class Files Core Java API Security Package Key Database Security Manager Access Controller
  • 21. Java Sandbox • Permissions • Code Source • Protection Domain • Policy File • Keystore
  • 22. Java 2 Security Model • All code runs in a sandbox • All classes are loaded with full bytecode verification • All classes are loaded with Java language features • Signed classes verify the integrity and origination of Java classes • Security policy provides fine-grained access • Crypto APIs
  • 24. Android • Open Platform • First phone based on Android came out in 2009 • 75% smartphone market share as of October1 1: idc.com
  • 25. Android Security Model • Platform Security • Crypto APIs • Secure Communication APIs • Key Management APIs
  • 26. Install Time User Consent You control your phone!
  • 28. Linux Kernel Unique UID and GID for each application at install time Sharing can occur through component interactions Linux Process Sandbox
  • 29. Linux Kernel (Cont’d) include/linux/android_aid.h AID_NET_BT 3002 Can create Bluetooth Sockets AID_INET 3003 Can create IPv4 and IPv6 Sockets
  • 30. Middleware • Libraries for code execution • Libraries for services • Take care of device specific issues • Compiled to machine language • Native and Java code
  • 31. Java Virtual Machine? • There is no JVM in Android platform • No byte code is executed • JAR file will not run on Android platform
  • 33. Dalvik Virtual Machine • Dalvik does not align to Java SE or Java ME • Library built on a subset of the Apache Harmony Java • Highly optimized VM to support multiple VM instances • Register based architecture • Shared constant pool • Executes Dalvik executables (.dex)
  • 34. .dex File Source Files Java Compiler JAR Tool DX Converter Dalvik VM Example.jar A.class B.class Strings.xml Icon.png Example.jar Classes.dex Strings.xml Icon.png
  • 36. Dalvik Virtual Machine • No security manager • Permissions are enforced in OS and not in VM • As of Android 2.2 Dalvik has a JIT compiler • Dalvik Bytecode verification mainly for optimization • GC for each VM instance
  • 37. Android Application Structure • Application is made of components • Activity: Define screens • Service: Background processing • Broadcast Receiver: Mailbox for messages from other applications • Content Provider: Relational database for sharing information
  • 38. Android Application Structure • Applications communicate through Intents • Secure RPC using Binder • AndroidManifest.xml defines policy for application
  • 39. Permission Protection Levels • Normal android.permission.VIBRATE com.android.alarm.permission.SET_ALARM • Dangerous android.permission.SEND_SMS android.permission.CALL_PHONE • Signature android.permission.FORCE_STOP_PACKAGES android.permission.INJECT_EVENTS • SignatureOrSystem android.permission.ACCESS_USB android.permission.SET_TIME All components are secured by permissions Developers can define their own permissions as well
  • 40. Application Layer Security • Permissions restrict component interaction • Permission labels defined in AndroidManifest.xml • Applications are self-signed; no CA required • Signatures define persistence and authorship
  • 41. Android Security Model • Linux process sandbox • Permission based component interaction • Dalvik is not a security boundary • All applications need to be signed • Signature define persistence and authorship • Install time security decisions • Crypto APIs
  • 43. Vision Protect host machine from malicious code Optimization for mobile platform
  • 44. Install Time Checking Who are you? What do you want to do?
  • 45. Sandbox Permissions + Code Sources + Policy + keystore + Protection Domains Linux Process Sandbox
  • 48. Protection Domain Code Sources + Permissions Process
  • 49. Virtual Machine VM is a security boundary VM is NOT a security boundary
  • 50. Security Enforcement Applets v/s Applications Native v/s Java code No exceptions!
  • 51.

Editor's Notes

  1. permission: type, name, and action of permissionCode source: location and signer of codeProtection domain: permission + codePolicy file: defines protection domainKeystore: verifies identity
  2. Total system RAM is 64 MB; available after low level startup: 40MB and after high level services have started: 20 MB and large system libs 10 MB
  3. "java.version" property returns "java.class.version" invariably returns 50"user.home" and "user.name" properties do not existHighly optimized VM to support multiple VM instances with own address space and separate memoryRelies on Linux kernel for underlying functionality such as threading and low-level memory managementLibrary built on a subset of the Apache Harmony JavaMemory is clean (mmap() and unwritten)) or dirty (malloc)Shared memory: used by many processesPrivate memory used by one process
  4. ExamplesDex structures are using valid indices and offsets and code can’t misbehaveOptimaization: byte swapping (not needed on ARM)m static linking, pruning empty methodsRelies on Linux kernel for underlying functionality Garbage Collector is independent for each process but respect sharingBytecode verifierOptimization“Exact” GCIntra-application SecurityAnalysis & Debugging