VulnWatch by ve1ve2
high 7.5 EPSS 0.36%

GHSA-5hj8-q7fv-qrj6 / CVE-2026-128073: gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue

Source:
GitHub Security Advisories
Published:
Fetched:
Updated:
Affects:
github.com/russellhaering/gosaml2

https://github.com/advisories/GHSA-5hj8-q7fv-qrj6 ↗

ghsagoCWE-20CWE-248

gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue ### Summary An attacker who can supply a crafted SAML Response for parsing can crash a `gosaml2` service provider by sending an `EncryptedAssertion` with AES-GCM encryption metadata and a `CipherValue` shorter than the GCM nonce size (12 bytes). The library panics with `slice bounds out of range` before any validation completes. This is a **distinct issue from [GHSA-hwqm-qvj9-4jr2](https://github.com/russellhaering/gosaml2/security/advisories/GHSA-hwqm-qvj9-4jr2)**, which addressed panics in the AES-CBC decryption path (commit [`3418f9ae09063ff8df0ce1bd93f24e538e614def`](https://github.com/russellhaering/gosaml2/commit/3418f9ae09063ff8df0ce1bd93f24e538e614def), included in `v0.10.0`). That fix added a block-size check for CBC but left the AES-GCM path completely unprotected. ### Details `ValidateEncodedResponse()` decrypts `EncryptedAssertion` nodes before signature or content validation completes. There are two call sites: 1. **Signed Response branch** -- [`decode_response.go#L341`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L341) 2. **Unsigned Response branch** -- [`decode_response.go#L388`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L388) Both call `decryptAssertions()` ([`decode_response.go#L150-L200`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L150-L200)), which calls `EncryptedAssertion.DecryptBytes()` at [`decode_response.go#L176`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L176). Inside `DecryptBytes()` ([`types/encrypted_assertion.go#L34-L92`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/types/encrypted_assertion.go#L34-L92)), the AES-GCM branch ([line 53, `case MethodAES128GCM, MethodAES192GCM, MethodAES256GCM:`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/types/encrypted_assertion.go#L53)) slices the decoded ciphertext without checking its length at [line 59](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/types/encrypted_assertion.go#L59): ```go nonce, data := data[:c.NonceSize()], data[c.NonceSize():] ``` If `CipherValue` decodes to fewer than 12 bytes (GCM nonce size), Go panics with `slice bounds out of range`. All three GCM key sizes (AES-128-GCM, AES-192-GCM, AES-256-GCM) share the same vulnerable branch. **Comparison with the patched CBC path:** The CBC branch (lines 65-88 of the same file) correctly checks `len(data) % k.BlockSize() != 0` before slicing -- this was the fix for GHSA-hwqm-qvj9-4jr2. The GCM branch has no equivalent guard. The attacker only needs the SP's public certificate (typically available in SAML metadata) to wrap a symmetric key via RSA-OAEP. The `CipherValue` for the assertion body can be left empty. No valid signature Affected packages: go:github.com/russellhaering/gosaml2 Patched: github.com/russellhaering/gosaml2 0.12.0

Linked vulnerabilities (3)

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

gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue

CWE: CWE-20, CWE-248Aliases: CVE-2026-128073, GHSA-hwqm-qvj9-4jr2
CVE-2026-128073 high 7.5 EPSS 0.36% (p30) NVDCVE.orgGHSAGHSA
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue

CWE: CWE-20, CWE-248Aliases: GHSA-5hj8-q7fv-qrj6, GHSA-hwqm-qvj9-4jr2NVD: Received

Also reported by (1)