CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-869J-R97X-HX2G

GHSA-869J-R97X-HX2G: Local Path Traversal and Cross-Origin Resource Sharing Bypass in Anki Desktop

Alon Barad
Alon Barad
Software Engineer

Jun 19, 2026·8 min read·30 visits

Executive Summary (TL;DR)

A critical vulnerability in Anki's local HTTP media server allows malicious websites to perform cross-origin directory traversal attacks, resulting in silent local file exfiltration from vulnerable browsers such as Firefox.

The local media server (mediasrv.py) in Anki up to and including version 25.09.2 fails to validate incoming HTTP requests. The server does not validate the Origin header, enabling cross-origin requests. Additionally, several endpoints suffer from directory traversal vulnerabilities. Combined, these flaws permit an unauthenticated remote attacker to exfiltrate arbitrary files from a local file system when a user visits a malicious website.

Vulnerability Overview

Anki desktop applications bundle a local Flask-based web server (mediasrv.py) running on the loopback interface (127.0.0.1). This web server serves internal UI assets, user media files, and application-specific templates necessary for rendering interactive flashcards. Because this server exposes a local network port to the system, it establishes an attack surface accessible by other processes on the same system, as well as sandboxed environments such as web browsers.

The security model of local loopback servers relies on browser-enforced boundary security to prevent external sites from interacting with local endpoints. This boundary is defined by the Same-Origin Policy (SOP) and Cross-Origin Resource Sharing (CORS) rules. In affected versions of Anki (up to and including version 25.09.2), multiple implementation weaknesses in mediasrv.py break these boundary guarantees. Specifically, a combination of deficient CORS validation (CWE-346) and improper restriction of file path access (CWE-22) allows external actors to abuse the local server.

An attacker can exploit these weaknesses by hosting a malicious website that targets the vulnerable local endpoints. When a user runs Anki and visits the attacker-controlled webpage, the attacker can leverage the victim's browser as a network pivot to access the local web server. The local server processes unauthorized cross-origin requests, allowing the attacker to bypass path restrictions, read sensitive local files, and exfiltrate them to a remote destination.

Root Cause Analysis

The primary root cause resides within the origin-checking mechanics of qt/aqt/mediasrv.py. The server previously configured its Cross-Origin Resource Sharing policy using the third-party flask_cors library, specifying origins as "127.0.0.1". However, this setup did not strictly validate incoming HTTP Origin headers from cross-origin requests, enabling remote domains to craft valid requests that bypass local access limits.

Furthermore, the internal validation for the Host header was insufficient and fragile. The code validated the Host header by ensuring it started with local prefixes containing trailing colons, such as 127.0.0.1:. This check failed to handle requests that omitted the port, and did not validate the companion Origin header. In certain browsers that do not implement Private Network Access (PNA), such as Mozilla Firefox, cross-origin HTTP requests are allowed to proceed to localhost without pre-flight validation, meaning the server must implement strict manual origin verification.

The second core failure lies in the resolution of file paths. In the _builtin_data endpoint, incoming path arguments were appended using unsafe path joining: aqt_data_path() / ".." / path. The code executed read_bytes() directly on the resolved path without verifying if the requested resource remained within the intended directory boundaries. Additionally, the standard local file request handler implemented a substring-based prefix check (fullpath.startswith(directory)) which is vulnerable to prefix-matching bypasses when directories share common name prefixes.

Code Analysis

To understand the path traversal and CORS validation weaknesses, we examine the vulnerable code implementation alongside the corrected logic implemented in version 25.09.3. The original implementation allowed arbitrary directory navigation due to a lack of proper base-path canonicalization and substring-matching flaws.

# Vulnerable implementation of directory check
directory = os.path.realpath(directory)
path = os.path.normpath(path)
fullpath = os.path.abspath(os.path.join(directory, path))
 
# protect against directory transversal
if not fullpath.startswith(directory):
    return _text_response(
        HTTPStatus.FORBIDDEN, f"Path for '{directory} - {path}' is a security leak!"
    )

The flaw in fullpath.startswith(directory) allows an attacker to navigate to sibling directories that share a prefix. For instance, if the authorized directory is /home/user/app, a requested path of ../app_backup/conf.json resolves to /home/user/app_backup/conf.json, which starts with /home/user/app and erroneously passes the validation. The patched version resolves this by appending the platform-specific directory separator (os.sep) to the base directory before performing the validation check:

def ensure_safe_path(base_dir: str | Path, path: str | Path) -> str:
    base_dir = os.path.realpath(base_dir)
    path = os.path.normpath(path)
    fullpath = os.path.abspath(os.path.join(base_dir, path))
 
    # The patch appends os.sep to ensure strict directory containment
    if not fullpath.startswith(base_dir + os.sep):
        raise UnsafePathException(path)
    return fullpath

In addition, the flask_cors dependency was completely removed, replaced by manual extraction and comparison of the Origin and Host headers. A shadowing bug was also fixed in commit 858e5689d0e4fd24f74856c7e8f245412694a219, where the generator expression (f"{host}:" for host in _LOCALHOST_HOSTS) shadowed the outer host variable. The corrected logic utilizes an explicit loop parameter h to preserve the outer variable context:

# Patched Host and Origin validation
if os.environ.get("ANKI_API_HOST") != "0.0.0.0":
    host = request.headers.get("Host", "").lower()
    origin = request.headers.get("Origin", "").lower()
    allowed_hosts = tuple(f"{h}:" for h in _LOCALHOST_HOSTS)
    if not any(host.startswith(h) for h in allowed_hosts):
        logger.warning("denied non-local host: %s", host)
        abort(403)
    if origin and not is_localhost_origin(origin):
        logger.warning("denied non-local origin: %s", origin)
        abort(403)

Exploitation Methodology

Exploiting this vulnerability requires zero administrative privileges and can be achieved entirely through a user-interaction vector. The attack relies on the victim visiting a malicious or compromised web page while the Anki application is running in the background. The malicious page executes client-side JavaScript within the user's browser context to perform a local network scan.

The script first attempts to locate the exact TCP port of mediasrv by executing rapid asynchronous fetch requests to localhost across a range of common ports. Once the correct port is identified, the exploit issues a request to the _builtin_data endpoint with a path-traversal sequence. In a vulnerable browser environment such as Firefox, which does not block public-to-local requests, the browser forwards the request to http://127.0.0.1:<port>/_builtin/../../../../etc/passwd or an equivalent system file path.

The local server parses the payload, performs the unsafe directory resolution, reads the file, and sends the contents back in the HTTP response. Because the server fails to reject non-local origins, the browser allows the calling JavaScript context to read the response payload. The script then encodes the file data (e.g., via Base64) and transmits it to an attacker-controlled remote logging server, achieving full local file exposure.

Technical Impact

The impact of this vulnerability is rated High with a CVSS v4.0 score of 8.7. Successful exploitation results in unauthorized, arbitrary read access to the victim's local file system. An attacker can access sensitive documents, configuration files, SSH keys, API tokens, browser session databases, and other credentials stored under the user's home directory.

The severity is moderated by the user's choice of browser. Modern Chromium-based browsers enforce Private Network Access (PNA) specifications, which block or prompt for local resource requests initiated from public internet origins. Consequently, users running Chrome, Microsoft Edge, or Brave are substantially protected. However, users utilizing Firefox or older versions of Safari are highly vulnerable, as these browsers lack PNA controls and will transparently execute and return the cross-origin requests.

Because the server runs with the same privileges as the logged-in user, the file traversal capability is bound by the user's operating system permissions. It does not directly provide remote code execution (RCE) on its own. However, if an attacker can read sensitive application configurations or writable startup scripts, they may be able to chain this file read primitive into complete system compromise.

Remediation and Long-Term Fixes

The recommended and primary remediation strategy is upgrading the local Anki installation to version 25.09.3 or higher. This version deprecates the generic flask_cors library configuration in favor of strict, manual validation of both the Host and Origin headers against localhost patterns. Furthermore, the path validation is refactored to enforce strict directory containment using canonical paths.

If an immediate upgrade is not possible, users should employ localized mitigation strategies to minimize exposure. The most effective workaround is utilizing a web browser that implements full Private Network Access (PNA) security policies to prevent public websites from reaching localhost. Users should avoid running the Anki desktop application in the background while browsing untrusted web pages on browsers that lack PNA support.

From a development perspective, secure coding practices require that loopback servers always implement explicit origin verification. Relying on default CORS library configurations or simple substring checks is highly error-prone. Base directories must always be canonicalized, and path validations must enforce boundaries by including directory separator boundaries, ensuring that input paths cannot navigate outside the intended scope.

Official Patches

AnkiFix path traversal vulnerabilities in mediasrv
AnkiFix host validation logic shadowing bug

Fix Analysis (2)

Technical Appendix

CVSS Score
8.7/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Affected Systems

Anki Desktop Application (aqt Python module)

Affected Versions Detail

Product
Affected Versions
Fixed Version
aqt
Anki
<= 25.09.225.09.3
AttributeDetail
CWE IDCWE-346, CWE-22
Attack VectorNetwork
CVSS v4.08.7
ImpactArbitrary Local File Read
Exploit StatusProof of Concept (PoC) available
First Patched Version25.09.3

MITRE ATT&CK Mapping

T1204.001User Execution: Malicious Link
Initial Access
T1190Exploit Public-Facing Application
Initial Access
T1083File and Directory Discovery
Discovery
T1048Exfiltration Over Alternative Protocol
Exfiltration
CWE-346
Origin Validation Error

The product does not properly validate the origin of a request, or improperly restricts access to system directories.

Vulnerability Timeline

Security fix commits authored in the official repository
2026-05-06
Anki version 25.09.3 officially tagged and released
2026-05-07
GitHub Security Advisory GHSA-869J-R97X-HX2G published
2026-06-19

References & Sources

  • [1]GitHub Security Advisory GHSA-869J-R97X-HX2G
  • [2]Anki Security Advisory Bulletin
  • [3]Anki 25.09.3 Release Notes
  • [4]Patch Commit: Secure Path Traversal Checks
  • [5]Patch Commit: Host Shadowing Verification Fix
  • [6]Tavis Ormandy's Original Disclosure Details on X

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-16454
4.3

CVE-2026-16454: Object-Level Authorization Bypass in Eclipse hawkBit Direct Device Integration Controller

CVE-2026-16454 is an object-level authorization bypass vulnerability (CWE-284, CWE-862) in Eclipse hawkBit versions 1.0.3 and prior. The flaw exists within the Direct Device Integration (DDI) REST controller (hawkbit-ddi-resource), where endpoints responsible for enumerating software module metadata and serving firmware binaries fail to verify whether the requested software module is assigned to the authenticated device. Consequently, any device with valid credentials (such as a TargetToken or GatewayToken) can enumerate software module identifiers and download arbitrary firmware artifacts across the entire tenant namespace.

Amit Schendel
Amit Schendel
10 views•9 min read
•2 days ago•CVE-2026-62284
8.6

CVE-2026-62284: Remote Code Execution and SSRF via Unsanitized Kubeconfig in OSAC Operator

CVE-2026-62284 (GHSA-5w5g-j6hw-6p8f) is a code injection and server-side request forgery vulnerability in the console-proxy component of the OSAC Operator. The RemoteConfigResolver parses Kubernetes Secrets containing kubeconfig files via clientcmd.RESTConfigFromKubeConfig without sanitizing execution-related fields. An attacker with RBAC permissions to create or modify labeled Secrets in monitored namespaces can supply a malicious exec credential plugin, resulting in arbitrary command execution within the console-proxy pod.

Amit Schendel
Amit Schendel
8 views•8 min read
•2 days ago•CVE-2026-62361
5.5

CVE-2026-62361: Authenticated SQL Injection and Table Access Control Bypass in Listmonk Subscriber Export

CVE-2026-62361 (GHSA-xgjr-7j9q-2h4r) is an authenticated SQL injection and authorization bypass vulnerability in listmonk, an open-source, self-hosted newsletter and mailing list manager written in Go. In versions prior to 6.2.0, the subscriber export endpoint (GET /api/subscribers/export) directly interpolates user-supplied SQL filter expressions into a PostgreSQL query without invoking the table allowlist validation function (validateQueryTables). Consequently, authenticated users possessing the subscribers:sql_query and subscribers:get_all permissions can bypass relational access controls, execute arbitrary subqueries against restricted tables such as users and settings, and modify database state via writable Common Table Expressions (CTEs).

Alon Barad
Alon Barad
9 views•11 min read
•2 days ago•CVE-2026-28385
5.0

CVE-2026-28385: Server-Side Request Forgery in Canonical LXD Image Import

CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.

Amit Schendel
Amit Schendel
10 views•9 min read
•2 days ago•GHSA-9J25-MM2H-2F76
9.9

CVE-2026-48750: Arbitrary File Write on Host via exec-output Symlink in Canonical LXD and Incus

Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.

Alon Barad
Alon Barad
8 views•12 min read
•2 days ago•GHSA-VGHH-5RFX-XHQ8
9.9

CVE-2026-48749: Arbitrary Host File Read and Write via Malicious Image Symlink in Canonical LXD and Incus

CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.

Amit Schendel
Amit Schendel
8 views•9 min read