Bug 2576238 (CVE-2026-132857)

Summary: CVE-2026-132857 flac: flac: stack buffer overflow in the flac CLI via crafted metadata blocks and --picture options
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: rhel-process-autobot, watson-tool-maintainers
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in the flac command-line encoder. When re-encoding a specially crafted FLAC file carrying a very large number of metadata blocks, supplying multiple --picture options causes the encoder to write past the end of a fixed-size buffer on the stack, corrupting its internal state and crashing the process. This issue can be triggered only when a user runs the flac command-line tool with --picture options on an untrusted input file; the demonstrated impact is a crash of the encoding process.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description OSIDB Bzimport 2026-11-19 08:58:53 UTC
A stack-based buffer overflow (CWE-121) was found in the flac command-line encoder. When flac re-encodes a FLAC (or Ogg-FLAC) input, the decoder callback stores each metadata block of the input into the fixed-size, on-stack array FLACDecoderData.metadata_blocks[1024], embedded in the EncoderSession object (a stack local of flac__encode_file, src/flac/encode.c:862). The callback rejects inputs carrying more than 1024 blocks, so an input with exactly 1024 blocks fills the array completely. EncoderSession_init_encoder() then appends one metadata clone per --picture option to that same array with no bound check (flac 1.4.3: src/flac/encode.c:1677-1685) -- the only writer into the array without one; the vorbis-comment (1715), cuesheet (1773), seektable (1830) and padding (1879) writers all carry a num_metadata_blocks < sizeof(metadata_blocks)/sizeof(metadata_blocks[0]) guard.

Overflow condition: input_blocks + pictures > 1024 (with the 64-picture cap, any input with >= 963 blocks suffices). The out-of-bounds stores write heap pointers (FLAC__metadata_object_clone results) over consecutive EncoderSession fields: index 1024 -> samples_left_to_process, 1025 -> fatal_error, 1026 -> encoder (FLAC__StreamEncoder*), then fin, seek_table_template, progress, compression_ratio; the object ends at index 1032. Once the encoder field is clobbered (3rd --picture option), the first FLAC__stream_encoder_* call dereferences a picture clone as an encoder and faults.

Only the FLAC/Ogg-FLAC input path is affected; WAV/AIFF input uses a heap-growing list. metaflac and libFLAC API consumers are not affected (the array is CLI-local).

Reproduced on flac-1.4.3-6.el10 (RHEL 10 package set) with a crafted valid FLAC file (1024 metadata blocks: STREAMINFO + VORBIS_COMMENT + 1022 zero-length PADDING, passes flac -t):
- Stock release binary: 1 --picture option -> clean encode; 2 -> graceful error abort; >= 3 -> SIGSEGV (exit 139).
- libasan rebuild from RPM source, 8 options: AddressSanitizer stack-buffer-overflow, WRITE of size 8 in EncoderSession_init_encoder, addr2line-resolved to the unguarded append at src/flac/encode.c:1684, overflowing the encoder_session stack object.
- valgrind on the stock binary: invalid read at address 0x6 in FLAC__stream_encoder_set_verify -- the clobbered encoder field holds a picture clone (FLAC__METADATA_TYPE_PICTURE == 6), independently confirming the store hit the encoder field.

Demonstrated impact is a crash of the encoding process; the written values are heap pointers to clones of the victim's own --picture specifications, not attacker-chosen data, and code execution was not demonstrated (512-byte overrun cap, PIE/RELRO/NX).

Affected versions: the unguarded append is present in flac 1.3.2 (encode.c:1826), 1.3.3 (1825), 1.4.3 (1684) and 1.5.0/master (1717) -- i.e. the versions shipped in RHEL 8, 9 and 10 -- with no dist-git patch covering it. No CVE currently covers this issue.

Suggested fix: bound the append as the sibling writers do (reject or stop once num_metadata_blocks reaches sizeof(metadata_blocks)/sizeof(metadata_blocks[0])); replacing the fixed 1024-entry array with a dynamically grown list is the larger cleanup flagged by the upstream BAD MAGIC number comment.

CVSS 3.1: AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H (5.5 Medium).

Reported by Calif.io (ANT-2026-XEY70RK0) via the Product Security support portal (PSIRTSUPT-30538); analysis artifacts in the ticket directory PSIRTSUPT-30538__flac-bof.