The vulnerabilities
Go's encoding/xml package does not preserve XML semantics during round-trips, allowing crafted markup to change meaning while still appearing correctly signed. This can bypass SAML authentication and enable privilege escalation.
mattermost.com
Published on mattermost.com
This blog post is a part of Mattermost’s public disclosure of three serious vulnerabilities in Go’s encoding/xml related to tokenization round-trips. The public disclosure comes as a result of several months of work, including collaborating with the Go security team since August 2020 and with affected downstream…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the encoding/xml package's data structures and parsing logic do not guarantee that decoding and re-encoding preserves the original XML semantics, especially with namespaces and directives.
Impact
Attackers could tamper with signed SAML messages to escalate privileges or bypass authentication in affected Go-based SAML implementations.
What the attacker needed
Go-based SAML implementation using encoding/xml; attacker can inject XML markup into signed SAML message
The fix
No complete fix in Go is available; a workaround is to use the open-source xml-roundtrip-validator library, and affected SAML libraries have released patches.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When a program reads XML and then writes it back out, the output should mean the same as the input. In Go's XML library, specially crafted input can change meaning during this process. For SAML, which uses XML for single sign-on, an attacker could alter a signed message to impersonate another user.