CVE-2021-45681
QueryInterface should call AddRef before returning pointer
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
7.5
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
- Record
CVE-2021-45681- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:N/A:P - Weakness
- CWE-787
- Updated
- 2026-11-02
CVE List No score
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
- Record
CVE-2021-45681- Updated
- 2026-11-02
EUVDEUVD-2022-0715 No score
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
- Record
EUVD-2022-0715- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-w4cc-pc2h-whcj
7.5
Out-of-bounds Write in derive-com-impl
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
- Record
GHSA-w4cc-pc2h-whcj- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-787
- Updated
- 2026-11-02
GitHub AdvisoriesGHSA-9rg7-3j4f-cf4x No score
QueryInterface should call AddRef before returning pointer
Affected version of this crate, which is a required dependency in com-impl,
provides a faulty implementation of the IUnknown::QueryInterface method.
QueryInterface implementation must call IUnknown::AddRef before returning the pointer,
as describe in this documentation:
https://docs.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(refiid_void)
As it is not incrementing the refcount as expected, the following calls to IUnknown::Release method
will cause WMI to drop reference to the interface, and can lead to invalid reference.
This is documented in https://docs.microsoft.com/en-us/windows/win32/learnwin32/managing-the-lifetime-of-an-object#reference-counting
There is no simple workaround, as you can't know how many time QueryInterface will be called. The only way to quick fix this is to use the macro expanded version of the code and modify the QueryInterface method to add the AddRef call yourself.
The issue was corrected in commit 9803f31fbd1717d482d848f041044d061fca6da7.
- Record
GHSA-9rg7-3j4f-cf4x- Updated
- 2026-11-02
OSVGHSA-w4cc-pc2h-whcj
7.5
Out-of-bounds Write in derive-com-impl
An issue was discovered in the derive-com-impl crate before 0.1.2 for Rust. An invalid reference (and memory corruption) can occur because AddRef might not be called before returning a pointer.
- Record
GHSA-w4cc-pc2h-whcj- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-787
- Updated
- 2026-11-02
OSVGHSA-9rg7-3j4f-cf4x No score
QueryInterface should call AddRef before returning pointer
Affected version of this crate, which is a required dependency in com-impl,
provides a faulty implementation of the IUnknown::QueryInterface method.
QueryInterface implementation must call IUnknown::AddRef before returning the pointer,
as describe in this documentation:
https://docs.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(refiid_void)
As it is not incrementing the refcount as expected, the following calls to IUnknown::Release method
will cause WMI to drop reference to the interface, and can lead to invalid reference.
This is documented in https://docs.microsoft.com/en-us/windows/win32/learnwin32/managing-the-lifetime-of-an-object#reference-counting
There is no simple workaround, as you can't know how many time QueryInterface will be called. The only way to quick fix this is to use the macro expanded version of the code and modify the QueryInterface method to add the AddRef call yourself.
The issue was corrected in commit 9803f31fbd1717d482d848f041044d061fca6da7.
- Record
GHSA-9rg7-3j4f-cf4x- Updated
- 2026-11-02
OSVRUSTSEC-2021-0083 No score
QueryInterface should call AddRef before returning pointer
Affected version of this crate, which is a required dependency in com-impl,
provides a faulty implementation of the IUnknown::QueryInterface method.
QueryInterface implementation must call IUnknown::AddRef before returning the pointer,
as describe in this documentation:
https://docs.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(refiid_void)
As it is not incrementing the refcount as expected, the following calls to IUnknown::Release method
will cause WMI to drop reference to the interface, and can lead to invalid reference.
This is documented in https://docs.microsoft.com/en-us/windows/win32/learnwin32/managing-the-lifetime-of-an-object#reference-counting
There is no simple workaround, as you can't know how many time QueryInterface will be called. The only way to quick fix this is to use the macro expanded version of the code and modify the QueryInterface method to add the AddRef call yourself.
The issue was corrected in commit 9803f31fbd1717d482d848f041044d061fca6da7.
- Record
RUSTSEC-2021-0083- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
derive-com-implcrates.io |
before 0.1.2 | 0.1.2 |
derive-com-implcrates.io |
All versions | None known |
derive-com-implcrates.io |
0.0.0-0 up to 0.1.2 | 0.1.2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-45681 is a high vulnerability (CVSS 7.5) in Derive-com-impl Project Derive-com-impl, published January 20, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.09%, the 65th percentile. Fixed in derive-com-impl 0.1.2.
References
rustsec.org/advisories/RUSTSEC-2021-0083.html
raw.githubusercontent.com/rustsec/advisory-db/main/crates/derive-com-impl/RUSTSEC-2021-0083.md
github.com/Connicpu/com-impl/issues/1
github.com/Connicpu/com-impl/commit/9803f31fbd1717d482d848f041044d061fca6da7
github.com/advisories/GHSA-9rg7-3j4f-cf4x
nvd.nist.gov/vuln/detail/CVE-2021-45681