Skip to content
Race condition Advisory Advanced

GHSL-2026-190: TOCTOU in the MongoDB JS mongodb-connection-string-url release notes workflow

The release_notes workflow checked that the person triggering it was a maintainer, but then checked out the mutable pull request head ref rather than the commit the maintainer had reviewed. An external pull request author could update that ref after the trigger and have their code run in a job holding a GITHUB_TOKEN with contents: write and pull-requests: write.

jarlob Follow

Originally disclosed on GitHub Security Lab

The releasenotes workflow authorizes a maintainer to trigger a run, but does not bind that authorization to the commit that the maintainer reviewed. It subsequently checks out the mutable refs/pull/<number>/head ref and executes files from that checkout.

jarlob, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The workflow authorised the triggering actor but did not bind that authorisation to a specific commit, then checked out the mutable refs/pull/<number>/head ref.

Impact

Attacker-controlled code could run on a GitHub Actions runner and use a GITHUB_TOKEN with contents: write and pull-requests: write to alter repository content or pull request state, though a maintainer must trigger the workflow and branch protection may restrict changes to protected refs.

What the attacker needed

An open pull request in the repository; a maintainer triggers the workflow; attacker can push to the PR head branch

The fix

It was fixed in pull request #141.

How it was found

  1. The contributor presents a benign commit for review.
  2. A maintainer dispatches the workflow for that pull request or posts the accepted run release_notes comment.
  3. The contributor updates the pull request head before actions/checkout resolves refs/pull/<number>/head.
  4. The maintainer passes the authorization check, but the workflow checks out and executes the contributor’s new, unauthorised commit.
  5. A modified local action or package lifecycle script executes during setup, and modified repository scripts subsequently execute with GITHUB_TOKEN in their environment.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A GitHub Actions workflow is an automated job that runs on GitHub's servers. This one was meant to let a trusted maintainer approve generating release notes for a pull request, but it fetched whatever the newest version of the pull request branch was at the moment it ran, not the version the maintainer had looked at. So the contributor could quietly push new code in between approval and execution, and that code would run with a token that can write to the repository.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.