diff options
| author | Daniel Kubec <[email protected]> | 2026-07-21 11:18:53 +0200 |
|---|---|---|
| committer | Norbert Pocs <[email protected]> | 2026-08-22 08:11:57 +0200 |
| commit | 6fa8ce64f35df0bf7f74cdd6f1cedf2637642c5f (patch) | |
| tree | ec6bccf25fc2f41f0ed7df9d75d91dac8e0cc0de | |
| parent | cms: fix AuthEnvelopedData authAttrs tags and verify them as AEAD AAD (diff) | |
| download | openssl-6fa8ce64f35df0bf7f74cdd6f1cedf2637642c5f.tar.gz openssl-6fa8ce64f35df0bf7f74cdd6f1cedf2637642c5f.zip | |
Add test for CVE-2026-63076
Assisted-by: Claude:claude-fable-5
Reviewed-by: Milan Broz <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
Merge-date: Sat Aug 22 06:12:03 2026
| -rw-r--r-- | test/cmp_protect_test.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/cmp_protect_test.c b/test/cmp_protect_test.c index 510ca9648c6..7ddf07ed70f 100644 --- a/test/cmp_protect_test.c +++ b/test/cmp_protect_test.c @@ -181,6 +181,38 @@ static int test_cmp_calc_protection_pbmac(void) EXECUTE_TEST(execute_calc_protection_pbmac_test, tear_down); return result; } + +/* + * Regression test for the ossl_cmp_calc_protection() protectionAlg + * type-confusion DoS: a PKIMessage whose protectionAlg has the + * id-PasswordBasedMAC OID but carries a BOOLEAN parameter instead of the + * expected PBMParameter SEQUENCE. X509_ALGOR_get0() then returns the boolean's + * union member (0xff) via ppval; the unpatched code took the non-NULL ppval as + * a valid ASN1_STRING * and dereferenced 0xff, crashing with a near-NULL + * access. The fixed code must reject the malformed parameter and return NULL. + */ +static int test_cmp_calc_protection_pbmac_bad_alg_param(void) +{ + unsigned char sec_insta[] = { 'i', 'n', 's', 't', 'a' }; + X509_ALGOR *alg = NULL; + + SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up); + if (!TEST_true(OSSL_CMP_CTX_set1_secretValue(fixture->cmp_ctx, + sec_insta, sizeof(sec_insta))) + || !TEST_ptr(fixture->msg = load_pkimsg(ip_PBM_f, libctx)) + || !TEST_ptr(alg = X509_ALGOR_new()) + || !TEST_true(X509_ALGOR_set0(alg, OBJ_nid2obj(NID_id_PasswordBasedMAC), + V_ASN1_BOOLEAN, (void *)1))) { + X509_ALGOR_free(alg); + tear_down(fixture); + fixture = NULL; + } else { + X509_ALGOR_free(fixture->msg->header->protectionAlg); + fixture->msg->header->protectionAlg = alg; + } + EXECUTE_TEST(execute_calc_protection_fails_test, tear_down); + return result; +} static int execute_MSG_protect_test(CMP_PROTECT_TEST_FIXTURE *fixture) { return TEST_int_eq(fixture->expected, @@ -589,6 +621,7 @@ int setup_tests(void) ADD_TEST(test_cmp_calc_protection_no_key_no_secret); ADD_TEST(test_cmp_calc_protection_pkey); ADD_TEST(test_cmp_calc_protection_pbmac); + ADD_TEST(test_cmp_calc_protection_pbmac_bad_alg_param); ADD_TEST(test_MSG_protect_with_msg_sig_alg_protection_plus_rsa_key); ADD_TEST(test_MSG_protect_with_certificate_and_key); |
