Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

borgbackup/borg
master @ 840de26
38
Fixes
5
CVEs
HIGH
Peak severity
30.3%
Coverage
Highlights
Auth Bypass: 11 prior fixes. Scrutinize any change in this area.
src/borg/crypto/low_level.pyx: most-fixed (7 issues). Treat as high-risk during review.
17 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Cryptographic Issues: Borg previously lacked adequate integrity validation binding archives and manifests together, allowing attackers with repository access to spoof or tamper with archives. Mitigating this required introducing Tertiary Authentication for Metadata (TAM) and making TAM verification strictly mandatory across archive and manifest loading paths.
Memory Corruption: Insecure handling of raw pointers in Cython allowed Python bytes objects (such as encryption and MAC keys) to be garbage-collected while raw C pointers still referenced them, leading to use-after-free or memory corruption. The fix required statically copying keys into struct byte arrays.
Cryptographic Issues: Flaws in OpenSSL AEAD cipher execution—such as failure to prevent internal 32-bit block counter overflows, failure to enforce IV initialization state transitions, and incorrect decryption error-propagation logic—threatened keystream reuse and decryption verification bypasses.