CVE-2026-32313: xmlseclibs is Missing AES-GCM Authentication Tag Validation on Encrypted Nodes Allows for Unauthorized Decryption

Published Mar 13, 2026
·
Updated

Summary XML nodes encrypted with either aes-128-gcm, aes-192-gcm, or aes-256-gcm lack validation of the authentication tag length. An attacker can use this to brute-force an authentication tag, recover the GHASH key, and decrypt the encrypted nodes. It also allows to forge arbitrary ciphertexts without knowing the encryption key.

Details When decrypting with either aes-128-gcm, aes-192-gcm, or aes-256-gcm here, the $authTag is set from a substr(), but never has its length validated (it should be validated with something like strlen($authTag) == self::AUTHTAGLENGTH). For that reason, a shorter than expected data blob will allow for the $authTag to have as short a tag as only one byte (see PHP's documentation%20has%20been%20called.%20Otherwise%20the%20decryption%20may%20succeed%20if%20the%20given%20tag%20only%20matches%20the%20start%20of%20the%20proper%20tag.)).

See this example: php function test($data) { $ivSize = 12; $tagSize = 16;

$iv = substr($data, 0, $ivSize); $data = substr($data, $ivSize); $offset = 0 - $tagSize; $tag = substr($data, $offset); $ct = substr($data, 0, $offset);

echo 'IV: "' . $iv . '"' . PHPEOL; echo 'Tag: "' . $tag . '"' . PHPEOL; echo 'CT: "' . $ct . '"' . PHPEOL; }

/ Outputs: php > test('myNonceNoncet'); IV: "myNonceNonce" Tag: "t" CT: "" php > test('myNonceNonceta'); IV: "myNonceNonce" Tag: "ta" CT: "" php > test('myNonceNoncetag'); IV: "myNonceNonce" Tag: "tag" CT: "" /

With a legit ciphertext in hand, this is enough to recover the GHASH key. With that key, any authenticated tags can be computed offline which allows for decryption of the ciphertext and forgery of arbitrary ciphertexts.

PoC 1. Setup a server expecting XML with an encrypted assertion - Run this php script poc.php with php -S 127.0.0.1:8888 (taken from this saml test case) - The script expects this private key: sp-private-key.pem. 2. Create an XML document with an encrypted assertion (encrypted with aes-256-gcm) - Here is the SAMLResponse used in the video below: samlresponse.txt

Note: The steps from 3 to 6 are implemented in this exploit script: noncereusewithfmtvaloracle.py. You can run the script with sage -python noncereusewithfmtvaloracle.py -s 'url-encodedandbase64-encodedsamlresponse'

3. Take the content of the <xenc:CipherValue> node and apply the following modifications 1. Base64-decode the content 2. Take the first 12 bytes and save them as the nonce 3. Take the last 16 bytes and save them as the tag 4. Now brute-force the tag of an empty ciphertext 1. Loop through all 256 possible byte values (let's call that bytetagattempt) 2. Concatenate together the nonce and the bytetagattempt 3. Base64-encode the result 4. Replace the content of the <xenc:CipherValue> node with this result 5. On http errors 500, we learn that the tag is valid 6. Do the same for the next byte of the tag until all 16 bytes have been brute-forced 4. With this new tag and the empty ciphertext, compute the GHASH key (the way to do this has been described in this blog post) 5. Use this GHASH key to compute authentication tags offline for arbitrary ciphertexts 6. Decryption is done by observing XML parsing errors that occur after modifying the ciphertext, those can be seen as http errors 500

poc.webm

Impact The general impact is: - XML nodes encrypted with AES-GCM can be decrypted by observing parsing differences - XML nodes encrypted with AES-GCM can be modified to decrypt to an arbitrary value - The GCM internal GHASH key can be recovered

In cases where the encryption key is embedded in the XML and is encrypted with the Service Provider's public key (like often done with SAML), the last two items don't have a big impact. This is because: - With the Service Provider's public key, an arbitrary ciphertext can be created with a known symmetric key - The symmetric keys are generated on the fly every time the IdP creates a new SAMLResponse

In any case, secrets that are embedded in the XML, whether coming from an IdP, or from another scheme, can be decrypted.

Important: If static symmetric keys are used, as the GHASH key could have leaked, you must rotate those keys.

References For additional information on the issue, you can refer to this blog post about the OpenSSL issue and how it can be exploited.

Other sources

xmlseclibs is a library written in PHP for working with XML Encryption and Signatures. Prior to 3.1.5, XML nodes encrypted with either aes-128-gcm, aes-192-gcm, or aes-256-gcm lack validation of the authentication tag length. An attacker can use this to brute-force an authentication tag, recover the GHASH key, and decrypt the encrypted nodes. It also allows to forge arbitrary ciphertexts without knowing the encryption key. This vulnerability is fixed in 3.1.5.

MITRE

Affected Software

3 affected componentsFixes available
pypi/xmlseclibs<3.1.5
composer/robrichards/xmlseclibs<3.1.5
3.1.5
Xmlseclibs Project Xmlseclibs<3.1.5

Event History

Mar 13, 2026
CVE Published
via MITRE·07:50 PM
Data Sourced
via MITRE·07:50 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·08:04 PM
Data Sourced
via GitHub·08:04 PM
DescriptionSeverityWeaknessAffected Software
Mar 16, 2026
Data Sourced
via NVD·02:19 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 22, 58183
Event
via FIRST·03:45 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-32313?

CVE-2026-32313 has a critical severity due to the potential for unauthorized decryption of sensitive data.

2

How do I fix CVE-2026-32313?

You can fix CVE-2026-32313 by upgrading to xmlseclibs version 3.1.5 or later.

3

What causes CVE-2026-32313?

CVE-2026-32313 is caused by missing AES-GCM authentication tag validation on encrypted XML nodes.

4

What versions of xmlseclibs are affected by CVE-2026-32313?

The versions of xmlseclibs affected by CVE-2026-32313 are those prior to 3.1.5.

5

Can CVE-2026-32313 lead to data breaches?

Yes, CVE-2026-32313 can potentially lead to data breaches by allowing attackers to decrypt sensitive information.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203