Supply chain attack due to unclaimed ruby gems leads to Code execution
The GitLab project's documentation instructed users to install a Ruby gem that was not registered on rubygems.org, allowing an attacker to claim the gem name and publish malicious code. Anyone following the installation instructions would install the attacker's code, leading to remote code execution.
GitLab
Originally disclosed on GitLab
- Fixed in 3 hours
- Disclosed after 3 hours
HackerOne report #1701466 by hackerhero on 2022-09-15, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Have a look at the official documentation of 'microsoft_graph_mailer' ruby gem.
https://gitlab.com/gitlab-org/gitlab/-/tree/master/vendor/gems/microsoft_graph_mailer
The documentation has mentioned the installation steps for this library.
Official installation instructions direct users to install "microsoft_graph_mailer" using gem install command
gem install microsoft_graph_mailer
[REDACTED]
But i saw this ruby gem was not claimed on https://rubygems.org.
attacker can claim this ruby gem on rubygems.org
and host malicious code inside it.
Then anyone who trusts Gitlabs's open source project and follows the installation instructions will end up installing malware on their PC.
As soon as anyone installs malicious ruby gem, code will be executed on that machine, and it will give remote access to attacker.
** PS: Before any malicious attacker could claim this package and attack gitlab users, i have claimed this. So no one else could claim it and host malicious code in it to target gitlab users. **
you can verify by visiting https://rubygems.org/gems/microsoft_graph_mailer
( currently it doesn't contain any malicious code that could harm any user or gitlabs reputation.)
[REDACTED]
PS: let me know in case you want this package transferred to your account or you want this package deleted.
Best Regards,
[@]hackerhero
Impact
Anyone who trusts Gitlabs's open source project and follows the installation instructions will end up installing malware on their PC.
As soon as anyone installs malicious ruby gem, code will be executed on that machine, and it will give remote access to attacker.
Attachments
How To Reproduce
Please add reproducibility information to this section:
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
The project's documentation referenced a Ruby gem name that was not registered on the public package registry, leaving it open to being claimed by an attacker.
Impact
Anyone who trusts GitLab's open source project and follows the installation instructions could install malware that executes code and gives remote access to the attacker.
What the attacker needed
Attacker claims the unclaimed gem name; victim follows GitLab's installation instructions
The fix
The reporter suggests transferring or deleting the claimed gem, or updating the documentation.
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.
When you install a software package, your computer trusts that the name belongs to the real developer. Here, the name was not registered, so anyone could take it and upload harmful code. Then people following GitLab's instructions would run that harmful code without knowing.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.