Skip to content
RCE Advisory Intermediate

GHSL-2020-242: Command injection in telegramdesktop/tdesktop workflow

A GitHub workflow used the name of a pull request's source branch directly inside a shell command, so a crafted branch name could inject extra commands. An attacker could run arbitrary commands in the workflow, exfiltrate secrets and the temporary repository token, and potentially modify the repository.

jarlob Follow

Originally disclosed on GitHub Security Lab

The ‘useragentupdater.yml’ GitHub workflow is vulnerable to arbitrary command injection.

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

Impact

The injection could exfiltrate secrets and the temporary repository token to an attacker-controlled server, and because the attacker controls the workflow's execution they could delay it to give the server time to modify the repository.

What the attacker needed

Ability to fork the repository; ability to open and close a pull request

The fix

The issue was resolved, though the text does not describe the fix; it should be fixed by not interpolating the branch name into the shell command, for example by passing it through an environment variable and quoting it.

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 workflow is an automated script that runs when something happens in a repository, such as a pull request being closed. Here the script pasted the branch name into a shell command without cleaning it, so a branch name containing shell syntax could make the script run extra commands chosen by the attacker.

What is RCE?

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

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.

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.