How I Saved Christmas for Google π
The author found a dependency confusion vulnerability in Google Cloud by uploading a malicious package with the same name as an internal package but a higher version. When Google's systems installed the package, the malicious code executed and sent a callback to the author's server.
It was a cold winter morning. I woke up early as I had to start my journey on a great program which was none other than Google Vrp.
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 package manager was configured to prefer the highest version across both public and private repositories, allowing a malicious public package to override the internal one.
Impact
The attacker could execute arbitrary code on Google's servers, potentially leading to full compromise of the affected systems.
What the attacker needed
Google Cloud account; Knowledge of internal package names; Ability to upload packages to public repository
The fix
The vulnerability was mitigated by temporarily disabling the Moments feature, but the underlying dependency confusion issue should be fixed by ensuring private packages are not overridden by public ones.
How it was found
- Enumerate packages used by Google Cloud services via automated scanning.
- Identify combined packages that exist in both private and public repositories.
- Find a package name missing from the public repository.
- Upload a malicious package with the same name and a higher version to the public repository.
- Wait for the package to be installed by Google's systems and receive a callback.
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.
Dependency confusion happens when a company uses both private and public package repositories. If an attacker uploads a package with the same name as a private one but a higher version number, the system may download the attacker's package instead. This can let the attacker run their own code on the company's servers.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.