Skip to content
RCE Write-up Advanced

Hacking Unity Games with Malicious GameObjects

The author found that Unity GameObjects, which are non-code assets, can be crafted so that their serialised event and visual-scripting data calls dangerous methods such as opening a URL or starting a process. An attacker who gets a malicious GameObject into a game, for example through a tampered AssetBundle or a mod, could run arbitrary code on a player's or developer's machine.

Jason Kielpinski Follow

Published on blog.includesecurity.com

At IncludeSec our clients are asking us to hack on all sorts of crazy applications from mass scale web systems to IoT devices and low-level firmware. Something that we’re seeing more of is hacking virtual reality systems and mass scale video games so we had a chance to do some research and came up with a bit of a…

IncludeSec, on blog.includesecurity.com

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 underlying mistake is that UnityEvent and Bolt data in serialised GameObjects are trusted to reference only safe methods, but the YAML can name any method in any loaded assembly, including private and static ones, and the game invokes it without validation.

What the attacker needed

Attacker supplies a malicious asset; victim loads the asset or mod; victim triggers the event, e.g. clicks; for the network route, a Windows host

The fix

Developers should scrutinise third-party assets, download AssetBundles only over HTTPS with verified certificate validation, and strip dangerous components such as EventTrigger, Bolt flow machines and UI behaviours from downloaded GameObjects before instantiating them, or use a strict allow-list of…

How it was found

  1. Obtain or craft a GameObject whose serialised YAML contains an event handler entry.
  2. Edit the handler's target type and method name to a dangerous method with a single argument.
  3. Set the argument to a value such as a remote file location or a shell command.
  4. Place the GameObject in an AssetBundle or in the game project.
  5. Have the victim load the asset and trigger the event, for example by clicking the object.

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.

A Unity game is built from pieces called GameObjects, and these pieces can carry small event settings that tell the game which function to run when something is clicked. The author showed that these settings are stored in a text file that can be edited by hand, so a piece that looks like harmless art can be made to call a dangerous function. If a player or developer loads such a piece, for example from a downloaded mod, the attacker's chosen code can run on their computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.