Skip to content
RCE Advisory Intermediate CVE-2021-32849

GHSL-2021-076: Arbitrary command execution in Gerapy - CVE-2021-32849

Two functions in Gerapy build shell commands from user-supplied input without sanitisation, allowing an authenticated attacker to run arbitrary commands on the server. The attacker could execute code on the host.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

The function projectclone is vulnerable to command injection while handling attacker controlled data. The address (1) variable is used in the creation of a git clone command (2) in an insecure way that allows an attacker to craft the url of a repository that contains shell commands (3).

ghsecuritylab, 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

User-controlled input is interpolated into a shell command string that is executed with shell=True, without any sanitisation or escaping.

Impact

An authenticated attacker could execute arbitrary commands on the system, leading to code execution.

What the attacker needed

Authenticated user account

How it was found

  1. Send a POST request to the project_clone endpoint with an address value that contains shell metacharacters.
  2. The server builds a git clone command using that address and runs it through the shell.
  3. The injected shell commands execute on the host.

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.

The application takes text from a user and pastes it directly into a command that the computer runs. Because special characters in that text are not cleaned, an attacker can add their own commands, which the computer then executes as if the attacker were sitting at the keyboard.

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 ghsecuritylab

View all

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