You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The feature of code signing was introduced in Java to provide an alternative mechanism for granting elevated privileges to code depending on the security policy in effect. For example, Java applets that need to read system properties from a user's machine can escape the default sandbox restrictions by prompting the user with a security dialog, about whether the party that signed the code is considered trustworthy. This element of trusting the signature allows applets to escape the default security sandbox. On the other hand, in the presence of a custom security policy, explicit permissions need to be granted to the particular codebase and signer. This has the benefit of ensuring that only trusted signed code runs with the specified privileges.

Signing code, however, has its own demerits. According to Schneier [[Schneier 00]]:

First, users have no idea how to decide if a particular signer is trusted or not. Second, just because a component is signed doesn't mean that it is safe. Third, just because two components are individually signed does not mean that using them together is safe; lots of accidental harmful interactions can be exploited. Fourth, "safe" is not an all-or-nothing thing; there are degrees of safety. And fifth, the fact that the evidence of attack (the signature on the code) is stored on the computer under attack is mostly useless: The attacker could delete or modify the signature during the attack, or simply reformat the drive where the signature is stored."

Code signing is designed primarily to verify authenticity of origin and integrity of the code. It relies on the Certification Authority (CA) to duly confirm the identity of the principal signer. Naive users should not be expected to understand how certificates and the PKI work. All too often, they associate digital signatures with safety of code execution, and trust the code to cause them no harm.

In general, there is a misconception that signed code is safe to be executed. The problem manifests itself when a vulnerability is discovered in signed code. As many users choose the option of permanently trusting the organizations that they have full confidence in, they are not notified if an adversary offers them the vulnerable software with the intentions of exploiting it. Consider, for example, signed Java applets. Whenever a certificate is verified to be correct (as opposed to being self-signed or tampered), the user is confronted with a security dialog that has the option of "Always trusting the content from the publisher" turned on. Unfortunately, this setting overrides any future warning dialogs about potentially vulnerable software versions from the respective organization.

In addition, McGraw and Felten [[McGraw 00]] stress that only privileged code should be signed. They further recommend that, since all development is not in-house, an organization that signs its code must not vouch for code acquired from a third party. Anything that is not comprehensible must not be signed (Also see the related guideline [SEC09-J. Create and sign a SignedObject before creating a SealedObject]). They suggest using the AccessController mechanism wherein only the privileged code (doPrivileged() section) ought to be signed. The other code can be left unsigned, restricting it to the sandbox.

It follows that unprivileged code is not required to be digitally signed and therefore should not be. This conviction adequately respects the guideline SEC00-J. Follow the principles of least privilege.

Exceptions

EX1: An organization that has an internal PKI and uses code signing for internal development activities (such as to facilitate code-check-in and track developers) may sign unprivileged code. This codebase should however, not be carried forward to the production environment. The keys used for signing must not be used to ship the products.

Risk Assessment

Signing unprivileged code violates the principle of least privilege as it can circumvent security restrictions defined by the security policies of applets and JNLP applications, for example.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

SEC13-J

high

probable

medium

P12

L1

Automated Detection

TODO

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

References

[[Schneier 00]]
[[McGraw 00]] Appendix C: Sign Only Privileged Code
[[Dormann 08]]


SEC12-J. Prefer using SSLSockets over Sockets for secure data exchange      00. Security (SEC)      SEC30-J. Always use a Security Manager

  • No labels