Java security

From HandWiki
Revision as of 17:28, 26 October 2021 by imported>AnLinks (fixing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Java platform provides a number of features designed for improving the security of Java applications. This includes enforcing runtime constraints through the use of the Java Virtual Machine (JVM), a security manager that sandboxes untrusted code from the rest of the operating system, and a suite of security APIs that Java developers can utilise. Despite this, criticism has been directed at the programming language, and Oracle, due to an increase in malicious programs that revealed security vulnerabilities in the JVM, which were subsequently not properly addressed by Oracle in a timely manner.

Security features

The JVM

The binary form of programs running on the Java platform is not native machine code but an intermediate bytecode. The JVM performs verification on this bytecode before running it to prevent the program from performing unsafe operations such as branching to incorrect locations, which may contain data rather than instructions. It also allows the JVM to enforce runtime constraints such as array bounds checking. This means that Java programs are significantly less likely to suffer from memory safety flaws such as buffer overflow than programs written in languages such as C which do not provide such memory safety guarantees.

The platform does not allow programs to perform certain potentially unsafe operations such as pointer arithmetic or unchecked type casts. It also does not allow manual control over memory allocation and deallocation; users are required to rely on the automatic garbage collection provided by the platform. This also contributes to type safety and memory safety.

Security manager

The platform provides a security manager which allows users to run untrusted bytecode in a "sandboxed" environment designed to protect them from malicious or poorly written software by preventing the untrusted code from accessing certain platform features and APIs. For example, untrusted code might be prevented from reading or writing files on the local filesystem, running arbitrary commands with the current user's privileges, accessing communication networks, accessing the internal private state of objects using reflection, or causing the JVM to exit.

The security manager also allows Java programs to be cryptographically signed; users can choose to allow code with a valid digital signature from a trusted entity to run with full privileges in circumstances where it would otherwise be untrusted.

Users can also set fine-grained access control policies for programs from different sources. For example, a user may decide that only system classes should be fully trusted, that code from certain trusted entities may be allowed to read certain specific files, and that all other code should be fully sandboxed.

Security APIs

The Java Class Library provides a number of APIs related to security, such as standard cryptographic algorithms, authentication, and secure communication protocols.

Potential sources of security vulnerabilities in Java applications

There are a number of possible sources of security vulnerabilities in Java applications, some of which are common to non-Java applications and some of which are specific to the Java platform. (Note that these refer to potential sources of vulnerabilities which need to be kept in mind by security-conscious programmers: this is not intended as a list of actual vulnerabilities.)

Examples of potential sources of vulnerability common to Java and non-Java applications are:

  • Vulnerabilities in the protection mechanisms provided by the hardware or operating system which the application relies upon for its security
  • Vulnerabilities in native libraries, such as the C standard library, which may be used to implement the application and/or runtime
  • Vulnerabilities caused purely by errors in user programs (for example improper construction of SQL queries leading to SQL injection vulnerabilities)

However, much discussion of Java security focusses on potential sources of vulnerability specific to the Java platform. These include:

  • Vulnerabilities in the sandboxing mechanism which allow untrusted bytecode to circumvent the restrictions imposed by the security manager
  • Vulnerabilities in the Java class library which an application relies upon for its security

A vulnerability in the Java platform will not necessarily make all Java applications vulnerable. When vulnerabilities and patches are announced, for example by Oracle, the announcement will normally contain a breakdown of which types of application are affected (example).

For example, a hypothetical security flaw which affects only the security manager sandboxing mechanism of a particular JVM implementation would mean that only Java applications which run arbitrary untrusted bytecode would be compromised: applications where the user fully trusts and controls all bytecode being executed would not. This would mean that, say, a web browser plugin based on that JVM would be vulnerable to malicious applets downloaded from public websites, but a server-side web application running on the same version of the JVM where the administrator has full control over the classpath would be unaffected.[1] As with non-Java applications, security vulnerabilities can stem from parts of the platform which may not initially appear to be security-related. For example, in 2011, Oracle issued a security fix for a bug in the Double.parseDouble method.[2] This method converts a string such as "12.34" into the equivalent double-precision floating point number. The bug caused this method to enter an infinite loop when called on a specific input. This bug had security implications, because for example if a web server converts a string typed into a form by the user using this method, a malicious user could type in the string which triggers the bug. This would cause the web server thread processing the malicious request to enter an infinite loop and become unavailable for serving requests from other users. Doing this repeatedly to a vulnerable web server would be an easy denial-of-service attack: all the web server's threads for responding to user requests would soon be stuck in the infinite loop and the web server would be unable to serve any legitimate users at all.

Criticism of security manager

The security manager in the Java platform (which, as mentioned above, is designed to allow the user to safely run untrusted bytecode) has been criticized in recent years for making users vulnerable to malware, especially in web browser plugins which execute Java applets downloaded from public websites, more informally known as "Java in the browser".

Oracle's efforts to address these vulnerabilities resulted in a delay to the release of Java 8.[3]

2012

An OS X trojan referred to as Flashback exploited a vulnerability in Java, which had not been patched by Apple, although Oracle had already released a patch.[4] In April, Apple later released a removal tool for Lion users without Java.[5] With Java 7 Update 4, Oracle began to release Java directly for Lion and later.[6]

In October, Apple released an update that removed the Java plugin from all browsers.[7] This was seen as a move by Apple to distance OS X from Java.[8]

2013

In January, a zero-day vulnerability was found in all versions of Java 7, including the latest version Java 7 Update 10, which was already exploited in the wild.[9] The vulnerability was caused by a patch to fix an earlier vulnerability.[10] In response, Apple blacklisted the latest version of the Java plugin.[11] Oracle released a patch (Update 11) within three days.[12] Microsoft also released a patch for Internet Explorer versions 6, 7, and 8.[13]

Cyberespionage malware Red October was found exploiting a Java vulnerability that was patched in October 2011.[14] The website for Reporters Without Borders was also compromised by a Java vulnerability in versions prior to Update 11.[15]

After the release of Update 11, another vulnerability began circulating online,[16] which was later confirmed.[17] It was also found that Java's security mode itself was vulnerable due to a bug.[18] In response, Mozilla disabled Java (as well as Adobe Reader and Microsoft Silverlight) in Firefox by default,[19] while Apple blacklisted the latest Java plugin again.[20]

In February, Twitter reported that it had shut down an attack. Twitter advised users to disable Java, although it did not explain why.[21] Later in the month, Facebook reported that it had been hacked by a zero-day Java attack.[22] Apple also reported an attack.[23] It was found that a breach of an iPhone developer forum was used to attack Twitter, Facebook, and Apple.[24] The forum itself was unaware of the breach.[25] Following Twitter, Facebook, and Apple, Microsoft reported that it was also similarly compromised.[26]

Another vulnerability discovered allowed for the Java security sandbox to be completely bypassed in the original release of Java 7, as well as Updates 11 and 15.[27] In March, trojan called McRat was found exploiting a zero-day Java vulnerability.[28] Oracle then released another patch to address the vulnerability.[29]

See also

References

  1. Security Alert for CVE-2013-0422 Released. Oracle Corporation. Retrieved 2013-04-24.
  2. Oracle Releases Hotfix for the Double.parseDouble Bug in Record Time. InfoQ. Retrieved 2013-04-24.
  3. Secure The Train. Blog of Mark Reinhold, Chief Architect of Oracle's Java Platform Group. 2013-04-18.
  4. Goodin, Dan (2012-04-02). "Mac Flashback trojan exploits unpatched Java vulnerability, no password needed". Ars Technica. https://arstechnica.com/apple/2012/04/mac-trojan-exploits-unpatched-java-vulnerability-no-password-needed/. Retrieved 2014-02-18. 
  5. Geuss, Megan (2012-04-14). "Flashback malware removal tool arrives for Java-less Mac users". Ars Technica. https://arstechnica.com/apple/2012/04/flashback-malware-removal-tool-for-java-less-mac-users/. Retrieved 2014-02-18. 
  6. Foresman, Chris (2012-04-27). "Forget Apple: Oracle to bring Java security fixes directly to Mac users". Ars Technica. https://arstechnica.com/apple/2012/04/oracle-updates-java-to-se-7-for-os-x-brings-full-jdk-support/. Retrieved 2014-02-18. 
  7. Goodin, Dan (2012-10-18). "Apple removes Java from all OS X Web browsers". Ars Technica. https://arstechnica.com/apple/2012/10/apple-removes-java-from-all-os-x-web-browsers/. Retrieved 2014-02-18. 
  8. Cheng, Jacqui (2012-12-23). "Where OS X security stands after a volatile 2012". Ars Technica. https://arstechnica.com/apple/2012/12/where-os-x-security-stands-after-a-volatile-2012/. Retrieved 2014-02-18. 
  9. Goodin, Dan (2013-01-10). "Critical Java zero-day bug is being "massively exploited in the wild" (Updated)". Ars Technica. https://arstechnica.com/security/2013/01/critical-java-zero-day-bug-is-being-massively-exploited-in-the-wild/. Retrieved 2014-02-18. 
  10. Goodin, Dan (2013-01-11). "Critical Java vulnerability made possible by earlier incomplete patch (Updated)". Ars Technica. https://arstechnica.com/security/2013/01/critical-java-vulnerability-made-possible-by-earlier-incomplete-patch/. Retrieved 2014-02-18. 
  11. Foresman, Chris (2013-01-11). "Apple blacklists Java on OS X to prevent latest "critical" exploits". Ars Technica. https://arstechnica.com/apple/2013/01/apple-blacklists-java-on-os-x-to-prevent-latest-critical-exploits/. Retrieved 2014-02-18. 
  12. Mattise, Nathan (2013-01-14). "Oracle patches widespread Java zero-day bug in three days (Updated)". Ars Technica. https://arstechnica.com/security/2013/01/oracle-patches-widespread-java-zero-day-bug-in-just-three-days-that-is/. Retrieved 2014-02-18. 
  13. Goodin, Dan (2013-01-14). "Microsoft releases emergency update to patch Internet Explorer bug". Ars Technica. https://arstechnica.com/security/2013/01/microsoft-releases-emergency-update-to-patch-internet-explorer-bug/. Retrieved 2014-02-18. 
  14. Goodin, Dan (2013-01-15). "Red October relied on Java exploit to infect PCs". Ars Technica. https://arstechnica.com/security/2013/01/massive-espionage-malware-relied-on-java-exploit-to-infect-pcs/. Retrieved 2014-02-18. 
  15. Goodin, Dan (2013-01-22). "Just-patched Java, IE bugs used to snare human rights sites". Ars Technica. https://arstechnica.com/security/2013/01/just-patched-java-ie-bugs-used-to-snare-human-rights-sites/. Retrieved 2014-02-18. 
  16. Goodin, Dan (2013-01-16). "$5,000 will buy you access to another, new critical Java vulnerability (Updated)". Ars Technica. https://arstechnica.com/security/2013/01/5000-will-buy-you-access-to-another-new-critical-java-vulnerability/. Retrieved 2014-02-18. 
  17. Goodin, Dan (2013-01-18). "Critical Java vulnerabilities confirmed in latest version". Ars Technica. https://arstechnica.com/security/2013/01/critical-java-vulnerabilies-confirmed-in-latest-version/. Retrieved 2014-02-18. 
  18. Goodin, Dan (2013-01-28). "Java’s new "very high" security mode can’t protect you from malware". Ars Technica. https://arstechnica.com/security/2013/01/javas-new-very-high-security-mode-cant-protect-you-from-malware/. Retrieved 2014-02-18. 
  19. Goodin, Dan (2013-01-31). "Firefox to block content based on Java, Reader, and Silverlight". Ars Technica. https://arstechnica.com/security/2013/01/firefox-to-block-content-based-on-java-reader-and-silverlight/. Retrieved 2014-02-18. 
  20. Foresman, Chris (2013-01-31). "For second time in a month, Apple blacklists Java Web plugin". Ars Technica. https://arstechnica.com/apple/2013/01/for-second-time-in-a-month-apple-blacklists-java-web-plug-in/. Retrieved 2014-02-18. 
  21. Goodin, Dan (2013-02-02). "Twitter detects and shuts down password data hack in progress". Ars Technica. https://arstechnica.com/security/2013/02/twitter-detects-and-shuts-down-password-data-hack-in-progress/. Retrieved 2014-02-18. 
  22. Gallagher, Sean (2013-02-15). "Facebook computers compromised by zero-day Java exploit". Ars Technica. https://arstechnica.com/security/2013/02/facebook-computers-compromised-by-zero-day-java-exploit/. Retrieved 2014-02-18. 
  23. Cheng, Jacqui (2013-02-19). "Apple HQ also targeted by hackers, will release tool to protect customers". Ars Technica. https://arstechnica.com/apple/2013/02/apple-hq-also-targeted-by-hackers-will-release-tool-to-protect-customers/. Retrieved 2014-02-18. 
  24. Gallagher, Sean (2013-02-19). "Facebook, Twitter, Apple hack sprung from iPhone developer forum". Ars Technica. https://arstechnica.com/security/2013/02/web-forum-for-iphone-developers-hosted-malware-that-hacked-facebook/. Retrieved 2014-02-18. 
  25. Cheng, Jacqui (2013-02-20). "Dev site behind Apple, Facebook hacks didn’t know it was booby-trapped". Ars Technica. https://arstechnica.com/security/2013/02/dev-site-behind-apple-facebook-hacks-didnt-know-it-was-booby-trapped/. Retrieved 2014-02-18. 
  26. Bright, Peter (2013-02-22). "Microsoft joins Apple, Facebook, and Twitter; comes out as hack victim". Ars Technica. https://arstechnica.com/security/2013/02/microsoft-joins-apple-facebook-and-twitter-comes-out-as-hack-victim/. Retrieved 2014-02-18. 
  27. Brodkin, Jon (2013-02-25). "Java’s latest security problems: New flaw identified, old one attacked". Ars Technica. https://arstechnica.com/security/2013/02/javas-latest-security-problems-new-flaw-identified-old-one-attacked/. Retrieved 2014-02-18. 
  28. Goodin, Dan (2013-03-01). "Another Java zero-day exploit in the wild actively attacking targets". Ars Technica. https://arstechnica.com/security/2013/03/another-java-zero-day-exploit-in-the-wild-actively-attacking-targets/. Retrieved 2014-02-18. 
  29. Mattise, Nathan (2013-03-05). "Oracle releases new Java patch to address this week’s McRat problem". Ars Technica. https://arstechnica.com/security/2013/03/oracle-releases-new-java-patch-to-address-this-weeks-mcrat-problem/. Retrieved 2014-02-18. 

External links