Skip to content

f-311:C_WrapKey does not check CKA_EXTRACTABLE on the key being wrapped#165

Merged
SparkiDev merged 1 commit intowolfSSL:masterfrom
miyazakh:f-311
Mar 17, 2026
Merged

f-311:C_WrapKey does not check CKA_EXTRACTABLE on the key being wrapped#165
SparkiDev merged 1 commit intowolfSSL:masterfrom
miyazakh:f-311

Conversation

@miyazakh
Copy link
Copy Markdown
Contributor

C_WrapKey doesn't check CKA_EXTRACTABLE on the key being wrapped. Neither WP11_Generic_SerializeKey nor WP11_Rsa_SerializeKeyPTPKCS8 check the extractable flag before serializing key material. Per the PKCS#11 specification, C_Wrapkey has to return CKR_KEY_UNEXTRACTABLE when attempting to wrap a key with CKA_EXTRACTABLE=CK_FALSE. This allows an attacker with a valid session to export any key material through wrapping, even keys explicitly marked as non-extractable, defeating the fundamental key protection model.

Fix the issue and add regression test.
Fix the unit test which expected to be wrapping the key, but it didn't set CKA_ETRACTABLE to CK_TRUE

@dgarske dgarske requested a review from SparkiDev March 17, 2026 19:26
@SparkiDev SparkiDev merged commit 426f30c into wolfSSL:master Mar 17, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants