Security Vulnerability Report
中文
CVE-2026-33487 CVSS 7.5 HIGH

CVE-2026-33487

Published: 2026-03-26 18:16:30
Last Modified: 2026-04-20 14:15:09

Description

goxmlsig provides XML Digital Signatures implemented in Go. Prior to version 1.6.0, 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. goxmlsig version 1.6.0 contains a patch.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Configurations (Affected Products)

cpe:2.3:a:goxmldsig_project:goxmldsig:*:*:*:*:*:*:*:* - VULNERABLE
goxmlsig < 1.6.0
Go language versions prior to 1.22 (when using older go.mod)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC Concept: Demonstrating the loop variable capture issue in Go < 1.22 // This code simulates the vulnerable logic in goxmlsig validate.go package main import ( "fmt" ) // Reference simulates the struct in goxmlsig type Reference struct { ID string Data string } func vulnerableValidate(targetID string, refs []Reference) *Reference { var matchedRef *Reference for _, _ref := range refs { if _ref.ID == targetID { // VULNERABILITY: Taking address of the loop variable "_ref" // In Go < 1.22, this address is reused for every iteration. matchedRef = &_ref } } return matchedRef } func main() { // Scenario: We want to validate "TargetElement" // The attacker provides a list where "TrustedElement" is last. refs := []Reference{ {ID: "TargetElement", Data: "Malicious Data"}, {ID: "TrustedElement", Data: "Valid Signed Data"}, } // Attempt to find the reference for "TargetElement" found := vulnerableValidate("TargetElement", refs) if found != nil { fmt.Printf("Found ID: %s\n", found.ID) fmt.Printf("Found Data: %s\n", found.Data) // In Go < 1.22, due to the bug, found.Data will be "Valid Signed Data" // even though we searched for "TargetElement". // This causes the validation to pass incorrectly. if found.Data == "Malicious Data" { fmt.Println("Detected Malicious Data (Expected behavior in secure code)") } else { fmt.Println("Validation Bypassed! Pointed to wrong element.") } } }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-33487", "sourceIdentifier": "[email protected]", "published": "2026-03-26T18:16:30.070", "lastModified": "2026-04-20T14:15:08.583", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "goxmlsig provides XML Digital Signatures implemented in Go. Prior to version 1.6.0, 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. goxmlsig version 1.6.0 contains a patch."}, {"lang": "es", "value": "goxmlsig proporciona Firmas Digitales XML implementadas en Go. Antes de la versión 1.6.0, la función 'validateSignature' en 'validate.go' recorre las referencias en el bloque 'SignedInfo' para encontrar una que coincida con el ID del elemento firmado. En versiones de Go anteriores a la 1.22, o cuando 'go.mod' utiliza una versión anterior, existe un problema de captura de variable de bucle. El código toma la dirección de la variable de bucle '_ref' en lugar de su valor. Como resultado, si más de una referencia coincide con el ID o si la lógica del bucle es incorrecta, el puntero 'ref' siempre terminará apuntando al último elemento en el slice 'SignedInfo.References' después del bucle. goxmlsig versión 1.6.0 contiene un parche."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-347"}, {"lang": "en", "value": "CWE-682"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:goxmldsig_project:goxmldsig:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.6.0", "matchCriteriaId": "F33DF651-C3B7-47BB-85EF-3D044F20608B"}]}]}], "references": [{"url": "https://github.com/russellhaering/goxmldsig/security/advisories/GHSA-479m-364c-43vc", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}