CVE-2023-45676
High · 7.8CVSS
7.8
EPSS
0.5%
Published
Oct 21, 2023
CISA due date
—
Cloudanix analysis
A flaw in a popular audio library can let attackers take over a computer simply by tricking it into opening a specially made music file.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Integer overflow in setup_malloc allows a negative value to bypass buffer size checks, resulting in an out-of-bounds write when storing vendor metadata from a crafted Ogg Vorbis file, enabling arbitrary code execution.
Why it matters to the business
Applications that decode untrusted Ogg Vorbis audio using the affected library can be fully compromised, allowing attackers to execute arbitrary code on user systems or servers that process media files.
How an attack unfolds
An attacker crafts a malicious Ogg Vorbis file containing a specially chosen large value for the vendor metadata size. When the vulnerable stb_vorbis library parses the file, the integer overflow in setup_malloc produces a negative size that passes the allocation check, leading to an out-of-bounds write during metadata storage that can be leveraged for code execution.
How to fix it
Replace the vulnerable stb_vorbis implementation with a patched version from the upstream repository that corrects the integer overflow in setup_malloc. If a fixed release is unavailable, apply vendor-supplied patches or switch to an alternative Vorbis decoder. As a temporary mitigation, avoid processing untrusted Ogg Vorbis files in affected applications.
How to confirm the fix worked
Review the stb_vorbis.c source to confirm setup_malloc performs proper bounds checking on sz before adding offsets and that negative allocation sizes are rejected. Recompile dependent applications and test with known-good crafted files that previously triggered the overflow.
Typical attack path
- Attacker creates a malicious Ogg Vorbis file with oversized vendor metadata field
- Victim application opens or processes the crafted file using the vulnerable library
- setup_malloc computes sz+7 resulting in integer overflow to a negative value
- Negative size bypasses maximum buffer check and triggers out-of-bounds write
- Attacker-controlled data overwrites memory structures to achieve code execution
How to detect it
Examine application crash logs or memory dumps for segmentation faults or access violations occurring inside stb_vorbis metadata parsing routines when processing Ogg Vorbis files. Correlate file-open events with subsequent unexpected process behavior or code injection indicators.
What your security team should do
- Inventory all products and dependencies that statically or dynamically link stb_vorbis.c
- Prioritize patching or replacing the library in any media-processing pipelines that accept external files
- Implement file-type sandboxing or content-disarmament for audio decoding until remediation is complete
- Monitor upstream stb repository for official fixed releases and apply them promptly
The record
stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. A crafted file may trigger out of bounds write in `f->vendor[i] = get8_packet(f);`. The root cause is an integer overflow in `setup_malloc`. A sufficiently large value in the variable `sz` overflows with `sz+7` in and the negative value passes the maximum available memory buffer check. This issue may lead to code execution.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | libstb | 0 | No fix |
| Debian:12 | libstb | 0 | No fix |
| Debian:13 | libstb | 0 | No fix |
| SUSE:Package Hub 15 SP6 | SDL2_sound | 0 | 2.0.4-bp156.2.3.1 |
| Ubuntu:20.04:LTS | libstb | 0 | No fix |
| Ubuntu:22.04:LTS | libstb | 0 | No fix |
| Ubuntu:24.04:LTS | libstb | 0 | No fix |
| Ubuntu:24.10 | libstb | 0 | No fix |
| Ubuntu:25.04 | libstb | 0 | No fix |
| Ubuntu:25.10 | libstb | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | libstb | 0 | No fix |
| openSUSE:Leap 15.6 | SDL2_sound | 0 | 2.0.4-bp156.2.3.1 |
| openSUSE:Tumbleweed | SDL2_sound | 0 | 2.0.4-1.1 |
| openSUSE:Tumbleweed | SDL3_sound | 0 | 3.2.0-1.1 |
Related vulnerabilities
- CVE-2023-47212 A heap-based buffer overflow vulnerability exists in the comment functionality of stb… Also affects libstb
- CVE-2023-43281 Double Free vulnerability in Nothings Stb Image.h v.2.28 allows a remote attacker to… Also affects libstb
- CVE-2023-45664 stb_image is a single file MIT licensed library for processing images. Also affects libstb
- CVE-2023-45682 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45679 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45675 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45666 stb_image is a single file MIT licensed library for processing images. Also affects libstb
- CVE-2023-45667 stb_image is a single file MIT licensed library for processing images. Also affects libstb