Advanced Java Security
Advanced Java Security
Advanced Java Security
Even experienced Java programmers are not mastering by all means the various security services offered by Java, and are likewise not aware of the different vulnerabilities that are relevant for Web applications written in Java. The course besides introducing security components of Standard Java Edition deals with security issues of Java Enterprise Edition (JEE) and Web services. Discussion of specific services is preceded with the foundations of cryptography and secure communication. Various exercises deal with declarative and programmatic security techniques in JEE, while both transport-layer and end-to-end security of Web services is discussed. The use of all components is presented through several practical exercises, where participants can try out the discussed APIs and tools for themselves. The course also goes through and explains the most frequent and severe programming flaws of the Java language and platform and Web-related vulnerabilities. Besides the typical bugs committed by Java programmers, the introduced security vulnerabilities cover both language-specific issues and problems stemming from the runtime environment. All vulnerabilities and the relevant attacks are demonstrated through easy-to-understand exercises, followed by the recommended coding guidelines and the possible mitigation techniques. Audience: Java and JEE developers, software architects and testers, max 15 participants SDL level: 300 Preparedness: Advanced Java Exercises: Hands-on
Content
Java security technologies and services: Java language security solutions, Java Virtual Machine (JVM) and Java Runtime Environment (JRE); ByteCode Verifier and Classloader; Security Manager and Access Controller, managing permissions with the PolicyTool; Java Cryptography Architecture (JCA) and Java Cryptographic Extension (JCE), Java Secure Socket Extension (JSSE), Java Authentication and Authorization Service (JAAS), Java Keystore (JKS) and the KeyTool Java Enterprise Edition (JEE) topics: security solutions; declarative and programmatic security; annotations and deployment descriptors; Web/Presentation Tier, Enterprise Java Beans (EJB)/Business Tier, Enterprise Information System (EIS)/Integration Tier; Java Message Service (JMS), Java Database Connectivity (JDBC) Web services: SOAP and REST; Transport-layer security, application- and container-managed authentication, authorization; End-to-end security; Web Services Security (WSS), username/password authentication, signing (XML Signature) and encryption (XML Encryption) Java specific vulnerabilities: integer overflows in Java (e.g. in java.util.zip.CRC32); Calendar/ZoneInfo deserialization bug (CVE 2008-5353); unsafe reflection; Web-related vulnerabilities like SQL Injection, Command Injection, Cross-Site Scripting (XSS), Cross-Site Request Forgery (CSRF), HTTP Injection, Insecure Direct Object Reference; unsafe Java Native Interface (JNI); improper error and exception handling; insecure randomness of java.util.Random; object hijacking; serialization of sensitive information; dangers of mobile code; Denial-of-Service (DoS) in Java (the 2.2250738585072012e -308 bug), problem with inner classes, and many more Exercises: setting and using permissions; authentication and authorization through JAAS; using JCA/JCE providers for digital signing and encryption; permission for signed code; using JSSE switching from HTTP to HTTPS; working with file and JDBC realms, setting the deployment descriptors accordingly; authentication, specifying roles and method permissions by annotation and deployment descriptors; using wsimport to generate client artifacts plain and SSL communication with the container; application and container managed authentication; WS Security with username and password; XMLS Signature; XML Encryption; exploiting SQL injection step-by-step; crafting Cross-Site Scripting attacks; uploading and running executable code; crashing through JNI; proof-of-concept exploit of Calendar/ZoneInfo
Integrity
Authenticity
Modeling message manipulation Message Authentication Code (MAC)
Non-repudiation
Non-repudiation Asymmetric digital signature (RSA/DSA)
Confidentiality
Model of encrypted communication Encryption methods in practice Strength of encryption algorithms Requirements of remote identification Model of anonymous communication Traffic analysis Theoretically strong protection against traffic analysis Practical protection against traffic analysis Relationships between requirements
Summary
Symmetric-key cryptography
Security protocols
Secure network protocols Specific vs. general solutions Different encryption protocols General robust encryption protocols Commonly used solutions SSL / TLS / WTLS protocols
Security services Message structure SSL/TLS handshake
Cryptographic services
Secure communication
Java EE security
Introduction to Java EE security
Java EE multi-tier architecture Roles and responsibilities Java EE container-based security Basic concepts: user, group, role, realm Example: setting up security roles Example: mapping roles to users and groups Example: securing the communication Basic concepts Security roles Declaring security roles Mapping security roles to users and groups Checking the callers identity programmatically Specifying security constraints Java EE authentication Specifying an authentication mechanism HTTP basic authentication Form-based authentication HTTPS client authentication Exercise Jee/WebSecurity Exercise WebSecurity Create a new user in a file realm Exercise WebSecurity Using JDBC realm Declaring security roles Mapping security roles to users and groups Accessing the callers context programmatically Specifying method permissions by annotation Specifying method permissions by the deployment descriptor Propagating the identity Exercise Jee/EJBSecurity Integration with the back-end EIS system
Mobile code
Takeaways
Note: Our classroom trainings come with a number of easy-to-understand exercises providing live hacking fun. By accomplishing these exercises with the lead of the trainer, participants can analyze vulnerable code snippets and commit attacks against them in order to fully understand the root causes of certain security problems. All exercises are prepared in a plug-and-play manner by using a pre-set desktop virtual machine, which provides a uniform development environment.