GHSA-r7jw-wp68-3xch CVE-2023-0215 RUSTSEC-2023-0009
openssl-src vulnerable to Use-after-free following `BIO_new_NDEF`
- Severity
- 7.5 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 5.02%
- Chance of exploitation in the next 30 days. Higher than 92.26% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-416 Use After Free
- Fix
111.25.0- Upgrade openssl-src to this version or later
Description
The public API function BIO_new_NDEF is a helper function used for streaming ASN.1 data via a BIO. It is primarily used internally to OpenSSL to support the SMIME, CMS and PKCS7 streaming capabilities, but may also be called directly by end user applications.
The function receives a BIO from the caller, prepends a new BIO_f_asn1 filter BIO onto the front of it to form a BIO chain, and then returns the new head of the BIO chain to the caller. Under certain conditions, for example if a CMS recipient public key is invalid, the new filter BIO is freed and the function returns a NULL result indicating a failure. However, in this case, the BIO chain is not properly cleaned up and the BIO passed by the caller still retains internal pointers to the previously freed filter BIO. If the caller then goes on to call BIO_pop() on the BIO then a use-after-free will occur. This will most likely result in a crash.
This scenario occurs directly in the internal function B64_write_ASN1() which may cause BIO_new_NDEF() to be called and will subsequently call BIO_pop() on the BIO. This internal function is in turn called by the public API functions PEM_write_bio_ASN1_stream, PEM_write_bio_CMS_stream, PEM_write_bio_PKCS7_stream, SMIME_write_ASN1, SMIME_write_CMS and SMIME_write_PKCS7.
Other public API functions that may be impacted by this include i2d_ASN1_bio_stream, BIO_new_CMS, BIO_new_PKCS7, i2d_CMS_bio_stream and i2d_PKCS7_bio_stream.
Affected versions
crates.io
| Package | Vulnerable | Fixed in |
|---|---|---|
| openssl-src | < 111.25.0 |
111.25.0 |
| openssl-src | >= 300.0.0, < 300.0.12 |
300.0.12 |
| openssl-src | >= 0.0.0-0, < 111.25.0>= 300.0.0, < 300.0.12 |
111.25.0300.0.12 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
openssl-src crates.io → 111.25.0
- cargo
cargo update -p openssl-src --precise 111.25.0
Severity breakdown
CVSS 3.1 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-416: Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
How to prevent it
- Architecture and Design: Choose a language that provides automatic memory management.
- Implementation: When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.
References
Advisories
Packages
Other links
- git.openssl.org/gitweb
- git.openssl.org/gitweb
- git.openssl.org/gitweb
- psirt.global.sonicwall.com/vuln-detail/SNWLID-2023-0003
- rustsec.org/advisories/RUSTSEC-2023-0009.html
- security.gentoo.org/glsa/202402-08
- security.netapp.com/advisory/ntap-20230427-0007
- security.netapp.com/advisory/ntap-20230427-0009
- security.netapp.com/advisory/ntap-20240621-0006
- openssl.org/news/secadv/20230207.txt
- security.netapp.com/advisory/ntap-20240621-0006
- cert-portal.siemens.com/productcert/html/ssa-203374.html
- cert-portal.siemens.com/productcert/html/ssa-337522.html
- cert-portal.siemens.com/productcert/html/ssa-398330.html
- cert-portal.siemens.com/productcert/html/ssa-556635.html
- cert-portal.siemens.com/productcert/html/ssa-561322.html
- cert-portal.siemens.com/productcert/html/ssa-625862.html
- cert-portal.siemens.com/productcert/html/ssa-769027.html
- cert-portal.siemens.com/productcert/html/ssa-794697.html
- cert-portal.siemens.com/productcert/html/ssa-879734.html
- cert-portal.siemens.com/productcert/html/ssa-943925.html
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-w67w-mw4j-8qrv openssl-src contains Read Buffer Overflow in X.509 Name Constraint | Medium | Also affects openssl-src |
| GHSA-vrh7-x64v-7vxq openssl-src contains `NULL` dereference during PKCS7 data verification | High | Also affects openssl-src |
| GHSA-vxrh-cpg7-8vjr openssl-src subject to NULL dereference validating DSA public key | High | Also affects openssl-src |
| GHSA-v5w6-wcm8-jm4q openssl-src contains Double free after calling `PEM_read_bio_ex` | High | Also affects openssl-src |
| GHSA-p52g-cm5j-mjv4 openssl-src subject to Timing Oracle in RSA Decryption | Medium | Also affects openssl-src |
| GHSA-29xx-hcv2-c4cp openssl-src subject to Invalid pointer dereference in `d2i_PKCS7` functions | High | Also affects openssl-src |
| GHSA-x4qr-2fvf-3mr5 Vulnerable OpenSSL included in cryptography wheels | High | Also affects openssl-src |
| GHSA-vr8j-hgmm-jh9r Denial of service by double-checked locking in openssl-src | High | Also affects openssl-src |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor