GHSL-2022-035: Integer Overflow in git shell - CVE-2022-39260
An integer overflow in git-shell's command parsing allows an attacker with git server access to trigger out-of-bounds reads and writes by sending a command longer than 2GB over SSH. This could potentially enable running arbitrary commands as the git user.
Originally disclosed on GitHub Security Lab
It is possible to trigger an integer overflow in splitcmdline, leading to out-of-bounds reads and writes. The vulnerability can be triggered remotely on a git server that is configured to allow ssh access using git-shell.
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
This vulnerability could potentially enable an attacker to run arbitrary commands as the `git` user on the git server, but only if they already have access to perform git operations.
What the attacker needed
Access to a git server using git-shell; permission to perform git operations
How it was found
- Compile the proof-of-concept program.
- Run the program with a file argument to generate a malicious input file.
- Send the generated file over SSH to the git server's git-shell.
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.
git-shell is a restricted shell that lets people use git commands over SSH but not run other programs. A bug in how it reads very long commands (over 2GB) can cause memory corruption, which might let an attacker run their own commands on the server. However, the attacker must already have a git account on that server.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.