Skip to content
RCE Write-up Advanced

VSCodeのGitHubリポジトリに対する不正なPushアクセス

A command injection flaw in VSCode's GitHub issue triage scripts, combined with a weak regex and missing authorisation, allowed an unprivileged user to execute arbitrary commands in a GitHub Actions workflow and gain write access to the VSCode repository.

blog.ryotak.net

Published on blog.ryotak.net

2021-01-12 4895 字 Bug Bounty 脆弱性 Microsoft VSCode RCE

RyotaK, on blog.ryotak.net

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the combination of an overly permissive regular expression that extracted user-controlled text from issue comments, missing authorisation checks on who could use the command, and passing that text unsanitised into a shell command.

What the attacker needed

A GitHub account; ability to comment on public issues; an issue matching the workflow's search query; the scheduled workflow runs daily

How it was found

  1. Find an issue that matches the scheduled workflow's search query.
  2. Post a comment containing the command disguised as a normal comment.
  3. Wait for the scheduled workflow to run and execute the injected command.
  4. Use the reverse shell to run commands on the GitHub Actions runner.
  5. Push a harmless file to a new branch to prove write access.
  6. Extract the GitHub token from the local git configuration to investigate branch protections.

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 write-up has not been written yet. The Original tab links to the source.

A script that automatically handles GitHub issues had a flaw: it took text from a public comment and used it in a system command without checking it. Because of that, anyone could sneak in extra commands that ran on the project's build server, giving them the ability to modify the project's code repository.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.