Skip to content

Security Audits and Tests ​

Trackarr is attacked on purpose before each major release: the code is reviewed, then the findings are reproduced against a running instance, fixed, and replayed. This page lists what was tested, what broke, and what changed. Numbers are the ones measured during the tests.

Findings are described here once a fix has shipped. Work that is still open is listed at the end without the details that would help an attacker.

How the tests are run ​

LayerWhat it isHow to run it
Unit teststests/security (request guards, description policy, rate limits, client IP resolution, panic mode crypto, session rules, honeypots)npm run test:security
Tracker testsAnnounce parsing, credit rules, limiter, snapshot, in tracker/srccd tracker && cargo test
Attack benchA production build on throwaway Postgres and Redis containers, client addresses simulated through the trusted proxy header, the Rust tracker compiled from source, and a real browser for anything that rendersmanual, scripted with curl and Node
Live serverThe same attacks replayed on a public demo instance behind Caddy, plus a full TCP port scan and a host review over SSHmanual
Dependenciesnpm audit --omit=dev and cargo auditalso run in CI
HostSSH, brute-force protection, updates, firewall. The script itself was run on a fresh Debian 13 machine, with and without an SSH key in placesudo ./scripts/harden-host.sh --check

The bench matters because several findings below passed code review for months: they only showed once a browser, a proxy and two accounts were involved.

December 2026 (v1.4.0) ​

Scope: the whole repository (188 API endpoints, the Rust tracker, Docker and Caddy configuration, install scripts, CI), then the attack bench and the demo server.

Tests and results ​

#TestBeforeAfter the fixes
1One anonymous request with a crafted 8 KB query stringThe request filter ran for 45 s and every other visitor waited (3.8 s with 4 KB on the demo server)400 in 3 ms
2Three anonymous 250 MB bodies sent to the login endpointProcess memory went from 86 MB to 1.7 GB. On the demo server two 200 MB bodies took the app from 106 MiB to 885 MiB of its 1 GiB limit413 in 4 ms, memory unchanged. Bodies of unknown size get 411
3A torrent description with a <style>, a fixed banner, a sign-in form and an image pointing to /.env, opened by a moderator in a real browserPage restyled, banner shown above the site, form rendered, and the moderator's address blocked for 5 minutes because the image request hit a trap pathMarkup removed, image dropped, the viewer is not affected
4An HTML form posted from a sibling subdomain with the admin's cookieA member was banned: the server never looked at where the request came from403, for forms, scripts and images sent by another origin
5Ten wrong passwords for the admin's username from one addressThe admin was refused for 15 minutes, with the right password, from any addressOnly the attacking address is refused. Under an attack from many addresses, a browser that already signed in still gets in
6Registering Alice and SEC_ADMIN next to alice and sec_adminBoth accepted409 Username already taken
7Eleven writes in one minute (comments, or anonymous requests from a shared address)The whole address was blocked from the site for 5 minutesThe eleventh gets 429. Only repeated violations lead to a block, which now doubles for repeat offenders as intended
8Panic mode: a member edits their torrent while the database is encrypted, then the admin restoresRestore failed with the right password and the database stayed encryptedThe edit is refused (503) and restore tolerates such rows
9Panic mode: two encryption requests at once; demoting then deleting the first adminCiphertext encrypted twice with a lost salt; panic password hash deletedSecond request refused; the account holding the hash cannot be deleted and is found whatever its role
10Tracker: event=completed from an account that never downloadedA snatch and a Hit and Run entry were recorded, which opens the seeding bonusIgnored. A completion counts when the tracker saw the peer leech first
11Tracker: announces from an account on hold or waiting for paymentAcceptedAccount on hold / Payment pending
12Tracker: 1,400 MiB of upload claimed in 15 s on a 1.2 KB torrent, with a second account as leecherCredited silentlyStill credited (see open work), and an alert reaches the admins
13Paid registration: one Solana transfer naming the references of several invoicesEach invoice counted the full amount (found by review, not run on-chain)Such a transfer pays nobody
14A 2 MB salt sent at registrationStored, and returned to anyone asking for a login challengeRefused
15Search for don't400: the request filter saw an attackWorks

What changed in the code ​

  • Request guards (server/utils/requestGuards.ts): requests sent by a page of another origin are refused using the browser's Fetch Metadata headers, with Origin as a fallback. Bodies must be JSON or multipart, declare their length, and stay under 1 MB (11 MB for uploads). The pattern-matching filter on query strings is gone: queries are parameterized and output is escaped where it is rendered, so it protected nothing and was itself the vulnerability.
  • Descriptions (shared/utils/descriptionPolicy.ts): an explicit list of tags and attributes, three allowed style properties, no image from the site's own pages, and links and images to other sites blocked by default outside a list of trusted hosts that admins edit in Admin → Security.
  • Rate limits: exceeding a limit answers 429; the address is blocked only when it keeps doing so. Trap paths no longer block a visitor whose browser was made to request them by a page.
  • Login: failures are counted per account and source address, and per account across all addresses. The second counter pauses logins except for browsers holding a known device token.
  • Panic mode: one run at a time, torrents cannot be edited while encrypted, restore keeps rows it cannot decrypt instead of failing.
  • Tracker: account state checked on every announce, snatches recorded from observed completions, seeding time counted once per member and torrent, hashed addresses in abuse events.
  • Two-factor authentication: TOTP codes from any authenticator app, ten single-use recovery codes, and a setting that requires it for moderators and admins. Enrolling asks for the password again, a code cannot be replayed, and turning it on signs every other session out. See Two-Factor Authentication.
  • Audit log: every state-changing staff action (57 admin and moderator endpoints, plus staff acting on a member's torrent, comment, forum post or bounty) is recorded with its author, target and a summary from which credentials are redacted. Admins read it in Admin → Security. Granting admin rights, changing payment details and panic mode events also raise an alert.
  • Forum, bounties, invoices: topics and posts are paginated; a post in a locked topic can no longer be deleted by its author; nobody can accept a bounty fill that pays themselves; one open invoice per account and coin, a Bitcoin address index is never handed out twice, time-locked Monero outputs do not count as paid.
  • Database: the application and the tracker connect with a role that is not a superuser and cannot create roles or databases. scripts/db-split-role.sh migrates an existing install.
  • Security updates: a release that fixes a vulnerability shows a red banner to the admins of every instance that has not installed it, and an alert on their webhooks.
  • Edge and host: Caddy caps request sizes and drops client addresses from its access logs, and the monitoring host can be limited to chosen addresses. scripts/harden-host.sh checks SSH, fail2ban, the firewall and automatic security updates. scripts/backup.sh makes database backups, encrypted with age when a recipient key is set, and scripts/restore.sh --verify proves a backup loads.
  • CI: the test suite and the dependency audits run on every pull request, with weekly dependency updates.

Checks on the new protections ​

The fixes and the features added with them were verified the same way, by a script of 41 requests against a production build, then in a browser:

  • two-factor: no enrolment without the password, a used code refused, a recovery code accepted once, other sessions closed when it is turned on, staff without it stripped of every staff power while it is required
  • audit log: staff actions recorded, no credential in any entry, closed to moderators and members
  • security updates: a security release found behind a newer ordinary one, banner shown to admins only, one alert per release
  • installer: a full unattended install on a fresh Debian 13 machine, then the first account, a backup, a verified and a full restore, the host hardening applied, and two more installer runs that changed no key of the configuration

What held ​

These were attacked and did not give way:

  • Every API endpoint that is not meant to be public checks the session, and roles are read from the database on each request, never from the cookie.
  • No SQL built from input, no script execution from member content (DOMPurify plus a nonce-based Content Security Policy).
  • Client address headers cannot be forged through Caddy: a request with a fake X-Forwarded-For was attributed to its real address on the demo server.
  • A full TCP scan of the demo server found ports 22, 80 and 443 only. Postgres, Redis and the tracker's private API are not reachable from outside.
  • Private messages can only be read by their participants, staff included. Bonus point debits are atomic: no double spend through concurrent requests.
  • No secret in the git history. npm audit reports nothing on production dependencies.

Host findings ​

The demo server itself was the weakest part: SSH accepted passwords for root, 5,598 password guesses arrived in 24 hours, there was no fail2ban, no firewall, no automatic security update and no backup. None of this is specific to Trackarr, which is why the installer now offers to check the host. See Host hardening.

October 2026 (v1.0.0) ​

First full audit, centred on the Rust tracker that had just replaced the Node one.

FindingFix
A member could register unlimited peers with random peer ids until the tracker ran out of memoryPeers capped per member and torrent
Random passkeys and info hashes each cost one database queryShape check, and a per-address failure limiter in front of the database
A member could farm upload with their own leecherLeechers of the same account do not count
No header timeout and no connection cap on the trackerAccept loop with a timer and a connection limit
The login verifier was stored as is: a database dump was enough to sign in as anyoneStored as a scrypt hash, converted at startup
Rate limits per full IPv6 address, none per accountLimits per /64 and per username
Sessions could not be revoked for 7 dayssession_version checked on every request
Database and Redis URLs inlined in the build, .env in the Docker build contextRead from the environment at runtime, .dockerignore
HA control plane (etcd, Patroni, Sentinel) without authenticationPasswords everywhere, dangerous Redis commands renamed
Panic mode left banned IPs, last IPs, private messages and shoutbox in clearCovered
Content Security Policy allowed inline scriptsPer-response nonce

Known limits and open work ​

  • Upload and download figures come from the client. This is how BitTorrent works: the tracker cannot see transfers. Trackarr bounds what an announce can claim, refuses self-seeding between a member's own peers, and now alerts on amounts a swarm could not have taken. Matching each upload against the downloads of other members is planned.
  • Sensitive settings are not behind a second confirmation. An admin session can change where payments are received without typing the password again; the change is logged and raises an alert.
  • Payment settings stay readable in panic mode. The receiving keys are needed to recognise payments, so a seized database still links the instance to its wallet. Invoices themselves are encrypted.
  • The multi-account guard compares exact addresses. Two addresses of the same IPv6 /64 are seen as different.
  • Images from trusted hosts still reveal the viewer's address to that host. Keep the trusted list short, or leave only the built-in screenshot host.

Reporting a vulnerability ​

Please do not open a public issue. Use Security → Report a vulnerability on the GitHub repository (private vulnerability reporting), with the version, the steps to reproduce and what an attacker gains. Reports stay private until a fix is released, and you are credited in the release notes if you want to be.

Released under the MIT License.