Is mp3gain safe? Known CVEs, patched builds, and a memory-safe alternative

Updated · mp3rgain v3.16.2

Short answer

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

CVEYearTypeWhere
CVE-2003-05772003Denial of service (invalid bitrate)common.c
CVE-2004-08052004Buffer overflowlayer2.c
CVE-2004-09912004Buffer overflow (MPEG header)mpglib
CVE-2006-16552006Heap overflow (multiple)layer3.c
CVE-2017-129122017Buffer over-readlayer3.c
CVE-2017-144062017NULL pointer dereferenceinterface.c
CVE-2017-144072017Stack buffer over-readgain_analysis.c
CVE-2017-144082017Buffer over-readlayer3.c
CVE-2017-144092017Buffer overflow (CVSS 7.8, high)layer3.c
CVE-2017-144102017Read access violationlayer3.c
CVE-2017-144112017Stack buffer overflowinterface.c
CVE-2017-144122017Invalid memory writeinterface.c
CVE-2017-98722017Buffer over-readlayer3.c
CVE-2018-107762018Segfault, denial of servicecommon.c
CVE-2018-107782018Read access violationlayer3.c
CVE-2020-153592020Stack overflow (code execution)Local variable overflow
CVE-2021-340852021Out-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

CVEYearTypeWhere
CVE-2017-129112017Stack memory corruptionapetag.c
CVE-2018-107772018Buffer overflowapetag.c
CVE-2019-183592019Buffer over-read (CVSS 5.5, medium)apetag.c
CVE-2023-493562023Stack 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 itVersionPatchedNotes
Debian, Ubuntu (apt)1.6.2-3YesThe most complete patch set; links the system libmpg123
openSUSE1.6.2PartlySecurity updates issued in 2020
Fedora1.6.2PartlySome CVEs tracked in Bugzilla
Homebrew1.6.2NoBuilt against libmpg123, which avoids the decoder CVEs, but without the APE tag patches
Arch Linux (AUR)1.6.2NoRemoved from the official repositories; user-maintained
Chocolatey1.5.2NoNot updated since 2014; bundles the old decoder
SourceForge, Windows1.2.5 (stable)NoA 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:

Jobmp3gain, aacgainmp3rgain
Gain changeRewrites global_gain in the bitstream (C)The same method (Rust)
Decoding for analysismpglib or libmpg123; faad2 for AAC (C)Symphonia (Rust)
MP4 containermp4v2 (C)Symphonia and mp3rgain's own parser (Rust)
APE tagsapetag.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.

Next