Using a Custom Cipher with NID_undef may lead to NULL encryption
OpenSSL supports creating a custom cipher via the legacy EVP_CIPHER_meth_new() function and associated function calls. This function was deprecated in OpenSSL 3.0 and application authors are instead encouraged to use the new provider mechanism in order to implement custom ciphers. OpenSSL versions 3.0.0 to 3.0.5 incorrectly handle legacy custom ciphers passed to the EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() and EVP_CipherInit_ex2() functions (as well as other similarly named encryption and decryption initialisation functions). Instead of using the custom cipher directly it incorrectly tries to fetch an equivalent cipher from the available providers. An equivalent cipher is found based on the NID passed to EVP_CIPHER_meth_new(). This NID is supposed to represent the unique NID for a given cipher. However it is possible for an application to incorrectly pass NID_undef as this value in the call to EVP_CIPHER_meth_new(). When NID_undef is used in this way the OpenSSL encryption/decryption initialisation function will match the NULL cipher as being equivalent and will fetch this from the available providers. This will succeed if the default provider has been loaded (or if a third party provider has been loaded that offers this cipher). Using the NULL cipher means that the plaintext is emitted as the ciphertext. Applications are only affected by this issue if they call EVP_CIPHER_meth_new() using NID_undef and subsequently use it in a call to an encryption/decryption initialisat
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2022-3358
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 16:22 UTC · Revision 1
Source evidence
Using a Custom Cipher with NID_undef may lead to NULL encryption
core-osv · Original sourcePublished 11 Oct 2022, 15:00 UTC
OpenSSL supports creating a custom cipher via the legacy EVP_CIPHER_meth_new() function and associated function calls. This function was deprecated in OpenSSL 3.0 and application authors are instead encouraged to use the new provider mechanism in order to implement custom ciphers. OpenSSL versions 3.0.0 to 3.0.5 incorrectly handle legacy custom ciphers passed to the EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() and EVP_CipherInit_ex2() functions (as well as other similarly named encryption and decryption initialisation functions). Instead of using the custom cipher directly it incorrectly tries to fetch an equivalent cipher from the available providers. An equivalent cipher is found based on the NID passed to EVP_CIPHER_meth_new(). This NID is supposed to represent the unique NID for a given cipher. However it is possible for an application to incorrectly pass NID_undef as this value in the call to EVP_CIPHER_meth_new(). When NID_undef is used in this way the OpenSSL encryption/decryption initialisation function will match the NULL cipher as being equivalent and will fetch this from the available providers. This will succeed if the default provider has been loaded (or if a third party provider has been loaded that offers this cipher). Using the NULL cipher means that the plaintext is emitted as the ciphertext. Applications are only affected by this issue if they call EVP_CIPHER_meth_new() using NID_undef and subsequently use it in a call to an encryption/decryption initialisat
osv:CVE-2022-3358
Complete source record
{
"id": "f34c490e5f421b81828a52d5063bdde2131f8355bb536f0eef4676ba30f300a2",
"url": "https://osv.dev/vulnerability/CVE-2022-3358",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Using a Custom Cipher with NID_undef may lead to NULL encryption",
"summary": "OpenSSL supports creating a custom cipher via the legacy EVP_CIPHER_meth_new() function and associated function calls. This function was deprecated in OpenSSL 3.0 and application authors are instead encouraged to use the new provider mechanism in order to implement custom ciphers. OpenSSL versions 3.0.0 to 3.0.5 incorrectly handle legacy custom ciphers passed to the EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() and EVP_CipherInit_ex2() functions (as well as other similarly named encryption and decryption initialisation functions). Instead of using the custom cipher directly it incorrectly tries to fetch an equivalent cipher from the available providers. An equivalent cipher is found based on the NID passed to EVP_CIPHER_meth_new(). This NID is supposed to represent the unique NID for a given cipher. However it is possible for an application to incorrectly pass NID_undef as this value in the call to EVP_CIPHER_meth_new(). When NID_undef is used in this way the OpenSSL encryption/decryption initialisation function will match the NULL cipher as being equivalent and will fetch this from the available providers. This will succeed if the default provider has been loaded (or if a third party provider has been loaded that offers this cipher). Using the NULL cipher means that the plaintext is emitted as the ciphertext. Applications are only affected by this issue if they call EVP_CIPHER_meth_new() using NID_undef and subsequently use it in a call to an encryption/decryption initialisat",
"evidence": "osv:CVE-2022-3358",
"products": [],
"severity": "unknown",
"structured": {
"id": "CVE-2022-3358",
"aliases": [
"CVE-2022-3358",
"GHSA-4f63-89w9-3jjv",
"RUSTSEC-2022-0059"
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/openssl/openssl",
"type": "GIT",
"events": [
{
"introduced": "89cd17a031e022211684eb7eb41190cf1910f9fa"
},
{
"fixed": "75a6bc17f32505421a78476a972d4d9b74f303b6"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:openssl:openssl:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "3.0.0"
},
{
"fixed": "3.0.6"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"openssl-3.0.5",
"openssl-3.0.4",
"openssl-3.0.3",
"openssl-3.0.2",
"openssl-3.0.1",
"openssl-3.0.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-3358.json"
}
}
],
"modified": "2026-10-28T02:30:30.327443230Z",
"provider": "osv",
"references": [
"https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=5485c56679d7c49b96e8fc8ca708b0b7e7c03c4b",
"https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0023",
"https://www.openssl.org/news/secadv/20221011.txt",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/3xxx/CVE-2022-3358.json",
"https://nvd.nist.gov/vuln/detail/CVE-2022-3358",
"https://security.gentoo.org/glsa/202402-08",
"https://security.netapp.com/advisory/ntap-20221028-0014/"
],
"provider_metadata": {
"cna_assigner": "openssl",
"unresolved_ranges": [
{
"extracted_events": [
{
"range": [
{
"introduced": "Fixed in OpenSSL 3.0.6 (Affected 3.0.0-3.0.5)"
},
{
"last_affected": "Fixed in OpenSSL 3.0.6 (Affected 3.0.0-3.0.5)"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandaloneSingleVersion"
}
]
}
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/3xxx/CVE-2022-3358.json"
}
},
"related_cves": [
{
"value": "CVE-2022-3358",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 497327,
"published_at": "2022-10-11T15:00:14.123+00:00"
}