Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If untrusted code is permitted to load classes, it may possess the ability to load sensitive classes required by trusted code. If the trusted code has not already loaded these classes, subsequent attempts to subsequently do so may result in untrusted classes being substituted for the sensitive classes. As a result, if a program permits untrusted code to load classes, it must first preload any sensitive classes it needs. Once properly loaded, these sensitive classes cannot be replaced by untrusted code.

...

Code Block
bgColor#FFCCCC
// This method exists in the class DigesterFactory and is called by 
// ContextConfig.createWebXmlDigester().
// which is in turn called by ContextConfig.createWebDigester()
// webDigester finally contains the value of digester defined
// in this method.
public static Digester newDigester(boolean xmlValidation,
                                   boolean xmlNamespaceAware,
                                   RuleSet rule) {
  Digester digester = new Digester();
  // ...
  digester.setUseContextClassLoader(true);
  // ...
  return digester;
}

...

The underlying problem is that the newInstance() method is being invoked on behalf of a web application's class loader, the WebappClassLoader, and it loads classes before Tomcat has loaded all the classes it needs. If a web application has loaded its own Trojan javax.xml.parsers.SAXParserFactory, when Tomcat tries to access a SAXParserFactory, it accesses the trojan Trojan SaxParserFactory installed by the web application rather than the standard Java SAXParserFactory that Tomcat depends on.

...

Even if the Tomcat server continues to use the WebappClassLoader to create the parser instance when attempting to process the web.xml and other files, the explicit call to getParser() in init() ensures that the default parser has been set during prior initialization and is impossible to replacecannot be replaced. Because this is a one-time setting, future attempts to change the parser are futile.

...

Allowing untrusted code to load classes enables untrusted code to replace benign classes with trojan Trojan classes.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

SEC03-J

high

probable

medium

P12

L1

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="eb8432b390fe9335-b910a520-4a9f4464-838d8e47-296218b818596b3485e2b214"><ac:plain-text-body><![CDATA[

[[CVE 2011

AA. Bibliography#CVE 08]]

[CVE-2009-0783

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0783]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="bb193182f10e979a-3b81f752-4ac34863-be33a338-cc7ba32627cc6b9ee7d9e606"><ac:plain-text-body><![CDATA[

[[Gong 2003

AA. Bibliography#Gong 03]]

Section 4.3.2, Class Loader Delegation Hierarchy

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c9ddf753ed506402-ec374810-4c384c46-ad1f9512-1e2a6a07a3e5c0000101fcff"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

§4.3.2, The Class Object

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3b515515b4151ffd-91a73d4e-47e048fe-bdbf96a8-77aa594fc3b7f09ab3adef50"><ac:plain-text-body><![CDATA[

[[Tomcat 2009

AA. Bibliography#Tomcat 09]]

[Bug ID 29936

https://issues.apache.org/bugzilla/show_bug.cgi?id=29936], API Class org.apache.tomcat.util.digester.Digester, [Security fix in v 6.0.20

http://tomcat.apache.org/security-6.html]

]]></ac:plain-text-body></ac:structured-macro>

...