Is mp3gain safe? Known CVEs, patched builds, and a memory-safe alternative
Updated · mp3rgain v3.16.2
It depends on which build you have. mp3gain 1.6.2 and the code it bundles have 21 published CVEs, nearly all of them memory errors that a crafted audio file can trigger. The Debian and Ubuntu packages are patched. The Windows downloads on SourceForge and the Chocolatey package are not, and upstream has made no release containing the fixes. aacgain is not patched anywhere. mp3rgain is a separate program written in Rust that shares none of that code.
mp3gain is not malware, and for files you ripped yourself the practical risk is small. The exposure is opening a file from someone else: a download, a shared folder, a library you did not create. This page lists what is known, which builds are fixed, and what mp3rgain does differently, including the limits of that claim.
Where the vulnerabilities are
Almost all of them sit in two places:
- The bundled MP3 decoder. mp3gain carries an old fork of mpg123's
mpglib (
mpglibDBL) to decode audio for analysis. mpg123 itself has had years of security fixes; the fork has not. Since 1.6.x mp3gain can be built against the system libmpg123, which avoids these, but the Windows build and many packages still use the bundled code. - APE tag handling.
apetag.c, the code that reads and writes mp3gain's own tags, has several buffer overflows.
Decoder and analysis
| CVE | Year | Type | Where |
|---|---|---|---|
| CVE-2003-0577 | 2003 | Denial of service (invalid bitrate) | common.c |
| CVE-2004-0805 | 2004 | Buffer overflow | layer2.c |
| CVE-2004-0991 | 2004 | Buffer overflow (MPEG header) | mpglib |
| CVE-2006-1655 | 2006 | Heap overflow (multiple) | layer3.c |
| CVE-2017-12912 | 2017 | Buffer over-read | layer3.c |
| CVE-2017-14406 | 2017 | NULL pointer dereference | interface.c |
| CVE-2017-14407 | 2017 | Stack buffer over-read | gain_analysis.c |
| CVE-2017-14408 | 2017 | Buffer over-read | layer3.c |
| CVE-2017-14409 | 2017 | Buffer overflow (CVSS 7.8, high) | layer3.c |
| CVE-2017-14410 | 2017 | Read access violation | layer3.c |
| CVE-2017-14411 | 2017 | Stack buffer overflow | interface.c |
| CVE-2017-14412 | 2017 | Invalid memory write | interface.c |
| CVE-2017-9872 | 2017 | Buffer over-read | layer3.c |
| CVE-2018-10776 | 2018 | Segfault, denial of service | common.c |
| CVE-2018-10778 | 2018 | Read access violation | layer3.c |
| CVE-2020-15359 | 2020 | Stack overflow (code execution) | Local variable overflow |
| CVE-2021-34085 | 2021 | Out-of-bounds read, memory corruption (CVSS 9.8, critical) | layer3.c |
CVE-2020-15359 was found by VDA Labs with the Mayhem fuzzer, which reported about 1,600 crashes from about 6,000 test cases, some of them pointer overwrites that could allow code execution.
APE tags
| CVE | Year | Type | Where |
|---|---|---|---|
| CVE-2017-12911 | 2017 | Stack memory corruption | apetag.c |
| CVE-2018-10777 | 2018 | Buffer overflow | apetag.c |
| CVE-2019-18359 | 2019 | Buffer over-read (CVSS 5.5, medium) | apetag.c |
| CVE-2023-49356 | 2023 | Stack buffer overflow (CVSS 7.5, high) | apetag.c |
These four were fixed in mp3gain's source repository on 2025-11-01, when the maintainer applied the Debian and openSUSE patches. No release has followed, so pre-built binaries and packages built from the 1.6.2 release do not have them.
Which mp3gain builds are patched
Because there is no patched release, every distribution decides for itself. Status as of November 2025:
| Where you got it | Version | Patched | Notes |
|---|---|---|---|
Debian, Ubuntu (apt) | 1.6.2-3 | Yes | The most complete patch set; links the system libmpg123 |
| openSUSE | 1.6.2 | Partly | Security updates issued in 2020 |
| Fedora | 1.6.2 | Partly | Some CVEs tracked in Bugzilla |
| Homebrew | 1.6.2 | No | Built against libmpg123, which avoids the decoder CVEs, but without the APE tag patches |
| Arch Linux (AUR) | 1.6.2 | No | Removed from the official repositories; user-maintained |
| Chocolatey | 1.5.2 | No | Not updated since 2014; bundles the old decoder |
| SourceForge, Windows | 1.2.5 (stable) | No | A 2004-era binary, affected by every CVE listed above |
Sources: the Debian security tracker, Repology, and SourceForge bug #62, where the patches were applied upstream.
aacgain
aacgain is a fork of mp3gain that adds AAC. Its last release is 2.0.0 (December 2019) and
its last commit was in July 2022. It bundles all of its dependencies as source, none updated
for security: the same mpglibDBL decoder and unpatched apetag.c,
plus faad2 and mp4v2, each with CVEs of their own (for example CVE-2018-14326 and
CVE-2023-29584 in mp4v2). No distribution ships a patched aacgain, and Homebrew deprecated
its formula as unmaintained in April 2023.
What mp3rgain does differently
mp3rgain is a rewrite, not a patched fork. It shares no code with mp3gain or aacgain:
| Job | mp3gain, aacgain | mp3rgain |
|---|---|---|
| Gain change | Rewrites global_gain in the bitstream (C) | The same method (Rust) |
| Decoding for analysis | mpglib or libmpg123; faad2 for AAC (C) | Symphonia (Rust) |
| MP4 container | mp4v2 (C) | Symphonia and mp3rgain's own parser (Rust) |
| APE tags | apetag.c (C) | mp3rgain's own reader and writer (Rust) |
mp3rgain's own source (the library, the command-line tool, and the desktop app) contains
no unsafe blocks, and neither do the Symphonia crates it decodes with. In safe
Rust an out-of-range access stops the program with an error instead of corrupting memory,
and use-after-free, null dereferences, and data races are rejected when the code is
compiled. The buffer overflows and over-reads that make up nearly every CVE above are
exactly the class this removes.
What this does not claim. It describes the design, not a tested
guarantee. No CVE proof-of-concept file is part of mp3rgain's test suite, and there is no
fuzzing harness yet. Safe Rust does not remove ordinary bugs: a malformed file can still
make mp3rgain stop with an error or use more memory than it should. Some dependencies,
such as rayon, use unsafe internally. Problems like these are worth
reporting.
Checking it yourself
# No unsafe blocks in mp3rgain's own code (prints nothing)
grep -rnw unsafe src mp3rgui/src
# Known-vulnerable dependencies (CI runs this for both lockfiles)
cargo audit
cargo audit --file mp3rgui/Cargo.lock
Release downloads carry a SHA-256 file and, since v3.16.0, a GitHub build provenance attestation, which shows that a file was built by this repository's release workflow from its tag:
gh attestation verify mp3rgain-v3.16.2-windows-x86_64.zip --repo M-Igashi/mp3rgain
CI also runs CodeQL and GitHub's dependency review. The apps make no network connections and collect no telemetry. Windows binaries are not code-signed; the macOS app is signed with a Developer ID and notarized. More on verifying a download is on the install guide.
If you are using mp3gain today
- On Debian or Ubuntu, from
apt: you have the patched build. Switching is optional; mp3rgain adds AAC, parallel processing, and BS.1770 modes. - On Windows, from SourceForge or Chocolatey: that binary has none of the fixes. mp3rgui is the same workflow in a maintained app, and it can undo files MP3Gain already adjusted.
- Using aacgain anywhere: there is no patched build. mp3rgain handles the same M4A files with the same flags.
- In a script, container, or CI job: the flags, TSV output, and undo tag match, so replacing the binary name is usually the whole migration. Migration notes.
The full reference list, including each distribution's advisories, is in docs/security.md on GitHub.