SlideShare una empresa de Scribd logo
1 de 58
Security Architecture
of the Java Platform
Martin Toshev
Who am I
Software consultant
BG JUG board member (http://jug.bg)
OpenJDK contributor
Currently finishing a book on RabbitMQ
Agenda
• Evolution of the Java security model
• Outside the sandbox - APIs for secure coding
• Designing and coding with security in mind
Evolution of the Java security
model
Evolution of the
Java security model
• Traditionally - companies protect they assets
using strict physical and network access policies
• Tools such as anti-virus software, firewalls,
IPS/IDS systems facilitate this approach
Evolution of the
Java security model
• With the introduction of various technologies for
loading and executing code on the client machine
from the browser (such as Applets) - a new range
of concerns emerge related to client security –
this is when the Java security sandbox starts to
evolve …
Evolution of the
Java security model
• The goal of the Java security sandbox is to allow
untrusted code from applets to be executed in a
trusted environment such as the user's browser
Evolution of the
Java security model
• JDK 1.0 (when it all started …) – the original
sandbox model was introduced
Applet
(untrusted)
System code
(trusted)
JVM
Browser
http://voxxeddays.com/demoapplet
Evolution of the
Java security model
• Code executed by the JVM is divided in two
domains – trusted and untrusted
• Strict restriction are applied by default on the
security model of applets such as denial to
read/write data from disk, connect to the
network and so on
Evolution of the
Java security model
• JDK 1.1 (gaining trust …) – applet signing
introduced
Applet
(untrusted)
System code
(trusted)
JVM
Browser
Signed Applet
(trusted)
http://voxxeddays.com/demoapplet
http://voxxeddays.com/trustedapplet
Evolution of the
Java security model
• Local code (as in JDK 1.0) and signed applet code
(as of JDK 1.1) are trusted
• Unsigned remote code (as in JDK 1.0) is not
trusted
Evolution of the
Java security model
• Steps needed to sign and run an applet:
– Compile the applet
– Create a JAR file for the applet
– Generate a pair of public/private keys
– Sign the applet JAR with the private key
– Export a certificate for the public key
– Import the Certificate as a Trusted Certificate
– Create the policy file
– Load and run the applet
Evolution of the
Java security model
• JDK 1.2 (gaining more trust …) – fine-grained
access control
Applet
System code
JVM
Browser
grant codeBase http://voxxeddays.com/demoapplet {
permission java.io.FilePermisions “C:Windows” “delete”
}
security.policy
SecurityManager.checkPermission(…)
AccessController.checkPermission(…)
http://voxxeddays.com/demoapplet
Evolution of the
Java security model
• The security model becomes code-centric
• Additional access control decisions are specified
in a security policy
• No more notion of trusted and untrusted code
Evolution of the
Java security model
• The notion of protection domain introduced –
determined by the security policy
• Two types of protection domains – system and
application
Evolution of the
Java security model
• The protection domain is set during classloading
and contains the code source and the list of
permissions for the class
applet.getClass().getProtectionDomain();
Evolution of the
Java security model
• One permission can imply another permission
java.io.FilePermissions “C:Windows” “delete”
implies
java.io.FilePermissions “C:Windowssystem32” “delete”
Evolution of the
Java security model
• One code source can imply another code source
codeBase http://voxxeddays.com/
implies
codeBase http://voxxeddays.com/demoapplet
Evolution of the
Java security model
• Since an execution thread may pass through
classes loaded by different classloaders (and
hence – have different protection domains) the
following rule of thumb applies:
The permission set of an execution thread is considered
to be the intersection of the permissions of all protection
domains traversed by the execution thread
Evolution of the
Java security model
• JDK 1.3, 1,4 (what about entities running the
code … ?) – JAAS
Applet
System code
JVM
Browser
http://voxxeddays.com/demoapplet
grant principal javax.security.auth.x500.X500Principal "cn=Tom"
{ permission java.io.FilePermissions “C:Windows” “delete” }
security.policy
Evolution of the
Java security model
• JAAS (Java Authentication and Authorization
Service) extends the security model with role-
based permissions
• The protection domain of a class now may
contain not only the code source and the
permissions but a list of principals
Evolution of the
Java security model
• The authentication component of JAAS is
independent of the security sandbox in Java and
hence is typically used in more wider context
(such as j2ee app servers)
• The authorization component is the one that
extends the Java security policy
Evolution of the
Java security model
• Core classes of JAAS:
– javax.security.auth.Subject - an authenticated subject
– java.security.Principal - identifying characteristic of a subject
– javax.security.auth.spi.LoginModule - interface for
implementors of login (PAM) modules
– javax.security.auth.login.LoginContext - creates objects used
for authentication
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
1) upon system startup a security policy is set and a
security manager is installed
Policy.setPolicy(…)
System.setSecurityManager(…)
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
2) during classloading (e.g. of a remote applet) bytecode
verification is done and the protection domain is set
for the current classloader (along with the code
source, the set of permissions and the set of JAAS
principals)
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
3) when system code is invoked from the remote code
the SecurityManager is used to check against the
intersection of protection domains based on the chain
of threads and their call stacks
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
SocketPermission permission = new
SocketPermission("voxxeddays.com:8000-
9000","connect,accept");
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(permission);
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
4) application code can also do permission checking
against remote code using a SecurityManager or an
AccessController
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
SocketPermission permission = new
SocketPermission("voxxeddays.com:8000-9000",
"connect,accept");
AccessController.checkPermission(permission)
Evolution of the
Java security model
• Up to JDK 1.4 the following is a typical flow for
permission checking:
5) application code can also do permission checking with
all permissions of the calling domain or a particular
JAAS subject
AccessController.doPrivileged(…)
Subject.doAs(…)
Subject.doAsPrivileged(…)
Evolution of the
Java security model
• The security model defined by
java.lang.SecurityManager is customizable
• For example: Oracle JVM uses a custom
SecurityManager with additional permission
classes where the code source is a database
schema (containing e.g. Java stored procedures)
Evolution of the
Java security model
• JDK 1.5, 1.6 (enhancing the model …) – new
additions to the sandbox model (e.g. LDAP
support for JAAS)
Evolution of the
Java security model
• JDK 1.7, 1.8 (further enhancing the model …) –
enhancements to the sandbox model (e.g.
AccessController.doPrivileged() for checking
against a subset of permissions)
Evolution of the
Java security model
• JDK 1.9 and beyond … (applying the model to
modules …)
application module
system
module 1
JVM
Browser
http://voxxeddays.com/appmodule
security.policy
system
module 2
Evolution of the
Java security model
• By modules we understand modules in JDK as
defined by project Jigsaw
• Modules must conform to the same security
model as applets – moreover each module is
loaded by a different classloader – hence classes
in different modules must have different
protection domains
Evolution of the
Java security model
• Modularization of the JDK system classes
allows further to define fine-grained access
control permissions for classes in the system
domain
• This is not currently allowed due to the
monolithic nature of the JDK
Outside the sandbox - APIs for
secure coding
Outside the sandbox - APIs for secure
coding
• The security sandbox defines a strict model for
execution of remote code in the JVM
• The other side of the coin are the security APIs
that provide utilities for implementing the
different aspects of application security …
Outside the sandbox - APIs for secure
coding
• The additional set of APIs includes:
– JCA (Java Cryptography Architecture)
– PKI (Public Key Infrastructure) utilities
– JSSE (Java Secure Socket Extension)
– Java GSS API (Java Generic Security Services)
– Java SASL API (Java Simple Authentication and Security
Layer)
Outside the sandbox - APIs for secure
coding
• JCA provides utilities for:
– creating digital signatures
– creating message digests
– using cryptographic ciphers (symetric/asymetric,
block/stream)
– using different other types of cryptographic services and
algorithms
Outside the sandbox - APIs for secure
coding
• JCA has a pluggable architecture
• JCA is independent from particular cryptographic
algorithms
• JCA continues to evolve (especially by providing
stronger cryptographic algorithms)
Outside the sandbox - APIs for secure
coding
• PKI utilities provide means for working with:
– certificates
– certificate revocation lists (CRL)
– OCSP (Online Certificate Status Protocol)
– key stores and trust stores (also based on the PKCS -
public-key cryptography standards)
Outside the sandbox - APIs for secure
coding
• PKI certificate revocation check (revision):
• PKI utilities continue to evolve (especially in
providing more support for managing certificates
and keys)
certificate
authorityrevocation
checking
OCSP
CRL
certificate
certificate
Outside the sandbox - APIs for secure
coding
• JSSE provides an implementation of the TSL/SSL
sockets for working with remote communication
• JSSE continues to evolve (especially in the
support for additional features such as Server
Name Identication)
Outside the sandbox - APIs for secure
coding
• Java GSS API provides an alternative of JSSE
for secure communication
• Java GSS API is a framework for providing
token-based security services that is
independent of the underlying protocols
Outside the sandbox - APIs for secure
coding
• Java GSS API can be used along with JAAS for
authentication purposes
• Java GSS API continues to evolve (especially in
the support for Kerberos authentication)
Outside the sandbox - APIs for secure
coding
• Java SASL defines a protocol for exchange of
authentication data
• Java SASL is a framework where external
providers give concrete semantics to the
authentication data being exchanged
Outside the sandbox - APIs for secure
coding
• Java SASL continues to evolve (especially with
support for additional and enhanced
properties for exchanging authentication data)
Designing and coding with
security in mind
Designing and coding
with security in mind
• First of all - follow programing guidelines and
best practices - most are not bound to the Java
programming language (input validation, error
handling, type safety, access modifiers, resource
cleanup, prepared SQL queries and whatever you
can think of …)
Designing and coding
with security in mind
• Respect the SecurityManager - design libraries so
that they work in environments with installed
SecurityManager
• Example: GSON library does not respect the
SecurityManager and cannot be used without additional
reflective permissions in some scenarios
Designing and coding
with security in mind
• Grant minimal permissions to code that requires
them - the principle of "least privilege"
• Copy-pasting, of course, increases the risk of
security flows (if the copied code is flawed)
Designing and coding
with security in mind
• Sanitize exception messages from sensitive
information - often this results in an unintended
exposal of exploitable information
• Let alone exception stacktraces … in many cases
they convey a wealth of information about the
system
Thank you
References
• Java Security Overview (white paper)
http://www.oracle.com/technetwork/java/js-white-paper-
149932.pdf
• Java SE Platform Security Architecture Spec
http://docs.oracle.com/javase/7/docs/technotes/guides/sec
urity/spec/security-spec.doc.html
• Inside Java 2 Platform Security, 2nd edition
http://www.amazon.com/Inside-Java%C2%BF-Platform-
Security-Implementation/dp/0201787911
References
• Java Security, 2nd edition, Scott Oaks
http://shop.oreilly.com/product/9780596001575.do
• Securing Java, Gary McGraw, Ed Felden
http://www.securingjava.com
• Secure Coding Guidelines for Java SE
http://www.oracle.com/technetwork/java/seccodeguide
-139067.html#0
References
• Java 2 Network Security
http://www.amazon.com/JAVA-Network-Security-2nd-
Edition/dp/0130155926
• Java Security Documentation
http://docs.oracle.com/javase/8/docs/technotes/guides/
security/index.html
References
• Core Java Security: Class Loaders, Security
Managers and Encryption
http://www.informit.com/articles/article.aspx?p=118796
7
• Overview of Java Security Models
http://docs.oracle.com/cd/E12839_01/core.1111/e1004
3/introjps.htm#CHDCEJGH

Más contenido relacionado

La actualidad más candente

Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
 
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpikeMyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpikeos890
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization VulnerabilitiesLuca Carettoni
 
MyFaces Universe at ApacheCon
MyFaces Universe at ApacheConMyFaces Universe at ApacheCon
MyFaces Universe at ApacheConos890
 
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 Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Josef Cacek
 
Scala play-framework
Scala play-frameworkScala play-framework
Scala play-frameworkAbdhesh Kumar
 
Java Security Manager Reloaded - jOpenSpace Lightning Talk
Java Security Manager Reloaded - jOpenSpace Lightning TalkJava Security Manager Reloaded - jOpenSpace Lightning Talk
Java Security Manager Reloaded - jOpenSpace Lightning TalkJosef Cacek
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)CODE WHITE GmbH
 
Apache DeltaSpike
Apache DeltaSpikeApache DeltaSpike
Apache DeltaSpikeos890
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomavenManav Prasad
 
MyFaces Extensions Validator r3 News
MyFaces Extensions Validator r3 NewsMyFaces Extensions Validator r3 News
MyFaces Extensions Validator r3 Newsos890
 
Make JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODIMake JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODIos890
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversationsos890
 
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksState of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksLucidworks
 
[OWASP Poland Day] Application frameworks' vulnerabilities
[OWASP Poland Day] Application frameworks' vulnerabilities[OWASP Poland Day] Application frameworks' vulnerabilities
[OWASP Poland Day] Application frameworks' vulnerabilitiesOWASP
 

La actualidad más candente (20)

Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
Java Security
Java SecurityJava Security
Java Security
 
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpikeMyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
 
MyFaces Universe at ApacheCon
MyFaces Universe at ApacheConMyFaces Universe at ApacheCon
MyFaces Universe at ApacheCon
 
Java part 1
Java part 1Java part 1
Java part 1
 
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 Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014
 
Scala play-framework
Scala play-frameworkScala play-framework
Scala play-framework
 
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
 
Java Security Manager Reloaded - jOpenSpace Lightning Talk
Java Security Manager Reloaded - jOpenSpace Lightning TalkJava Security Manager Reloaded - jOpenSpace Lightning Talk
Java Security Manager Reloaded - jOpenSpace Lightning Talk
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
 
Apache DeltaSpike
Apache DeltaSpikeApache DeltaSpike
Apache DeltaSpike
 
JSF2
JSF2JSF2
JSF2
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomaven
 
MyFaces Extensions Validator r3 News
MyFaces Extensions Validator r3 NewsMyFaces Extensions Validator r3 News
MyFaces Extensions Validator r3 News
 
Make JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODIMake JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODI
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversations
 
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksState of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
 
[OWASP Poland Day] Application frameworks' vulnerabilities
[OWASP Poland Day] Application frameworks' vulnerabilities[OWASP Poland Day] Application frameworks' vulnerabilities
[OWASP Poland Day] Application frameworks' vulnerabilities
 

Destacado

Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Martin Toshev
 
Writing Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cWriting Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cMartin Toshev
 
Writing Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSWriting Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSMartin Toshev
 
Writing Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cWriting Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cMartin Toshev
 
RxJS vs RxJava: Intro
RxJS vs RxJava: IntroRxJS vs RxJava: Intro
RxJS vs RxJava: IntroMartin Toshev
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)Martin Toshev
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in developmentMartin Toshev
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message BrokerMartin Toshev
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Simon Ritter
 
Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Trisha Gee
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 

Destacado (15)

Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 
Writing Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cWriting Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12c
 
Writing Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSWriting Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMS
 
Writing Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cWriting Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12c
 
Modular Java
Modular JavaModular Java
Modular Java
 
RxJS vs RxJava: Intro
RxJS vs RxJava: IntroRxJS vs RxJava: Intro
RxJS vs RxJava: Intro
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message Broker
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?
 
Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Real World Java 9 (QCon London)
Real World Java 9 (QCon London)
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 

Similar a Security Аrchitecture of Тhe Java Platform

Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security ArchitectureRamesh Nagappan
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.pptHaymanotTadese
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application ServersMartin Toshev
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java securityveszpremimeetup
 
From java to android a security analysis
From java to android  a security analysisFrom java to android  a security analysis
From java to android a security analysisPragati Rai
 
Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sri Prasanna
 
Creating Secure Applications
Creating Secure Applications Creating Secure Applications
Creating Secure Applications guest879f38
 
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONS
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONSADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONS
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONSelliando dias
 
Spring security 2017
Spring security 2017Spring security 2017
Spring security 2017Vortexbird
 
Weblogic Cluster Security
Weblogic Cluster SecurityWeblogic Cluster Security
Weblogic Cluster SecurityAditya Bhuyan
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Christian Schneider
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPRafal Gancarz
 
CDI and Seam 3: an Exciting New Landscape for Java EE Development
CDI and Seam 3: an Exciting New Landscape for Java EE DevelopmentCDI and Seam 3: an Exciting New Landscape for Java EE Development
CDI and Seam 3: an Exciting New Landscape for Java EE DevelopmentSaltmarch Media
 
How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?Ksenia Peguero
 
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Christian Schneider
 

Similar a Security Аrchitecture of Тhe Java Platform (20)

Javantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin ToshevJavantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin Toshev
 
Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security Architecture
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Servers
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
 
Security in Java
Security in JavaSecurity in Java
Security in Java
 
From java to android a security analysis
From java to android  a security analysisFrom java to android  a security analysis
From java to android a security analysis
 
Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)
 
Creating Secure Applications
Creating Secure Applications Creating Secure Applications
Creating Secure Applications
 
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONS
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONSADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONS
ADDRESSING TOMORROW'S SECURITY REQUIREMENTS IN ENTERPRISE APPLICATIONS
 
Spring security 2017
Spring security 2017Spring security 2017
Spring security 2017
 
Weblogic security
Weblogic securityWeblogic security
Weblogic security
 
Weblogic Cluster Security
Weblogic Cluster SecurityWeblogic Cluster Security
Weblogic Cluster Security
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
 
Web security
Web securityWeb security
Web security
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
CDI and Seam 3: an Exciting New Landscape for Java EE Development
CDI and Seam 3: an Exciting New Landscape for Java EE DevelopmentCDI and Seam 3: an Exciting New Landscape for Java EE Development
CDI and Seam 3: an Exciting New Landscape for Java EE Development
 
Websphere - Introduction to SSL part 1
Websphere  - Introduction to SSL part 1Websphere  - Introduction to SSL part 1
Websphere - Introduction to SSL part 1
 
How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?
 
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
 

Más de Martin Toshev

Building highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkBuilding highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkMartin Toshev
 
Big data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseBig data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseMartin Toshev
 
Semantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cSemantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cMartin Toshev
 
Practical security In a modular world
Practical security In a modular worldPractical security In a modular world
Practical security In a modular worldMartin Toshev
 
Java 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeJava 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeMartin Toshev
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Martin Toshev
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Martin Toshev
 

Más de Martin Toshev (9)

Building highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkBuilding highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache Spark
 
Big data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseBig data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle Database
 
Jdk 10 sneak peek
Jdk 10 sneak peekJdk 10 sneak peek
Jdk 10 sneak peek
 
Semantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cSemantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12c
 
Practical security In a modular world
Practical security In a modular worldPractical security In a modular world
Practical security In a modular world
 
Java 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeJava 9 Security Enhancements in Practice
Java 9 Security Enhancements in Practice
 
Java 9 sneak peek
Java 9 sneak peekJava 9 sneak peek
Java 9 sneak peek
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
 

Último

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 

Último (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 

Security Аrchitecture of Тhe Java Platform

  • 1. Security Architecture of the Java Platform Martin Toshev
  • 2. Who am I Software consultant BG JUG board member (http://jug.bg) OpenJDK contributor Currently finishing a book on RabbitMQ
  • 3. Agenda • Evolution of the Java security model • Outside the sandbox - APIs for secure coding • Designing and coding with security in mind
  • 4. Evolution of the Java security model
  • 5. Evolution of the Java security model • Traditionally - companies protect they assets using strict physical and network access policies • Tools such as anti-virus software, firewalls, IPS/IDS systems facilitate this approach
  • 6. Evolution of the Java security model • With the introduction of various technologies for loading and executing code on the client machine from the browser (such as Applets) - a new range of concerns emerge related to client security – this is when the Java security sandbox starts to evolve …
  • 7. Evolution of the Java security model • The goal of the Java security sandbox is to allow untrusted code from applets to be executed in a trusted environment such as the user's browser
  • 8. Evolution of the Java security model • JDK 1.0 (when it all started …) – the original sandbox model was introduced Applet (untrusted) System code (trusted) JVM Browser http://voxxeddays.com/demoapplet
  • 9. Evolution of the Java security model • Code executed by the JVM is divided in two domains – trusted and untrusted • Strict restriction are applied by default on the security model of applets such as denial to read/write data from disk, connect to the network and so on
  • 10. Evolution of the Java security model • JDK 1.1 (gaining trust …) – applet signing introduced Applet (untrusted) System code (trusted) JVM Browser Signed Applet (trusted) http://voxxeddays.com/demoapplet http://voxxeddays.com/trustedapplet
  • 11. Evolution of the Java security model • Local code (as in JDK 1.0) and signed applet code (as of JDK 1.1) are trusted • Unsigned remote code (as in JDK 1.0) is not trusted
  • 12. Evolution of the Java security model • Steps needed to sign and run an applet: – Compile the applet – Create a JAR file for the applet – Generate a pair of public/private keys – Sign the applet JAR with the private key – Export a certificate for the public key – Import the Certificate as a Trusted Certificate – Create the policy file – Load and run the applet
  • 13. Evolution of the Java security model • JDK 1.2 (gaining more trust …) – fine-grained access control Applet System code JVM Browser grant codeBase http://voxxeddays.com/demoapplet { permission java.io.FilePermisions “C:Windows” “delete” } security.policy SecurityManager.checkPermission(…) AccessController.checkPermission(…) http://voxxeddays.com/demoapplet
  • 14. Evolution of the Java security model • The security model becomes code-centric • Additional access control decisions are specified in a security policy • No more notion of trusted and untrusted code
  • 15. Evolution of the Java security model • The notion of protection domain introduced – determined by the security policy • Two types of protection domains – system and application
  • 16. Evolution of the Java security model • The protection domain is set during classloading and contains the code source and the list of permissions for the class applet.getClass().getProtectionDomain();
  • 17. Evolution of the Java security model • One permission can imply another permission java.io.FilePermissions “C:Windows” “delete” implies java.io.FilePermissions “C:Windowssystem32” “delete”
  • 18. Evolution of the Java security model • One code source can imply another code source codeBase http://voxxeddays.com/ implies codeBase http://voxxeddays.com/demoapplet
  • 19. Evolution of the Java security model • Since an execution thread may pass through classes loaded by different classloaders (and hence – have different protection domains) the following rule of thumb applies: The permission set of an execution thread is considered to be the intersection of the permissions of all protection domains traversed by the execution thread
  • 20. Evolution of the Java security model • JDK 1.3, 1,4 (what about entities running the code … ?) – JAAS Applet System code JVM Browser http://voxxeddays.com/demoapplet grant principal javax.security.auth.x500.X500Principal "cn=Tom" { permission java.io.FilePermissions “C:Windows” “delete” } security.policy
  • 21. Evolution of the Java security model • JAAS (Java Authentication and Authorization Service) extends the security model with role- based permissions • The protection domain of a class now may contain not only the code source and the permissions but a list of principals
  • 22. Evolution of the Java security model • The authentication component of JAAS is independent of the security sandbox in Java and hence is typically used in more wider context (such as j2ee app servers) • The authorization component is the one that extends the Java security policy
  • 23. Evolution of the Java security model • Core classes of JAAS: – javax.security.auth.Subject - an authenticated subject – java.security.Principal - identifying characteristic of a subject – javax.security.auth.spi.LoginModule - interface for implementors of login (PAM) modules – javax.security.auth.login.LoginContext - creates objects used for authentication
  • 24. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: 1) upon system startup a security policy is set and a security manager is installed Policy.setPolicy(…) System.setSecurityManager(…)
  • 25. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: 2) during classloading (e.g. of a remote applet) bytecode verification is done and the protection domain is set for the current classloader (along with the code source, the set of permissions and the set of JAAS principals)
  • 26. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: 3) when system code is invoked from the remote code the SecurityManager is used to check against the intersection of protection domains based on the chain of threads and their call stacks
  • 27. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: SocketPermission permission = new SocketPermission("voxxeddays.com:8000- 9000","connect,accept"); SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(permission);
  • 28. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: 4) application code can also do permission checking against remote code using a SecurityManager or an AccessController
  • 29. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: SocketPermission permission = new SocketPermission("voxxeddays.com:8000-9000", "connect,accept"); AccessController.checkPermission(permission)
  • 30. Evolution of the Java security model • Up to JDK 1.4 the following is a typical flow for permission checking: 5) application code can also do permission checking with all permissions of the calling domain or a particular JAAS subject AccessController.doPrivileged(…) Subject.doAs(…) Subject.doAsPrivileged(…)
  • 31. Evolution of the Java security model • The security model defined by java.lang.SecurityManager is customizable • For example: Oracle JVM uses a custom SecurityManager with additional permission classes where the code source is a database schema (containing e.g. Java stored procedures)
  • 32. Evolution of the Java security model • JDK 1.5, 1.6 (enhancing the model …) – new additions to the sandbox model (e.g. LDAP support for JAAS)
  • 33. Evolution of the Java security model • JDK 1.7, 1.8 (further enhancing the model …) – enhancements to the sandbox model (e.g. AccessController.doPrivileged() for checking against a subset of permissions)
  • 34. Evolution of the Java security model • JDK 1.9 and beyond … (applying the model to modules …) application module system module 1 JVM Browser http://voxxeddays.com/appmodule security.policy system module 2
  • 35. Evolution of the Java security model • By modules we understand modules in JDK as defined by project Jigsaw • Modules must conform to the same security model as applets – moreover each module is loaded by a different classloader – hence classes in different modules must have different protection domains
  • 36. Evolution of the Java security model • Modularization of the JDK system classes allows further to define fine-grained access control permissions for classes in the system domain • This is not currently allowed due to the monolithic nature of the JDK
  • 37. Outside the sandbox - APIs for secure coding
  • 38. Outside the sandbox - APIs for secure coding • The security sandbox defines a strict model for execution of remote code in the JVM • The other side of the coin are the security APIs that provide utilities for implementing the different aspects of application security …
  • 39. Outside the sandbox - APIs for secure coding • The additional set of APIs includes: – JCA (Java Cryptography Architecture) – PKI (Public Key Infrastructure) utilities – JSSE (Java Secure Socket Extension) – Java GSS API (Java Generic Security Services) – Java SASL API (Java Simple Authentication and Security Layer)
  • 40. Outside the sandbox - APIs for secure coding • JCA provides utilities for: – creating digital signatures – creating message digests – using cryptographic ciphers (symetric/asymetric, block/stream) – using different other types of cryptographic services and algorithms
  • 41. Outside the sandbox - APIs for secure coding • JCA has a pluggable architecture • JCA is independent from particular cryptographic algorithms • JCA continues to evolve (especially by providing stronger cryptographic algorithms)
  • 42. Outside the sandbox - APIs for secure coding • PKI utilities provide means for working with: – certificates – certificate revocation lists (CRL) – OCSP (Online Certificate Status Protocol) – key stores and trust stores (also based on the PKCS - public-key cryptography standards)
  • 43. Outside the sandbox - APIs for secure coding • PKI certificate revocation check (revision): • PKI utilities continue to evolve (especially in providing more support for managing certificates and keys) certificate authorityrevocation checking OCSP CRL certificate certificate
  • 44. Outside the sandbox - APIs for secure coding • JSSE provides an implementation of the TSL/SSL sockets for working with remote communication • JSSE continues to evolve (especially in the support for additional features such as Server Name Identication)
  • 45. Outside the sandbox - APIs for secure coding • Java GSS API provides an alternative of JSSE for secure communication • Java GSS API is a framework for providing token-based security services that is independent of the underlying protocols
  • 46. Outside the sandbox - APIs for secure coding • Java GSS API can be used along with JAAS for authentication purposes • Java GSS API continues to evolve (especially in the support for Kerberos authentication)
  • 47. Outside the sandbox - APIs for secure coding • Java SASL defines a protocol for exchange of authentication data • Java SASL is a framework where external providers give concrete semantics to the authentication data being exchanged
  • 48. Outside the sandbox - APIs for secure coding • Java SASL continues to evolve (especially with support for additional and enhanced properties for exchanging authentication data)
  • 49. Designing and coding with security in mind
  • 50. Designing and coding with security in mind • First of all - follow programing guidelines and best practices - most are not bound to the Java programming language (input validation, error handling, type safety, access modifiers, resource cleanup, prepared SQL queries and whatever you can think of …)
  • 51. Designing and coding with security in mind • Respect the SecurityManager - design libraries so that they work in environments with installed SecurityManager • Example: GSON library does not respect the SecurityManager and cannot be used without additional reflective permissions in some scenarios
  • 52. Designing and coding with security in mind • Grant minimal permissions to code that requires them - the principle of "least privilege" • Copy-pasting, of course, increases the risk of security flows (if the copied code is flawed)
  • 53. Designing and coding with security in mind • Sanitize exception messages from sensitive information - often this results in an unintended exposal of exploitable information • Let alone exception stacktraces … in many cases they convey a wealth of information about the system
  • 55. References • Java Security Overview (white paper) http://www.oracle.com/technetwork/java/js-white-paper- 149932.pdf • Java SE Platform Security Architecture Spec http://docs.oracle.com/javase/7/docs/technotes/guides/sec urity/spec/security-spec.doc.html • Inside Java 2 Platform Security, 2nd edition http://www.amazon.com/Inside-Java%C2%BF-Platform- Security-Implementation/dp/0201787911
  • 56. References • Java Security, 2nd edition, Scott Oaks http://shop.oreilly.com/product/9780596001575.do • Securing Java, Gary McGraw, Ed Felden http://www.securingjava.com • Secure Coding Guidelines for Java SE http://www.oracle.com/technetwork/java/seccodeguide -139067.html#0
  • 57. References • Java 2 Network Security http://www.amazon.com/JAVA-Network-Security-2nd- Edition/dp/0130155926 • Java Security Documentation http://docs.oracle.com/javase/8/docs/technotes/guides/ security/index.html
  • 58. References • Core Java Security: Class Loaders, Security Managers and Encryption http://www.informit.com/articles/article.aspx?p=118796 7 • Overview of Java Security Models http://docs.oracle.com/cd/E12839_01/core.1111/e1004 3/introjps.htm#CHDCEJGH

Notas del editor

  1. The code source on the other hand contains the URL location, the list of signers and the list of certificates
  2. The code source on the other hand contains the URL location, the list of signers and the list of certificates
  3. The code source on the other hand contains the URL location, the list of signers and the list of certificates
  4. The code source on the other hand contains the URL location, the list of signers and the list of certificates
  5. The code source on the other hand contains the URL location, the list of signers and the list of certificates
  6. A typical scenario – in a single multiuser operating system we may have multiple users accessing the same applet from the browser – we may want to define permissions based on the currently logged-in user by providing integration with e.g. Kerberos (in case of a Windows OS)
  7. An AccessControlContext keeps the list of protection domains for the current thread
  8. An AccessControlContext keeps the list of protection domains for the current thread
  9. There are two main differences in using a SecurityManager and an AccessController: The SecurityManager needs to be installed while AccessController only provides static methods The SecurityManager can be customized while AccessController provides additional algorithms that can be used over the default security model
  10. There are two main differences in using a SecurityManager and an AccessController: The SecurityManager needs to be installed while AccessController only provides static methods The SecurityManager can be customized while AccessController provides additional algorithms that can be used over the default security model
  11. Calling code with a different JAAS subject is similar to the Unix setuid utility