Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/anacrolix/torrent
  4. ›
  5. GHSA-2wrx-84qj-4pcg

GHSA-2wrx-84qj-4pcg: anacrolix torrent has unbounded recursion in the bencode decoder that causes stack-overflow crash and CPU-exhaustion DoS

October 30, 2026

anacrolix/torrent’s bencode decoder (bencode/) applies no limit on the nesting depth of nested dictionaries and lists. Two distinct denial-of-service mechanisms follow from that single root cause, both reachable from a single crafted .torrent file or from metadata obtained from a peer on a magnet-link/v2 download:

  1. Stack-overflow process crash. Decoder.readOneValue recurses once per nesting level with no depth bound. A .torrent whose info value is a list nested a few million levels deep (≈8 MB file) drives the recursion past the 1 GiB goroutine-stack limit and the process dies with an unrecoverable fatal error: stack overflow. 2. Quadratic CPU exhaustion. metainfo.FileTree.UnmarshalBencode (BitTorrent v2) re-parses each subtree at every level, making parse time grow ~O(n²). A v2 info dict with a ~30,000-level file tree (≈0.2 MB) takes ~66 s to decode; 60,000 levels exceeds 90 s of decode time.

Affected: every application embedding github.com/anacrolix/torrent that ingests attacker-supplied metainfo - the CLI tools (cmd/torrent, cmd/torrent2), any server that opens .torrent files, or any client that accepts metadata from a peer for a magnet/v2 download. No depth limit has ever existed in the decoder.

References

  • github.com/advisories/GHSA-2wrx-84qj-4pcg
  • github.com/anacrolix/torrent/commit/76452a2c8a2fd9c59d4d4f10fc3495723d538c7b
  • github.com/anacrolix/torrent/security/advisories/GHSA-2wrx-84qj-4pcg

Code Behaviors & Features

Detect and mitigate GHSA-2wrx-84qj-4pcg with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 1.61.1-0.20260911233437-76452a2c8a2f

Fixed versions

  • 1.61.1-0.20260911233437-76452a2c8a2f

Solution

Upgrade to version 1.61.1-0.20260911233437-76452a2c8a2f or above.

Impact 6.5 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-407: Inefficient Algorithmic Complexity
  • CWE-674: Uncontrolled Recursion

Source file

go/github.com/anacrolix/torrent/GHSA-2wrx-84qj-4pcg.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:24 +0000.