Skip to content
Race condition Advisory Advanced

GHSL-2026-191: TOCTOU in the MongoDB JS Kerberos release notes workflow

The release_notes workflow checked that the person triggering it was a maintainer, but then checked out a mutable pull request ref rather than the commit that was reviewed. An external pull request author could update that ref after the maintainer's decision and have their code run with a write-scoped GITHUB_TOKEN.

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 JavaScript could run on a privileged runner and use a GITHUB_TOKEN with contents: write and pull-requests: write, though a maintainer must trigger the workflow and branch protection may limit changes to protected refs.

What the attacker needed

An open pull request from an external contributor; a maintainer triggers the workflow; attacker updates the ref before checkout

The fix

The workflow was fixed in pull request #351, presumably by binding the authorisation to a specific commit rather than a mutable ref.

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 the pull request ref.
  4. The maintainer passes the authorization check, but the workflow checks out the contributor's new, unauthorised commit.
  5. Modified repository scripts 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 generate release notes for a pull request, but it only checked who pressed the button, not which version of the code they approved. Because the pull request branch can still be changed by its author, the author could swap in malicious code after approval and have it run with powerful repository permissions.

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.