NULL Pointer Dereference Affecting derive-com-impl package, versions *


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.11% (44th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about NULL Pointer Dereference vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-RUST-DERIVECOMIMPL-1569198
  • published24 Aug 2021
  • disclosed20 Jan 2021
  • creditUnknown

Introduced: 20 Jan 2021

CVE-2021-45681  (opens in a new tab)
CWE-476  (opens in a new tab)

How to fix?

A fix was pushed into the master branch but not yet published.

Overview

derive-com-impl is a Procedural macros to help implement COM interfaces from Rust.

Affected versions of this package are vulnerable to NULL Pointer Dereference. It 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. 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.

CVSS Scores

version 3.1