The vulnerability exists because the application validates the SAML signature but then uses the original, untrusted XML document to extract user information. This is a classic XML signature wrapping vulnerability. An attacker can provide a SAML response where the signature is valid for a certain part of the document, but the application extracts the user's identity from a different, unsigned, and malicious part of the same document.
The patch fixes this by introducing a new function, getVerifiedXml, which, instead of returning a simple boolean, returns the actual XML content that was verified by the signature. The main processing function, SAML.validatePostResponseAsync, was updated to use this new function and to ensure that all subsequent processing is performed only on the verified data.
The key vulnerable functions are SAML.validatePostResponseAsync, which contained the flawed validation logic, and SAML.processValidlySignedAssertionAsync, which consumed the untrusted data. The validateSignature function, while not malicious in itself, was an enabler of the vulnerability due to its insufficient return value, and was therefore deprecated.