🛡️ OSEC-2026-12 — mirage-crypto

⚪ Unknown ✅ No Known Exploit OSV
N/A
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

AEAD decrypt_into functions writes plaintext before checking the tag

On the generic GCM path, AES.GCM.authenticate_decrypt_into (as well as Chacha20.authenticate_decrypt_into and AES.CCM16.authenticate_decrypt_into) writes the decrypted plaintext into the caller's destination buffer and only then compares the tag. On a forged tag the function returns false, but the destination buffer already holds the full plaintext. AEAD decryption is meant to be all-or-nothing: no plaintext should be released until the tag verifies. This is a release of unverified plaintext, and a caller that reads the buffer without first checking the return value sees forged-but-decrypted data. RustCrypto's aes-gcm fixed the same defect in CVE-2023-42811 (rated medium) by re-encrypting the buffer on tag failure.

Solution

The tag is validated first, and only if the tag is valid, the decryption into the provided buffer is done. In the CCM code, the tag is computed over the plaintext - if the tag validation fails, the provided buffer is zeroed.

Reproduction

```OCaml

module GCM = Mirage_crypto.AES.GCM

let () =

let key = GCM.of_secret (String.make 32 '\x00') in

let nonce = String.make 12 '\x00' in

let secret = "let password = 42" in

let len = String.length secret in

let blob = GCM.authenticate_encrypt ~key ~nonce secret in

(* flip one bit of the 16-byte tag (at offset len); the ciphertext is untouched *)

let forged = Bytes.of_string blob in

Bytes.set forged len (Char.chr (Char.code (Bytes.get forged len) lxor 1));

let forged = Bytes.unsafe_to_string forged in

let dst = Bytes.make len '\x00' in

let verified =

GCM.authenticate_decrypt_into ~key ~nonce forged ~src_off:0 ~tag_off:len dst

~dst_off:0 len

in

Printf.printf "tag verified: %b (the message is rejected as forged)\n" verified;

Printf.printf "secret left in the output buffer: %S\n" (Bytes.to_string dst)

```

Timeline

  • June 25th 2026: report to ocaml/security-advisories
  • June 29th: acknowledgement of issue with several questions for the reporter
  • July 6th: answers from reporter, including a patch
  • July 27th: release of mirage-crypto 2.2.0 and security advisory

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity high, availability none.

Affected software

OSEC-2026-12 is recorded against 1 package.

  • mirage-crypto (fixed in 2.2.0)

Timeline and source

Published on 27 July 2026 and last revised on 7 August 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.

Details

Severity Unknown
CVSS Score N/A
CVSS Vector CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
CWE N/A
Public Exploit ✅ No
Source OSV
Published 2026-07-27
Updated 2026-08-12
Modified 2026-08-07
Fix URL N/A

Affected Packages

Software From version Fixed in
mirage-crypto 2.2.0

References

N/A

Similar Threats

More OSEC 2026 advisories

Browse all of OSEC 2026 in the advisory index.

Free Vulnerability Check

Is your site affected by OSEC-2026-12?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against OSEC-2026-12 and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.