CVE-2026-5223: prohibit unpacking symlinks and other unexpected entries
authorJosh Triplett <josh@joshtriplett.org>
Mon, 30 Mar 2026 17:35:55 +0000 (10:35 -0700)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Thu, 28 May 2026 18:58:07 +0000 (20:58 +0200)
commit5981df49527a742cd45aaf9d7a08ea8da262ea68
tree10009d7b587d9e82a5f5f10299a6df151046af9f
parentebb9e5c277106a9e9f2a4a327cfa841d7fbdc496
CVE-2026-5223: prohibit unpacking symlinks and other unexpected entries

Cargo has historically not allowed creating .crate packages containing
symlinks. (It packages the symlink target in place of the symlink,
instead.) So, any package containing a symlink would have to be
hand-constructed. Such packages are also not allowed on crates.io, so it
could only come from an alternate registry.

Rather than dealing with symlink traversal attacks when unpacking a
crate, just prohibit symlinks entirely.

In the process, also prohibit other kinds of unusual entries. As an
exception, allow character devices but warn about them, because some
exist in crates on crates.io.

FG: adapted paths
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Gbp-Pq: Topic cargo
Gbp-Pq: Name CVE-2026-5223-prohibit-unpacking-symlinks-and-other-unexp.patch
src/tools/cargo/src/cargo/sources/registry/mod.rs
src/tools/cargo/tests/testsuite/registry.rs