Creating a normal private package
Unity's package manager (UPM) uses the same protocol as npm, and private registries like Verdaccio by default proxy to the public npm registry, choosing the highest version. An attacker who knows a private package name could publish a higher-version package to public npm, causing code execution on developer machines when imported.
blog.includesecurity.com
Published on blog.includesecurity.com
The Unity game engine has a package manager which allows packaged code and assets to be imported into a game, with dependencies automatically handled. Originally this was used only for Unity-produced packages, such as the GUI system.
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
The private registry (Verdaccio) is configured by default to proxy to the public npm registry and select the highest version, and Unity's package manager does not support namespaced packages to prevent name collisions.
Impact
An attacker could execute code on developer machines and potentially include malicious code in final game builds, but only if the private registry is configured to proxy to the public npm registry (the default for Verdaccio).
What the attacker needed
Private registry proxies to public npm; attacker knows private package name; developer imports the package
The fix
The registry server should be configured to either not pull from the public npm registry at all, or to not pull packages with a specific internal prefix from the public registry.
How it was found
- Create a normal private package and publish it to a local Verdaccio registry.
- Configure Unity's manifest.json to use the private registry for a scope.
- Create a malicious package with the same name but a higher version and publish it to the public npm registry.
- Open the Unity package manager and observe it shows the malicious public package instead of the private one.
- Import the package into Unity, causing the malicious code to run.
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.
When a game studio uses a private package registry to share internal code, the registry software (Verdaccio) often also looks at the public npm registry. If someone publishes a package with the same name but a higher version number on the public registry, the package manager picks the public one. That lets an attacker run their own code on the developer's computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.