Skip to content
Memory corruption Write-up Advanced

I Found a Stack Buffer Overflow in ALSA-lib, The Audio Library Running on Every Linux Machine | CVE-2026-90781

An off-by-one condition in two name= parsing loops of ALSA-lib's control element ID parser allowed a one-byte NUL write past a 64-byte stack buffer. An attacker could trigger a crash (denial of service) by supplying a 64-character name value through UCM configs, alsactl restore, or alsamixer arguments.

Harsh Raj Singhania Follow

Published on medium.com

Cybersecurity

Harsh Raj Singhania, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

ALSA, the Advanced Linux Sound Architecture, has two halves. The kernel half is the audio subsystem inside the Linux kernel. ALSA-lib is the userspace half: the library applications call to talk to that subsystem. PipeWire, PulseAudio and JACK use it. alsamixer, the terminal volume tool, is built on it, and the alsactl restore command that loads saved audio settings calls it. The copyright header of the vulnerable file reads:

Text
Copyright (c) 2010 by Jaroslav Kysela <[redacted]>

Every controllable parameter of an audio device, such as volume, mute switch, EQ band or microphone gain, is a control element. Each has a text identifier like:

Text
numid=1,iface=MIXER,name='Master Playback Volume'

The public function snd_ctl_ascii_elem_id_parse() converts such a string into an internal struct. It is called from alsamixer, from alsactl, from ALSA's Use Case Manager (UCM) and from control remapping. The parsing itself happens in __snd_ctl_ascii_elem_id_parse() in src/control/ctlparse.c, and that is where the bug lives.

From the original on medium.com

Setup

The vulnerable source is referenced at v1.2.16.1 (lines 216 to 241 of src/control/ctlparse.c). The researcher built a standalone harness using the exact same parsing logic from ctlparse.c, unchanged, and ran it with AddressSanitizer.

Finding it

The starting point was an existing fix. PR #509 was titled "Fix Theoretical One-byte Buffer Overrun" and identified an off-by-one in the numid= parsing loop inside __snd_ctl_ascii_elem_id_parse(). The fix was a one-character change:

C
if (size < (int)sizeof(buf))
C
// After PR #509
if (size < (int)sizeof(buf) - 1)

The numid= loop was fixed. Directly below it, the two name= loops carried the exact same condition and were left untouched.

The function declares a 64-byte stack buffer:

C
char buf[64];

Valid indices are buf[0] through buf[63]. A pointer ptr and a counter size track the parse, and after the loop the code always writes a terminating NUL:

C
*ptr = '\0';

The two name= loops as they existed in the vulnerable source:

Quoted string variant, for input like name='Master Volume':

C
while (*str && *str != c) {
    if (size < (int)sizeof(buf)) {   // BUG: should be sizeof(buf) - 1
        *ptr++ = *str;
        size++;
    }
    str++;
}
// ...
*ptr = '\0';

Unquoted string variant, a bare name without quotes:

C
while (*str && *str != ',') {
    if (size < (int)sizeof(buf)) {   // BUG: should be sizeof(buf) - 1
        *ptr++ = *str;
        size++;
    }
    str++;
}
// ...
*ptr = '\0';

For comparison, the already-fixed numid= loop in the development source at the time of the report:

C
while (*str && *str != ',') {
    if (size < (int)sizeof(buf) - 1) {   // CORRECT
        *ptr++ = *str;
        size++;
    }
    str++;
}
*ptr = '\0';

The difference is one character, - 1, applied to numid= but not to the two name= loops in the same function.

Exploitation

Step 1: work out the arithmetic

sizeof(buf) is 64. The loop permits writing while size < 64, so when size equals 63 the character is written, size becomes 64 and ptr advances to buf + 64. The loop then exits, either because the string ended or because the delimiter was hit. The code then executes *ptr = '\0' with ptr == buf + 64, writing to buf[64], one byte past the end of a buffer that owns indices 0 through 63.

With sizeof(buf) - 1 the condition becomes size < 63. The 64th character is rejected, ptr never reaches buf + 64, and the NUL lands on buf[63], the last valid byte.

Step 2: trigger the unquoted variant

The harness calls the parser with a name= value of 64 A characters:

C
snd_ctl_ascii_elem_id_parse(&id,
    "name=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");

ASan reports:

Text
ERROR: AddressSanitizer: stack-buffer-overflow
WRITE of size 1 at 0x7f1d540000e0 thread T0
Text
  [32, 96) 'buf' (line 22) <== Memory access at offset 96 overflows this variable

The [32, 96) range means buf occupies 64 bytes of stack starting at offset 32. The access is at offset 96, which is 32 + 64, the first byte past the end of buf. ASan calls this the "Stack right redzone", the poison zone placed immediately after each stack object, so hitting it confirms exactly where the write lands.

Step 3: trigger the quoted variant

The quoted variant was tested separately with 64 B's wrapped in single quotes:

Text
ERROR: AddressSanitizer: stack-buffer-overflow
WRITE of size 1  [32, 96) 'buf' <== Memory access at offset 96 overflows this variable

Same offset, same one-byte out-of-bounds write, from a second independent code path.

Step 4: confirm the fixed path

The same 64-character payload run through the corrected condition produced no report:

Text
Fixed path: size capped at 63, NUL writes to buf[63] — no ASan report.

Root cause

The condition size < (int)sizeof(buf) allows the loop to fill all 64 bytes of buf and advance ptr to buf + 64. The unconditional *ptr = '\0' after the loop then writes one byte past the buffer. The correct bound is sizeof(buf) - 1, which reserves the last byte for the terminator. PR #509 had already established this for the numid= loop; the two name= loops in the same function kept the old condition.

Impact

The write is one byte, the value is always '\0', and it always lands at the same address relative to buf. It is not an arbitrary write: neither the value nor its position relative to other stack objects can be chosen. With stack canaries enabled, the default on every major Linux distribution, the function return after the write trips the canary check and aborts the process, so the realistic demonstrated outcome is a crash, a denial of service. Without canaries, or where the overwritten byte lands in a non-critical neighbouring stack slot, the behaviour could be silent memory corruption, but code execution was not demonstrated and is not claimed. VulnCheck published it at CVSS 4.8 Medium; the researcher had recommended 5.5.

Reachability runs through the normal audio configuration workflow. UCM configuration files ship with hardware support, and a distro's alsa-ucm-conf package contains a config for the specific hardware model. Those configs contain cset directives such as:

Text
cset "name='Headphone Jack Switch' on"

That string goes through __snd_ctl_ascii_elem_id_parse(), and PipeWire and PulseAudio load UCM configs when audio devices are connected. A malformed UCM configuration with a name= value 64 characters long reaches the vulnerable path directly. The same parser is reached through alsactl restore, which reads saved audio state from a file, and through alsamixer command line arguments.

Fix

The researcher emailed Jaroslav Kysela on August 29, and the fix was committed the same day:

Text
[redacted]

The reply was one sentence: "Thanks. Fixed." The fix is exactly four characters added in two places, - 1, to both name= loops, mirroring the correction PR #509 had already made to the numid= loop.

Variants to test

  1. Audit every loop in a function after an off-by-one fix lands. Look for sibling loops with the same bound expression and a trailing terminator write. A positive result is a second loop where size < sizeof(buf) is followed by an unconditional *ptr = '\0'.
  2. Grep for the pattern sizeof(buf)) next to *ptr++ in C parsers that copy into fixed stack buffers. A positive result is a loop that can fill the buffer completely before the terminator is written.
  3. Test both quoted and unquoted branches of any string parser separately. A positive result is the same out-of-bounds offset reported from two independent code paths.
  4. Run the parser under AddressSanitizer with an input exactly the size of the buffer. A positive result is a stack-buffer-overflow report whose access offset equals the buffer's start offset plus its size.
  5. Trace callers of the parser into configuration file loaders, such as UCM cset directives, and check whether a 64-character name= value can arrive from a config file. A positive result is a config-driven path that reaches the vulnerable loop.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A security researcher found a small mistake in a piece of software that almost every Linux computer uses to handle sound. The mistake is one character missing from a piece of code that copies text into a fixed-size box in memory. Because of that missing character, a long enough piece of text can make the program write one byte just past the end of the box. That is called a stack buffer overflow.

The researcher did not find this by guessing. He found it by reading a fix that someone else had already made to a very similar piece of code in the same function, and then asking a simple question: did they fix every place where this same mistake appears? The answer was no. Two other places had the identical mistake and were left alone.

He proved the bug with a testing tool that watches memory accesses, reported it to the person who wrote the library, and the fix was committed the same day. The bug was given an official identifier, CVE-2026-90781, and VulnCheck published it at 4.8 Medium.

This article walks through the whole story from zero: what the library is, what the code does, why the missing character matters, how the proof worked, and what the real-world impact is. No prior security knowledge is assumed.

The library: what ALSA is and why it is everywhere

ALSA stands for Advanced Linux Sound Architecture. It is the part of Linux that deals with audio, and it comes in two halves.

The first half lives inside the Linux kernel itself. The kernel is the core program of the operating system, the layer that talks directly to hardware such as your speakers and microphone. That half is the audio subsystem.

The second half is ALSA-lib. This is a library: a collection of ready-made code that other programs can call instead of writing everything themselves. ALSA-lib is the userspace half, meaning it runs in ordinary programs rather than inside the kernel. Applications call it to talk to the kernel's audio subsystem.

Think of the kernel half as the sound card's driver and ALSA-lib as the front desk that every program must speak to before it can reach the driver. Programs do not talk to the driver directly; they go through the front desk.

Many well-known programs use this front desk:

  • PipeWire, PulseAudio and JACK, which are sound servers that route audio between applications and devices.
  • alsamixer, the terminal tool you use to adjust volume.
  • The alsactl restore command, which loads your saved audio settings when the system starts.

Every time you plug headphones into a Linux laptop, some part of this library is involved. If you are reading the article on a Linux machine, you have almost certainly used it today, probably within the last few minutes.

The copyright header at the top of the file that contains the bug reads:

Text
Copyright (c) 2010 by Jaroslav Kysela <[redacted]>

Jaroslav Kysela wrote ALSA and has maintained it for over two decades. He is also the person who fixed this bug, on the same day it was reported. That gives you a sense of the scale: this is not an obscure project, it is foundational software maintained by its original author.

Control elements and the parser

Inside ALSA, every adjustable parameter of an audio device is called a control element. Volume, a mute switch, an equaliser band, microphone gain: each one is a control element.

Each control element has a text identifier, a human-readable label the system can use to refer to it. One looks like this:

Text
numid=1,iface=MIXER,name='Master Playback Volume'

Read it as a set of labelled fields separated by commas. numid=1 is a numeric identifier. iface=MIXER says which interface the control belongs to. name='Master Playback Volume' is the name, wrapped in single quotes.

Programs need to turn that text into an internal data structure, a format the computer can work with efficiently. The function that does this is called snd_ctl_ascii_elem_id_parse(). A function is a named block of code that performs a task; you give it input and it produces output. This one is a public API, meaning it is officially offered for other programs to call.

It is called from alsamixer, from alsactl, from ALSA's Use Case Manager (UCM), and from control remapping. UCM is a system of configuration files that describe how a particular piece of audio hardware should be set up; we will come back to it.

The public function is a wrapper. The actual parsing work, the character-by-character reading of the string, happens in an internal function called __snd_ctl_ascii_elem_id_parse(), in the file src/control/ctlparse.c. That is where the bug lives.

From the original on medium.com

The earlier fix that started everything

Before getting to the bug itself, you need to know that the maintainer had already found a version of it.

Someone opened a pull request numbered 509. A pull request, or PR, is a proposed change to a codebase: someone edits the code and asks the project to accept the edit. This one was titled "Fix Theoretical One-byte Buffer Overrun".

"Buffer overrun" is the general name for writing past the end of a reserved area of memory. "One-byte" means the overrun is a single byte. "Theoretical" was the author's way of saying they did not think it could really happen in practice.

The PR identified that the numid= parsing loop inside __snd_ctl_ascii_elem_id_parse() had an off-by-one condition. An off-by-one is exactly what it sounds like: a calculation that is wrong by one unit, usually because someone forgot that counting starts at zero or forgot to leave room for something. The fix was a one-character change:

C
if (size < (int)sizeof(buf))
C
// After PR #509
if (size < (int)sizeof(buf) - 1)

Line by line:

  • if (size < (int)sizeof(buf)) is the old condition. size is a counter of how many characters have been copied so far. sizeof(buf) asks the computer how many bytes the buffer buf occupies. (int) converts that number to an integer type so the comparison works cleanly. The condition says: keep copying as long as the count is smaller than the buffer's size.
  • if (size < (int)sizeof(buf) - 1) is the new condition. It says: keep copying as long as the count is smaller than the buffer's size minus one. That leaves one byte free at the end.

They filed it. They closed it. The numid= loop was fixed. The author called the problem theoretical. But directly below that loop, in the same function, the two name= loops had the exact same condition, and they were left untouched.

This is the key moment of the whole story. A fix landed in one place, and nobody checked whether the same mistake existed nearby.

The vulnerable code

Now let us look at the code as it existed before the fix.

At the top of __snd_ctl_ascii_elem_id_parse() there is a declaration of a 64-byte buffer on the stack:

C
char buf[64];

Line by line:

  • char means the buffer holds characters, one byte each.
  • buf is the name of the buffer.
  • [64] means it has room for 64 of them.

The stack is a region of memory a program uses for short-lived data while a function runs. Think of it as a scratchpad: the function writes notes there, uses them, and the space is reclaimed when the function returns. A buffer is a reserved block within that scratchpad.

Because the buffer has 64 slots and counting starts at zero, the valid indices are buf[0] through buf[63]. There is no buf[64]. That slot belongs to whatever comes next in memory.

The function also keeps a pointer ptr and a counter size. A pointer is a variable that holds a memory address, like a bookmark that says where you are in the buffer. size counts how many characters have been written so far. As the function parses each field, it copies characters into the buffer one at a time, moving ptr forward and incrementing size.

After the loop, the code always writes a terminating NUL:

C
*ptr = '\0';

Line by line:

  • *ptr means "the memory location that ptr points at".
  • = '\0' stores the NUL character there. NUL is a byte with value zero. In C, strings are stored as characters followed by a NUL, which marks the end. Programs reading the string keep going until they hit that zero byte.

So the function copies characters, then marks the end with a zero. That is normal and correct, as long as ptr is still inside the buffer when the marking happens.

Here are the two name= parsing loops as they existed in the vulnerable source.

The quoted string variant, used when the name is wrapped in quotes, like name='Master Volume':

C
while (*str && *str != c) {
    if (size < (int)sizeof(buf)) {   // BUG: should be sizeof(buf) - 1
        *ptr++ = *str;
        size++;
    }
    str++;
}
// ...
*ptr = '\0';

Line by line:

  • while (*str && *str != c) is a loop that keeps going while two things are true. *str is the character currently being read from the input string; if it is zero, the string has ended. *str != c means the character is not the closing quote character c. So the loop runs until the input ends or the closing quote is reached.
  • if (size < (int)sizeof(buf)) is the faulty check. It allows copying while the count is below 64, which means it allows the 64th character to be copied.
  • *ptr++ = *str; copies the current input character into the buffer and then moves the pointer forward by one. The ++ after ptr means "use the current address, then advance".
  • size++; increments the counter.
  • str++; moves to the next input character.
  • *ptr = '\0'; writes the terminator after the loop, unconditionally.

The unquoted string variant, for a bare name without quotes:

C
while (*str && *str != ',') {
    if (size < (int)sizeof(buf)) {   // BUG: should be sizeof(buf) - 1
        *ptr++ = *str;
        size++;
    }
    str++;
}
// ...
*ptr = '\0';

Line by line:

  • This is the same structure, except the loop stops at a comma instead of a quote. *str != ',' means "the current character is not a comma". A comma separates fields in the identifier string, so it marks the end of the name.
  • The faulty check, the copy, the counter increment and the terminator write are identical to the quoted variant.

Now compare that to the already-fixed numid= loop in the development source at the time of the report:

C
while (*str && *str != ',') {
    if (size < (int)sizeof(buf) - 1) {   // CORRECT
        *ptr++ = *str;
        size++;
    }
    str++;
}
*ptr = '\0';

Line by line:

  • The loop and the copy are the same as the unquoted name= variant.
  • The difference is the check: size < (int)sizeof(buf) - 1. The - 1 reserves the last byte for the terminator.

The difference between the broken loops and the fixed one is one character: - 1. It was applied to the numid= loop but not to the two name= loops sitting in the same function.

Why the condition is wrong

Walk through the arithmetic once and it becomes obvious.

sizeof(buf) is 64. The loop permits writing while size < 64. So when size equals 63, the check passes, the character is written into the buffer, size becomes 64, and ptr advances to buf + 64, one slot past the end.

The loop then exits, either because the input string ended or because the delimiter was hit. Then the code executes *ptr = '\0' with ptr == buf + 64. That writes to buf[64]. But buf only owns indices 0 through 63. buf[64] is one byte past the end of the buffer.

With sizeof(buf) - 1, the condition becomes size < 63. The 64th character is rejected. ptr never reaches buf + 64. The NUL writes to buf[63], the last valid byte. Safe.

That is the whole bug: one missing - 1, in two places.

Proving it with AddressSanitizer

A bug in code is a claim. To turn it into a finding, you need evidence that it actually happens when the program runs. The researcher built a standalone harness: a small test program that uses the exact same parsing logic from ctlparse.c, unchanged, and runs it under a tool called AddressSanitizer.

AddressSanitizer, or ASan, is a tool that watches a program's memory accesses while it runs. If the program reads or writes outside a reserved area, ASan notices and prints a detailed report. It is like a safety inspector standing next to the scratchpad, noting every time a pen goes over the edge of the page.

The trigger for the unquoted variant is simple: call the parser with a name= value made of 64 A characters.

C
snd_ctl_ascii_elem_id_parse(&id,
    "name=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");

Line by line:

  • snd_ctl_ascii_elem_id_parse(&id, ...) calls the public parsing function. &id passes the address of a structure where the result should be stored, so the function can fill it in.
  • The second argument is the input string. It starts with name=, followed by exactly 64 A characters. That is one character more than the buffer can hold together with its terminator.

ASan reports:

Text
ERROR: AddressSanitizer: stack-buffer-overflow
WRITE of size 1 at 0x7f1d540000e0 thread T0

Line by line:

  • ERROR: AddressSanitizer: stack-buffer-overflow names the problem: a write past the end of a buffer that lives on the stack.
  • WRITE of size 1 says a single byte was written out of bounds.
  • at 0x7f1d540000e0 is the memory address where it happened.
  • thread T0 says it happened on the program's main thread.

A second line gives the detail:

Text
  [32, 96) 'buf' (line 22) <== Memory access at offset 96 overflows this variable

Line by line:

  • [32, 96) describes the memory range that buf occupies. The square bracket means the start is included; the round bracket means the end is excluded. So the buffer covers offsets 32 up to but not including 96.
  • 'buf' is the name of the variable.
  • (line 22) points at the line in the source where the buffer is declared.
  • Memory access at offset 96 overflows this variable says the write landed at offset 96, which is exactly where the buffer ends and the next memory begins.

The range tells you buf occupies 64 bytes of stack starting at offset 32. The access is at offset 96, which is 32 + 64, the first byte past the end of buf. ASan calls this the "Stack right redzone": the poison zone it places immediately after each stack object. Hitting it confirms exactly where the write lands.

Proving the quoted variant too

The quoted variant was tested separately, with 64 B's wrapped in single quotes. This matters because the two loops are separate code paths: fixing or breaking one does not automatically affect the other. If both are broken, both should be shown to be broken.

Text
ERROR: AddressSanitizer: stack-buffer-overflow
WRITE of size 1  [32, 96) 'buf' <== Memory access at offset 96 overflows this variable

Line by line:

  • The error type is the same: a stack buffer overflow.
  • The write is again one byte.
  • The buffer range is again [32, 96), and the access is again at offset 96.

Same report, same offset, same one-byte out-of-bounds write. Two independent code paths, both confirmed.

Confirming the fixed version

A good proof also checks the other direction: that the corrected code does not have the problem. The same 64-character payload was run through the corrected condition.

Text
Fixed path: size capped at 63, NUL writes to buf[63] — no ASan report.

Line by line:

  • size capped at 63 means the counter can never exceed 63, because the check rejects the 64th character.
  • NUL writes to buf[63] means the terminator lands on the last valid byte of the buffer.
  • no ASan report means AddressSanitizer saw nothing wrong.

This is how you show that the fix actually fixes the problem, rather than just moving it around.

Where this is actually reachable

The public API wrapper, snd_ctl_ascii_elem_id_parse(), is called all over the ALSA userspace stack. But the most interesting reachability path is UCM, ALSA's Use Case Manager.

UCM configuration files ship with hardware support for audio devices. If you have a laptop running Linux, your distribution's alsa-ucm-conf package contains a UCM config for your specific hardware model. These configs contain cset directives that look like this:

Text
cset "name='Headphone Jack Switch' on"

Line by line:

  • cset is the directive name. It tells the configuration system to set a control element.
  • The quoted part is the control identifier, in the same name=... format the parser understands.
  • on is the value to set.

That string goes through __snd_ctl_ascii_elem_id_parse(). PipeWire and PulseAudio load UCM configs when audio devices are connected. A malformed UCM configuration with a name= value 64 characters long reaches the vulnerable path directly.

This is also reachable through alsactl restore, which reads saved audio state from a file, and through alsamixer command line arguments. The parser is not buried in a corner of the library that nothing calls. It is used in the normal audio device configuration workflow.

What this is and what it is not

The researcher is careful to be precise here, because "a stack buffer overflow in ALSA-lib" sounds scarier than what the evidence actually shows.

The write is one byte. The written value is always '\0'. It always lands at the same address relative to buf. This is not an arbitrary write: you cannot choose what goes there, or exactly where relative to other stack objects it lands. An arbitrary write, where an attacker controls both the value and the location, is far more dangerous because it can be used to redirect the program's execution. This is not that.

With stack canaries enabled, which is the default for every major Linux distribution, a function return after this write triggers the canary check, which aborts the process. A stack canary is a small value placed next to a buffer on the stack; before the function returns, the program checks that the value is unchanged. If a write has spilled over and changed it, the program knows something went wrong and stops. The realistic demonstrated outcome is a crash, which is a denial of service: the program stops working, but nothing worse.

Without stack canaries, or in a configuration where the overwritten byte happens to land in a non-critical neighbouring stack slot, the behaviour could be silent memory corruption. But the researcher did not demonstrate code execution and does not claim it. Code execution means making the program run an attacker's instructions, and that is a much stronger claim than the evidence supports.

CVSS 4.8 Medium is the right score for what this actually is. CVSS is a standard scoring system for vulnerabilities, where higher numbers mean more severe. The researcher recommended 5.5 in the original submission; VulnCheck published it at 4.8. That is a defensible call.

The reason this still deserves a CVE, and the reason it is worth writing about, is not the raw severity number. It is the provenance: where the bug came from and how it was found. This is a confirmed stack buffer overflow in a library that every Linux audio stack depends on. The class of bug had already been identified and fixed in the same function. Two instances of it were missed. That is a clean, well-evidenced finding even at a Medium score.

The maintainer and the fix

The researcher emailed Jaroslav Kysela on August 29. He committed the fix the same day:

Text
[redacted]

That long string is a commit identifier: a unique fingerprint for one saved change in a code repository. It is how you point at exactly one version of the code.

The reply was one sentence: "Thanks. Fixed."

The fix is exactly four characters added in two places, - 1, to both name= loops, mirroring the correction PR #509 had already made to the numid= loop. That is it. The man who wrote this library in 2010, and who has been maintaining it since, looked at the report and had it done in hours.

A different ALSA-lib CVE that is not this one

VulnCheck published another ALSA-lib CVE in 2026: CVE-2026-56109, a double-free in parse_def() inside src/conf.c. A double-free is a different kind of memory bug where the same block of memory is released twice. It is a completely different file, a completely different function and a completely different bug class. If you have read about ALSA-lib security issues this year, that is the other one. This article is about CVE-2026-90781, in src/control/ctlparse.c, in __snd_ctl_ascii_elem_id_parse(), an off-by-one in two name= loops.

The habit behind the finding

This is one of nine posts in the researcher's series, covering seven languages and runtimes, a different project each time. They all started the same way. Something in the existing code, or in an existing fix, implied that the problem was handled. He checked whether that was actually true.

PR #509 said "fix theoretical one-byte buffer overrun". The word "theoretical" stuck, but more than that, the fix was right. It was just applied to one out of three places where the same condition existed. Checking the neighbours takes maybe ten minutes once you understand what you are looking at. It found two more.

The overflow PR #509 fixed was called theoretical. It was not. The two they missed alongside it were not either.

Glossary

  • AddressSanitizer (ASan): a tool that watches a running program's memory accesses and reports any read or write outside a reserved area.
  • ALSA (Advanced Linux Sound Architecture): the audio system of Linux, split between a kernel half and a userspace half.
  • ALSA-lib: the userspace library that applications call to talk to the kernel's audio subsystem.
  • API (Application Programming Interface): a defined set of functions a program offers so other programs can use it.
  • Arbitrary write: a memory write where an attacker controls both the value written and the location, which is far more dangerous than a fixed one-byte write.
  • Buffer: a reserved block of memory used to hold data temporarily.
  • Buffer overrun / buffer overflow: writing past the end of a reserved block of memory.
  • Byte: the basic unit of computer memory, usually holding one character.
  • Canary (stack canary): a small value placed next to a buffer on the stack and checked before a function returns, to detect memory corruption.
  • Code execution: making a program run instructions chosen by an attacker.
  • Commit: a saved change in a code repository, identified by a unique fingerprint.
  • Control element: any adjustable parameter of an audio device, such as volume or a mute switch.
  • CVE: a public identifier assigned to a known security vulnerability.
  • CVSS: a standard scoring system for the severity of vulnerabilities.
  • Denial of service: making a program or system stop working, without necessarily gaining anything from it.
  • Double-free: a memory bug where the same block of memory is released twice.
  • Function: a named block of code that performs a task.
  • Harness: a small test program built to exercise a specific piece of code.
  • Kernel: the core of an operating system, which talks directly to hardware.
  • Library: a collection of ready-made code that other programs can call.
  • NUL: a byte with value zero, used in C to mark the end of a string.
  • Off-by-one: a calculation that is wrong by one unit.
  • Pointer: a variable that holds a memory address.
  • PR (pull request): a proposed change to a codebase, submitted for review and acceptance.
  • Redzone: a poisoned area AddressSanitizer places around memory objects to catch out-of-bounds accesses.
  • Stack: a region of memory a program uses for short-lived data while functions run.
  • Stack buffer overflow: writing past the end of a buffer that lives on the stack.
  • Terminator: the NUL byte written after a string to mark its end.
  • UCM (Use Case Manager): ALSA's system of configuration files describing how particular audio hardware should be set up.
  • Userspace: the part of a system where ordinary programs run, as opposed to the kernel.
  • VulnCheck: the organisation that published the advisory for this CVE.

More by Harsh Raj Singhania

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.