|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
In addition to strong typing and overflow protection, Suns engineers also took advantage of the object-oriented nature of the language itself to add security. With the exception of the primitive types, everything in Java is a basic object. This strict adherence to object-oriented methodology means that all the theoretical benefits of object-oriented programming (OOP) are realized in Java. These include
Every Java object has a unique hash code associated with it. This feature enables the current state of a Java program to be fully inventoried at any time, enabling the Java Virtual Machine to watch for unauthorized objects. How Java Provides Security over the InternetBecause of the protection of the JVM and the language itself, most users can run most applets and be confident that the applet will play in its own sandbox without interfering with system resources on the end users machine. Sometimes, however, you need to write an applet that accesses those system resources, and the end user is willing to trust that you wont damage his or her system or steal confidential information. The problem is that an end user downloading your applets over the Internet could be duped into running malicious applets written by someone else. Figure 41.3 illustrates the problem, known as the man-in-the-middle attack.
In this example, Bob has connected to Alices server. His browser downloaded a Web page that included an applet. In reality, Charlie has programmed his server to intercept the applet on its way to Bob and substitute Charlies version of the applet. While Bob thinks hes trusting Alices applet, in reality he has opened his system to a malicious applet written by Charlie.
The solution to this problem is offered by an applet-level security mechanism called the JavaSecurity API. (An API is an Application Programming Interfacea way for a library developer to give the programmer access to a set of features.) One of the capabilities offered in the JavaSecurity API is digital signing. To use this capability, bundle your Java class files and any related files that your applet needs into a Java archive (JAR). You then electronically sign the JAR file. When the end user retrieves the JAR from your server, he or she can verify your signature. If a man in the middle attempts to substitute a different applet, the signature will not verify and the end user is warned about the forgery.
Applets Versus ActiveX ControlsThe only serious competitor to Java applets is offered by Microsoft and is called ActiveX controls. ActiveX controls are an Internet version of an older standard, called OCX controls. These controls can be written in any language and can do anything that anyone can do in that language. No technical reason prevents an ActiveX programmer from writing a trojan horse that deletes every file on your hard drive or that copies confidential information back to the Internet. Microsoft has tried to address this problem by encouraging ActiveX developers to use their code-signing facility, making ActiveX controls proof against man-in-the-middle attacks. Suns approach, with Java, is different, with security checks built into the language itself. As youll see, Sun also supports signed applets, which the end user may choose to trust. The Microsoft WayMicrosofts approach means that every ActiveX control functions like a trusted Java applet. Because most end users will not want to download unsigned ActiveX controls, no equivalent exists to the untrusted applet, in which security is ensured by the Java sandbox. If an end user chooses to trust all ActiveX controls, sooner or later the end users machine may fall victim to an attack. With most attacks, it may be difficult to determine which ActiveX control was responsible. An ActiveX control could replace a system file such as move.exe, for example, and then alter itself so the malicious part of the ActiveX control was deleted. The next time the end user attempts to move a file, the trojan horse version of move.exe runs, accomplishing the malicious programmers objective. Even if the end user detects the problem, it will be difficult to trace the problem back to the specific ActiveX control.
Java Browser RestrictionsSun recommends that browser vendors limit applets by enforcing three rules. These rules are enforced by the Sun code licensed by major browser vendors, such as Netscape Communications and Microsoft, as well as by the Sun Java plug-in:
The first rule closes most security holes. If an applet cannot read the local hard drive, it cannot access most confidential information. If it cannot write the hard drive, it cannot plant viruses or trojan horses. The second rule makes it less likely that the user will inadvertently enter confidential information (such as a credit card number) into an untrusted applet.
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |