Wysoka

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

  • Ujawniono: 13.03.2026
  • Aktualizacja: 11.10.2026 10:22

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::AUTHTAG_LENGTH). 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).

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 . '"' . PHP_EOL;
    echo 'Tag: "' . $tag . '"' . PHP_EOL;
    echo 'CT: "' . $ct . '"' . PHP_EOL;
}

/* 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
  2. Create an XML document with an encrypted assertion (encrypted with aes-256-gcm)

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

  1. 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 byte_tag_attempt)
      2. Concatenate together the nonce and the byte_tag_attempt
      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
  2. With this new tag and the empty ciphertext, compute the GHASH key (the way to do this has been described in this blog post)
  3. Use this GHASH key to compute authentication tags offline for arbitrary ciphertexts
  4. 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.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Paczka Composer robrichards/xmlseclibs < 3.1.5 3.1.5

Odnośniki

Ocena CVSS 8.2/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
Słabość (CWE)
CWE-354
Platforma
Composer
Paczka
robrichards/xmlseclibs
Ujawniono
13.03.2026
Aktualizacja
11.10.2026 10:22

Źródła i licencje

OSV / GitHub Advisory Database - GHSA-4v26-v6cg-g6f9 - CC BY 4.0

Historia podatności: robrichards/xmlseclibs

Wszystkie opisane podatności tej paczki (Paczka Composer), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkich wpisów
4
Pierwsza → ostatnia
11.2019 03.2026
Bez poprawki
0
Wykorzystywana w atakach
0

Rozkład istotności

  • Wysoka 3
  • Średnia 1

Ujawnienia w latach

  1. 2019: 1
  2. 2020: 0
  3. 2021: 0
  4. 2022: 0
  5. 2023: 0
  6. 2024: 1
  7. 2025: 1
  8. 2026: 1
  1. xmlseclibs: Missing AES-GCM Authentication Tag Validation on Encrypted Nodes Allows for Unauthorized Decryption ten wpis
    Wysoka · 8.2 CVE-2026-32313 < 3.1.5 3.1.5
  2. Wysoka · 7.5 ghsa-2g98-f9jv-w8c5 >= 1.0.0, < 3.0.2 3.0.2
  3. Wysoka · 8.8 CVE-2019-3465 >= 3.0.0, < 3.0.4, >= 1.0.0, < 2.1.1 3.0.4, 2.1.1

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.