Miggo Logo

CVE-2019-16881: Use after free in portaudio-rs

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.62937%
Published
8/25/2021
Updated
6/13/2023
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
portaudio-rsrust< 0.3.20.3.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper panic safety in C callback handlers. Both functions:

  1. Used mem::transmute to convert raw pointers to Boxes
  2. Called user-provided Rust closures (which might panic)
  3. Relied on mem::forget AFTER the closure execution to prevent deallocation

If the closure panicked before mem::forget, the Box would be dropped normally, freeing memory while PortAudio might retain the callback pointer. The commit diff shows the fix replaced this pattern with Box::leak/Box::from_raw, eliminating the panic-sensitive mem::forget sequence.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

*****t** v*rsions o* t*is *r*t* is not p*ni* s*** wit*in **ll***k *un*tions str**m_**ll***k *n* str**m_*inis***_**ll***k. T** **ll to us*r-provi*** *losur* mi**t p*ni* ***or* * m*m::*or**t **ll, w*i** t**n **us*s * us* **t*r *r** t**t *r*nts *tt**k*r

Reasoning

T** vuln*r**ility st*ms *rom improp*r p*ni* s***ty in * **ll***k **n*l*rs. *ot* *un*tions: *. Us** m*m::tr*nsmut* to *onv*rt r*w point*rs to *ox*s *. **ll** us*r-provi*** Rust *losur*s (w*i** mi**t p*ni*) *. R*li** on m*m::*or**t **T*R t** *losur* *