Impersonating Other Players with UDP Spoofing in Mirror
Mirror's KCP transport authenticates clients only by a hash of their IP address and port, with no cryptographic token or HMAC. An attacker who can spoof UDP packets and guess the sequence number can impersonate another player and invoke commands on their behalf.
Published on blog.includesecurity.com
Mirror is an open-source multiplayer game framework for Unity. The history of Mirror is pretty interesting, I’d encourage anyone interested to give it a read on their site.
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 lack of any per-connection secret or cryptographic authentication; the server trusts the source IP and port of UDP packets, which can be spoofed.
Impact
An attacker could impersonate another player, potentially cheating or harassing others; the attack requires knowing the victim's IP and port and guessing the sequence number, and may be blocked by ISPs that filter spoofed packets.
What the attacker needed
Attacker on same network or able to spoof packets; know victim's IP address; know or brute-force victim's UDP port; brute-force sequence number
The fix
The fix was to add secure cookies to KCP, and an encrypted transport is under development.
How it was found
- Determine the client's source IP and UDP port (e.g., via a port scan or packet capture).
- Brute force the sequence number (sn) value, which starts at 0 and increments by 1.
- Craft a spoofed UDP packet with the victim's source IP and port, containing a valid KCP header and a CommandMessage payload.
- Send the spoofed packet to the server, which will process it as if it came from the victim.
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.
In many online games, the server needs to know which player sent each message. Mirror, a framework for Unity games, used only the sender's network address (IP and port) to identify players. Because UDP packets can be forged to show a fake sender address, someone on the same network could pretend to be another player and send commands as them.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.