SlideShare a Scribd company logo
Java & Secure Programming (Bad Examples found in JDK) Marc Schönefeld, University of Bamberg Illegalaccess.org
The speaker ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The situation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Selected Java Security Alerts in 2003/2004: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The problem ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classloaders and Protection Domains
Why search for security bugs in java code ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
J2EE multi-tier application types
J2EE multi-tier attack types Evil Twin Attack Data-Injection (SQL, legacy format) Denial-Of-Service,  Malicious serialized data
Java Security Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http:// java.sun.com/security/seccodeguide.html
Java Security Antipatterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How to search for security bugs in java code ? ,[object Object],jChains ( http://jchains.dev.java.net  ) Policy evaluation tools ,[object Object],[object Object],[object Object],Findbugs (bases  on Apache BCEL) Bytecode audit analyzers Time consuming analysis,  needs experience JAD (!),  JODE Decompilers useful only if source code is available and complete [in most of the cases it isn’t]  PMD ,  Checkstyle Source Code Detectors
Bytecode analyzers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Security Antipatterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Antipattern 1: Integer overflow ,[object Object],[object Object],[object Object],[object Object],[object Object]
Java Antipattern 1: Integer overflow ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Antipattern 1: Integer overflow ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Antipattern 1: Integer overflow,  Risk and extent ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Antipattern 1: Integer overflow,  the Refactoring public void update(byte[] b, int off, int len) { if (b == null) {   throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len ) {   throw new ArrayIndexOutOfBoundsException(); } crc = updateBytes(crc, b, off, len);  } After JDK 1.4.1 02 public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off + len > b.length)  {  throw new ArrayIndexOutOfBoundsException(); } crc = updateBytes(crc, b, off, len);  }  Before JDK 1.4.1 01
Java Antipattern 1: Integer overflow,  the Refactoring (bytecode) Integer Overflow Bytecode Pattern Bytecode of Refactoring 12:  iload_2 13:  iflt  28 16:  iload_3 17:  iflt  28 20:  iload_2 21:  aload_1 22:  arraylength 23:  iload_3 24:  isub 25:  if_icmple  36 After   (1.4.1_02) 12:  iload_2 13:  iflt  28 16:  iload_3 17:  iflt  28 20:  iload_2 21:  iload_3 22:  iadd 23:  aload_1 24:  arraylength 25:  if_icmple  36 Before (1.4.1_01)
Java Antipattern 1: Harmful integer overflow,  How to find during auditing ?  ,[object Object],[object Object],[object Object],[object Object]
AP1: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object]
Antipattern 2: Serialisation side effects  ,[object Object],[object Object],[object Object],[object Object]
AP 2: Risk and Extent ,[object Object],[object Object],[object Object],[object Object],[object Object],Causes JVM  crash  on Win32  java.awt.font.ICC_Profile Triggers an unexpected  OutOfMemoryError  which may kill the current listening thread and disable the service (as an error it bypasses most try/catch checks)  java.util.HashMap Triggers complex computation,  „ JVM may become  unresponsive “ [Sun Alert 57707] java.util.regex.Pattern
AP 2: Risk and Extent  http:// classic.sunsolve.sun.com /pub-cgi/retrieve.pl?doc=fsalert%2F57707
AP2: Serialisation side effects, a refactoring private void readObject(java.io.ObjectInputStream s)throws… {  s.defaultReadObject();  // Initialize counts  groupCount = 1;  //  if length > 0,    localCount = 0;  //  the Pattern is lazily compiled  compiled = false;   if (pattern.length() == 0) {   root = new Start(lastAccept);     matchRoot = lastAccept;   compiled = true;  }  }  After JDK 1.4.2 06 private void readObject(java.io.ObjectInputStream s)throws… {   s.defaultReadObject();  // Initialize counts   groupCount = 1;   localCount = 0;  // Recompile object tree   if (pattern.length() > 0)   compile();// so we compile for the next 1600 years     else   root = new Start(lastAccept);  } Before JDK 1.4.2 05
AP2: How to find during code audit ?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP2: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object]
AP3: Privileged Code Side Effects ,[object Object],[object Object],[object Object]
AP3: Privileged Code Side Effects ,[object Object],[object Object], 
AP3: Privileged Code Side Effects: Risk and Extent ,[object Object],[object Object],[object Object],[object Object],[object Object],… . … transport temporary files (such as executables) to the client’s machine, which can be launched later ( http://www.derkeiler.com/Mailing-Lists/Full-Disclosure/2004-07/0462.html   )   java.awt.Font (i) fill up the remaining free space of file system of the client machine with a large file containing zero bytes  Java.awt.Font(ii) escape the applet sandbox and test existence of files on the client’s machine  java.awt.font.ICC_Profile
AP3: Privileged Code Side Effects: Risk and Extent
AP3: Refactorings  ,[object Object],[object Object],[object Object]
AP3: Privileged Code Side Effects:  How to audit ?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP3: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP4: Inappropriate Scope ,[object Object],[object Object]
AP4: Inappropriate Scope: Risk and Extent  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP4: Inappropriate Scope: Risk and Extent http:// classic.sunsolve.sun.com / pub-cgi /retrieve.pl?doc=fsalert%2F54760
AP4: Inappropriate Scope: Refactoring 1) Creation of subclasses is forbidden, to prevent leaking of secret data by new methods 2)  Scope of public finalize method degraded to protected, so no class can overwrite it 3) Data fields were moved to appropriate private (class local) scope  1 2 3 public  final   class  NBA {     protected final synchronized void finalize()   public synchronized Object getData()   public synchronized Object clone()   public synchronized void copyTo(NBA nba)    public synchronized void copyTo(byte javadata[]) private long data;   private int size;   private Class type; } After (JMF 2.1.1e) public  class  NBA { public void finalize()   public Object getData()   public Object clone()   public void copyTo(NBA nba)   public void copyTo(byte javadata[])   public long data;   public int size;   public Class type; } Before (JMF 2.1.1c)
AP4: Inappropriate Scope Side Effects:  How to audit ?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP4: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object],[object Object]
AP5: Non-Final Static Fields ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP5: Non-Final Static Variables, Risk & Extent ,[object Object],[object Object],[object Object]
AP5: Non-Final Static Variables, Risk & Extent http://www.heise.de/newsticker/meldung/41308 Unsigned Java-Applets jump out of Sandbox
AP5: Non-Final Static Variables: Refactoring The  final  modifier prohibits modification of a variable after initial value was set. Initially they only used it to protect their product name     public class org.apache.xalan.processor. XSLProcessorVersion { public static final java.lang.String PRODUCT; public static  final  java.lang.String LANGUAGE; public static  final  int VERSION; public static  final  int RELEASE; public static  final  int MAINTENANCE; public static  final  int DEVELOPMENT; public static  final  java.lang.String S_VERSION; } After (JDK1.42_05) public class org.apache.xalan.processor. XSLProcessorVersion { public static final java.lang.String PRODUCT; public static java.lang.String LANGUAGE; public static int VERSION; public static int RELEASE; public static int MAINTENANCE; public static int DEVELOPMENT; public static java.lang.String S_VERSION; } Before (JDK1.42_04)
AP5: Non-Final Static Variables:  How to audit ?  ,[object Object],[object Object],[object Object],[object Object],[object Object]
AP5: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Antipattern 6: Insecure component reuse  ,[object Object],[object Object],[object Object]
AP6: Insecure component reuse, Risk & Extent ,[object Object],[object Object],[object Object],[object Object],[object Object]
AP5: Non-Final Static Variables, Risk & Extend http:// classic.sunsolve.sun.com /pub-cgi/retrieve.pl?doc=fsalert%2F57613
AP6: Insecure component reuse: Refactoring This refactoring is  adjusting  the enhanced functionality of the component to the level needed  for running the component securely  in confined execution models. Technically the refactoring cures an antipattern 4 and an antipattern 5.  The  private  modifier prohibits malicious code to modify the table consisting the  built-in functions of the XSLT parser. public class org.apache.xpath.compiler.FunctionTable { private  static org.apache.xpath.compiler.FuncLoader[] m_functions;  [...] } After (JDK1.42_06) public class org.apache.xpath.compiler.FunctionTable { public static org.apache.xpath.compiler.FuncLoader[] m_functions; [...] } Before (JDK1.42_05)
AP6: Insecure component reuse: How to audit ?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AP6: Conclusion and Suggestions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
finally{} Q & A Download at www.illegalaccess.org Detectors presented Send me an eMail  [email_address] Contact

More Related Content

What's hot

"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
Nelson Brito
 
Breakfast cereal for advanced beginners
Breakfast cereal for advanced beginnersBreakfast cereal for advanced beginners
Breakfast cereal for advanced beginners
Truptiranjan Nayak
 
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
Automated In-memory Malware/Rootkit  Detection via Binary Analysis and Machin...Automated In-memory Malware/Rootkit  Detection via Binary Analysis and Machin...
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
Malachi Jones
 
Class loaders
Class loadersClass loaders
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
Andrew Petukhov
 
Unit8 security (2) java
Unit8 security (2) javaUnit8 security (2) java
Unit8 security (2) java
Sharafat Husen
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
Dinis Cruz
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilities
GreenD0g
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
Luca Carettoni
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
Luca Carettoni
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
joaomatosf_
 
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
Reversing & Malware Analysis Training Part 6 -  Practical Reversing (I)Reversing & Malware Analysis Training Part 6 -  Practical Reversing (I)
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
securityxploded
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
Home
 
Abusing Java Remote Interfaces
Abusing Java Remote InterfacesAbusing Java Remote Interfaces
Abusing Java Remote Interfaces
juanvazquezslides
 
DEFCON 21: EDS: Exploitation Detection System WP
DEFCON 21: EDS: Exploitation Detection System WPDEFCON 21: EDS: Exploitation Detection System WP
DEFCON 21: EDS: Exploitation Detection System WP
Amr Thabet
 
DEFCON 21: EDS: Exploitation Detection System Slides
DEFCON 21: EDS: Exploitation Detection System SlidesDEFCON 21: EDS: Exploitation Detection System Slides
DEFCON 21: EDS: Exploitation Detection System Slides
Amr Thabet
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedyearninginjava
 
EVIL: Exploiting Software via Natural Language
EVIL: Exploiting Software via Natural LanguageEVIL: Exploiting Software via Natural Language
EVIL: Exploiting Software via Natural Language
Pietro Liguori
 
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
Pietro Liguori
 
Reading Group Presentation: Why Eve and Mallory Love Android
Reading Group Presentation: Why Eve and Mallory Love AndroidReading Group Presentation: Why Eve and Mallory Love Android
Reading Group Presentation: Why Eve and Mallory Love Android
Michael Rushanan
 

What's hot (20)

"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
 
Breakfast cereal for advanced beginners
Breakfast cereal for advanced beginnersBreakfast cereal for advanced beginners
Breakfast cereal for advanced beginners
 
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
Automated In-memory Malware/Rootkit  Detection via Binary Analysis and Machin...Automated In-memory Malware/Rootkit  Detection via Binary Analysis and Machin...
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
 
Class loaders
Class loadersClass loaders
Class loaders
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
Unit8 security (2) java
Unit8 security (2) javaUnit8 security (2) java
Unit8 security (2) java
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilities
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
Reversing & Malware Analysis Training Part 6 -  Practical Reversing (I)Reversing & Malware Analysis Training Part 6 -  Practical Reversing (I)
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
Abusing Java Remote Interfaces
Abusing Java Remote InterfacesAbusing Java Remote Interfaces
Abusing Java Remote Interfaces
 
DEFCON 21: EDS: Exploitation Detection System WP
DEFCON 21: EDS: Exploitation Detection System WPDEFCON 21: EDS: Exploitation Detection System WP
DEFCON 21: EDS: Exploitation Detection System WP
 
DEFCON 21: EDS: Exploitation Detection System Slides
DEFCON 21: EDS: Exploitation Detection System SlidesDEFCON 21: EDS: Exploitation Detection System Slides
DEFCON 21: EDS: Exploitation Detection System Slides
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
 
EVIL: Exploiting Software via Natural Language
EVIL: Exploiting Software via Natural LanguageEVIL: Exploiting Software via Natural Language
EVIL: Exploiting Software via Natural Language
 
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
Slide presentation of "How Bad Can a Bug Get? An Empirical Analysis of Softwa...
 
Reading Group Presentation: Why Eve and Mallory Love Android
Reading Group Presentation: Why Eve and Mallory Love AndroidReading Group Presentation: Why Eve and Mallory Love Android
Reading Group Presentation: Why Eve and Mallory Love Android
 

Viewers also liked

2.Public Vulnerability Databases
2.Public Vulnerability Databases2.Public Vulnerability Databases
2.Public Vulnerability Databasesphanleson
 
3.Secure Design Principles And Process
3.Secure Design Principles And Process3.Secure Design Principles And Process
3.Secure Design Principles And Processphanleson
 
8.Integer Overflows
8.Integer Overflows8.Integer Overflows
8.Integer Overflowsphanleson
 
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS USING SE-TOOLKIT – A CA...
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS  USING SE-TOOLKIT – A CA...eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS  USING SE-TOOLKIT – A CA...
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS USING SE-TOOLKIT – A CA...Kevin M. Moker, CFE, CISSP, ISSMP, CISM
 
EC-Council Certified Network Defender
EC-Council Certified Network DefenderEC-Council Certified Network Defender
EC-Council Certified Network Defender
ITpreneurs
 
TH3 Professional Developper CEH social engineering
TH3 Professional Developper CEH social engineeringTH3 Professional Developper CEH social engineering
TH3 Professional Developper CEH social engineering
th3prodevelopper
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
Narudom Roongsiriwong, CISSP
 

Viewers also liked (7)

2.Public Vulnerability Databases
2.Public Vulnerability Databases2.Public Vulnerability Databases
2.Public Vulnerability Databases
 
3.Secure Design Principles And Process
3.Secure Design Principles And Process3.Secure Design Principles And Process
3.Secure Design Principles And Process
 
8.Integer Overflows
8.Integer Overflows8.Integer Overflows
8.Integer Overflows
 
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS USING SE-TOOLKIT – A CA...
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS  USING SE-TOOLKIT – A CA...eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS  USING SE-TOOLKIT – A CA...
eForensics Magazine - HOW TO STEAL GMAIL CREDENTIALS USING SE-TOOLKIT – A CA...
 
EC-Council Certified Network Defender
EC-Council Certified Network DefenderEC-Council Certified Network Defender
EC-Council Certified Network Defender
 
TH3 Professional Developper CEH social engineering
TH3 Professional Developper CEH social engineeringTH3 Professional Developper CEH social engineering
TH3 Professional Developper CEH social engineering
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 

Similar to JavaSecure

Auscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCEAuscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCE
David Jorm
 
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It PosesEnterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Alex Senkevitch
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Servers
Martin Toshev
 
Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101
Mario-Leander Reimer
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
securityxploded
 
Java-Unit-I.ppt
Java-Unit-I.pptJava-Unit-I.ppt
Java-Unit-I.ppt
RameswarGprec
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdf
KALAISELVI P
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Apostolos Giannakidis
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
Hamid Ghorbani
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
Shaharyar khan
 
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
ITAS VIETNAM
 
Java introduction
Java introductionJava introduction
Java introduction
NAVEENA ESWARAN
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.ppt
JyothiAmpally
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONING
Satish Chandra
 
FEATURES OF JAVA
FEATURES OF JAVAFEATURES OF JAVA
FEATURES OF JAVA
Rhythm Suiwal
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Security Bootcamp
 
IDA Vulnerabilities and Bug Bounty  by Masaaki Chida
IDA Vulnerabilities and Bug Bounty  by Masaaki ChidaIDA Vulnerabilities and Bug Bounty  by Masaaki Chida
IDA Vulnerabilities and Bug Bounty  by Masaaki Chida
CODE BLUE
 

Similar to JavaSecure (20)

Auscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCEAuscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCE
 
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It PosesEnterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
 
Java Security
Java SecurityJava Security
Java Security
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Servers
 
Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
 
Java-Unit-I.ppt
Java-Unit-I.pptJava-Unit-I.ppt
Java-Unit-I.ppt
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdf
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
 
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
 
Java introduction
Java introductionJava introduction
Java introduction
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.ppt
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONING
 
Advanced Java
Advanced JavaAdvanced Java
Advanced Java
 
FEATURES OF JAVA
FEATURES OF JAVAFEATURES OF JAVA
FEATURES OF JAVA
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
 
IDA Vulnerabilities and Bug Bounty  by Masaaki Chida
IDA Vulnerabilities and Bug Bounty  by Masaaki ChidaIDA Vulnerabilities and Bug Bounty  by Masaaki Chida
IDA Vulnerabilities and Bug Bounty  by Masaaki Chida
 

Recently uploaded

Role of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in MiningRole of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in Mining
Naaraayani Minerals Pvt.Ltd
 
Unveiling the Secrets How Does Generative AI Work.pdf
Unveiling the Secrets How Does Generative AI Work.pdfUnveiling the Secrets How Does Generative AI Work.pdf
Unveiling the Secrets How Does Generative AI Work.pdf
Sam H
 
anas about venice for grade 6f about venice
anas about venice for grade 6f about veniceanas about venice for grade 6f about venice
anas about venice for grade 6f about venice
anasabutalha2013
 
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Lviv Startup Club
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
AUDIJEAngelo
 
Skye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto AirportSkye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto Airport
marketingjdass
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
dylandmeas
 
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
Kumar Satyam
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
zoyaansari11365
 
Set off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptxSet off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptx
HARSHITHV26
 
Lookback Analysis
Lookback AnalysisLookback Analysis
Lookback Analysis
Safe PaaS
 
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
my Pandit
 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
fakeloginn69
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
Erika906060
 
PriyoShop Celebration Pohela Falgun Mar 20, 2024
PriyoShop Celebration Pohela Falgun Mar 20, 2024PriyoShop Celebration Pohela Falgun Mar 20, 2024
PriyoShop Celebration Pohela Falgun Mar 20, 2024
PriyoShop.com LTD
 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
dylandmeas
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
KaiNexus
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Navpack & Print
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
creerey
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
RajPriye
 

Recently uploaded (20)

Role of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in MiningRole of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in Mining
 
Unveiling the Secrets How Does Generative AI Work.pdf
Unveiling the Secrets How Does Generative AI Work.pdfUnveiling the Secrets How Does Generative AI Work.pdf
Unveiling the Secrets How Does Generative AI Work.pdf
 
anas about venice for grade 6f about venice
anas about venice for grade 6f about veniceanas about venice for grade 6f about venice
anas about venice for grade 6f about venice
 
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
 
Skye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto AirportSkye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto Airport
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
 
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
 
Set off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptxSet off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptx
 
Lookback Analysis
Lookback AnalysisLookback Analysis
Lookback Analysis
 
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
 
PriyoShop Celebration Pohela Falgun Mar 20, 2024
PriyoShop Celebration Pohela Falgun Mar 20, 2024PriyoShop Celebration Pohela Falgun Mar 20, 2024
PriyoShop Celebration Pohela Falgun Mar 20, 2024
 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
 

JavaSecure

  • 1. Java & Secure Programming (Bad Examples found in JDK) Marc Schönefeld, University of Bamberg Illegalaccess.org
  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 9. J2EE multi-tier attack types Evil Twin Attack Data-Injection (SQL, legacy format) Denial-Of-Service, Malicious serialized data
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Java Antipattern 1: Integer overflow, the Refactoring public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len ) { throw new ArrayIndexOutOfBoundsException(); } crc = updateBytes(crc, b, off, len); } After JDK 1.4.1 02 public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off + len > b.length) { throw new ArrayIndexOutOfBoundsException(); } crc = updateBytes(crc, b, off, len); } Before JDK 1.4.1 01
  • 20. Java Antipattern 1: Integer overflow, the Refactoring (bytecode) Integer Overflow Bytecode Pattern Bytecode of Refactoring 12: iload_2 13: iflt 28 16: iload_3 17: iflt 28 20: iload_2 21: aload_1 22: arraylength 23: iload_3 24: isub 25: if_icmple 36 After (1.4.1_02) 12: iload_2 13: iflt 28 16: iload_3 17: iflt 28 20: iload_2 21: iload_3 22: iadd 23: aload_1 24: arraylength 25: if_icmple 36 Before (1.4.1_01)
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. AP 2: Risk and Extent http:// classic.sunsolve.sun.com /pub-cgi/retrieve.pl?doc=fsalert%2F57707
  • 26. AP2: Serialisation side effects, a refactoring private void readObject(java.io.ObjectInputStream s)throws… { s.defaultReadObject(); // Initialize counts groupCount = 1; // if length > 0, localCount = 0; // the Pattern is lazily compiled compiled = false; if (pattern.length() == 0) { root = new Start(lastAccept); matchRoot = lastAccept; compiled = true; } } After JDK 1.4.2 06 private void readObject(java.io.ObjectInputStream s)throws… { s.defaultReadObject(); // Initialize counts groupCount = 1; localCount = 0; // Recompile object tree if (pattern.length() > 0) compile();// so we compile for the next 1600 years else root = new Start(lastAccept); } Before JDK 1.4.2 05
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. AP3: Privileged Code Side Effects: Risk and Extent
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. AP4: Inappropriate Scope: Risk and Extent http:// classic.sunsolve.sun.com / pub-cgi /retrieve.pl?doc=fsalert%2F54760
  • 39. AP4: Inappropriate Scope: Refactoring 1) Creation of subclasses is forbidden, to prevent leaking of secret data by new methods 2) Scope of public finalize method degraded to protected, so no class can overwrite it 3) Data fields were moved to appropriate private (class local) scope 1 2 3 public final class NBA { protected final synchronized void finalize() public synchronized Object getData() public synchronized Object clone() public synchronized void copyTo(NBA nba) public synchronized void copyTo(byte javadata[]) private long data; private int size; private Class type; } After (JMF 2.1.1e) public class NBA { public void finalize() public Object getData() public Object clone() public void copyTo(NBA nba) public void copyTo(byte javadata[]) public long data; public int size; public Class type; } Before (JMF 2.1.1c)
  • 40.
  • 41.
  • 42.
  • 43.
  • 44. AP5: Non-Final Static Variables, Risk & Extent http://www.heise.de/newsticker/meldung/41308 Unsigned Java-Applets jump out of Sandbox
  • 45. AP5: Non-Final Static Variables: Refactoring The final modifier prohibits modification of a variable after initial value was set. Initially they only used it to protect their product name  public class org.apache.xalan.processor. XSLProcessorVersion { public static final java.lang.String PRODUCT; public static final java.lang.String LANGUAGE; public static final int VERSION; public static final int RELEASE; public static final int MAINTENANCE; public static final int DEVELOPMENT; public static final java.lang.String S_VERSION; } After (JDK1.42_05) public class org.apache.xalan.processor. XSLProcessorVersion { public static final java.lang.String PRODUCT; public static java.lang.String LANGUAGE; public static int VERSION; public static int RELEASE; public static int MAINTENANCE; public static int DEVELOPMENT; public static java.lang.String S_VERSION; } Before (JDK1.42_04)
  • 46.
  • 47.
  • 48.
  • 49.
  • 50. AP5: Non-Final Static Variables, Risk & Extend http:// classic.sunsolve.sun.com /pub-cgi/retrieve.pl?doc=fsalert%2F57613
  • 51. AP6: Insecure component reuse: Refactoring This refactoring is adjusting the enhanced functionality of the component to the level needed for running the component securely in confined execution models. Technically the refactoring cures an antipattern 4 and an antipattern 5. The private modifier prohibits malicious code to modify the table consisting the built-in functions of the XSLT parser. public class org.apache.xpath.compiler.FunctionTable { private static org.apache.xpath.compiler.FuncLoader[] m_functions; [...] } After (JDK1.42_06) public class org.apache.xpath.compiler.FunctionTable { public static org.apache.xpath.compiler.FuncLoader[] m_functions; [...] } Before (JDK1.42_05)
  • 52.
  • 53.
  • 54. finally{} Q & A Download at www.illegalaccess.org Detectors presented Send me an eMail [email_address] Contact