...
According to the Java Tutorials [Tutorials 2008],
If you are creating applet code that you will sign, it needs to be placed in a JAR file. The same is true if you are creating application code that may be similarly restricted by running it with a security manager. The reason you need the JAR file is that when a policy file specifies that code signed by a particular entity is permitted one or more operations, such as specific file reads or writes, the code is expected to come from a signed JAR file. (The term "signed code" is an abbreviated way of saying "code in a class file that appears in a JAR file that was signed.")
...
This noncompliant code example demonstrates the JarRunner
application, which can be used to dynamically execute a particular class residing within a JAR file (abridged version of the class in The Java Tutorials [Tutorials 2008]). It creates a JarClassLoader
that loads an application update, plug-in, or patch over an untrusted network such as the Internet. The URL to fetch the code is specified as the first argument (for example, http://www.securecoding.cert.org/software-updates.jar); any other arguments specify the arguments that are to be passed to the class that is loaded. JarRunner
uses reflection to invoke the main()
method of the loaded class. Unfortunately, by default, JarClassLoader
verifies the signature using the public key contained within the JAR file.
...
Automated detection is not feasible in the fully general case. However, an approach similar to Design Fragments [Fairbanks 2007] could assist both programmers and static analysis tools.
...
Improperly Verified Signature [XZR] | |
CWE-300. Channel accessible by non-endpoint (aka "man-in-the-middle") | |
| CWE-319. Cleartext transmission of sensitive information |
| CWE-494. Download of code without integrity check |
| CWE-347. Improper verification of cryptographic signature |
Bibliography
[API 2006] |
|
[Bea 2008] |
|
JAR Signing and Signed bundles and protecting against malicious code | |
| |
Chapter 24, The | |
12.8.3, | |
| |
Signature Validation | |
Chapter 12, Digital Signatures, Signed Classes | |
| |
The |
...