SlideShare una empresa de Scribd logo
1 de 23
Java security
(in a nutshell)
Outline
 components of Java
 Java security models
 main components of the Java security architecture
   – class loaders
   – byte code verification
   – the Security Manager




                                                      2
Components of Java
                      the development environment
                        – development lifecycle
                        – Java language features
                        – class files and bytecode
                      the execution environment
                        – the Java Virtual Machine (JVM)
                      interfaces and architectures
                        – e.g., Java beans, RMI, JDBC, etc.
Components of Java




                                                              3
Components of Java / The Development Environment   Development lifecycle

                                                                            Java                                                       Java
                                                                                                        compiler
                                                                         source code                                                 bytecode

                                                     programmer

                                                   notes
                                                       – Java is a high-level programming language
                                                             source code is English-like (syntax is similar to C)
                                                       – Java is compiled and interpreted
                                                            • source code is compiled into bytecode (low-level, platform independent code)
                                                            • bytecode is interpreted (real machine code produced at run time)
                                                             fast and portable (“write once run anywhere”)
                                                       – dynamic linking (no link phase at compile time)
                                                            • program consists of class definitions
                                                            • each class is compiled into a separate class file
                                                            • classes may refer to each other, references are resolved at run-time

                                                                                                                                                4
Java language features
                                                      object-oriented
Components of Java / The Development Environment




                                                      multi-threaded
                                                      strongly typed
                                                      exception handling
                                                      very similar to C/C++, but cleaner and simpler
                                                       –   no more struct and union
                                                       –   no more (stand alone) functions
                                                       –   no more multiple inheritance
                                                       –   no more operator overloading
                                                       –   no more pointers
                                                    garbage collection
                                                       – objects no longer in use are removed automatically from memory


                                                                                                                          5
Class files
                                                    contain
Components of Java / The Development Environment




                                                      – magic number (0xCAFEBABE)
                                                      – JVM major and minor version
                                                      – constant pool
                                                           • contains
                                                                – constants (e.g., strings) used by this class
                                                                – names of classes, fields, and methods that are referred to by this class
                                                           • used as a symbol table for linking purposes
                                                           • many bytecode instructions take as arguments numbers which are used as
                                                             indexes into the constant pool
                                                      –   class information (e.g., name, super class, access flags, etc.)
                                                      –   description of interfaces, fields, and methods
                                                      –   attributes (name of the source file)
                                                      –   bytecode


                                                                                                                                             6
The Java Virtual Machine (JVM)

                                                                                                                                   JVM
Components of Java / The Execution Environment




                                                                     class loader    class file          heap
                                                     network                                                               JIT
                                                                       instance       verifier
                                                                                                      class
                                                                                                      area
                                                       local          primordial                                        execution
                                                                     class loader                                        engine
                                                 untrusted classes

                                                  trusted classes
                                                                     native method                   native method       Security
                                                  native methods         loader                           area           Manager




                                                                                           operating system



                                                                                                                     native code
                                                                                                                     Java code

                                                                                                                                     7
JVM cont’d
                                                  class loaders
                                                     – locate and load classes into the JVM
Components of Java / The Execution Environment




                                                     – primordial class loader
                                                         • loads trusted classes (system classes found on the boot class path)
                                                         • integral part of the JVM
                                                     – class loader instances
                                                         • instances of java.net.URLClassLoader (which extends SecureClassLoader)
                                                         • load untrusted classes from the local file system or from the network and
                                                           passes them to the class file verifier
                                                         • application developers can implement their own class loaders
                                                  class file verifier
                                                     – checks untrusted class files
                                                         • size and structure of the class file
                                                         • bytecode integrity (references, illegal operations, …)
                                                         • some run-time characteristics (e.g., stack overflow)
                                                     – a class is accepted only if it passes the test
                                                                                                                                       8
JVM cont’d
                                                  native method loader
                                                    – native methods are needed to access some of the underlying operating
Components of Java / The Execution Environment




                                                      system functions (e.g., graphics and networking features)
                                                    – once loaded, native code is stored in the native method area for easy
                                                      access
                                                  the heap
                                                    – memory used to store objects during execution
                                                    – how objects are stored is implementation specific
                                                  execution engine
                                                    – a virtual processor that executes bytecode
                                                    – has virtual registers, stack, etc.
                                                    – performs memory management, thread management, calls to native
                                                      methods, etc.


                                                                                                                              9
JVM cont’d
                                                  Security Manager
                                                    – enforces access control at run-time (e.g., prevents applets from reading
Components of Java / The Execution Environment




                                                      or writing to the file system, accessing the network, printing, ...)
                                                    – application developers can implement their own Security Manager
                                                    – or use the policy based SM implementation provided by the JDK
                                                  JIT – Just In Time compiler
                                                    – performance overhead due to interpreting bytecode
                                                    – translates bytecode into native code on-the-fly
                                                        • works on a method-by-method basis
                                                        • the first time a method is called, it is translated into native code and stored
                                                          in the class area
                                                        • future calls to the same method run the native code
                                                    – all this happens after the class has been loaded and verified


                                                                                                                                        10
Java security models
                          the need for Java security
                          the sandbox (Java 1.0)
                          the concept of trusted code (Java 1.1)
                          fine grained access control (Java 2)
Java security models




                                                                    11
The need for Java security
                        code mobility can be useful (though not indispensable)
                          – may reduce bandwidth requirements
                          – improve functionality of web services
                        but downloaded executable content is dangerous
                          – the source may be unknown hence untrusted
                          – hostile applets may modify or destroy data in your file system
                          – hostile applets may read private data from your file system
                          – hostile applets may install other hostile code on your system (e.g.,
                            virus, back-door, keyboard sniffer, …)
                          – hostile applets may try to attack someone else from your system
Java security models




                            (making you appear as the responsible for the attack)
                          – hostile applets may use (up) the resources of your system (DoS)
                          – all this may happen without you knowing about it


                                                                                                   12
The sandbox
                       idea: limit the resources that can be accessed by applets

                                                                     JVM

                                     local code                            sandbox

                                  remote code
                                     (applets)


                                                                   resources


                           – introduced in Java 1.0
Java security models




                           – local code had unrestricted access to resources
                           – downloaded code (applet) was restricted to the sandbox
                                • cannot access the local file system
                                • cannot access system resources,
                                • can establish a network connection only with its originating web server

                                                                                                            13
The concept of trusted code
                       idea: applets that originate from a trusted source could be trusted

                                                                 JVM
                                    local code

                                                          signed and      sandbox
                                  remote code             trusted
                                     (applets)             unsigned, or
                                                            signed and
                                                              untrusted

                                                               resources
Java security models




                           – introduced in Java 1.1
                           – applets could be digitally signed
                           – unsigned applets and applets signed by an untrusted principal were restricted
                             to the sandbox
                           – local applications and applets signed by a trusted principal had unrestricted
                             access to resources
                                                                                                             14
Fine grained access control
                       idea: every code (remote or local) has access to the system resources based on what is
                           defined in a policy file
                                                                                                            JVM


                        local or remote code
                                                            class loaders
                        (signed or unsigned)



                                            policy
                                             file
                                                                                     resources
Java security models




                            –   introduced in Java 2
                            –   a protection domain is an association of a code source and the permissions granted
                            –   the code source consists of a URL and an optional signature
                            –   permissions granted to a code source are specified in the policy file
                                  grant CodeBase “http://java.sun.com”, SignedBy “Sun” {
                                    permission java.io.FilePermission “${user.home}${/}*”, “read, write”;
                                    permission java.net.SocketPermission “localhost:1024-”, “listen”;};
                                                                                                                     15
The three pillars of Java security
                                                the Security Manager
                                                class loaders
                                                the bytecode verifier
Components of the Java security architecture




                                                                                    16
The Security Manager
                                                ensures that the permissions specified in the policy file are not
                                                 overridden
                                                implements a checkPermission() method, which
Components of the Java security architecture




                                                  – takes a permission object as parameter, and
                                                  – returns a yes or a no (based on the code source and the permissions
                                                    granted for that code source in the policy file)
                                                checkPermission() is called from trusted system classes
                                                  – e.g., if you want to open a socket you need to create a Socket object
                                                  – the Socket class is a trusted system class that always invokes the
                                                    checkPermission() method
                                                this requires that
                                                  – all system resources are accessible only via trusted system classes
                                                  – trusted system classes cannot be overwritten (ensured by the class
                                                    loading mechanism)
                                                                                                                            17
The Security Manager cont’d
                                                the JVM allows only one SM to be active at a time
                                                there is a default SM provided by the JDK
                                                Java programs (applications, applets, beans, …) can replace
Components of the Java security architecture




                                                 the default SM by their own SM only if they have permission to
                                                 do so
                                                  – two permissions are needed:
                                                       • create an instance of SecurityManager
                                                       • set an SM instance as active
                                                  – example:
                                                      grant CodeBase “…”, SignedBy “…” {
                                                         permission java.lang.RuntimePermission “createSecurityManager”;
                                                         permission java.lang.RuntimePermission “setSecurityManager”;};
                                                  – invoking the SecurityManager constructor or the setSecurityManager() method
                                                    will call the checkPermissions() method of the current SM and verify if the caller
                                                    has the needed permissions
                                                                                                                                    18
Class loaders
                                                separate name spaces
                                                  – classes loaded by a class loader instance belong to the same name
                                                    space
Components of the Java security architecture




                                                  – since classes with the same name may exist on different Web sites,
                                                    different Web sites are handled by different instances of the applet class
                                                    loader
                                                  – a class in one name space cannot access a class in another name space
                                                   classes from different Web sites cannot access each other
                                                establish the protection domain (set of permissions) for a
                                                 loaded class
                                                enforce a search order that prevents trusted system classes
                                                 from being replaced by classes from less trusted sources
                                                  – see next two slide …


                                                                                                                           19
Class loading process
                                               when a class is referenced
                                                JVM: invokes the class loader associated with the requesting program
                                                class loader: has the class already been loaded?
Components of the Java security architecture




                                                  – yes:
                                                       • does the program have permission to access the class?
                                                           – yes: return object reference
                                                           – no: security exception
                                                  – no:
                                                       • does the program have permission to create the requested class?
                                                           – yes:
                                                                » first delegate loading task to parent
                                                                » if parent returns success, then return (class is loaded)
                                                                » if parent returned failure, then load class and return
                                                           – no: security exception
                                                                                                                             20
Class loading task delegation

                                                       primordial class loader
                                                                                    4a        loads class from
                                                           (searches on
                                                        the boot class path)                  boot class path
Components of the Java security architecture




                                                           3           4b failure

                                                       a class loader instance
                                                       started at JVM startup       5a        loads class from
                                                            (searches on                      class path
                                                           the class path)

                                                           2           5b success / failure

                                                       a class loader instance
                                                       associated with a URL        6
                                                                                          loads class from URL
                                                        (searches on the site
                                                        specified by the URL)

                                                            1
                                                       class request
                                                                                                                 21
Byte code verifier
                                                performs static analysis of the bytecode
                                                  – syntactic analysis
                                                      • all arguments to flow control instructions must cause branches to the start
                                                        of a valid instruction
Components of the Java security architecture




                                                      • all references to local variables must be legal
                                                      • all references to the constant pool must be to an entry of appropriate type
                                                      • all opcodes must have the correct number of arguments
                                                      • exception handlers must start at the beginning of a valid instruction
                                                      • …
                                                  – data flow analysis
                                                      • attempts to reconstruct the behavior of the code at run time without
                                                        actually running the code
                                                      • keeps track only of types not the actual values in the stack and in local
                                                        variables
                                                  – it is theoretically impossible to identify all problems that may occur at
                                                    run time with static analysis


                                                                                                                                    22
Comparison with ActiveX
 ActiveX controls contain native code
 security is based on the concept of trusted code
   – ActiveX controls are signed
   – if signer is trusted, then the control is trusted too
   – once trusted, the control has full access to resources
 not suitable to run untrusted code
   – no sandbox mechanism




                                                              23

Más contenido relacionado

La actualidad más candente (20)

Jsp lifecycle
Jsp   lifecycleJsp   lifecycle
Jsp lifecycle
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
Java Multithreading and Concurrency
Java Multithreading and ConcurrencyJava Multithreading and Concurrency
Java Multithreading and Concurrency
 
OOP java
OOP javaOOP java
OOP java
 
servlet in java
servlet in javaservlet in java
servlet in java
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Thread priorities
Thread prioritiesThread priorities
Thread priorities
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
JVM
JVMJVM
JVM
 
Java rmi
Java rmiJava rmi
Java rmi
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
Applets
AppletsApplets
Applets
 
Java database connectivity with MySql
Java database connectivity with MySqlJava database connectivity with MySql
Java database connectivity with MySql
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Java notes
Java notesJava notes
Java notes
 
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
 

Destacado

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
 
Security Architecture of the Java platform
Security Architecture of the Java platformSecurity Architecture of the Java platform
Security Architecture of the Java platformMartin Toshev
 
Security via Java
Security via JavaSecurity via Java
Security via JavaBahaa Zaid
 
JBoss Negotiation in AS7
JBoss Negotiation in AS7JBoss Negotiation in AS7
JBoss Negotiation in AS7Josef Cacek
 
Java Secure Coding Practices
Java Secure Coding PracticesJava Secure Coding Practices
Java Secure Coding PracticesOWASPKerala
 
"CERT Secure Coding Standards" by Dr. Mark Sherman
"CERT Secure Coding Standards" by Dr. Mark Sherman"CERT Secure Coding Standards" by Dr. Mark Sherman
"CERT Secure Coding Standards" by Dr. Mark ShermanRinaldi Rampen
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Martin Toshev
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculasAnkush Kumar
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Codingbilcorry
 
CIS14: Best Practices You Must Apply to Secure Your APIs
CIS14: Best Practices You Must Apply to Secure Your APIsCIS14: Best Practices You Must Apply to Secure Your APIs
CIS14: Best Practices You Must Apply to Secure Your APIsCloudIDSummit
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practicesScott Hurrey
 
Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Josef Cacek
 
Secure Coding for Java - An Introduction
Secure Coding for Java - An IntroductionSecure Coding for Java - An Introduction
Secure Coding for Java - An IntroductionSebastien Gioria
 
Spring Security
Spring SecuritySpring Security
Spring SecurityBoy Tech
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleSpringPeople
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMMikhail Egorov
 
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Matt Raible
 

Destacado (20)

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
 
Security Architecture of the Java platform
Security Architecture of the Java platformSecurity Architecture of the Java platform
Security Architecture of the Java platform
 
Security via Java
Security via JavaSecurity via Java
Security via Java
 
Jar signing
Jar signingJar signing
Jar signing
 
JBoss Negotiation in AS7
JBoss Negotiation in AS7JBoss Negotiation in AS7
JBoss Negotiation in AS7
 
Java Secure Coding Practices
Java Secure Coding PracticesJava Secure Coding Practices
Java Secure Coding Practices
 
"CERT Secure Coding Standards" by Dr. Mark Sherman
"CERT Secure Coding Standards" by Dr. Mark Sherman"CERT Secure Coding Standards" by Dr. Mark Sherman
"CERT Secure Coding Standards" by Dr. Mark Sherman
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculas
 
415212 415212
415212 415212415212 415212
415212 415212
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
 
CIS14: Best Practices You Must Apply to Secure Your APIs
CIS14: Best Practices You Must Apply to Secure Your APIsCIS14: Best Practices You Must Apply to Secure Your APIs
CIS14: Best Practices You Must Apply to Secure Your APIs
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014Java Security Manager Reloaded - Devoxx 2014
Java Security Manager Reloaded - Devoxx 2014
 
Secure Coding for Java - An Introduction
Secure Coding for Java - An IntroductionSecure Coding for Java - An Introduction
Secure Coding for Java - An Introduction
 
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
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeople
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORM
 
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
 

Similar a Java security

Introduction to java by priti sajja
Introduction to java by priti sajjaIntroduction to java by priti sajja
Introduction to java by priti sajjaPriti Srinivas Sajja
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaVisual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaMicro Focus
 
JAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptxJAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptx20EUEE018DEEPAKM
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to javamanish kumar
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVAHome
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6bestip
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMshamnasain
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.pptHaymanotTadese
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdprat0ham
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 

Similar a Java security (20)

Introduction to java by priti sajja
Introduction to java by priti sajjaIntroduction to java by priti sajja
Introduction to java by priti sajja
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaVisual COBOL Development for Unix and Java
Visual COBOL Development for Unix and Java
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
 
Understanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual MachineUnderstanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual Machine
 
JAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptxJAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptx
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
FEATURES OF JAVA
FEATURES OF JAVAFEATURES OF JAVA
FEATURES OF JAVA
 
Curso de Programación Java Intermedio
Curso de Programación Java IntermedioCurso de Programación Java Intermedio
Curso de Programación Java Intermedio
 
Java Starting
Java StartingJava Starting
Java Starting
 
Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to java
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 

Último

VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...SUHANI PANDEY
 
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一ougvy
 
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7shivanni mehta
 
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men 🔝Muzaffarpur🔝 ...
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men  🔝Muzaffarpur🔝  ...➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men  🔝Muzaffarpur🔝  ...
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men 🔝Muzaffarpur🔝 ...amitlee9823
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...motiram463
 
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证tufbav
 
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in DammamAbortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammamahmedjiabur940
 
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...gajnagarg
 
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...gajnagarg
 
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...amitlee9823
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证ehyxf
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja Nehwal
 
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证tufbav
 
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...gajnagarg
 
SM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdfSM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdfStefanoBiamonte1
 

Último (20)

VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
 
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
 
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
 
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men 🔝Muzaffarpur🔝 ...
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men  🔝Muzaffarpur🔝  ...➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men  🔝Muzaffarpur🔝  ...
➥🔝 7737669865 🔝▻ Muzaffarpur Call-girls in Women Seeking Men 🔝Muzaffarpur🔝 ...
 
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
 
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
 
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
 
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in DammamAbortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
 
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Berhampur Escorts ☎️9352988975 Two shot with one gir...
 
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...
Just Call Vip call girls Begusarai Escorts ☎️9352988975 Two shot with one gir...
 
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...
Hosa Road Call Girls Service: ☎ 7737669865 ☎ High Profile Model Escorts | Ban...
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
 
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Dharwad 7001035870 Whatsapp Number, 24/07 Booking
 
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证
怎样办理斯威本科技大学毕业证(SUT毕业证书)成绩单留信认证
 
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Bhiwandi Escorts ☎️9352988975 Two shot with one girl...
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdfSM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdf
 

Java security

  • 2. Outline  components of Java  Java security models  main components of the Java security architecture – class loaders – byte code verification – the Security Manager 2
  • 3. Components of Java  the development environment – development lifecycle – Java language features – class files and bytecode  the execution environment – the Java Virtual Machine (JVM)  interfaces and architectures – e.g., Java beans, RMI, JDBC, etc. Components of Java 3
  • 4. Components of Java / The Development Environment Development lifecycle Java Java compiler source code bytecode programmer notes – Java is a high-level programming language  source code is English-like (syntax is similar to C) – Java is compiled and interpreted • source code is compiled into bytecode (low-level, platform independent code) • bytecode is interpreted (real machine code produced at run time)  fast and portable (“write once run anywhere”) – dynamic linking (no link phase at compile time) • program consists of class definitions • each class is compiled into a separate class file • classes may refer to each other, references are resolved at run-time 4
  • 5. Java language features  object-oriented Components of Java / The Development Environment  multi-threaded  strongly typed  exception handling  very similar to C/C++, but cleaner and simpler – no more struct and union – no more (stand alone) functions – no more multiple inheritance – no more operator overloading – no more pointers  garbage collection – objects no longer in use are removed automatically from memory 5
  • 6. Class files  contain Components of Java / The Development Environment – magic number (0xCAFEBABE) – JVM major and minor version – constant pool • contains – constants (e.g., strings) used by this class – names of classes, fields, and methods that are referred to by this class • used as a symbol table for linking purposes • many bytecode instructions take as arguments numbers which are used as indexes into the constant pool – class information (e.g., name, super class, access flags, etc.) – description of interfaces, fields, and methods – attributes (name of the source file) – bytecode 6
  • 7. The Java Virtual Machine (JVM) JVM Components of Java / The Execution Environment class loader class file heap network JIT instance verifier class area local primordial execution class loader engine untrusted classes trusted classes native method native method Security native methods loader area Manager operating system native code Java code 7
  • 8. JVM cont’d  class loaders – locate and load classes into the JVM Components of Java / The Execution Environment – primordial class loader • loads trusted classes (system classes found on the boot class path) • integral part of the JVM – class loader instances • instances of java.net.URLClassLoader (which extends SecureClassLoader) • load untrusted classes from the local file system or from the network and passes them to the class file verifier • application developers can implement their own class loaders  class file verifier – checks untrusted class files • size and structure of the class file • bytecode integrity (references, illegal operations, …) • some run-time characteristics (e.g., stack overflow) – a class is accepted only if it passes the test 8
  • 9. JVM cont’d  native method loader – native methods are needed to access some of the underlying operating Components of Java / The Execution Environment system functions (e.g., graphics and networking features) – once loaded, native code is stored in the native method area for easy access  the heap – memory used to store objects during execution – how objects are stored is implementation specific  execution engine – a virtual processor that executes bytecode – has virtual registers, stack, etc. – performs memory management, thread management, calls to native methods, etc. 9
  • 10. JVM cont’d  Security Manager – enforces access control at run-time (e.g., prevents applets from reading Components of Java / The Execution Environment or writing to the file system, accessing the network, printing, ...) – application developers can implement their own Security Manager – or use the policy based SM implementation provided by the JDK  JIT – Just In Time compiler – performance overhead due to interpreting bytecode – translates bytecode into native code on-the-fly • works on a method-by-method basis • the first time a method is called, it is translated into native code and stored in the class area • future calls to the same method run the native code – all this happens after the class has been loaded and verified 10
  • 11. Java security models  the need for Java security  the sandbox (Java 1.0)  the concept of trusted code (Java 1.1)  fine grained access control (Java 2) Java security models 11
  • 12. The need for Java security  code mobility can be useful (though not indispensable) – may reduce bandwidth requirements – improve functionality of web services  but downloaded executable content is dangerous – the source may be unknown hence untrusted – hostile applets may modify or destroy data in your file system – hostile applets may read private data from your file system – hostile applets may install other hostile code on your system (e.g., virus, back-door, keyboard sniffer, …) – hostile applets may try to attack someone else from your system Java security models (making you appear as the responsible for the attack) – hostile applets may use (up) the resources of your system (DoS) – all this may happen without you knowing about it 12
  • 13. The sandbox idea: limit the resources that can be accessed by applets JVM local code sandbox remote code (applets) resources – introduced in Java 1.0 Java security models – local code had unrestricted access to resources – downloaded code (applet) was restricted to the sandbox • cannot access the local file system • cannot access system resources, • can establish a network connection only with its originating web server 13
  • 14. The concept of trusted code idea: applets that originate from a trusted source could be trusted JVM local code signed and sandbox remote code trusted (applets) unsigned, or signed and untrusted resources Java security models – introduced in Java 1.1 – applets could be digitally signed – unsigned applets and applets signed by an untrusted principal were restricted to the sandbox – local applications and applets signed by a trusted principal had unrestricted access to resources 14
  • 15. Fine grained access control idea: every code (remote or local) has access to the system resources based on what is defined in a policy file JVM local or remote code class loaders (signed or unsigned) policy file resources Java security models – introduced in Java 2 – a protection domain is an association of a code source and the permissions granted – the code source consists of a URL and an optional signature – permissions granted to a code source are specified in the policy file grant CodeBase “http://java.sun.com”, SignedBy “Sun” { permission java.io.FilePermission “${user.home}${/}*”, “read, write”; permission java.net.SocketPermission “localhost:1024-”, “listen”;}; 15
  • 16. The three pillars of Java security  the Security Manager  class loaders  the bytecode verifier Components of the Java security architecture 16
  • 17. The Security Manager  ensures that the permissions specified in the policy file are not overridden  implements a checkPermission() method, which Components of the Java security architecture – takes a permission object as parameter, and – returns a yes or a no (based on the code source and the permissions granted for that code source in the policy file)  checkPermission() is called from trusted system classes – e.g., if you want to open a socket you need to create a Socket object – the Socket class is a trusted system class that always invokes the checkPermission() method  this requires that – all system resources are accessible only via trusted system classes – trusted system classes cannot be overwritten (ensured by the class loading mechanism) 17
  • 18. The Security Manager cont’d  the JVM allows only one SM to be active at a time  there is a default SM provided by the JDK  Java programs (applications, applets, beans, …) can replace Components of the Java security architecture the default SM by their own SM only if they have permission to do so – two permissions are needed: • create an instance of SecurityManager • set an SM instance as active – example: grant CodeBase “…”, SignedBy “…” { permission java.lang.RuntimePermission “createSecurityManager”; permission java.lang.RuntimePermission “setSecurityManager”;}; – invoking the SecurityManager constructor or the setSecurityManager() method will call the checkPermissions() method of the current SM and verify if the caller has the needed permissions 18
  • 19. Class loaders  separate name spaces – classes loaded by a class loader instance belong to the same name space Components of the Java security architecture – since classes with the same name may exist on different Web sites, different Web sites are handled by different instances of the applet class loader – a class in one name space cannot access a class in another name space  classes from different Web sites cannot access each other  establish the protection domain (set of permissions) for a loaded class  enforce a search order that prevents trusted system classes from being replaced by classes from less trusted sources – see next two slide … 19
  • 20. Class loading process when a class is referenced  JVM: invokes the class loader associated with the requesting program  class loader: has the class already been loaded? Components of the Java security architecture – yes: • does the program have permission to access the class? – yes: return object reference – no: security exception – no: • does the program have permission to create the requested class? – yes: » first delegate loading task to parent » if parent returns success, then return (class is loaded) » if parent returned failure, then load class and return – no: security exception 20
  • 21. Class loading task delegation primordial class loader 4a loads class from (searches on the boot class path) boot class path Components of the Java security architecture 3 4b failure a class loader instance started at JVM startup 5a loads class from (searches on class path the class path) 2 5b success / failure a class loader instance associated with a URL 6 loads class from URL (searches on the site specified by the URL) 1 class request 21
  • 22. Byte code verifier  performs static analysis of the bytecode – syntactic analysis • all arguments to flow control instructions must cause branches to the start of a valid instruction Components of the Java security architecture • all references to local variables must be legal • all references to the constant pool must be to an entry of appropriate type • all opcodes must have the correct number of arguments • exception handlers must start at the beginning of a valid instruction • … – data flow analysis • attempts to reconstruct the behavior of the code at run time without actually running the code • keeps track only of types not the actual values in the stack and in local variables – it is theoretically impossible to identify all problems that may occur at run time with static analysis 22
  • 23. Comparison with ActiveX  ActiveX controls contain native code  security is based on the concept of trusted code – ActiveX controls are signed – if signer is trusted, then the control is trusted too – once trusted, the control has full access to resources  not suitable to run untrusted code – no sandbox mechanism 23