QueryInterface should call AddRef before returning pointer
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
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`.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | derive-com-impl (crates.io) | before 0.1.2 | 0.1.2 | Patch available | GHSA-9rg7-3j4f-cf4x |
- derive-com-impl (crates.io) Vendor— Affected before 0.1.2 Fixed in 0.1.2 Patch available GHSA-9rg7-3j4f-cf4x
Remediation
- Fix · GHSA-9rg7-3j4f-cf4x derive-com-impl (crates.io) Fixed in 0.1.2 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-9rg7-3j4f-cf4x
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences