Supply Chain Attacks on Linux distributions - Fedora Pagure
Pagure passed a user-controlled query parameter into the arguments of a git log command, so an attacker could make git write the history of a chosen file to any path the service user could write. By overwriting the git user's shell startup file, an attacker could run commands on the server and gain a shell as the git user.
fenrisk.com
Published on fenrisk.com
As discussed in the meta-article, we picked Pagure from the Fedora Apps Directory and already had a technical approach in mind. A software forge is likely to be a good target for an argument injection: we can expect the…
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 code passed a request parameter straight into the argument list of an external git command without using git's end-of-options marker, so the value was treated as an option rather than a reference.
Impact
An attacker could write to arbitrary files and execute code on any Pagure instance, potentially modifying Fedora package repositories; the authors confirmed it on their local instance and, with permission, on the Fedora staging server, while overwriting application files did not work on the RPM-deployed staging instance because those files are owned by root.
What the attacker needed
A free Fedora contributor account; ability to reach the history page; service user can write the target file
The fix
It was fixed by the maintainers, who patched production within hours and released Pagure 5.14.1, though the authors note these are one-off fixes that do not address the deeper root cause of shelling out to git.
How it was found
- Create a free Fedora contributor account and a repository with a commit history.
- Send a request to the file history page with the identifier parameter set to an output option pointing at the git user's shell startup file.
- Connect to the server over SSH as the git user, which runs the overwritten startup file and executes the injected command.
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.
Pagure is a website that hosts source code repositories. When you view a file's history, the site builds a command for the git program using text you supplied in the web address. Because that text was not checked, a visitor could make git save its output into a file of their choosing, and one of those files is run automatically when someone connects over SSH, giving the attacker a shell on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.