Ankitects Anki MPV script injection vulnerability
Anki's MPV media player integration passes flashcard sound filenames directly as command-line arguments, allowing an attacker to inject MPV options. A malicious flashcard can load a bundled configuration file that runs a Lua script, leading to arbitrary code execution on the victim's system.
Originally disclosed on Cisco Talos
An arbitrary script execution vulnerability exists in the MPV functionality of Ankitects Anki 24.04. A specially crafted flashcard can lead to a arbitrary code execution.
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 report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could achieve arbitrary code execution on the victim's system with the privileges of the Anki process.
What the attacker needed
Victim imports a malicious deck with media; victim plays the crafted sound
The fix
The vulnerability was fixed by the vendor in a patch release.
How it was found
- Create a flashcard with a sound reference that uses an MPV option to load an extra configuration file.
- Place a configuration file and a Lua script in the Anki media folder.
- Import the deck along with its media into Anki.
- When the sound is played, MPV loads the configuration and runs the Lua script, achieving code execution.
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.
Anki is a flashcard app that plays sounds using a separate media player called MPV. The app takes the sound filename from the flashcard and hands it straight to MPV without checking it. Because MPV accepts options that start with dashes, an attacker can make the filename look like an option that tells MPV to load a malicious script, which then runs on the victim'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.