/

CVE-2026-128073

Severity:

HIGH RISK

(7.5)

Improper Input Validation (CWE-20) in gosaml2 SAML Response

CVE-2026-128073

Received

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20, CWE-248

Impact:

Denial of Service

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

gosaml2 can panic while decrypting a malformed encrypted SAML assertion because it does not validate the ciphertext's nonce or initialization-vector length before slicing it. A remote attacker who can submit a response to an affected service provider may trigger a denial of service without a valid identity-provider signature.

Affected context

The issue affects gosaml2 response validation when an encrypted assertion is processed. In affected implementations, ValidateEncodedResponse() attempts decryption before signature or content validation completes, and EncryptedAssertion.DecryptBytes() may slice decoded ciphertext before checking that it contains the required AES-GCM nonce or AES-CBC initialization vector. A panic may terminate the request goroutine or, depending on the service's panic recovery, the process.

Exploit preconditions

  • Attack surface: A service-provider endpoint that accepts SAML responses containing encrypted assertions
  • Required access: The ability to send a SAML response; a valid identity-provider signature or relationship is not required. The service provider's public certificate is sufficient to wrap a symmetric key.
  • Trigger point: Decryption during ValidateEncodedResponse(), before signature or content validation completes
  • Why exploitation is possible: Short or empty decoded ciphertext can reach slicing operations without prior nonce or initialization-vector length checks, causing an unrecovered panic

Why this happens

The underlying bug is insufficient validation of decoded ciphertext before cryptographic processing. DecryptBytes() assumes the input contains a complete AES-GCM nonce or AES-CBC initialization vector and slices it without first establishing that the required bytes are present. Invalid input can therefore cause a runtime bounds panic rather than a controlled validation error. This maps to CWE-20: Improper Input Validation; the panic behavior is also related to CWE-248: Uncaught Exception.

Potential impact

  • A crafted response may cause a request-handling goroutine to terminate.
  • Depending on panic recovery and service architecture, the failure could interrupt or terminate the service process.
  • Repeated requests may reduce service availability.

General mitigation guidance

Defensive patterns include validating decoded ciphertext lengths before slicing or invoking cryptographic operations, and returning controlled errors for malformed input. Treat inbound SAML data as untrusted until all relevant checks succeed, and perform structural validation before decryption or other operations that can panic. Use panic recovery as defense in depth rather than as a substitute for input validation, and limit the privileges and resources available to the service.

How teams detect issues like this

  • Use static analysis and code review to find byte-slice operations on decoded or attacker-controlled data that lack preceding length checks.
  • Review cryptographic parsing paths for validation that occurs only after decryption or other risky operations.
  • Add tests and fuzzing for empty and undersized encrypted assertion values, verifying that malformed inputs return errors rather than panic.
  • Apply CI policies that flag unchecked input-derived slicing and ensure request handlers have appropriate panic containment.

Sources

SourceLink
github.comgithub.com/russellhaering/gosaml2/commit/b2bd784b196b21f606faaa6a4eeae929bd75aa20
github.comgithub.com/russellhaering/gosaml2/pull/281
github.comgithub.com/russellhaering/gosaml2/releases/tag/v0.12.0
github.comgithub.com/russellhaering/gosaml2/security/advisories/GHSA-5hj8-q7fv-qrj6

Frequently asked

questions

It may be exploitable remotely when a service provider accepts attacker-controlled SAML responses containing encrypted assertions.

No. The described issue occurs before signature validation completes; the service provider's public certificate is sufficient to wrap a symmetric key.

Validate ciphertext lengths before slicing or decryption, and reject malformed input with controlled errors instead of allowing a panic.

Treat protocol input as untrusted, validate structure before processing, and use fuzzing and review checks to find unchecked slicing and panic-prone parsing paths.

Find out what's already
exploitable in your codebase.