Skip to content

Commit 5965ea5

Browse files
Viktor Dukhovnit8m
authored andcommitted
kek_unwrap_key(): Fix incorrect check of unwrapped key size
Fixes CVE-2025-9230 The check is off by 8 bytes so it is possible to overread by up to 8 bytes and overwrite up to 4 bytes. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (cherry picked from commit 9c462be)
1 parent 74d92a3 commit 5965ea5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/cms/cms_pwri.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
242242
/* Check byte failure */
243243
goto err;
244244
}
245-
if (inlen < (size_t)(tmp[0] - 4)) {
245+
if (inlen < 4 + (size_t)tmp[0]) {
246246
/* Invalid length value */
247247
goto err;
248248
}

0 commit comments

Comments
 (0)