Lucene search

K
talosTalos IntelligenceTALOS-2024-1993
HistoryJul 22, 2024 - 12:00 a.m.

Ankitects Anki MPV script injection vulnerability

2024-07-2200:00:00
Talos Intelligence
www.talosintelligence.com
4
arbitrary code execution
flashcard vulnerability
script injection
anki 24.04
mpv functionality
windows anki
lua script
vendor patch.

CVSS3

9.6

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

AI Score

9.8

Confidence

High

EPSS

0.001

Percentile

38.0%

Talos Vulnerability Report

TALOS-2024-1993

Ankitects Anki MPV script injection vulnerability

July 22, 2024
CVE Number

CVE-2024-26020

SUMMARY

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. An attacker can send malicious flashcard to trigger this vulnerability.

CONFIRMED VULNERABLE VERSIONS

The versions below were either tested or verified to be vulnerable by Talos or confirmed to be vulnerable by the vendor.

Ankitects Anki 24.04

PRODUCT URLS

Anki - <https://apps.ankiweb.net/&gt;

CVSSv3 SCORE

9.6 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

CWE

CWE-74 - Improper Neutralization of Special Elements in Output Used by a Downstream Component (β€˜Injection’)

DETAILS

Anki is an open-source program that helps with memorization of information through the use of flash cards. It supports syncing of these cards across multiple computers as well as sharing cards with other users. It supports multiple different content types such as images, audio, videos, and scientific notation (via LaTeX).

For Windows Anki uses this code to play media files:

https://github.com/ankitects/anki/blob/main/qt/aqt/sound.py#L363

class SimpleMpvPlayer(SimpleProcessPlayer, VideoPlayer):
    default_rank = 1

    args, env = _packagedCmd(
        [
            "mpv",
            "--no-terminal",
            "--force-window=no",
            "--ontop",
            "--audio-display=no",
            "--keep-open=no",
            "--input-media-keys=no",
            "--autoload-files=no",
        ]
    )

This runs an instance of MPV for every file played on Windows in flash cards.

The command looks like mpv --no-terminal .... sound.mp3 where sound.mp3 is the file it plays.

In Anki cards sound is played with [sound:music.mp3].

You can replace music.mp3 with something else and it’ll pass it directly as an argument to MPV.

We replaced music.mp3 with [sound:--include=extra.conf].

This loads an extra configuration file that mpv uses.

Our configuration file contains:

[1] script=run.lua
[2] idle=yes

[1] mpv can load and run Lua scripts, we are pointing to a script called run.lua. [2] tells mpv to wait until everything else is done (including the script) to close.

Normally without [2] mpv would see there is no audio file and close instantly.

We can bundle our run.lua script and extra.conf file in with the flashcards by putting it into the Anki media folder.

When a user imports an Anki deck they must also import the media. There are no limits on what media can be, so you can include scripts like we have.

Using this exploit we have managed to get full command Injection on the users system.

TIMELINE

2024-05-27 - Vendor Disclosure
2024-06-24 - Vendor Patch Release
2024-07-22 - Public Release

Credit

Discovered by Autumn Bee Skerritt of Cisco Duo Security and Jacob B.


Vulnerability Reports Next Report

TALOS-2024-1992

Previous Report

TALOS-2024-1994

CVSS3

9.6

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

AI Score

9.8

Confidence

High

EPSS

0.001

Percentile

38.0%