SlideShare une entreprise Scribd logo
1  sur  39
JVM Assisted Clearing of
Sensitive Data
Charlie Gracie
Advisory Software Developer
IBM Runtime Technologies
September 21, 2016
2
• Software developer at IBM on the J9 Java VM since 2004
• Garbage collection architect
• Also a project lead on the Eclipse OMR project
– https://github.com/eclipse/omr
– https://eclipse.org/omr
Who am I
3
Sensitive data
4
• Sensitive Personal Information (SPI)
– SIN, passwords, credit card numbers, etc.
Sensitive data
5
• Sensitive Personal Information (SPI)
– SIN, passwords, credit card numbers, etc.
• Encryption keys, certificates, etc.
Sensitive data
6
• Sensitive Personal Information (SPI)
– SIN, passwords, credit card numbers, etc.
• Encryption keys, certificates, etc.
• Other confidential data
Sensitive data
7
How is this a problem?
8
• Attacks like heart bleed
How is this a problem?
9
• Attacks like heart bleed
• Transmitting diagnostic files for support
How is this a problem?
10
• Attacks like heart bleed
• Transmitting diagnostic files for support
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x417789d7, pid=21139, tid=1024
#
# Java VM: Java HotSpot(TM) Server VM (6-beta2-b63 mixed mode)
# Problematic frame:
# C [libApplication.so+0x9d7]
How is this a problem?
11
• Attacks like heart bleed
• Transmitting diagnostic files for support
• Running monitoring tools
How is this a problem?
12
• Do not store sensitive data on the heap
Solution
13
• Do not store sensitive data on the heap
• Limit the time it is on the heap
• Use char[] instead of Strings
• Hash char[] data so it isn’t in clear text
Best practices
14
• Do not rely on the GC
– Data may still be present hours after it is no longer used!
• Arrays.fill(user.password, 0);
• user.SIN = 0;
Clear the data yourself
15
• Strings are immutable in Java
• Strings could be cached in the intern() list
• JPasswordField getPassword() returns char[]
• Exceptions/logging may print Object.toString
– A string will print its contents
– A char[] will print the memory location
Use char[] instead Strings
16
• Hash the char[] data as soon as possible
– No clear text on the heap
• This adds another level of protection
Hash char[] data
17
Example to handle passwords
String username = usernameField.getText();
char[] password = passwordField.getPassword();
// Hash the password in place in the array
secureHash(password);
// Check to see if the username / password combo are valid
bool isValidLogin = isPasswordCorrect(username, password);
// Zero out the hashed password, for security.
Arrays.fill(password, '0');
18
Example to handle passwords
String username = usernameField.getText();
char[] password = passwordField.getPassword();
// Hash the password in place in the array
secureHash(password);
// Check to see if the username / password combo are valid
bool isValidLogin = isPasswordCorrect(username, password);
// Zero out the hashed password, for security.
Arrays.fill(password, '0');
19
Example to handle passwords
String username = usernameField.getText();
char[] password = passwordField.getPassword();
// Hash the password in place in the array
secureHash(password);
// Check to see if the username / password combo are valid
bool isValidLogin = isPasswordCorrect(username, password);
// Zero out the hashed password, for security.
Arrays.fill(password, '0');
20
Example to handle passwords
String username = usernameField.getText();
char[] password = passwordField.getPassword();
// Hash the password in place in the array
secureHash(password);
// Check to see if the username / password combo are valid
bool isValidLogin = isPasswordCorrect(username, password);
// Zero out the hashed password, for security.
Arrays.fill(password, '0');
21
Example to handle passwords
String username = usernameField.getText();
char[] password = passwordField.getPassword();
// Hash the password in place in the array
secureHash(password);
// Check to see if the username / password combo are valid
bool isValidLogin = isPasswordCorrect(username, password);
// Zero the hashed password
Arrays.fill(password, '0');
22
• Can I still find the data after you clear it?
Is that enough?
23
• Can I still find the data after you clear it?
• Yes, it is possible!
Is that enough?
24
1. Perform a copy collection in the young generation
2. Defragment the tenure area
GC object movement
25
Compaction example
26
Compaction example
27
Compaction example
28
Compaction example
29
Compaction example
30
• Provide new APIs to create sensitive objects
• After object movement the GC will clear the old locations
– Only for sensitive objects
• On object death the GC could clear the data
– This would likely be an optional feature
– You still should clear it yourself
• Tooling can be provided to clean diagnostic files
My proposal
31
• Provide a set of APIs for allocating sensitive objects
• Provide an API for converting an object to a sensitive object
• Provide an API to clear the object
New APIs
32
• APIs should be implementable by all JVMs
– JVM is free to track objects in the most efficient way for that JVM
• No API to query the list of sensitive objects
• No API to make a sensitive object not sensitive
SensitiveObjects
33
• Allocation
1. Array.newSensitiveInstance(Class<?> componentType, int length)
2. Array.newSensitiveInstance(Class<?> componentType, int… dimensions)
3. Class.newSenstiveInstance()
4. Constructor.newSensitiveInstance(Object… initArgs)
New APIs
34
• Converting and clearing
1. SensitiveObject.convertToSensitiveInstance(Object object)
2. SensitiveObject.clearData(Object object)
New APIs
35
• Small cost per object that is moved
– Need to clear the data
– JVMs already use very optimized versions of memory clearing
• Clearing dead objects
– Likely causes extra list management for sensitive objects
– Forces the GC to visit dead objects
• Overhead at allocation time
– GC has to mark this object as sensitive
GC cost for sensitive objects
36
• Clean sensitive objects when creating the files
• Post process the files to clean sensitive data
Diagnostic files
37
• Create a JSR/JEP for the proposal
• Get feedback from you the developers
Next steps
38
• Limit the time sensitive data is on the heap
• Do not store sensitive data in String objects
• Hash or obfuscate the data when possible
• Think about my proposal and provide feedback
Points to takeaway
Thank You!
Charlie Gracie| cgracie@ca.ibm.com | @crgracie

Contenu connexe

Tendances

sizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may mattersizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may matterDawid Weiss
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)Nikita Popov
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка TwistedMaxim Kulsha
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Charles Nutter
 
Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Mark Baker
 
Web scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabsWeb scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabszekeLabs Technologies
 
Ts archiving
Ts   archivingTs   archiving
Ts archivingConfiz
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same projectKarol Wrótniak
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersBen van Mol
 
Perl Intro 8 File Handles
Perl Intro 8 File HandlesPerl Intro 8 File Handles
Perl Intro 8 File HandlesShaun Griffith
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETTomas Jansson
 
Solr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachSolr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachAlexandre Rafalovitch
 
Perl Intro 9 Command Line Arguments
Perl Intro 9 Command Line ArgumentsPerl Intro 9 Command Line Arguments
Perl Intro 9 Command Line ArgumentsShaun Griffith
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...Christopher Frohoff
 
Attacks against Microsoft network web clients
Attacks against Microsoft network web clients Attacks against Microsoft network web clients
Attacks against Microsoft network web clients Positive Hack Days
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtextmeysholdt
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testabilityJohn Sundell
 

Tendances (20)

sizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may mattersizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may matter
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка Twisted
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
 
Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)
 
Web scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabsWeb scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabs
 
Ts archiving
Ts   archivingTs   archiving
Ts archiving
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same project
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
 
Perl Intro 8 File Handles
Perl Intro 8 File HandlesPerl Intro 8 File Handles
Perl Intro 8 File Handles
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
 
Solr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachSolr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approach
 
Perl Intro 9 Command Line Arguments
Perl Intro 9 Command Line ArgumentsPerl Intro 9 Command Line Arguments
Perl Intro 9 Command Line Arguments
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
 
Attacks against Microsoft network web clients
Attacks against Microsoft network web clients Attacks against Microsoft network web clients
Attacks against Microsoft network web clients
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtext
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 
Java
JavaJava
Java
 
Mastering Java ByteCode
Mastering Java ByteCodeMastering Java ByteCode
Mastering Java ByteCode
 

En vedette

Digital Citizenship for Elementary School Parents
Digital Citizenship for Elementary School ParentsDigital Citizenship for Elementary School Parents
Digital Citizenship for Elementary School ParentsTeaching Sagittarian
 
Правовая неотложка
Правовая неотложкаПравовая неотложка
Правовая неотложкаstodva
 
Taratura di contatori di gas di nuova generazione
Taratura di contatori di gas di nuova generazioneTaratura di contatori di gas di nuova generazione
Taratura di contatori di gas di nuova generazioneTogetherToSolve
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesCharlie Gracie
 
DataCore Technology Overview
DataCore Technology OverviewDataCore Technology Overview
DataCore Technology OverviewJeff Slapp
 
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.Festividad de la Virgen de la Medalla Milagrosa. 27 nov.
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.Voluntariado A IC
 
Deep Learning vs. Cheap Learning
Deep Learning vs. Cheap LearningDeep Learning vs. Cheap Learning
Deep Learning vs. Cheap LearningMapR Technologies
 
Starting with SpagoBI Slide Support
Starting with SpagoBI Slide SupportStarting with SpagoBI Slide Support
Starting with SpagoBI Slide SupportSpagoWorld
 
The Keys to Digital Transformation
The Keys to Digital TransformationThe Keys to Digital Transformation
The Keys to Digital TransformationMapR Technologies
 
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...Indian dental academy
 
BSIMM: Bringing Science to Software Security
BSIMM: Bringing Science to Software SecurityBSIMM: Bringing Science to Software Security
BSIMM: Bringing Science to Software SecurityCigital
 

En vedette (15)

Digital Citizenship for Elementary School Parents
Digital Citizenship for Elementary School ParentsDigital Citizenship for Elementary School Parents
Digital Citizenship for Elementary School Parents
 
Huashan
HuashanHuashan
Huashan
 
Правовая неотложка
Правовая неотложкаПравовая неотложка
Правовая неотложка
 
Taratura di contatori di gas di nuova generazione
Taratura di contatori di gas di nuova generazioneTaratura di contatori di gas di nuova generazione
Taratura di contatori di gas di nuova generazione
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
DataCore Technology Overview
DataCore Technology OverviewDataCore Technology Overview
DataCore Technology Overview
 
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.Festividad de la Virgen de la Medalla Milagrosa. 27 nov.
Festividad de la Virgen de la Medalla Milagrosa. 27 nov.
 
Deep Learning vs. Cheap Learning
Deep Learning vs. Cheap LearningDeep Learning vs. Cheap Learning
Deep Learning vs. Cheap Learning
 
Starting with SpagoBI Slide Support
Starting with SpagoBI Slide SupportStarting with SpagoBI Slide Support
Starting with SpagoBI Slide Support
 
The Keys to Digital Transformation
The Keys to Digital TransformationThe Keys to Digital Transformation
The Keys to Digital Transformation
 
Application of gps
Application of gpsApplication of gps
Application of gps
 
17 encontro A Santa Ceia
17 encontro  A Santa Ceia17 encontro  A Santa Ceia
17 encontro A Santa Ceia
 
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...
Craniofacial anomalies /certified fixed orthodontic courses by Indian dental ...
 
BSIMM: Bringing Science to Software Security
BSIMM: Bringing Science to Software SecurityBSIMM: Bringing Science to Software Security
BSIMM: Bringing Science to Software Security
 
DIE MARKTMEINUNG AUS STUTTGART: Unsichere Zeiten
DIE MARKTMEINUNG AUS STUTTGART: Unsichere ZeitenDIE MARKTMEINUNG AUS STUTTGART: Unsichere Zeiten
DIE MARKTMEINUNG AUS STUTTGART: Unsichere Zeiten
 

Similaire à JavaOne 2016 - JVM assisted sensitive data

Protect Your Payloads: Modern Keying Techniques
Protect Your Payloads: Modern Keying TechniquesProtect Your Payloads: Modern Keying Techniques
Protect Your Payloads: Modern Keying TechniquesLeo Loobeek
 
CNIT 126 13: Data Encoding
CNIT 126 13: Data EncodingCNIT 126 13: Data Encoding
CNIT 126 13: Data EncodingSam Bowne
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsIvan Novikov
 
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGE
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGESecure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGE
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGEPriyanka Aash
 
Slides
SlidesSlides
Slidesvti
 
Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsAleksandr Yampolskiy
 
power-assert, mechanism and philosophy
power-assert, mechanism and philosophypower-assert, mechanism and philosophy
power-assert, mechanism and philosophyTakuto Wada
 
Third Party Auth in WebObjects
Third Party Auth in WebObjectsThird Party Auth in WebObjects
Third Party Auth in WebObjectsWO Community
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetricphanleson
 
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis ExperienceAndrey Karpov
 
CNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingCNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingSam Bowne
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxDavid Rodenas
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Sam Bowne
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesCharles Nutter
 
Crypto storage
Crypto storageCrypto storage
Crypto storageGraham Lee
 
Protect Sensitive Data with Ada Keystore
Protect Sensitive Data with Ada KeystoreProtect Sensitive Data with Ada Keystore
Protect Sensitive Data with Ada KeystoreStephane Carrez
 
Seminar Hacking & Security Analysis
Seminar Hacking & Security AnalysisSeminar Hacking & Security Analysis
Seminar Hacking & Security AnalysisDan H
 

Similaire à JavaOne 2016 - JVM assisted sensitive data (20)

Protect Your Payloads: Modern Keying Techniques
Protect Your Payloads: Modern Keying TechniquesProtect Your Payloads: Modern Keying Techniques
Protect Your Payloads: Modern Keying Techniques
 
CNIT 126 13: Data Encoding
CNIT 126 13: Data EncodingCNIT 126 13: Data Encoding
CNIT 126 13: Data Encoding
 
Java Tutorial
Java Tutorial Java Tutorial
Java Tutorial
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application Firewalls
 
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGE
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGESecure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGE
Secure Storage: COMPOSABLE AND ROBUST OUTSOURCED STORAGE
 
CSC PPT 13.pptx
CSC PPT 13.pptxCSC PPT 13.pptx
CSC PPT 13.pptx
 
Slides
SlidesSlides
Slides
 
Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programs
 
power-assert, mechanism and philosophy
power-assert, mechanism and philosophypower-assert, mechanism and philosophy
power-assert, mechanism and philosophy
 
Third Party Auth in WebObjects
Third Party Auth in WebObjectsThird Party Auth in WebObjects
Third Party Auth in WebObjects
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetric
 
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
 
CNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingCNIT 126: 13: Data Encoding
CNIT 126: 13: Data Encoding
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
 
Java Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O MechanismsJava Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O Mechanisms
 
Crypto storage
Crypto storageCrypto storage
Crypto storage
 
Protect Sensitive Data with Ada Keystore
Protect Sensitive Data with Ada KeystoreProtect Sensitive Data with Ada Keystore
Protect Sensitive Data with Ada Keystore
 
Seminar Hacking & Security Analysis
Seminar Hacking & Security AnalysisSeminar Hacking & Security Analysis
Seminar Hacking & Security Analysis
 

Dernier

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 

Dernier (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 

JavaOne 2016 - JVM assisted sensitive data

  • 1. JVM Assisted Clearing of Sensitive Data Charlie Gracie Advisory Software Developer IBM Runtime Technologies September 21, 2016
  • 2. 2 • Software developer at IBM on the J9 Java VM since 2004 • Garbage collection architect • Also a project lead on the Eclipse OMR project – https://github.com/eclipse/omr – https://eclipse.org/omr Who am I
  • 4. 4 • Sensitive Personal Information (SPI) – SIN, passwords, credit card numbers, etc. Sensitive data
  • 5. 5 • Sensitive Personal Information (SPI) – SIN, passwords, credit card numbers, etc. • Encryption keys, certificates, etc. Sensitive data
  • 6. 6 • Sensitive Personal Information (SPI) – SIN, passwords, credit card numbers, etc. • Encryption keys, certificates, etc. • Other confidential data Sensitive data
  • 7. 7 How is this a problem?
  • 8. 8 • Attacks like heart bleed How is this a problem?
  • 9. 9 • Attacks like heart bleed • Transmitting diagnostic files for support How is this a problem?
  • 10. 10 • Attacks like heart bleed • Transmitting diagnostic files for support # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x417789d7, pid=21139, tid=1024 # # Java VM: Java HotSpot(TM) Server VM (6-beta2-b63 mixed mode) # Problematic frame: # C [libApplication.so+0x9d7] How is this a problem?
  • 11. 11 • Attacks like heart bleed • Transmitting diagnostic files for support • Running monitoring tools How is this a problem?
  • 12. 12 • Do not store sensitive data on the heap Solution
  • 13. 13 • Do not store sensitive data on the heap • Limit the time it is on the heap • Use char[] instead of Strings • Hash char[] data so it isn’t in clear text Best practices
  • 14. 14 • Do not rely on the GC – Data may still be present hours after it is no longer used! • Arrays.fill(user.password, 0); • user.SIN = 0; Clear the data yourself
  • 15. 15 • Strings are immutable in Java • Strings could be cached in the intern() list • JPasswordField getPassword() returns char[] • Exceptions/logging may print Object.toString – A string will print its contents – A char[] will print the memory location Use char[] instead Strings
  • 16. 16 • Hash the char[] data as soon as possible – No clear text on the heap • This adds another level of protection Hash char[] data
  • 17. 17 Example to handle passwords String username = usernameField.getText(); char[] password = passwordField.getPassword(); // Hash the password in place in the array secureHash(password); // Check to see if the username / password combo are valid bool isValidLogin = isPasswordCorrect(username, password); // Zero out the hashed password, for security. Arrays.fill(password, '0');
  • 18. 18 Example to handle passwords String username = usernameField.getText(); char[] password = passwordField.getPassword(); // Hash the password in place in the array secureHash(password); // Check to see if the username / password combo are valid bool isValidLogin = isPasswordCorrect(username, password); // Zero out the hashed password, for security. Arrays.fill(password, '0');
  • 19. 19 Example to handle passwords String username = usernameField.getText(); char[] password = passwordField.getPassword(); // Hash the password in place in the array secureHash(password); // Check to see if the username / password combo are valid bool isValidLogin = isPasswordCorrect(username, password); // Zero out the hashed password, for security. Arrays.fill(password, '0');
  • 20. 20 Example to handle passwords String username = usernameField.getText(); char[] password = passwordField.getPassword(); // Hash the password in place in the array secureHash(password); // Check to see if the username / password combo are valid bool isValidLogin = isPasswordCorrect(username, password); // Zero out the hashed password, for security. Arrays.fill(password, '0');
  • 21. 21 Example to handle passwords String username = usernameField.getText(); char[] password = passwordField.getPassword(); // Hash the password in place in the array secureHash(password); // Check to see if the username / password combo are valid bool isValidLogin = isPasswordCorrect(username, password); // Zero the hashed password Arrays.fill(password, '0');
  • 22. 22 • Can I still find the data after you clear it? Is that enough?
  • 23. 23 • Can I still find the data after you clear it? • Yes, it is possible! Is that enough?
  • 24. 24 1. Perform a copy collection in the young generation 2. Defragment the tenure area GC object movement
  • 30. 30 • Provide new APIs to create sensitive objects • After object movement the GC will clear the old locations – Only for sensitive objects • On object death the GC could clear the data – This would likely be an optional feature – You still should clear it yourself • Tooling can be provided to clean diagnostic files My proposal
  • 31. 31 • Provide a set of APIs for allocating sensitive objects • Provide an API for converting an object to a sensitive object • Provide an API to clear the object New APIs
  • 32. 32 • APIs should be implementable by all JVMs – JVM is free to track objects in the most efficient way for that JVM • No API to query the list of sensitive objects • No API to make a sensitive object not sensitive SensitiveObjects
  • 33. 33 • Allocation 1. Array.newSensitiveInstance(Class<?> componentType, int length) 2. Array.newSensitiveInstance(Class<?> componentType, int… dimensions) 3. Class.newSenstiveInstance() 4. Constructor.newSensitiveInstance(Object… initArgs) New APIs
  • 34. 34 • Converting and clearing 1. SensitiveObject.convertToSensitiveInstance(Object object) 2. SensitiveObject.clearData(Object object) New APIs
  • 35. 35 • Small cost per object that is moved – Need to clear the data – JVMs already use very optimized versions of memory clearing • Clearing dead objects – Likely causes extra list management for sensitive objects – Forces the GC to visit dead objects • Overhead at allocation time – GC has to mark this object as sensitive GC cost for sensitive objects
  • 36. 36 • Clean sensitive objects when creating the files • Post process the files to clean sensitive data Diagnostic files
  • 37. 37 • Create a JSR/JEP for the proposal • Get feedback from you the developers Next steps
  • 38. 38 • Limit the time sensitive data is on the heap • Do not store sensitive data in String objects • Hash or obfuscate the data when possible • Think about my proposal and provide feedback Points to takeaway
  • 39. Thank You! Charlie Gracie| cgracie@ca.ibm.com | @crgracie

Notes de l'éditeur

  1. So my talk was titled JVM assisted clearing of sensitive data. So what do I mean by sensitive data
  2. Then you have sensitive data for your application like encryption keys, a reference to a company issued certificate which has not been signed, etc.
  3. Or any other confidential data used by your application.
  4. As a developer you may be wondering why there is a problem with having this data persist in the Java heap We are behind our company firewall No one has access to our machines, or privileges to access the memory for these processes.
  5. Heart bleed could be used to gather a very accurate picture of memory and was used to get usernames and passwords very effectively
  6. If you are running in the JVM and it crashes you will likely upload a system core file to be inspected. Now your memory dump is escaping your protected systems
  7. If you have ever seen a message like this you may have compromised your sensitive data. Now that the JVM has crash the memory has been written to disk. This already may have allowed someone to get access to the data but if you transmit the file to the JVM developers for inspection you are opening up the data for all sorts of attacks.
  8. You may be using an external tool for performance analysis which again is allowing your data to escape. Now hopefully I have convinced that this is something you as a developer needs to be concerned with what is my solution?
  9. The only way to keep this data completely safe is to never use it But that is not really a feasible solution. The data needs to be used so here are some current best practices for keeping your sensitive data secure
  10. You want to limit the time this data is actually on the heap. Clear the memory by writing zeros or some data pattern as soon as you are finished with it Hashing the string data will make it harder to get the actual password if the data is compromised
  11. How many people here know how the GC algorithms in the JVM work in general? None of the JVM GCs rely on reference counting (like c python, etc.) so objects are not collected immediately when they are no longer used. Objects will collected at some point after they are no longer used when the GC needs to reclaim memory. This may happening quickly after the object is no longer used but even so the data will still be visible in the heap until the memory is re-used
  12. You can not clear the data for a String. All of the APIs to get access to the char[] of a String actually copy the data into a new char[] JPasswordField getPassword() returns a char[] instead of a String for this very reason. There is an API to get the password as a String but it is not the recommended API Interoperability with libraries expecting a String Convert the char[] to a String as late as possible Do the best you can
  13. For values like a SIN you could obfuscate
  14. Code from https://nvisium.com/blog/2016/03/31/secure-password-strings/
  15. Code from https://nvisium.com/blog/2016/03/31/secure-password-strings/
  16. Code from https://nvisium.com/blog/2016/03/31/secure-password-strings/
  17. Code from https://nvisium.com/blog/2016/03/31/secure-password-strings/
  18. Code from https://nvisium.com/blog/2016/03/31/secure-password-strings/
  19. The steps above can really help limit the scope and visibility of your sensitive data but it is enough to make sure this data does not escape. Can you still find your data on the heap after you zero it?
  20. Yes it is possible. I am not talking about using any advanced forensic tools but just through simple visual inspection of the heap. Modern GC implementations move objects within the heap all of the time and leaving the old copies laying around.
  21. The GC will try to avoid visiting or writing any data that it does not have to, to dead objects.
  22. So assume this is what the heap looks like before a compaction. The dark blue is live objects and the light blue is free memory or dead objects This is pretty fragmented so the GC may decide to compact all of the live objects together so it has large blocks of free memory But before I move on to show you what the heap may look like after the compaction lets place an object containing sensitive data on the heap
  23. So here we have your sensitive object in red as the last live object on the heap
  24. Now we have performed the compaction and created on large free list entry. Lets assume the compactor just slides objects to the left during compaction. This is a simple form of compaction but even the most complicate compactor will likely still have the same issue That means it moved a lot of objects to new locations on the heap. By doing this some of the original object locations were overwritten but as you move further to the right the original locations are not just considered free memory and almost certainly have not been overwritten
  25. So we can see your object containing the users password moved to its new location
  26. But the data at the old location is almost certainly intact So at this point if you finished with your data and cleared it there is still technically a copy on the heap that you are not aware of. With more sophisticated GC technologies like the balanced GC in the IBM JDK or G1 in OpenJDK there are many more frequent scenarios where the GC will leave old copies of the data around for an undetermined amount of time There may be situations where the memory for an old copy of some of your sensitive data never gets re-used by the JVM process. The problem with these copies of the object are you can not predict or know that they are there. This makes it almost impossible for a java developer to improve the situation
  27. I believe the APIs for allocating are the most important since you want to ensure that there is no window for the GC to leave a copy of the object around once the data has been initialized
  28. After lots of investigation I settled on adding new APIs to resemble the currently APIs on Array, Class and Constructor for allocating new instances. I investigating using a new class that you could inherit but that meant you would not be able to easily handle primitive arrays and I think those will be the most common uses. Another thought was to create a new variant of the new keyword but I am not sure such a large change is required for this idea. I also played around with annotating fields and locals but I think that would make it much harder for the JVM to optimize Using these APIs will be more work for the developer but I think the tradeoff will be worth it.
  29. You may not always be in control of the allocation point so you may need to tell the GC to track an object after it is allocated. This is not ideal but it is here to shorten the window where the GC would create copies I am suggesting a clearData method as well to make it easier for the developer. The JVM has very optimized versions of code already for handling this operation so lets take advantage of it
  30. Earlier I mentioned that diagnostic files are one way sensitive data can escape your secure systems. JVMs implementing my proposed sensitive data object model could provide ways to clean this data from their diagnostic files If possible during the creation of the files they could clean the data. This may not always be possible in cases where the JVM is crashing so a post process tool could be created that you run on your system to clear the data before you send it
  31. Over the coming weeks I am going to start a dialog with the OpenJDK community to see if I can get an accepted proposal for this idea. Currently if you have any feedback or ideas find me here over the next few days or contact me via email.
  32. As developers we believe and trust that the systems our code runs on are secure but we need to spend the time to make sure we are doing as much as we can to make the likelihood of a leak as small as possible Really try to limit the time that sensitive data is actually alive and available on the heap. Do not rely on current GC technology to clean up your data for you. GCs are unpredictable and I have shown that they can actually create more copies of your sensitive data. I think the JVM needs to help keep sensitive data secure. I have my proposal on an improvement but your feedback and suggestions can help ensure we come up with the best solution.