200 likes | 381 Views
Chris Durham CSCI 297 May 26 th 2005. Java Security. Java Security , David Wheeler, April 2000 [A4] JAC: An Aspect Based Distributed Dynamic Framework , R. Pawlak et. al., December 2002 [A5]. Papers. Overview. Language Support (and problems) w/r/t Security [A4]
E N D
Chris Durham CSCI 297 May 26th 2005 Java Security
Java Security, David Wheeler, April 2000 [A4] JAC: An Aspect Based Distributed Dynamic Framework, R. Pawlak et. al., December 2002 [A5] Papers
Overview Language Support (and problems) w/r/t Security [A4] • 1.0, 1.1, 2; Sun vs Netscape vs MS • Protection Domains • several 'new' enhancements Environmental and 'aspect' security w/JAC [A5] • protection from/for environment and 'incorrectness' • what is an 'aspect'? • wrappers, example
Java 1.0 Security Policy • Applets in a Sandbox • no access to filesystem, libraries or programs, cannot manipulate basic classes • network access only to source of load • Applications no limits; can code a policy • SecurityManager class, check____() methods. • If no security Manager class, then all privs granted • ByteCodeVerifier, ClassLoader
Java 1.1 • Jar files: collect and optionally sign multiple files • JCA: Java Cryptography Architecture, Framework for crypto providers, minimal key and certificate management
Problems? 1.0 and 1.1 Issues
Problems with 1.0 and 1.1 • New Privileges hard to implement – methods added to SecurityManager class. • Sandbox limits functionality • so-called 'trusted' programs given a lot of leeway Netscape: Capbilities API: request privilege, UI asks for confirmation, privilege disabled on method return Microsoft: CAB vs JAR, Trust-based: zones (local, Intranet, Internet) and priv sets (High, Med, Low)
Java 2: Protection Domains • Policy object for a user: • CodeSource: Where code comes from (+ opt. signature) • Permissions: What user can do • ProtectionDomain: each class has one, contains set of permissions + CodeSource
Java 2: Protection Domains • If an object calls a method in a different object that requires a particular permission, and the two objects' classes are in different Protection Domains, what happens? • if permission exists in each Domain, then allow it, (based on intersection of permissions) • GuardedObject class protects individual instances of an object
Standard Permission (sub)Classes • FilePermission • file, directory, all files in a directory, paths, etc • rights: read,write,execute,delete • SocketPermission • IP/network or host(s)/domain(s) • ports (range) • rights: accept, connect, listen, resolve ... • PropertyPermission
lack of formal security model; insecure defaults hard to prove correctness dependencies weak against DoS, slow Sec Policy mgmt difficult Sec Policy mgmt flexible Java Security +/- 's • allows 'controlled' execution of other code • portability • Sun's source viewable • fine grained perms • Sec Policy mgmt flexible
'Future' (in 2000) • JAAS: PAM-like Authentication and Authorization service; user-centric as opposed to code centric control • JSSE: SSL for Java, (I don't see it much at all)
JAC: Java Aspect Components None of what we have talked about so far protects your code from things such as: • environmental issues • incorrect coding • dynamic reconfiguration concerns Aspect Programming can Help - How? http://www.onjava.com/pub/a/onjava/2004/01/14/aop.html
JAC Framework • 'wrap' existing code with new functionality • can use pre-defined wrappers (counters, authentication, trace and debug) etc. or write your own. • JAC is a framework, do not have to modify existing code, your code runs within the framework, framework 'intercepts' calls to methods • pre-defined wrappers require only a config file • Differs from similar project AspectJ in that JAC has the predefined aspects and can be dynamically 'woven', also works in a distributed environment, whereas AspectJ cannot
JAC/AOP: Terms • pointcut: Place in code where issues/concerns arise/need to be addressed .. pointcut() is a method in the aspect class that defines what classes and methods are going to be affected by the aspect • advice: the additional code • aspect: pointcut + advice (where + what) • wrapper: a class you extend to provide code (advice) that will be executed when a pointcut() occurs • weave: process of adding/removing aspects • crosscutting concerns: things that concern 'independent' objects
Example w/ Predefined Aspects JAC Source: http://jac.openweb.org Adventure game from Csci 210: Keep track of the number of times you pick up any treasure JAC file: adventure.jac applicationName: Adventure launchingClass: Adventure aspects: \ org.objectweb.jac.aspects.tracing.SimpleCountingWrapper counter.acc true
acc file counter.acc file: addTrace "ALL" "*StdCmds*", "*get*"; execution: java -jar jac.jar -C ./Adventure.jar adventure.jac But I cannot instantiate SimpleCountingWrapper ! argh
PreDefined Aspects • AuthenticationAC • ConfirmationAC • TransactionAC others... see: http://jac.objectweb.org/docs/programmer_guide_body.html
Hand-Written Aspects See: MyAC.java
Summary for JACS JACS provides a way to 'extend' existing code without having to recompile it. Takes existing code into a Framework and executes it there, thus allowing methods to be 'intercepted' at some predefined points to do checking or add additional functionality