Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. serde_with
  4. ›
  5. GHSA-7gcf-g7xr-8hxj

GHSA-7gcf-g7xr-8hxj: serde_with: KeyValueMap serialization panics on empty sequence or map entries

July 15, 2026

The public KeyValueMap serializer assumes that each mapped element has at least one field or item to use as the map key, but it subtracts 1 from the caller-visible length before validating that assumption. An application that serializes attacker-controlled data through #[serde_as(as = "KeyValueMap<_>")] can be crashed by an empty inner sequence or map entry.

References

  • github.com/advisories/GHSA-7gcf-g7xr-8hxj
  • github.com/jonasbb/serde_with/commit/c8a1d820ea25df01692b367058d587343e199389
  • github.com/jonasbb/serde_with/pull/966
  • github.com/jonasbb/serde_with/releases/tag/v3.21.0
  • github.com/jonasbb/serde_with/security/advisories/GHSA-7gcf-g7xr-8hxj

Code Behaviors & Features

Detect and mitigate GHSA-7gcf-g7xr-8hxj with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 3.21.0

Fixed versions

  • 3.21.0

Solution

Upgrade to version 3.21.0 or above.

Impact 4 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-20: Improper Input Validation

Source file

cargo/serde_with/GHSA-7gcf-g7xr-8hxj.yml

Spotted a mistake? Edit the file on GitLab.

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

Page generated Sat, 08 Aug 2026 00:19:03 +0000.