rotki: arbitrary file read and delete via the asset export download endpoint

Anyone who reaches the rotki REST API while the local user is unlocked reads any file of the backend process through GET /api/1/assets/user/download and deletes it in the same request, including the encrypted user database.

Advisory ID: TP-2026-130
Product: rotki (locally run portfolio and accounting application for crypto assets)
Vulnerability type: External control of a file path, arbitrary file read and delete (CWE-73)
CVE: not requested
CVSS 3.1: 8.8 (High) · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Affected versions: up to and including v1.43.1 (tested: v1.43.1)
Fixed in: v1.43.2
Reported: 13 June 2026

Summary

rotki is a locally run portfolio and accounting application for crypto assets whose Python backend exposes a REST API. The endpoint GET /api/1/assets/user/download takes the file_path parameter unchecked, serves the named file and deletes it after the response. The API checks no per-request token, only whether the local user is currently unlocked. The official Docker image binds the API to 0.0.0.0; the desktop installation binds to 127.0.0.1, where the default CORS rule http://localhost:*/* also admitted foreign origins such as http://localhost.evil.com until the fix in v1.44.3, so a web page in the user's browser could talk to the API. Anyone who reaches the API by either route while the user is logged in reads and deletes every file the backend process can access, including the encrypted user database that holds the exchange API keys.

Root cause

UserAssetsExportDownloadSchema declares file_path as a NonEmptyStringField with no base directory, normalisation or extension check (rotkehlchen/api/v1/schemas.py:4092-4094).
download_user_assets first registers the path for cleanup and then passes it to send_file (rotkehlchen/api/services/assets.py:351-358).
After the response the cleanup hook calls temp_file.unlink() and temp_file.parent.rmdir() on that same path (rotkehlchen/api/rest_helpers/downloads.py:17-22).
The sibling endpoint download_database_backup rejects paths outside the user data directory (rotkehlchen/api/rest.py:2477-2480), and that check is missing here.
@require_loggedin_user checks only the process-wide flag user_is_logged_in and no token, cookie or request origin (rotkehlchen/api/v1/resources.py:455).

Proof of Concept

GET /api/1/assets/user/download?file_path=/data/users/<user>/rotkehlchen.db HTTP/1.1
Host: <rotki-host>

The request carries no credentials. Verified on v1.43.1 in the official Docker image, which starts the backend with --api-host 0.0.0.0 (packaging/docker/entrypoint.py:191-192): the response contained the database file byte for byte, and afterwards the file was gone from the container. We tested the route through the CORS rule with a set Origin header against the API, not in a browser against the desktop build.

Impact

  • Read of every file the backend process can read; in the Docker image it runs as root.
  • Exfiltration of the SQLCipher-encrypted user database with exchange API keys and portfolio data for an offline attack on the password.
  • Deletion of the fetched file and of its directory if that is empty afterwards; deleting the user database logs the user out and destroys the data when no backup exists.

References

Is Something Like This in Your Software?

Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.