/

CVE-2026-22700

Severity:

HIGH RISK

(7.5)

Input Validation Error in RustCrypto SM2 Public-Key

CVE-2026-22700

Analyzed

Vulnerability type

Category:

Input Validation Error

CWE:

CWE-20

Impact:

Denial of Service via Panic/Crash

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A denial-of-service vulnerability in the RustCrypto Elliptic Curves crate affects the SM2 public-key encryption (PKE) decrypt() implementation, where untrusted ciphertext is split into slices without proper length checks.

By sending undersized or carefully malformed SM2 ciphertext, an attacker can trigger bounds-check panics in Rust, causing the calling thread or process to crash and potentially disrupting dependent services.

Affected context

This issue occurs in applications that use the RustCrypto Elliptic Curves crate's SM2 PKE decrypt() functionality, specifically in versions 0.14.0-pre.0 and 0.14.0-rc.0.

It is relevant when:

  • SM2 ciphertext is accepted from untrusted or partially trusted sources (e.g., network input, external clients, or other services), and
  • The application treats panic or thread termination in the crypto code path as a recoverable or normal failure, but in practice it brings down the process or critical worker.

The vulnerability manifests in the buffer handling logic that derives internal slices from attacker-controlled ciphertext or DER-encoded structures.

Exploit preconditions

  • Attack surface: Any SM2 PKE decryption endpoint or code path exposed to untrusted ciphertext (e.g., TLS-like protocols, custom SM2-based APIs, message decryption services).
  • Required access: Ability to supply arbitrary SM2 ciphertext to the decrypt() API (usually remote network access, but could also be IPC or queued messages).
  • Trigger point: Invocation of the vulnerable decrypt() implementation on malformed or undersized ciphertext that leads to invalid slice boundaries.
  • Why exploitation is possible: The decrypt() logic performs unchecked slice::split_at operations and related slicing on lengths derived directly from the ciphertext/DER content, allowing crafted inputs to cause Rust bounds-check failures that panic the thread or process.

Why this happens

The root cause is insufficient input validation in the SM2 decrypt() implementation, where internal slice operations assume that the ciphertext has a minimum structure and length.

Instead of robustly verifying buffer sizes and DER structure before performing split_at and related slicing, the code relies on the input being well-formed.

When an attacker provides shorter-than-expected ciphertext or malformed DER components, the computed offsets exceed the actual buffer length, triggering Rust's runtime bounds checks.

This maps to CWE-20: Improper Input Validation, in which untrusted data is not sufficiently checked before it is used to drive memory and control-flow decisions in cryptographic parsing logic.

Potential impact

  • Application or service crash when decrypting malicious SM2 ciphertext
  • Termination of worker threads or async tasks handling cryptographic operations
  • Denial of service for APIs, microservices, or endpoints that rely on SM2 decryption
  • Potential cascading failures in distributed systems if decryption is part of a critical request path or authentication flow

General mitigation guidance

Mitigation centers on strengthening input validation and hardening cryptographic parsing paths against malformed data:

  • Ensure all ciphertext and DER-encoded fields are length-checked before any slicing or structural parsing.
  • Treat all externally sourced ciphertext as untrusted and validate minimum sizes, expected structure, and field boundaries early in the decryption pipeline.
  • Prefer safe parsing routines that return structured errors rather than relying on panics to signal invalid input.
  • Design application architecture such that a panic in cryptographic code cannot bring down the entire process, for example by isolating risky parsing in separate workers or processes where feasible.
  • Apply defensive coding guidelines to cryptographic libraries, emphasizing constant-time behavior where needed and robust handling of malformed inputs that fails closed with explicit errors instead of crashes.

How teams detect issues like this

Organizations can detect and monitor similar issues using multiple approaches:

  • Static analysis and code scanning: Look for slice operations (split_at, indexing, slicing) where offsets or indices are derived from untrusted input without prior explicit length checks.
  • Manual code review: Pay special attention to cryptographic parsing code, DER decoding routines, and buffer handling logic, verifying clear preconditions on buffer sizes and structural invariants before slicing.
  • Fuzz testing: Apply fuzzers to SM2 decryption and other cryptographic entry points, targeting malformed, truncated, and oversized ciphertexts to identify panic-inducing paths.
  • Runtime monitoring: Track panics and crashes in production, correlating them with specific request types or crypto operations, and treat recurring panics on invalid input as potential denial-of-service vectors.
  • Policy enforcement: Incorporate secure coding guidelines for buffer management and input validation into CI/CD pipelines, with checks to prevent new code that slices based on unchecked external input.

Sources

SourceLink
github.comgithub.com/RustCrypto/elliptic-curves/commit/e60e99167a9a2b187ebe80c994c5204b0fdaf4ab
github.comgithub.com/RustCrypto/elliptic-curves/pull/1603
github.comgithub.com/RustCrypto/elliptic-curves/security/advisories/GHSA-j9xq-69pf-pcm8

Frequently asked

questions

Exploitation is straightforward if an attacker can send arbitrary SM2 ciphertext to a vulnerable decrypt() endpoint.

By repeatedly sending malformed or undersized inputs, an attacker may consistently trigger panics and cause denial-of-service conditions.

Not inherently. The key requirement is the ability to supply SM2 ciphertext to the affected decryption logic.

In many designs, decryption occurs before or during authentication, so unauthenticated remote clients could potentially trigger the vulnerability if SM2 decryption is exposed.

The safest pattern is to enforce strict input validation before performing any slice operations based on untrusted data.

Ensure that all lengths, offsets, and structural assumptions about ciphertext and DER-encoded fields are checked, and return explicit errors on invalid input rather than panicking.

Adopt defensive buffer-handling practices: never derive slice indices directly from external input without validating lengths, treat all ciphertext and encoded structures as potentially malformed, and combine fuzz testing with static analysis focused on parsing and slicing logic.

Establish code review checklists that flag unchecked indexing or slicing in cryptographic and protocol implementation code as high-risk patterns.

Find out what's already
exploitable in your codebase.