Skip to content

← Actionable
Medium, CVSS 5.1

serde_with: KeyValueMap serialization panics on empty sequence or map entries

GHSA-7gcf-g7xr-8hxj

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (serde_with 3.21.0), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

  • crates.io serde_with

    Affected
    >= 2.3.0, < 3.21.0
    Fixed in
    3.21.0

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS 4.0
5.1 · CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N · score source
EPSS
No dated EPSS signal available.
Source description

As published by the source; long descriptions are shortened.

Summary 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 #[serdeas(as = "KeyValueMap<")] can be crashed by an empty inner sequence or map entry. Details The affected public surface includes: - Serialization of #[serdeas(as = "KeyValueMap<")] values through serdejson::tostring or any other Serde serializer - Public KeyValueMap conversions for sequence and map-backed entries The root cause is: The KeyValueMap serializer preallocating Vec::withcapacity(len - 1) or Vec::withcapacity(len.unwrapor(17) - 1) before checking that the element actually contains the required first key field or item. The vulnerable data/control flow is: attacker-controlled empty entry - serdejson::tostring - KeyValueMap<TAs::serializeas - SeqAsMapSerializer::{serializeseq,serializemap} -…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 1 · created ·

    Published from ghsa record GHSA-7gcf-g7xr-8hxj

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: GHSA-7gcf-g7xr-8hxj

Advisory: serde_with: KeyValueMap serialization panics on empty sequence or map entries
IDs: GHSA-7gcf-g7xr-8hxj
Record: https://patchnext.com/advisories/ghsa-7gcf-g7xr-8hxj (revision 1, source checked 26 Oct 2026, 15:43 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Medium (CVSS 5.1)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: serde_with 3.21.0. A vendor fix does not mean a deployment is fixed.

## Affected components
- crates.io serde_with: affected >= 2.3.0, < 3.21.0; fixed in 3.21.0

## Suggested inspection (read-only)
- crates.io serde_with: check the installed version with your package manager.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on serde_with.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://github.com/advisories/GHSA-7gcf-g7xr-8hxj (GitHub-reviewed advisory GHSA-7gcf-g7xr-8hxj lists affected ranges: crates.io serde_with >=2.3.0 <3.21.0)

Commands are suggestions: review each one before running it.

Loading voting…