CVE-2023-45675
JSON

6.5medium

0 byte write heap buffer overflow in start_decoder in stb_vorbis

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.74% (higher than 55% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M

Description

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[len] = (char)'\0';`. The root cause is that if the len read in `start_decoder` is `-1` and `len + 1` becomes 0 when passed to `setup_malloc`. The `setup_malloc` behaves differently when `f->alloc.alloc_buffer` is pre-allocated. Instead of returning `NULL` as in `malloc` case it shifts the pre-allocated buffer by zero and returns the currently available memory block. This issue may lead to code execution.

Affected

Product or packageVersionsReported by
nothings stb<= 1.22, up to 1.22CVE List
nothings stb_vorbis.c1.22NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-787

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

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[len] = (char)'\0';`. The root cause is that if the len read in `start_decoder` is `-1` and `len + 1` becomes 0 when passed to `setup_malloc`. The `setup_malloc` behaves differently when `f->alloc.alloc_buffer` is pre-allocated. Instead of returning `NULL` as in `malloc` case it shifts the pre-allocated buffer by zero and returns the currently available memory block. This issue may lead to code execution.

NVD (es)

stb_vorbis es una librería de archivo único con licencia MIT para procesar archivos ogg vorbis. Un archivo manipulado puede provocar una escritura fuera de límites en `f-&gt;vendor[len] = (char)'\0';`. La causa principal es que si el len leído en `start_decoder` es `-1` y `len + 1` se convierte en 0 cuando se pasa a `setup_malloc`. `setup_malloc` se comporta de manera diferente cuando `f-&gt;alloc.alloc_buffer` está preasignado. En lugar de devolver "NULL" como en el caso de "malloc", desplaza el búfer preasignado a cero y devuelve el bloque de memoria disponible actualmente. Este problema puede provocar la ejecución del código.

References

https://securitylab.github.com/advisories/GHSL-2023-145_GHSL-2023-151_stb_image_h/third-party-advisory
https://github.com/nothings/stb/blob/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_vorbis.c#L3652-L3658third-party-advisory
https://github.com/nothings/stb/blob/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_vorbis.c#L3658third-party-advisory
https://github.com/nothings/stb/blob/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_vorbis.c#L950-L960third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UVQ7ONFH5GWLMXYEAJG32A3EUKUCEVCR/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QVABVF4GEM6BYD5L4L64RCRSXUHY6LGN/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NMXKOKPP4BKTNUTF5KSRDQAWOUILQZNO/

Sources

SourceRecordLicence
CVE ListCVE-2023-45675 changed 2025-02-13CVE Terms of Use
NVDCVE-2023-45675 changed 2026-06-17Public domain