|
The Mobile Information Device Profile (MIDP), which is built on top of the Connected Limited Device Configuration Profile (CLDC), allows you to develop wireless Java applications that can be downloaded over the air from open networks. Once downloaded, they can run on the user's device. Should the user be worried about security issues, such as corrupting the cellular phone, deleting data from the device, or transferring data to a remote server? This article explains wireless Java security issues and solutions. The Java 2 Standard Edition (J2SE) security mechanisms are not suitable for the CLDC/MIDP mainly due to the memory required by these mechanisms. This article presents a brief overview of the J2SE and applet sandbox security model, then it:
Overview of J2SE Security The Java security model is composed of three layers:
At the language layer, Java achieves its safety in different ways. First, Java strictly defines that all primitive data types are of a specific size, and independent of the machine architecture. Second, pointer arithmetic and forging access to objects cannot be done. Third, Java provides array-bound checking. Therefore, an attempt to index an out-of-bound item of an array will throw an exception. Finally, Java ensures that casting one object to another is a legal operation. The Java compiler and runtime system security layer provides the necessary features to ensure that the system is not subverted by invalid code. It provides a simple secure environment consisting of the class file verifier, downloading classes and checking libraries at runtime, and an automated garbage collector. In other words, the role of the class file verifier is to ensure that class files do not execute in any way that is not allowed by the JVM1 specification.
The first two layers ensure that the Java system is not subverted by invalid code, however, they do not provide any mechanism to protect against malicious instructions in a client-server application. The JDK1.0 introduced the The Conventional Sandbox
The three layers are used together to provide a restricted environment known as a
For example, when you visit a homepage with an applet embedded into it, the applet gets downloaded to your machine and runs in the sandbox on your machine. In other words, having applets run in the sandbox means that they cannot read/write local valuable resources (such as your files). Other constraints can be imposed, such as applets cannot establish network connections with hosts other than the ones they are downloaded from. To understand how the
This means when a public method call invokes the system security manager, the system determines whether the operation
Later releases of Java (e.g. JDK1.1 and above) introduced the concept of signed applets and protection domains. Protection domains are used to provide fine-grained access controls by allowing you to implement security policies that state what permissions you want the code to have. A security policy, which can be defined by the user who wants to run the code, is a text file with several grant clauses. The Security of Wireless Java Applications The J2SE security mechanisms are not suitable for CLDC/MIDP devices due to the amount of memory required by these mechanisms. Therefore, some compromises have been made when defining the security model for CLDC/MIDP. The guideline followed is to keep things simple. The focus is on two areas: (1) low-level KVM security and (2) application-level security. Low-level KVM Security In this area, a MIDP application downloaded to the device and executed by the K Virtual Machine (KVM) must not do any harm to the device in which it is running. This can be guaranteed by the Java class file verifier that ensures that the Java class file cannot contain references to invalid memory locations. The Class Verifier In the J2SE Java virtual machine, the class verifier is responsible for rejecting invalid class files. A JVM1 supporting CLDC must be able to reject invalid class files as well, however, the class verification process is expensive and time consuming; therefore, not ideal for small, resource-constrained devices. The KVM designers decided to move most of the verification work off the device and onto the desktop, where the class files are compiled or onto a server machine from which applications are being downloaded. This step (off-device class verification) is referred to as preverification. The device is simply responsible for running a few checks on the preverified class file to ensure that it was verified and is still valid. The KVM rejects any classes that are either invalid or not preverified. The verification process is shown in Figure 2. Please note, for the sake of clarity, we have omitted the process of JAR'ing and JAD'ing.
As Figure 2 illustrates, the new class file verification is a two-phase process:
Application-level Security
The type of security provided by the class verifier is limited to validating that a given Java class is a valid class but not more. Security threats, such as access to external resources (e.g. the file system), infrared devices or network will go unnoticed by the verifier. In J2SE, access to external resources
is controlled by the The CLDC/MIDP Sandbox
The KVM provides a sandbox security model that is different from the conventional Java sandbox model in the sense that it does not control access through the
In summary, the sandbox security model defined by the CLDC does not take advantage of a
For a more detailed list of the features that have been eliminated, please see the article The J2ME Platform: Which APIs come from the J2SE Platform. Overriding System Classes
One of the CLDC and MIDP requirements is the support for dynamic downloading of Java applications to the KVM. One security hole in the KVM would be exposed if the downloaded applications could override the system classes provided in the package Wireless Network Security The question that may come to mind, what has Java done in term of securing the data traveling over the wireless link. The short answer is this is not a Java security problem. This is a major problem, however, if and when mobile commerce takes off. Transferring sensitive data (such as personal information or credit card numbers) over wireless links is not a good idea. An interceptor may be able to capture that data, but if the data captured is encrypted then it would be of little use to the interceptor unless the malicious user knows how to decrypt it. Therefore, one solution for this is to use cryptography, which is the science of secrecy and scrambling data. The idea is to encrypt the data before you transfer it over the wireless link. The receiver receives the encrypted data and decrypts it (provided that s/he knows the decryption key). Currently, e-commerce applications are successfully using the Secure Socket Layer (SSL) developed by Netscape. SSL works nicely with e-commerce and hopefully it will be used for m-commerce as well. Cryptography is outside the scope of this article, however, if you are interested in encrypting data over wireless links, I recommend that you take a look at the Bouncy Castle open source project for Lightweight Cryptography APIs for J2ME. A tutorial on Bouncy Castle APIs is Chapter 12 Protecting Network Data of Jonathan Knudsen book on Wireless Java. Conclusion The Java platform has already proved that it is safe, reliable, and secure for both distributed systems and downloaded applications (applets) into browsers. The safety of the Java platform is important for protecting mobile devices from malicious code. Wireless Java applications are secure since the Java features that pose security problems have been eliminated from the CLDC/MIDP APIs as discussed in this article. More Information
1 As used in this document, the terms "Java virtual machine" or "JVM" mean a virtual machine for the Java platform. Back To Top | ||||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||