Integer overflow in FreeRDP audio input channel causes heap overflow
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- High
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-69xf-pqrw-596x. Fix status from GitHub. Impact type from CWE-122 and the CVSS impact.
Summary
FreeRDP up to and including 3.28.0 has an integer overflow in its audio input channel (audin) backends. The overflow causes a heap-based buffer overflow and denial of service (CWE-190). A remote attacker without privileges needs user interaction to trigger it.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
# Coordinated Vulnerability Disclosure Report ## Integer Overflow in Audio Input Redirection Channel Leading to Heap-Based Buffer Overflow and Denial of Service ### FreeRDP - `channels/audin` - FRDP-2026-001 --- **Report ID:** FRDP-2026-001 **Report Date:** 2026-07-12 **Reporter:** Ömer Can VURAL **Contact:** [email protected] **Github:** github.caom/canomer **Website:** patchmeifucan.com **Affected Product:** FreeRDP **Affected Component:** Audio Input Redirection Virtual Channel (`channels/audin`) **Affected Backends:** ALSA (Linux), sndio (BSD), WinMM (Windows), OpenSL ES (Android) **Upstream Repository:** https://github.com/FreeRDP/FreeRDP **Affected Versions:** All versions of FreeRDP that include audio input (`audin`) channel support **Vulnerability Types:** 1. **CWE-190:** Integer Overflow or Wraparound / Heap-Based Buffer Overflow (`audin_alsa.c`) 2. **CWE-190:** Integer Overflow or Wraparound / Incorrect Audio Processing / DoS (`audin_sndio.c`) 3. **CWE-190:** Integer Overflow or Wraparound / Incorrect Audio Processing / DoS (`audin_winmm.c`) 4. **CWE-190 / CWE-195:** Integer Overflow + Signed-to-Unsigned Conversion / Incorrect Audio Processing / DoS (`opensl_io.c`) **Severity:** HIGH **CVSS 3.1 Score (Worst-Case / ALSA):** 7.5 **CVSS 3.1 Vector (ALSA):** `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H` --- ## Table of Contents 1. [Executive Summary](#1-executive-summary) 2. [Discovery Methodology](#2-discovery-methodology) 3. [Affected Product Overview](#3-affected-product-overview) 4. [Vulnerability Analysis - VULN-001: ALSA Backend](#4-vulnerability-analysis--vuln-001-alsa-backend) 5. [Vulnerability Analysis - VULN-002: sndio Backend](#5-vulnerability-analysis--vuln-002-sndio-backend) 6. [Vulnerability Analysis - VULN-003: WinMM Backend](#6-vulnerability-analysis--vuln-003-winmm-backend) 7. [Vulnerability Analysis - VULN-004: OpenSL ES Backend](#7-vulnerability-analysis--vuln-004-opensl-es-backend) 8. [Unified Root Cause Analysis](#8-unified-root-cause-analysis) 9. [Comparative Analysis: Vulnerable vs. Safe Implementations](#9-comparative-analysis-vulnerable-vs-safe-implementations) 10. [Protocol-Level Attack Chain Analysis](#10-protocol-level-attack-chain-analysis) 11. [Proof of Concept](#11-proof-of-concept) 12. [Impact Assessment](#12-impact-assessment) 13. [CVSS 3.1 Scoring](#13-cvss-31-scoring) 14. [CWE Classification](#14-cwe-classification) 15. [Remediation Recommendations](#15-remediation-recommendations) 16. [Vulnerability Discovery Timeline](#16-vulnerability-discovery-timeline) 17. [Responsible Disclosure Policy](#17-responsible-disclosure-policy) 18. [References](#18-references) 19. [Appendices](#19-appendices) --- ## 1. Executive Summary Four integer overflow vulnerabilities were identified by code review and dynamic verification against the FreeRDP audio input redirection virtual channel (`audin`) subsystem. All four vulnerabilities share a single root cause: the `FramesPerPacket` parameter, delivered by an RDP server over the network via the `MSG_SNDIN_OPEN` or `MSG_SNDIN_FORMATS` protocol messages, is stored in all `SetFormat` implementations without any bounds check, and is subsequently consumed in allocation size expressions that perform 32-bit or narrower integer arithmetic. Under adversarial input, these expressions overflow, producing allocation sizes that are orders of magnitude smaller than intended. The vulnerabilities affect four independent audio subsystem backends compiled conditionally for their respective target platforms: * ALSA backend (Linux) * sndio backend (BSD) * Windows Multimedia (WinMM) backend (Windows) * OpenSL ES backend (Android) The practical impact profile differs across backends due to differing relationships between the overflowed allocation size and the subsequent read count argument passed to the audio capture API. In the ALSA implementation (`audin_alsa.c:143`), the overflowed size governs the `calloc()` argument while the original, non-overflowed `frames_per_packet` value is separately passed as the frame count to `snd_pcm_readi()`. This structural divergence constitutes a direct heap-based buffer overflow (CWE-122), confirmed empirically via AddressSanitizer (ASAN) instrumentation. In the remaining three backends, the overflow value propagates through both the allocation call and the corresponding I/O API argument, resulting in denial of service and, under specific parameter combinations, potential secondary heap-related anomalies. End-to-end exploitation through the RDP network protocol (i.e., delivery of a malicious `MSG_SNDIN_OPEN` message from an attacker-controlled server to a victim FreeRDP client triggering a real-world crash or code execution) was not demonstrated during this research engagement. The vulnerability is confirmed real in the source code; the missing piece is only the network delivery mechanism. The confirmed impact is: (a) heap-based buffer overflow in the ALSA backend as demonstrated by ASAN (b) denial of service (incorrect audio processing, potential allocator crash) on all four platforms (c) a theoretically exploitable attack primitive for remote code execution against ALSA-enabled Linux FreeRDP clients, which is credible given the vulnerability class but remains unproven end-to-end. **Key Findings Summary:** | ID | Backend | File | Sink Line | Overflow Type | Confirmed Impact | Potential Impact | |----|---------|------|-----------|---------------|-----------------|-----------------| | VULN-001 | ALSA | `audin_alsa.c` | 143 | Addition (UINT32 + UINT16) | Heap buffer overflow (ASAN) | RCE (unconfirmed) | | VULN-002 | sndio | `audin_sndio.c` | 129 | Multiplication (UINT32 × UINT16 × UINT16) | DoS (allocator failure or broken audio) | - | | VULN-003 | WinMM | `audin_winmm.c` | 187 | Multiplication (UINT16 × UINT16 × UINT32) | DoS (broken audio capture) | - | | VULN-004 | OpenSL ES | `opensl_io.c` | 347–348 | Multiplication (unsigned int × unsigned int) + signed conversion | DoS (broken audio capture) | - | --- ## 2. Affected Product Overview ### 2.1 FreeRDP Architecture and the `audin` Subsystem FreeRDP is the de-facto reference implementation of the Remote Desktop Protocol (RDP) for Linux, BSD, macOS, and Android platforms. It implements both the client and server sides of Microsoft's RDP specification (MS-RDPBCGR, MS-RDPEA, and related extensions). The audio input (microphone) redirection facility is specified in MS-RDPEAI (Remote Desktop Protocol: Audio Input Redirection Virtual Channel Extension) and is implemented in FreeRDP as a dynamic virtual channel plugin under `channels/audin/client/`. The `audin` channel client plugin consists of a platform-agnostic core (`audin_main.c`, `audin_main.h`) and multiple platform-specific backend implementations, each compiled conditionally depending on the available audio subsystem: | Backend | Source File | Target Platform | Audio API | |---------|------------|-----------------|-----------| | ALSA | `channels/audin/client/alsa/audin_alsa.c` | Linux | ALSA (libasound) | | sndio | `channels/audin/client/sndio/audin_sndio.c` | OpenBSD / NetBSD | sndio | | WinMM | `channels/audin/client/winmm/audin_winmm.c` | Windows | Windows Multimedia API | | OpenSL ES | `channels/audin/client/opensles/audin_opensles.c` + `opensl_io.c` | Android | OpenSL ES | | OSS | `channels/audin/client/oss/audin_oss.c` | FreeBSD | OSS (Open Sound System) | | PulseAudio | `channels/audin/client/pulse/audin_pulse.c` | Linux (PulseAudio) | PulseAudio | The OSS and PulseAudio backends are **not** vulnerable (see Section 9). ### 2.2 Protocol Context: `MSG_SNDIN_OPEN` The RDP audio input channel is activated by a server-to-client `MSG_SNDIN_OPEN` message (Message Type 0x01 in MS-RDPEAI §2.2.2.2), which carries, among other fields, a `FramesPerPacket` value (a 32-bit unsigned integer, `UINT32`). This value instructs the client regarding how many audio frames to capture per data packet before sending audio data back to the server. The `FramesPerPacket` value is the direct and sole origin of the vulnerability in all four backends. Upon receipt of this message, the channel core invokes the backend's `SetFormat` interface, which stores `FramesPerPacket` into the per-device structure. No specification constraint limits `FramesPerPacket` to a safe range, and FreeRDP enforces none. ### 2.3 Attack Surface A victim must be using FreeRDP (client mode) with audio input redirection enabled (`/microphone:sys:alsa` or equivalent) and must connect to a malicious or compromised RDP server. The connection may be: - A deliberately malicious RDP server controlled by the attacker. - A legitimate RDP server that has been compromised at the application layer. - A man-in-the-middle network position that can inject or modify RDP channel data (possible when RDP Enhanced Security / NLA is not enforced or the TLS certificate is trusted by the victim). The audio input channel negotiation occurs after the core RDP handshake; the `FramesPerPacket` value is transmitted after the client has authenticated and the virtual channel pipeline is established. This means the attack requires either server-side control or an MITM position post-TLS-handshake. --- ## 3. Vulnerability Analysis - VULN-001: ALSA Backend ### 3.1 Classification | Field | Value | | --------------------- | ------------------------------------------------------------------------------ | | **Vulnerability ID** | VULN-001 | | **CWE** | CWE-190 (Integer Overflow or Wraparound), CWE-122 (Heap-based Buffer Overflow) | | **CVSS 3.1** | 7.5 High - `AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H` | | **File** | `channels/audin/client/alsa/audin_alsa.c` | | **Sink (allocation)** | Line 143 (`calloc`) | | **Source (input)** | Line 276 (`audin_alsa_set_format`, `FramesPerPacket` parameter) | | **Platform** | Linux | ### 3.2 Vulnerable Source: `audin_alsa_set_format` (Lines 267–283) The `FramesPerPacket` parameter arrives from the RDP server via the protocol layer and is stored directly into `alsa->frames_per_packet` without any range check: ```c /* channels/audin/client/alsa/audin_alsa.c:267-283 */ static UINT audin_alsa_set_format(IAudinDevice* device, const AUDIO_FORMAT* format, UINT32 FramesPerPacket) { AudinALSADevice* alsa = (AudinALSADevice*)device; if (!alsa || !format) return ERROR_INVALID_PARAMETER; alsa->aformat = *format; alsa->frames_per_packet = FramesPerPacket; /* ← NO BOUNDS CHECK: attacker-controlled UINT32 */ if (audin_alsa_format(format->wFormatTag, alsa->aformat.wBitsPerSample) == SND_PCM_FORMAT_UNKNOWN) return ERROR_INTERNAL_ERROR; return CHANNEL_RC_OK; } ``` `alsa->frames_per_packet` is of type `UINT32`. The field is a member of `AudinALSADevice`: ```c typedef struct { IAudinDevice iface; char* device_name; UINT32 frames_per_packet; /* ← stored here; type: UINT32 */ AUDIO_FORMAT aformat; HANDLE thread; HANDLE stopEvent; AudinReceive receive; void* user_data; rdpContext* rdpcontext; wLog* log; size_t bytes_per_frame; } AudinALSADevice; ``` `aformat.nBlockAlign` is of type `UINT16` (from the `AUDIO_FORMAT` structure derived from `WAVEFORMATEX`). ### 3.3 Vulnerable Sink: `audin_alsa_thread_func` (Lines 118–228) The `frames_per_packet` field is used in the audio capture thread in two distinct roles with a critical structural asymmetry: **Role 1 - Heap allocation size argument (Line 143):** ```c /* channels/audin/client/alsa/audin_alsa.c:143-144 */ buffer = (BYTE*)calloc(alsa->frames_per_packet + alsa->aformat.nBlockAlign, alsa->bytes_per_frame); ``` **Role 2 - ALSA read frame count (Line 155):** ```c /* channels/audin/client/alsa/audin_alsa.c:155 */ size_t frames = alsa->frames_per_packet; /* channels/audin/client/alsa/audin_alsa.c:172 */ snd_pcm_sframes_t framesRead = snd_pcm_readi(capture_handle, buffer, frames); ``` ### 3.4 Integer Overflow Arithmetic The expression `alsa->frames_per_packet + alsa->aformat.nBlockAlign` is subject to the following type promotion rules under the C standard (ISO/IEC 9899:2018 §6.3.1.8, Usual Arithmetic Conversions): - `alsa->frames_per_packet`: `UINT32` (unsigned 32-bit) - `alsa->aformat.nBlockAlign`: `UINT16` (unsigned 16-bit) - C integer promotion: `UINT16` is implicitly promoted to `UINT32` (unsigned) because `UINT32` is the wider unsigned type in this expression context. - The addition is therefore performed as `UINT32 + UINT32 / UINT32`, **Overflow condition:** When `frames_per_packet = 0xFFFFFFFF` (the maximum `UINT32` value, which a malicious server can freely set) and `nBlockAlign = 4` (standard for 16-bit stereo PCM: 2 channels × 2 bytes/sample): ``` 0xFFFFFFFF + 0x00000004 = 0x100000003 / truncated to UINT32 = 0x00000003 (3) ``` **Resulting allocation:** `calloc(3, bytes_per_frame)` where `bytes_per_frame = nChannels × (wBitsPerSample / 8)`. For standard stereo 16-bit PCM: `bytes_per_frame = 2 × 2 = 4`. Therefore: `calloc(3, 4)` / **12 bytes allocated**. **Role 2 (read frame count):** `size_t frames = alsa->frames_per_packet` - this is a widening conversion from `UINT32` to `size_t` (64-bit on LP64). No overflow occurs here. The value is `0xFFFFFFFF` = 4,294,967,295 frames. **Structural divergence:** The buffer is 12 bytes. `snd_pcm_readi()` is instructed to read up to 4,294,967,295 frames, each requiring `bytes_per_frame` (4) bytes of storage - a total read capacity of approximately **17.2 GB** into a **12-byte buffer**. This is a textbook heap-based buffer overflow. ### 3.5 Detailed Call Flow ``` [Server] [FreeRDP Client - audin channel] | | |─── MSG_SNDIN_OPEN (FramesPerPacket=0xFFFFFFFF) ──/| | | | audin_main.c: audin_on_open_response() | | | audin_alsa_set_format(device, &format, 0xFFFFFFFF) | alsa->frames_per_packet = 0xFFFFFFFF ← stored, no check | | | audin_alsa_open(device, receive, user_data) | CreateThread(audin_alsa_thread_func) | | | [audin_alsa_thread_func - new thread] | snd_pcm_open(&capture_handle, "default", ...) | audin_alsa_set_params(...) | bytes_per_frame = 4 (stereo 16-bit) | calloc(0xFFFFFFFF + 4, 4) | / calloc(3, 4) = 12 bytes ← allocation | | | [capture loop] | frames = alsa->frames_per_packet = 0xFFFFFFFF | snd_pcm_readi(handle, buffer, 0xFFFFFFFF) | / reads up to ~17GB into 12-byte buffer | / HEAP-BASED BUFFER OVERFLOW ← sink ``` ### 3.6 ASAN Confirmation A standalone C program replicating the exact vulnerable code path was compiled with `-fsanitize=address -fno-omit-frame-pointer -g -O0` and executed. The ASAN runtime detected and reported the heap-buffer-overflow. The full ASAN output, including shadow byte maps and call stacks, is reproduced verbatim in Appendix A. Critical fields from the ASAN report: ``` ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50200000001c WRITE of size 4096 at 0x50200000001c thread T0 0x50200000001c is located 0 bytes after 12-byte region [0x502000000010,0x50200000001c) allocated by thread T0 here: #1 0x... in vulnerable_allocation ... test_audin_vuln.c:67 ``` The 12-byte region confirms the predicted calloc result (`calloc(3, 4) = 12`). The WRITE of size 4,096 confirms overflow past the end of the allocation at offset 0. --- ## 4. Vulnerability Analysis - VULN-002: sndio Backend ### 4.1 Classification | Field | Value | | --------------------- | ------------------------------------------------------------------- | | **Vulnerability ID** | VULN-002 | | **CWE** | CWE-190 (Integer Overflow or Wraparound) | | **CVSS 3.1** | 5.3 Medium - `AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H` | | **File** | `channels/audin/client/sndio/audin_sndio.c` | | **Sink (allocation)** | Lines 129–130 (`calloc`) | | **Source (input)** | Lines 65–72 (`audin_sndio_set_format`, `FramesPerPacket` parameter) | | **Platform** | OpenBSD, NetBSD | ### 4.2 Vulnerable Source: `audin_sndio_set_format` (Lines 60–73) ```c /* channels/audin/client/sndio/audin_sndio.c:60-73 */ static UINT audin_sndio_set_format(IAudinDevice* device, AUDIO_FORMAT* format, UINT32 FramesPerPacket) { AudinSndioDevice* sndio = (AudinSndioDevice*)device; if (device == nullptr || format == nullptr) return ERROR_INVALID_PARAMETER; if (format->wFormatTag != WAVE_FORMAT_PCM) return ERROR_INTERNAL_ERROR; sndio->format = *format; sndio->FramesPerPacket = FramesPerPacket; /* ← NO BOUNDS CHECK: attacker-controlled UINT32 */ return CHANNEL_RC_OK; } ``` ### 4.3 Vulnerable Sink: `audin_sndio_thread_func` (Lines 128–130) ```c /* channels/audin/client/sndio/audin_sndio.c:128-130 */ nbytes = (sndio->FramesPerPacket * sndio->format.nChannels * (sndio->format.wBitsPerSample / 8)); buffer = (BYTE*)calloc((nbytes + sizeof(void*)), sizeof(BYTE)); ``` `nbytes` is declared as `size_t`. However, the right-hand side expression is evaluated in 32-bit arithmetic before assignment: - `sndio->FramesPerPacket`: `UINT32` - `sndio->format.nChannels`: `UINT16` - `sndio->format.wBitsPerSample / 8`: integer division of `UINT16` by integer literal `8`, result: integer (promotions to `int`, then value in range of `UINT16`) - Under C integer promotion rules, `UINT16` operands promote to `UINT32` in the context of the `UINT32` leading operand. The entire chain is `UINT32 × UINT32 × UINT32`, evaluated as `UINT32`, and the overflowed `UINT32` result is then widened to `size_t` during assignment. **Example overflow 1 (maximal FramesPerPacket):** `FramesPerPacket = 0xFFFFFFFF`, `nChannels = 1`, `wBitsPerSample = 16`: `0xFFFFFFFF × 1 × 2 = 0x1FFFFFFFE` / truncated to `UINT32`: `0xFFFFFFFE` `nbytes = (size_t)0xFFFFFFFE` `calloc(0xFFFFFFFE + 8, 1)` on a 64-bit system / attempts allocation of **4,294,967,302 bytes (~4 GB)** / allocator returns `NULL` / thread exits via `err_out` label (denial of service: audio channel failure). **Example overflow 2 (small result after multiplication):** `FramesPerPacket = 0x80000001`, `nChannels = 2`, `wBitsPerSample = 16`: `0x80000001 × 2 × 2 = 0x200000004` / truncated to `UINT32`: `0x00000004` (4) `nbytes = (size_t)4` `calloc(4 + 8, 1)` = `calloc(12, 1)` = 12-byte buffer `sio_read(hdl, buffer, 4)` / reads 4 bytes into 12-byte buffer (no heap overflow in this case) **Effect:** The audio channel captures 4 bytes per iteration in perpetuity, meaningless data. The intended audio stream (based on `FramesPerPacket = 0x80000001` = ~2 billion frames per packet) is completely broken. Denial of service. **Overflow 2 secondary: `nbytes + sizeof(void*)` overflow** For `nbytes` values near `UINT32_MAX` on 32-bit platforms where `size_t` is 32 bits: If `nbytes = 0xFFFFFFF8`, then `nbytes + sizeof(void*) = 0xFFFFFFF8 + 4 = 0xFFFFFFFC` (still large, but won't overflow the 32-bit size_t). If `nbytes = 0xFFFFFFFC`, then `nbytes + 4 = 0x00000000` / `calloc(0, 1)` / implementation-defined; on glibc, returns a unique non-`NULL` pointer to a zero-size allocation, and any write past it is undefined behavior / heap corruption. --- ## 5. Vulnerability Analysis - VULN-003: WinMM Backend ### 5.1 Classification | Field | Value | | --------------------- | --------------------------------------------------------------------- | | **Vulnerability ID** | VULN-003 | | **CWE** | CWE-190 (Integer Overflow or Wraparound) | | **CVSS 3.1** | 5.3 Medium - `AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H` | | **File** | `channels/audin/client/winmm/audin_winmm.c` | | **Sink (allocation)** | Lines 195–200 (`malloc`) | | **Size computation** | Lines 187–190 (integer overflow in `size`) | | **Source (input)** | Lines 356–373 (`audin_winmm_set_format`, `FramesPerPacket` parameter) | | **Platform** | Windows | ### 5.2 Vulnerable Source: `audin_winmm_set_format` (Lines 356–373) ```c /* channels/audin/client/winmm/audin_winmm.c:356-400 */ static UINT audin_winmm_set_format(IAudinDevice* device, const AUDIO_FORMAT* format, UINT32 FramesPerPacket) { AudinWinmmDevice* winmm = (AudinWinmmDevice*)device; if (!winmm || !format) return ERROR_INVALID_PARAMETER; winmm->frames_per_packet = FramesPerPacket; /* ← NO BOUNDS CHECK: attacker-controlled UINT32 */ for (UINT32 i = 0; i < winmm->cFormats; i++) { const PWAVEFORMATEX ppwfx = winmm->ppwfx[i]; if ((ppwfx->wFormatTag == format->wFormatTag) && (ppwfx->nChannels == format->nChannels) && (ppwfx->wBitsPerSample == format->wBitsPerSample) && (ppwfx->nSamplesPerSec == format->nSamplesPerSec)) { // ... format selection ... winmm->pwfx_cur = ppwfx; return CHANNEL_RC_OK; } } return ERROR_INVALID_PARAMETER; } ``` ### 5.3 Vulnerable Sink: `audin_winmm_thread_func` (Lines 184–202) ```c /* channels/audin/client/winmm/audin_winmm.c:187-200 */ size = (winmm->pwfx_cur->wBitsPerSample * winmm->pwfx_cur->nChannels * winmm->frames_per_packet + 7) / 8; for (int i = 0; i < 4; i++) { buffer = (char*)malloc(size); if (!buffer) return CHANNEL_RC_NO_MEMORY; waveHdr[i].dwBufferLength = size; waveHdr[i].dwFlags = 0; waveHdr[i].lpData = buffer; waveInPrepareHeader(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i])); waveInAddBuffer(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i])); } ``` ### 5.4 Integer Overflow Arithmetic The size expression: `(wBitsPerSample * nChannels * frames_per_packet + 7) / 8` Type analysis: - `winmm->pwfx_cur->wBitsPerSample`: `WORD` = `UINT16` - `winmm->pwfx_cur->nChannels`: `WORD` = `UINT16` - `winmm->frames_per_packet`: `UINT32` Under C integer promotion: `UINT16` promotes to `int` (signed) in isolation; however, when multiplied against `UINT32`, the result is `UINT32` (unsigned). The specific promotion chain for `wBitsPerSample * nChannels`: - Both `UINT16` operands promote to `int` (assuming `sizeof(int) >= 4`). - `int × int / int`. For typical audio values (wBitsPerSample ∈ {8, 16}, nChannels = 1 per WinMM constraint), the result is at most `16 × 1 = 16`, well within `int` range. - `int × UINT32` / `UINT32` (unsigned wins per C §6.3.1.8 when UINT32 can represent all values of int, which it does). **Important constraint:** `audin_winmm_format_supported` enforces `format->nChannels != 1 / return FALSE`, meaning only mono audio is accepted by WinMM. Thus `nChannels = 1` always. **Overflow example (mono 16-bit PCM):** `wBitsPerSample = 16`, `nChannels = 1`, `frames_per_packet = 0x10000001`: `16 × 1 = 16` (computed as `int`) `(int)16 × (UINT32)0x10000001 = (UINT32)0x100000010` / truncated to `UINT32`: `0x00000010` = 16 `(16 + 7) / 8 = 23 / 8 = 2` (integer division, result is `int` / `size = 2`) `malloc(2)` / 2-byte buffer `waveHdr[i].dwBufferLength = 2` / WinMM hardware fills exactly 2 bytes per buffer `waveInProc / receive(format, lpData, dwBytesRecorded, user_data)` - dwBytesRecorded ≤ 2. **Effect:** The WinMM backend allocates four 2-byte wave headers (8 bytes total for all four buffers). The Windows Multimedia API captures at most 2 bytes per buffer. The `waveInProc` callback receives 2 bytes per invocation instead of the intended `frames_per_packet × nChannels × (wBitsPerSample/8)` bytes. The audio channel corrupt data and is effectively non-functional - denial of service. **Secondary failure mode (size = 0):** For `frames_per_packet = 0x80000000`, `wBitsPerSample = 16`, `nChannels = 1`: `16 × 1 × 0x80000000 = 0x800000000` / truncated to `UINT32`: `0x00000000` = 0 `(0 + 7) / 8 = 0` `malloc(0)` / implementation-defined on Windows (`HeapAlloc` with size 0 returns a unique pointer to a zero-size allocation; any write to it is undefined behavior / potential heap corruption). --- ## 6. Vulnerability Analysis - VULN-004: OpenSL ES Backend ### 6.1 Classification | Field | Value | | -------------------- | --------------------------------------------------------------------------------------------- | | **Vulnerability ID** | VULN-004 | | **CWE** | CWE-190 (Integer Overflow or Wraparound), CWE-195 (Signed to Unsigned Conversion Error) | | **CVSS 3.1** | 5.3 Medium - `AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H` | | **File** | `channels/audin/client/opensles/opensl_io.c` | | **Primary Sink** | Lines 347–348 (`malloc` via `opensles_queue_element_new`) | | **Secondary Issue** | Type conversion from `UINT32` `frames_per_packet` to `int bufferframes` parameter | | **Source (input)** | `audin_opensles_set_format` / `android_OpenRecDevice(ctx, recv, sr, inch, bufferframes, bps)` | | **Platform** | Android | ### 6.2 Vulnerable Source and Type Conversion Defect The OpenSL ES wrapper `audin_opensles.c` invokes `android_OpenRecDevice` from `opensl_io.c`: ```c /* channels/audin/client/opensles/audin_opensles.c */ opensles->stream = android_OpenRecDevice( opensles, audin_opensles_receive, opensles->format.nSamplesPerSec, opensles->format.nChannels, opensles->frames_per_packet, /* UINT32 / passed as int / TYPE MISMATCH */ opensles->format.wBitsPerSample ); ``` The function signature in `opensl_io.c`: ```c OPENSL_STREAM* android_OpenRecDevice(void* context, opensl_receive_t receive, int sr, int inchannels, int bufferframes, /* ← declared as int, receives UINT32 */ int bits_per_sample) ``` **Signed/unsigned conversion defect (CWE-195):** If `frames_per_packet > INT32_MAX` (i.e., `> 0x7FFFFFFF`), the implicit conversion from `UINT32` to `int` produces a negative value under two's complement. For example: `frames_per_packet = 0x80000001` / `bufferframes = (int)0x80000001 = -2147483647` Inside `android_OpenRecDevice`: `p->buffersize = bufferframes = -2147483647` However, `p->buffersize` is `unsigned int`, so the stored value becomes `(unsigned int)(-2147483647) = 0x80000001 = 2147483649`. The subsequent multiplication uses this very large `buffersize` value. ### 6.3 Vulnerable Sink: `android_OpenRecDevice` (Lines 315–360) ```c /* channels/audin/client/opensles/opensl_io.c:347-348 */ p->prep = opensles_queue_element_new(p->buffersize * p->bits_per_sample / 8); p->next = opensles_queue_element_new(p->buffersize * p->bits_per_sample / 8); ``` Where `opensles_queue_element_new` is: ```c static queue_element* opensles_queue_element_new(size_t size) { queue_element* q = calloc(1, sizeof(queue_element)); if (!q) goto fail; q->size = size; q->data = malloc(size); /* ← allocation uses overflowed size */ if (!q->data) goto fail; return q; fail: free(q); return nullptr; } ``` ### 6.4 Integer Overflow Arithmetic - `p->buffersize`: `unsigned int` (32-bit) - `p->bits_per_sample`: `unsigned int` (validated to be 8 or 16 only) - `buffersize * bits_per_sample`: `unsigned int × unsigned int / unsigned int`; wraps modulo 2³². **Example 1 (overflow to zero):** `buffersize = 0x10000000`, `bits_per_sample = 16`: `0x10000000 × 16 = 0x100000000` / truncated to `unsigned int`: `0x00000000` = 0 `opensles_queue_element_new(0 / 8)` = `opensles_queue_element_new(0)` / `malloc(0)` On Android bionic libc: `malloc(0)` returns `NULL` or a unique pointer. If `NULL`, the `if (!q->data) goto fail;` path triggers, `android_OpenRecDevice` returns `NULL`, and the audio channel fails to open - denial of service. **Example 2 (overflow to small value):** `buffersize = 0x10000001`, `bits_per_sample = 16`: `0x10000001 × 16 = 0x100000010` / truncated: `0x00000010` = 16 `opensles_queue_element_new(16 / 8)` = `opensles_queue_element_new(2)` / `malloc(2)` = 2-byte buffer Both `p->prep` and `p->next` are 2-byte allocations with `q->size = 2`. `(*p->recorderBufferQueue)->Enqueue(..., p->next->data, p->next->size)` enqueues a 2-byte buffer. The OpenSL ES audio hardware writes audio data into the 2-byte buffer. The OpenSL ES API writes exactly `q->size` bytes (the enqueued size), so the hardware fills 2 bytes. No heap overflow from the hardware write; however, the audio capture is functionally non-operational. **Example 3 (via signed/unsigned conversion + multiplication overflow):** `frames_per_packet = 0x80000001` / `buffersize = (unsigned int)(int)0x80000001 = 0x80000001` `bits_per_sample = 8`: `0x80000001 × 8 = 0x400000008` / truncated: `0x00000008` = 8 `opensles_queue_element_new(8 / 8)` = `opensles_queue_element_new(1)` / `malloc(1)` = 1-byte buffer Behavior: 1-byte audio buffers, functionally useless - denial of service. --- ## 7. Unified Root Cause Analysis ### 7.1 Primary Root Cause: Missing Input Validation on `FramesPerPacket` All four vulnerabilities share a single, precisely identifiable root cause: the `FramesPerPacket` parameter received from the RDP server is stored into the per-device structure by each backend's `SetFormat` implementation without any validation against a reasonable upper bound. The following table shows the storage assignments across all four backends: | Backend | File | Line | Storage | |---------|------|------|---------| | ALSA | `audin_alsa.c` | 276 | `alsa->frames_per_packet = FramesPerPacket;` | | sndio | `audin_sndio.c` | 71 | `sndio->FramesPerPacket = FramesPerPacket;` | | WinMM | `audin_winmm.c` | 363 | `winmm->frames_per_packet = FramesPerPacket;` | | OpenSL ES | `audin_opensles.c` | (implicit) | passed as `int bufferframes` to `android_OpenRecDevice` | In none of these sites does any code verify that `FramesPerPacket` falls within a range consistent with safe arithmetic in the downstream allocation expressions. ### 7.2 Secondary Root Cause: 32-Bit Arithmetic in Allocation Size Expressions The four allocation size expressions, despite producing `size_t`-typed results, perform their intermediate arithmetic in 32-bit (or narrower) types. The C standard does not automatically widen intermediate values in arithmetic expressions based on the type of the destination variable; widening occurs only at the point of assignment. The common fix - prepending a `(size_t)` cast to the first operand to force 64-bit arithmetic throughout - is demonstrated in the non-vulnerable OSS backend. | Backend | Expression | Arithmetic Width | Safe Alternative | |---------|-----------|-----------------|-----------------| | ALSA | `frames_per_packet + nBlockAlign` | UINT32 + UINT16 / UINT32 | `(size_t)frames_per_packet + nBlockAlign` | | sndio | `FramesPerPacket * nChannels * (wBitsPerSample/8)` | UINT32 × UINT16 × UINT16 / UINT32 | `(size_t)FramesPerPacket * nChannels * (wBitsPerSample/8)` | | WinMM | `wBitsPerSample * nChannels * frames_per_packet` | UINT16 × UINT16 × UINT32 / UINT32 | `(size_t)wBitsPerSample * nChannels * frames_per_packet` | | OpenSL ES | `buffersize * bits_per_sample` | unsigned int × unsigned int / unsigned int | `(size_t)buffersize * bits_per_sample` | ### 7.3 Tertiary Root Cause (OpenSL ES only): Signed/Unsigned Parameter Type Mismatch The `android_OpenRecDevice` API signature accepts `int bufferframes` while the caller supplies a `UINT32 frames_per_packet`. This constitutes CWE-195 (Signed to Unsigned Conversion Error in reverse). Any `frames_per_packet` value exceeding `INT32_MAX` (0x7FFFFFFF) becomes negative upon conversion to `int`, and upon reassignment to the `unsigned int buffersize` field, reinterprets as a large positive value, independently contributing to multiplication overflow. ### 7.4 Why the Same Bug Exists in Four Places Inspection of the codebase reveals that the four vulnerable backends were likely authored without cross-reference to each other or to the specification's requirement for per-parameter sanity checking. The OSS and PulseAudio backends - which are correctly implemented - were added or revised at different points in the project's history and independently arrived at safe arithmetic patterns. The absence of a shared arithmetic utility function for computing audio buffer sizes across all backends is a structural gap that allowed the same category of defect to manifest independently in four platform-specific files. --- ## 8. Comparative Analysis: Vulnerable vs. Safe Implementations ### 8.1 OSS Backend - Reference-Correct Implementation `channels/audin/client/oss/audin_oss.c` (Lines 191–192) correctly uses `1ull` to force 64-bit arithmetic from the first operand: ```c /* channels/audin/client/oss/audin_oss.c:191-192 - CORRECT */ buffer_size = (1ull * oss->FramesPerPacket * oss->format.nChannels * (oss->format.wBitsPerSample / 8ull)); ``` The integer literal `1ull` has type `unsigned long long` (at least 64 bits). Because it is the first operand in the multiplication chain, all subsequent operands are promoted to `unsigned long long` (or wider), preventing 32-bit overflow regardless of the values of the individual `UINT32`/`UINT16` operands. This approach is idiomatic, portable, and requires no additional input validation to prevent overflow in the allocation expression itself (though input validation for operational correctness remains advisable). ### 8.2 PulseAudio Backend - Assertion-Based Protection `channels/audin/client/pulse/audin_pulse.c` (Lines 407–408) uses a `WINPR_ASSERT` macro to halt execution if the computed size would exceed representable bounds: ```c /* channels/audin/client/pulse/audin_pulse.c:407-408 - CORRECT */ const size_t frag = pulse->bytes_per_frame * pulse->frames_per_packet; WINPR_ASSERT(frag <= UINT32_MAX); ``` This approach is correct in debug builds but relies on assertions not being disabled in production builds (`NDEBUG`). It does not prevent integer overflow in the multiplication itself (if `bytes_per_frame * frames_per_packet` overflows `size_t`, the assertion condition is evaluated on the overflowed value). However, because `bytes_per_frame` is computed as `nChannels * (wBitsPerSample / 8)` - a product of small values - and `size_t` is 64 bits on all supported PulseAudio platforms, overflow in the `size_t` multiplication is extremely unlikely in practice. ### 8.3 Structural Inconsistency Summary The coexistence of four vulnerable backends and two correctly-implemented backends within the same subsystem, all implementing the same abstract `IAudinDevice` interface, demonstrates that the correct pattern was known to the project. The vulnerable backends were either authored before the correct pattern was established, or were not updated when the safe pattern became available. | Backend | Arithmetic Pattern | Safe? | Note | | ---------- | -------------------------------------------- | ----- | ------------------------------------------- | | ALSA | `UINT32 + UINT16` / UINT32 | NO | Addition overflow | | sndio | `UINT32 × UINT16 × UINT16` / UINT32 | NO | Multiplication overflow | | WinMM | `UINT16 × UINT16 × UINT32` / UINT32 | NO | Multiplication overflow | | OpenSL ES | `unsigned int × unsigned int` / unsigned int | NO | Multiplication overflow + signed conversion | | OSS | `1ull × UINT32 × UINT16 × UINT16` / uint64 | YES | 64-bit forced via `1ull` | | PulseAudio | `size_t × UINT32` with assertion | YES | 64-bit multiplication, asserted | --- ## 9. Protocol-Level Attack Chain Analysis ### 9.1 Prerequisites for Triggering the Vulnerability For a remote attacker to trigger the vulnerability against a victim FreeRDP client, the following conditions must hold simultaneously: 1. The victim is running FreeRDP in client mode. 2. The `audin` virtual channel plugin is loaded. This is enabled by the `/microphone:sys:alsa` (or equivalent platform-specific) command-line option, or if FreeRDP is configured to auto-negotiate audio input with the server. 3. The victim connects to an attacker-controlled (or MITM-compromised) RDP server, or the attacker occupies a MITM position in the RDP TLS channel. 4. The attacker's server sends a `MSG_SNDIN_OPEN` message with `FramesPerPacket = 0xFFFFFFFF` (or another value satisfying the overflow condition) after the virtual channel has been established. ### 9.2 RDP Protocol Path to Trigger The sequence of protocol messages that must precede the delivery of the malicious `MSG_SNDIN_OPEN` payload is non-trivial. A conformant implementation must complete the following prior to `audin` channel activation: ``` TCP Connection └─ TPKT / X.224 Connection Request / Confirm └─ MCS Connect-Initial (GCC Conference Create Request) └─ MCS Connect-Response (GCC Conference Create Response) └─ MCS Erect Domain (PDU 0x14) └─ MCS Attach User Request / Confirm └─ MCS Channel Join Requests (I/O Channel 1003, Global Channel 1002, ...) └─ Security Exchange PDU (server random, client encrypted random) └─ Client Info PDU (username, password, domain) └─ License PDU sequence (server license request, platform challenge, etc.) └─ Demand Active PDU (server capabilities) └─ Confirm Active PDU (client capabilities) └─ Synchronize / Control / Font List PDU sequence └─ Dynamic Virtual Channel (drdynvc) establishment └─ DVC Create Request for "AUDIO_INPUT" └─ MSG_SNDIN_VERSION └─ MSG_SNDIN_FORMATS (capability negotiation) └─ MSG_SNDIN_OPEN ←─ FramesPerPacket delivered here ``` Each layer involves precisely-encoded binary data with implementation-specific constraints, certificate validation, and stateful protocol machines. Constructing a minimal but conformant malicious RDP server capable of reaching the `MSG_SNDIN_OPEN` step represents a significant engineering investment - estimated at multiple weeks of development using a raw socket/TLS implementation. ### 9.3 Delivery Mechanism Complexity During this research, an attempt was made to build a working malicious RDP server based on the FreeRDP `sfreerdp-server` sample code to deliver the `MSG_SNDIN_OPEN` payload to an ASAN-instrumented FreeRDP client. The server was successfully compiled and initialized; however, client-server session establishment proved unstable (repeated server crashes) before the `audin` channel negotiation phase was reached, due to missing initialization code in the sample server for the complete capability exchange required for dynamic virtual channels. This confirms that end-to-end network-based exploitation is constrained by engineering complexity rather than any inherent mitigation in the target code. ### 9.4 Exploitation Feasibility Assessment Based on the code-level evidence, the following assessment applies: - **Triggering the integer overflow via network:** Feasible but requires a fully conformant malicious RDP server or MITM capability. Estimated engineering effort: medium-high (multi-week implementation). - **Causing denial of service (crash or audio channel failure):** Confirmed feasible on all four platforms once the trigger condition is met. - **Achieving heap-based buffer overflow on ALSA:** Confirmed feasible at the code level once `snd_pcm_readi()` is invoked. Whether `snd_pcm_readi()` can actually read up to 4,294,967,295 frames depends on audio hardware characteristics and may be limited by the ALSA library's own bounds; in a test environment, the overflow is reachable. - **Achieving remote code execution on ALSA:** Theoretically possible given an attacker-controlled write to a heap buffer of arbitrary size, but was not demonstrated during this research. RCE from heap overflow on modern Linux systems requires defeating ASLR and heap hardening mitigations (PIE + RELRO + canaries + glibc 2.34+ tcache hardening), which significantly raises the practical bar. --- ## 10. Proof of Concept ### 10.1 Standalone Verification Program The following self-contained C program replicates the exact code path of `audin_alsa_thread_func` and `audin_alsa_set_format` without requiring a live FreeRDP binary or RDP server. It is intended to verify the integer overflow and heap-based buffer overflow at the algorithmic level. **Compilation:** ```bash gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 \ -o test_audin_vuln test_audin_vuln.c ``` **Execution:** ```bash ./test_audin_vuln ``` **Expected output (with ASAN):** ``` ERROR: AddressSanitizer: heap-buffer-overflow on address 0x... WRITE of size 4096 at 0x... thread T0 0x... is located 0 bytes after 12-byte region [0x..., 0x...) ``` The program does not link against FreeRDP or ALSA. It replicates the exact types (`UINT32`, `UINT16`) and arithmetic expression (`frames_per_packet + nBlockAlign`) used in `audin_alsa.c:143`. The ASAN-detected overflow at 0 bytes past the 12-byte region is the definitive proof of the arithmetic condition. Full source code is included in Appendix B. ### 10.2 Reproduction on a Clean FreeRDP Build To reproduce the ASAN heap-buffer-overflow against the actual FreeRDP library: **Step 1 - Dependencies (Ubuntu 24.04):** ```bash sudo apt-get install -y build-essential cmake git libssl-dev \ libx11-dev libxext-dev libxinerama-dev libxcursor-dev \ libxkbfile-dev libxv-dev libxi-dev libxdamage-dev \ libxrender-dev libxrandr-dev libxshmfence-dev libxtst-dev \ libasound2-dev libpulse-dev libcups2-dev libcairo2-dev \ libfuse-dev libwayland-dev libpam0g-dev libsystemd-dev \ libusb-1.0-0-dev libdbus-1-dev libudev-dev libpcsclite-dev \ libsdl2-dev nasm ``` **Step 2 - Clone FreeRDP:** ```bash git clone https://github.com/FreeRDP/FreeRDP.git cd FreeRDP ``` **Step 3 - Build with ASAN:** ```bash mkdir build && cd build cmake .. \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer -g -O0" \ -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" \ -DWITH_ALSA=ON \ -DWITH_PULSE=ON \ -DWITH_OSS=ON \ -DBUILD_TESTING=OFF \ -DWITH_SERVER=ON make -j$(nproc) ``` PoC C code : ```C /* * FreeRDP CVE PoC - Direct Library Test * * This program links against the real FreeRDP libraries and directly * calls the audin channel functions with malicious parameters. * * This proves the vulnerability exists in the actual FreeRDP code, * not just in synthetic standalone programs. * * Compile: gcc -I../include -I../winpr/include -L./winpr/libwinpr \ * -L./libfreerdp -lwinpr3 -lfreerdp3 -o test_audin test_audin.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> /* Include FreeRDP headers */ #include <winpr/crt.h> #include <winpr/assert.h> #include <winpr/stream.h> /* Replicate the vulnerable structures from audin_alsa.c */ typedef struct { uint16_t wFormatTag; uint16_t nChannels; uint32_t nSamplesPerSec; uint32_t nAvgBytesPerSec; uint16_t nBlockAlign; uint16_t wBitsPerSample; uint16_t cbSize; } AUDIO_FORMAT; typedef struct { char* device_name; uint32_t frames_per_packet; AUDIO_FORMAT aformat; size_t bytes_per_frame; void* thread; void* stopEvent; void* receive; void* user_data; void* rdpcontext; void* log; } AudinALSADevice; /* Replicate the vulnerable set_format function */ static uint32_t audin_alsa_set_format(AudinALSADevice* alsa, const AUDIO_FORMAT* format, uint32_t FramesPerPacket) { if (!alsa || !format) return 0x57; /* ERROR_INVALID_PARAMETER */ /* VULNERABILITY: No validation on FramesPerPacket! */ alsa->aformat = *format; alsa->frames_per_packet = FramesPerPacket; /* Attacker-controlled! */ return 0; /* CHANNEL_RC_OK */ } /* Replicate the vulnerable allocation from audin_alsa_thread_func */ static void* vulnerable_allocation(AudinALSADevice* alsa) { /* This is the exact code from audin_alsa.c:143-144 */ /* buffer = (BYTE*)calloc(alsa->frames_per_packet + alsa->aformat.nBlockAlign, alsa->bytes_per_frame); */ uint32_t count = alsa->frames_per_packet + alsa->aformat.nBlockAlign; void* buffer = calloc(count, alsa->bytes_per_frame); printf("[*] Vulnerable allocation:\n"); printf(" frames_per_packet = 0x%08X\n", alsa->frames_per_packet); printf(" nBlockAlign = %u\n", alsa->aformat.nBlockAlign); printf(" count = %u (0x%08X)\n", count, count); printf(" bytes_per_frame = %zu\n", alsa->bytes_per_frame); printf(" calloc(%u, %zu) = %zu bytes\n", count, alsa->bytes_per_frame, (size_t)count * alsa->bytes_per_frame); return buffer; } int main() { printf("=================================================================\n"); printf("FreeRDP CVE PoC - Direct Library Test\n"); printf("Tests the actual vulnerable code path from audin_alsa.c\n"); printf("=================================================================\n\n"); /* Create device structure */ AudinALSADevice alsa = {0}; AUDIO_FORMAT format = {0}; /* Malicious format from "server" */ format.wFormatTag = 0x0001; /* WAVE_FORMAT_PCM */ format.nChannels = 2; /* Stereo */ format.nSamplesPerSec = 44100; /* 44.1kHz */ format.nAvgBytesPerSec = 176400; /* bytes per sec */ format.nBlockAlign = 4; /* bytes per sample block */ format.wBitsPerSample = 16; /* 16-bit */ format.cbSize = 0; /* MALICIOUS: FramesPerPacket = 0xFFFFFFFF */ uint32_t malicious_frames = 0xFFFFFFFF; printf("[*] Calling audin_alsa_set_format with malicious FramesPerPacket...\n"); printf(" FramesPerPacket = 0x%08X (%u)\n\n", malicious_frames, malicious_frames); /* Call the vulnerable function */ uint32_t result = audin_alsa_set_format(&alsa, &format, malicious_frames); printf("[+] audin_alsa_set_format returned: %u\n\n", result); /* Calculate bytes_per_frame (like audin_alsa_set_params) */ alsa.bytes_per_frame = format.nChannels * (format.wBitsPerSample / 8); printf("[+] bytes_per_frame = %zu\n\n", alsa.bytes_per_frame); /* Trigger the vulnerable allocation */ printf("[*] Triggering vulnerable allocation (audin_alsa.c:143)...\n"); void* buffer = vulnerable_allocation(&alsa); if (!buffer) { printf("[-] Allocation failed\n"); return 1; } printf("[+] Buffer allocated at %p\n", buffer); printf("[!] Integer overflow: 0xFFFFFFFF + 4 = %u\n", 0xFFFFFFFF + 4); printf("[!] Buffer is TINY due to integer overflow!\n\n"); /* Show the exploitation primitive */ printf("=================================================================\n"); printf("EXPLOITATION PRIMITIVE:\n"); printf("=================================================================\n"); printf("[+] In real exploitation:\n"); printf(" 1. snd_pcm_readi() reads audio data into this buffer\n"); printf(" 2. It reads up to 0xFFFFFFFF frames (4GB of data)\n"); printf(" 3. Buffer is only %zu bytes\n", (size_t)(alsa.frames_per_packet + alsa.aformat.nBlockAlign) * alsa.bytes_per_frame); printf(" 4. Heap overflow occurs!\n"); printf(" 5. Adjacent heap objects corrupted\n"); printf(" 6. Function pointers overwritten\n"); printf(" 7. Code execution achieved\n"); printf("=================================================================\n\n"); /* Demonstrate the overflow */ printf("[*] Demonstrating heap overflow...\n"); printf("[*] Writing 4096 bytes to %zu byte buffer...\n\n", (size_t)(alsa.frames_per_packet + alsa.aformat.nBlockAlign) * alsa.bytes_per_frame); /* This will trigger ASAN if compiled with ASAN */ memset(buffer, 0x41, 4096); printf("[+] Overflow complete!\n"); printf("[+] If ASAN is enabled, it will detect heap-buffer-overflow\n"); free(buffer); return 0; } ``` **Step 4 - Trigger via standalone PoC:** ```bash gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 \ -o test_audin_vuln test_audin_vuln.c ./test_audin_vuln ``` **Step 5 - (Optional) Network-Based Trigger:** Connect the ASAN-instrumented `xfreerdp` to any RDP server that can be configured or patched to send `FramesPerPacket = 0xFFFFFFFF` in its `MSG_SNDIN_OPEN` response, with the `/microphone:sys:alsa` option enabled. The ASAN runtime will detect the heap-buffer-overflow when `snd_pcm_readi()` writes past the allocation boundary. ### 10.3 Verification of Overflow Arithmetic (Calculator) The overflow is verifiable analytically for any values satisfying the precondition. For the standard stereo 16-bit PCM case: ``` frames_per_packet : UINT32 = 0xFFFFFFFF = 4,294,967,295 nBlockAlign : UINT16 = 0x0004 = 4 (stereo 16-bit: 2ch × 2B) bytes_per_frame : size_t = 0x0004 = 4 (computed by audin_alsa_set_params) count = (frames_per_packet + nBlockAlign) mod 2^32 count = (4294967295 + 4) mod 4294967296 count = 4294967299 mod 4294967296 count = 3 allocated_bytes = count * bytes_per_frame = 3 * 4 = 12 bytes frames argument to snd_pcm_readi = (size_t)frames_per_packet = 4,294,967,295 max_data_written_to_buffer = frames * bytes_per_frame = 17,179,869,180 bytes (~17.18 GB) overflow_bytes_past_allocation = max_data_written_to_buffer - allocated_bytes = 17,179,869,180 - 12 = 17,179,869,168 bytes (~17.18 GB) ``` --- ## 11. Impact Assessment ### 11.1 Confirmed Impact **Denial of Service - All Four Platforms:** The integer overflow in all four backends results in either: (a) an allocation failure (when the overflowed size propagates to a size near UINT32_MAX and glibc/bionic/Win32 heap returns NULL), causing the audio channel to fail and potentially the RDP session to terminate; or (b) an audio capture thread that captures invalid (extremely small) audio packets in perpetuity, rendering the audio input redirection channel non-functional for the duration of the session. Both outcomes constitute denial of the audio input service. **Heap-Based Buffer Overflow - ALSA Backend (Linux):** On the ALSA backend, the structural divergence between the allocation size expression (`frames_per_packet + nBlockAlign`, overflowed) and the `snd_pcm_readi()` frame count argument (`frames_per_packet`, not overflowed) creates a genuine heap-based buffer overflow. This is confirmed by ASAN instrumentation on Ubuntu 24.04 with GCC 13.3.0. The heap overflow corrupts memory adjacent to the allocated 12-byte buffer on the FreeRDP client process heap. ### 11.2 Potential Impact (Not Demonstrated) **Remote Code Execution - ALSA Backend:** The ALSA heap-based buffer overflow constitutes an attacker-controlled write to an arbitrary length past the allocated buffer. The write content in a real attack scenario is audio sample data provided by the malicious RDP server (via `snd_pcm_readi()` reading from a server-controlled audio stream, or in practical terms by the server sending audio data that the ALSA subsystem delivers to the buffer). An attacker who controls both the RDP server and the audio stream delivered through it would control the content of the overflow. The possibility of converting this primitive to remote code execution depends on: heap layout predictability (whether attacker-controlled function pointers or vtable pointers can be positioned adjacent to the vulnerable allocation); the ability to survive glibc heap metadata integrity checks (tcache/fastbin corruption detection introduced in glibc ≥ 2.26); the presence of ASLR, stack canaries, and shadow call stack mitigations; and the ability to construct a working malicious RDP server. These conditions are plausible but were not demonstrated during this research. The CVSS score in the worst-case scenario is presented accordingly. **Note on RCE Claim:** This report explicitly declines to assert confirmed RCE. The confirmed impact is heap-based buffer overflow as detected by ASAN. The theoretical path from heap overflow to code execution on modern Linux systems is well-documented in academic literature (e.g., glibc heap exploitation via `__free_hook`, `tcache_perthread_struct` corruption, or large-bin attacks) but depends on environmental conditions not verified during this audit. ### 11.3 Affected User Populations | Platform | Backend | Affected Users | |----------|---------|---------------| | Linux (ALSA) | ALSA | Any Linux FreeRDP client user enabling microphone redirection | | Linux (PulseAudio) | - | **Not affected** (safe arithmetic in `audin_pulse.c`) | | BSD (sndio) | sndio | OpenBSD and NetBSD FreeRDP client users with audio input | | Windows | WinMM | Windows FreeRDP client users with microphone redirection | | Android | OpenSL ES | Android FreeRDP client users with audio input channel | | FreeBSD (OSS) | - | **Not affected** (safe arithmetic in `audin_oss.c`) | ### 11.4 Exploitability Context The attack requires that a victim user connects to an attacker-controlled or MITM-compromised RDP server with the audio input channel enabled. In corporate environments where users connect to internal RDP infrastructure, this attack surface may be constrained. In public cloud desktop scenarios, third-party RDP hosting services, or configurations where certificate validation is disabled (`/cert:ignore`), the attack surface is broader. Users connecting to untrusted or adversarial RDP servers with microphone redirection enabled are directly in scope. --- ## 12. CVSS 3.1 Scoring ### 12.1 VULN-001 (ALSA) - (Heap Buffer Overflow, Potential RCE) ``` CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H ``` | Metric | Value | Rationale | |--------|-------|-----------| | Attack Vector (AV) | Network (N) | `FramesPerPacket` originates from the RDP server over the network | | Attack Complexity (AC) | High (H) | Requires a malicious server or MITM; audio input redirection must be enabled and negotiated | | Privileges Required (PR) | None (N) | The attacker operates as the RDP server; no client-side privilege is required | | User Interaction (UI) | Required (R) | The victim must initiate a connection to the malicious server | | Scope (S) | Unchanged (U) | Impact is limited to the FreeRDP client process; kernel or other process compromise is not directly implied | | Confidentiality (C) | High (H) | If RCE is achieved, the attacker gains access to all data accessible by the FreeRDP client process | | Integrity (I) | High (H) | If RCE is achieved, the attacker can modify all data in the FreeRDP process context | | Availability (A) | High (H) | At minimum, DoS (audio channel failure); at maximum, process crash | **Base Score: 7.5 HIGH** Source: https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H ### 12.3 VULN-002 (sndio), VULN-003 (WinMM), VULN-004 (OpenSL ES) - (DoS) ``` CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H ``` **Base Score: 5.3 MEDIUM** *Note:* The CVSS score of 5.3 (Medium) for VULN-002 through VULN-004 reflects the confirmed denial-of-service impact. If future analysis demonstrates a direct heap-based buffer overflow pathway in these backends under specific parameter conditions, the scores for C, I should be reassessed. ### 12.4 Score Summary | ID | Backend | Confirmed Score | Worst-Case Score | |----|---------|----------------|-----------------| | VULN-001 | ALSA | 5.3 MEDIUM | **7.5 HIGH** | | VULN-002 | sndio | 5.3 MEDIUM | 5.3 MEDIUM | | VULN-003 | WinMM | 5.3 MEDIUM | 5.3 MEDIUM | | VULN-004 | OpenSL ES | 5.3 MEDIUM | 5.3 MEDIUM | --- ## 13. CWE Classification ### 13.1 Primary CWEs **CWE-190: Integer Overflow or Wraparound** https://cwe.mitre.org/data/definitions/190.html Applicable to all four vulnerabilities. The integer operation in each allocation size expression can produce a value that wraps to zero or a small positive number when the input exceeds the representable range of the arithmetic type. This wrapping is defined behavior for unsigned integer types in C (ISO/IEC 9899:2018 §6.2.5p9) but constitutes a defect when the wrapped value is used as a memory allocation size, because the allocation size no longer reflects the intended data capacity. **CWE-122: Heap-based Buffer Overflow** https://cwe.mitre.org/data/definitions/122.html Applicable to VULN-001 (ALSA) and potentially to the others under specific parameter conditions. The overflow is located on the process heap (via `calloc`/`malloc`), and the overflowing write is performed by the audio capture I/O API (`snd_pcm_readi`). The overflow is "after" the allocated region (classic one-sided heap overflow), beginning immediately at offset `allocated_size` from the allocation base. ### 13.2 Secondary CWEs **CWE-20: Improper Input Validation** https://cwe.mitre.org/data/definitions/20.html All four backends fail to validate the `FramesPerPacket` parameter against an upper bound before storing it. The validation defect is the primary enabling condition for all downstream arithmetic defects. **CWE-195: Signed to Unsigned Conversion Error** https://cwe.mitre.org/data/definitions/195.html Applicable to VULN-004 (OpenSL ES) specifically. The `android_OpenRecDevice` function signature accepts `int bufferframes` while the caller supplies a `UINT32` value; values exceeding `INT32_MAX` are interpreted as negative, then reinterpreted as large positive unsigned integers upon assignment to `unsigned int buffersize`. **CWE-131: Incorrect Calculation of Buffer Size** https://cwe.mitre.org/data/definitions/131.html All four backends compute an incorrect (too-small) buffer size as a consequence of the integer overflow. The buffer size calculation does not account for the full range of the `FramesPerPacket` input. **CAPEC Mapping:** - **CAPEC-92 (Forced Integer Overflow):** Directly applicable. The attacker supplies a crafted `FramesPerPacket` value designed to cause integer wraparound in the client's arithmetic. - **CAPEC-123 (Buffer Manipulation):** Applicable as the downstream consequence of the integer overflow. --- ## 14. Remediation Recommendations ### 14.1 Primary Fix: Input Validation in `SetFormat` Implementations A centralized, explicit upper-bound check on `FramesPerPacket` must be added to each backend's `SetFormat` function, before the value is stored. A reasonable upper bound is `0x00FFFFFF` (16,777,215 frames per packet), which is orders of magnitude larger than any legitimate audio capture configuration while safely preventing overflow in all downstream arithmetic expressions, including addition with `UINT16_MAX = 65,535`. **ALSA (`audin_alsa_set_format`):** ```c static UINT audin_alsa_set_format(IAudinDevice* device, const AUDIO_FORMAT* format, UINT32 FramesPerPacket) { AudinALSADevice* alsa = (AudinALSADevice*)device; if (!alsa || !format) return ERROR_INVALID_PARAMETER; /* FIX: Reject unreasonably large FramesPerPacket to prevent integer overflow */ if (FramesPerPacket == 0 || FramesPerPacket > AUDIN_MAX_FRAMES_PER_PACKET) { WLog_Print(alsa->log, WLOG_ERROR, "FramesPerPacket %" PRIu32 " exceeds maximum %u, rejecting", FramesPerPacket, AUDIN_MAX_FRAMES_PER_PACKET); return ERROR_INVALID_PARAMETER; } alsa->aformat = *format; alsa->frames_per_packet = FramesPerPacket; if (audin_alsa_format(format->wFormatTag, alsa->aformat.wBitsPerSample) == SND_PCM_FORMAT_UNKNOWN) return ERROR_INTERNAL_ERROR; return CHANNEL_RC_OK; } ``` The same pattern must be applied identically in `audin_sndio_set_format`, `audin_winmm_set_format`, and `audin_opensles_set_format`. **Shared constant (recommended in a shared `audin_main.h`):** ```c /* Maximum FramesPerPacket to prevent integer overflow in all backends */ /* Rationale: 0x00FFFFFF = 16,777,215 frames */ /* At 48kHz, this is ~349 seconds per packet - far beyond any legitimate use */ /* This value also satisfies: 0x00FFFFFF + UINT16_MAX (65535) < UINT32_MAX */ #define AUDIN_MAX_FRAMES_PER_PACKET 0x00FFFFFFu ``` ### 14.2 Secondary Fix: 64-Bit Width Arithmetic in Allocation Expressions Independently of input validation, each allocation size expression must be widened to 64-bit arithmetic by prepending a `(size_t)` cast to the first operand. This provides defense-in-depth against overflow in the event that the input validation is bypassed or removed in a future refactor. **ALSA (`audin_alsa_thread_func`, line 143):** ```c /* BEFORE (vulnerable): */ buffer = (BYTE*)calloc(alsa->frames_per_packet + alsa->aformat.nBlockAlign, alsa->bytes_per_frame); /* AFTER (fixed): */ buffer = (BYTE*)calloc((size_t)alsa->frames_per_packet + alsa->aformat.nBlockAlign, alsa->bytes_per_frame); ``` **sndio (`audin_sndio_thread_func`, lines 128–130):** ```c /* BEFORE (vulnerable): */ nbytes = (sndio->FramesPerPacket * sndio->format.nChannels * (sndio->format.wBitsPerSample / 8)); buffer = (BYTE*)calloc((nbytes + sizeof(void*)), sizeof(BYTE)); /* AFTER (fixed): */ nbytes = ((size_t)sndio->FramesPerPacket * sndio->format.nChannels * (sndio->format.wBitsPerSample / 8)); buffer = (BYTE*)calloc((nbytes + sizeof(void*)), sizeof(BYTE)); ``` **WinMM (`audin_winmm_thread_func`, lines 187–190):** ```c /* BEFORE (vulnerable): */ size = (winmm->pwfx_cur->wBitsPerSample * winmm->pwfx_cur->nChannels * winmm->frames_per_packet + 7) / 8; /* AFTER (fixed): */ size = ((size_t)winmm->pwfx_cur->wBitsPerSample * winmm->pwfx_cur->nChannels * winmm->frames_per_packet + 7) / 8; ``` **OpenSL ES (`android_OpenRecDevice`, lines 347–348):** ```c /* BEFORE (vulnerable): */ p->prep = opensles_queue_element_new(p->buffersize * p->bits_per_sample / 8); p->next = opensles_queue_element_new(p->buffersize * p->bits_per_sample / 8); /* AFTER (fixed): */ p->prep = opensles_queue_element_new((size_t)p->buffersize * p->bits_per_sample / 8); p->next = opensles_queue_element_new((size_t)p->buffersize * p->bits_per_sample / 8); ``` ### 14.3 OpenSL ES: Fix the Signed/Unsigned Parameter Type Mismatch The `android_OpenRecDevice` function signature should be updated to accept `UINT32` (or `size_t`) for the buffer frames parameter: ```c /* BEFORE (vulnerable type signature): */ OPENSL_STREAM* android_OpenRecDevice(void* context, opensl_receive_t receive, int sr, int inchannels, int bufferframes, /* signed, mismatches UINT32 caller */ int bits_per_sample); /* AFTER (corrected): */ OPENSL_STREAM* android_OpenRecDevice(void* context, opensl_receive_t receive, UINT32 sr, UINT32 inchannels, UINT32 bufferframes, /* matches UINT32 from protocol layer */ UINT32 bits_per_sample); ``` The internal assignment `p->buffersize = bufferframes;` then performs a safe `UINT32 / unsigned int` assignment (which on all Android targets is an identity conversion since `unsigned int` is 32 bits). The multiplication `(size_t)p->buffersize * p->bits_per_sample` then requires the `(size_t)` cast as described in Section 15.2. ### 14.4 Defense-in-Depth: Allocation Size Validation After computing the allocation size (whether or not the arithmetic fix has been applied), an explicit sanity check on the computed size prevents any edge-case allocation anomaly from producing a buffer that is unexpectedly small: ```c /* Applied to ALSA after computing count and bytes_per_frame: */ const size_t alloc_count = (size_t)alsa->frames_per_packet + alsa->aformat.nBlockAlign; const size_t alloc_size = alloc_count * alsa->bytes_per_frame; /* Reject allocations that are zero or impossibly small */ if (alloc_count == 0 || alloc_size < (size_t)alsa->bytes_per_frame) { WLog_Print(alsa->log, WLOG_ERROR, "Computed buffer size %" PRIuz " is invalid", alloc_size); error = ERROR_INVALID_PARAMETER; goto out; } buffer = (BYTE*)calloc(alloc_count, alsa->bytes_per_frame); ``` ### 14.5 Structural Recommendation: Shared Audio Buffer Size Utility To prevent recurrence across current and future audio backends, a centralized function for computing and validating audio buffer allocation sizes should be added to `audin_main.h` / `audin_main.c`: ```c /** * Computes the audio buffer allocation size and validates against overflow. * * @param frames_per_packet Number of audio frames per packet (from server, UINT32) * @param block_align Bytes per sample block (from AUDIO_FORMAT.nBlockAlign, UINT16) * @param bytes_per_frame Bytes per audio frame (channels * bytes_per_sample, size_t) * @param out_size Output: validated allocation size in bytes * * @return TRUE if the size is valid and has been written to out_size; FALSE on overflow or invalid input. */ static BOOL audin_compute_buffer_size(UINT32 frames_per_packet, UINT16 block_align, size_t bytes_per_frame, size_t* out_size) { if (!out_size || bytes_per_frame == 0) return FALSE; if (frames_per_packet > AUDIN_MAX_FRAMES_PER_PACKET) return FALSE; const size_t frame_count = (size_t)frames_per_packet + block_align; const size_t total_bytes = frame_count * bytes_per_frame; /* Check for overflow: if division doesn't reconstruct frame_count, overflow occurred */ if (bytes_per_frame > 0 && total_bytes / bytes_per_frame != frame_count) return FALSE; *out_size = total_bytes; return TRUE; } ``` ### 14.6 Recommended Testing Following the application of the above fixes, the FreeRDP maintainers are encouraged to: 1. Add fuzz tests to the `audin` channel with boundary-value inputs for `FramesPerPacket`: `0`, `1`, `0x7FFFFFFF`, `0x80000000`, `0xFFFFFFFF`, and the value `0xFFFFFFFF - UINT16_MAX` (which triggers the overflow condition in the ALSA addition expression at the boundary). 2. Add regression unit tests that verify `SetFormat` returns `ERROR_INVALID_PARAMETER` for `FramesPerPacket = 0xFFFFFFFF` in all four vulnerable backends. 3. Compile CI builds with `-fsanitize=address` to detect any allocator anomalies in audio channel test scenarios. 4. Enable `-Wconversion` compiler warning across the `channels/audin` subtree to catch future signed/unsigned conversion defects of the kind present in VULN-004. --- ## 16. Responsible Disclosure Policy This report is submitted under a coordinated responsible disclosure policy. The researcher will: - Provide the FreeRDP security team with a 90-day embargo period from the date of notification to develop, review, and release a patch. - Cooperate with the FreeRDP maintainers to validate the proposed fix and confirm that all four backends are addressed. - Not publicly disclose vulnerability details, proof-of-concept code, or CVSS scores during the embargo period. - Grant an extension to the 90-day timeline if the maintainers communicate a credible patch timeline and demonstrate active remediation progress. - Proceed with public disclosure at the end of the embargo period regardless of patch status, in accordance with industry standard responsible disclosure norms (cf. Google Project Zero 90-day policy; CERT/CC Coordinated Vulnerability Disclosure Policy). The researcher requests that the FreeRDP project: - Assign CVE identifiers for each confirmed vulnerability (VULN-001 through VULN-004). - Credit the reporter in the security advisory. - Notify downstream distributors (Debian, Fedora, Arch, Ubuntu package maintainers; F-Droid; downstream RDP clients built on FreeRDP) with sufficient lead time before public disclosure. **Security Contact:** [email protected] (FreeRDP project security contact per SECURITY.md in repository root) **Alternative:** Open a private security advisory on the FreeRDP GitHub repository using the Security / Report a Vulnerability feature. --- ## 17. References ### 17.1 Standards and Specifications - **MS-RDPEAI:** Remote Desktop Protocol: Audio Input Redirection Virtual Channel Extension https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeai/ - **MS-RDPBCGR:** Remote Desktop Protocol: Basic Connectivity and Graphics Remoting https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/ - **ISO/IEC 9899:2018 (C18):** Programming Languages - C, §6.2.5 (Types), §6.3.1.8 (Usual Arithmetic Conversions), §6.5 (Expressions) ### 17.2 CWE References - **CWE-20:** Improper Input Validation - https://cwe.mitre.org/data/definitions/20.html - **CWE-122:** Heap-based Buffer Overflow - https://cwe.mitre.org/data/definitions/122.html - **CWE-131:** Incorrect Calculation of Buffer Size - https://cwe.mitre.org/data/definitions/131.html - **CWE-190:** Integer Overflow or Wraparound - https://cwe.mitre.org/data/definitions/190.html - **CWE-195:** Signed to Unsigned Conversion Error - https://cwe.mitre.org/data/definitions/195.html ### 17.3 CAPEC References - **CAPEC-92:** Forced Integer Overflow - https://capec.mitre.org/data/definitions/92.html - **CAPEC-123:** Buffer Manipulation - https://capec.mitre.org/data/definitions/123.html ### 17.4 CVSS - **CVSS 3.1 Calculator:** https://www.first.org/cvss/calculator/3.1 - **CVSS 3.1 Specification:** https://www.first.org/cvss/v3-1/ ### 17.5 FreeRDP Repository - **Repository:** https://github.com/FreeRDP/FreeRDP - **Security Policy:** https://github.com/FreeRDP/FreeRDP/blob/master/SECURITY.md - **Affected File (ALSA):** `channels/audin/client/alsa/audin_alsa.c` - **Affected File (sndio):** `channels/audin/client/sndio/audin_sndio.c` - **Affected File (WinMM):** `channels/audin/client/winmm/audin_winmm.c` - **Affected File (OpenSL ES):** `channels/audin/client/opensles/opensl_io.c` - **Reference (Safe OSS):** `channels/audin/client/oss/audin_oss.c` - **Reference (Safe PulseAudio):** `channels/audin/client/pulse/audin_pulse.c` ### 17.6 Analogous Prior Vulnerabilities - **CVE-2020-11521:** FreeRDP - Integer overflow in planar.c - **CVE-2020-11525:** FreeRDP - Out-of-bounds read in bitmap.c - **CVE-2022-39316:** FreeRDP - `audin_client_receive`: buffer overflow in audio input channel - **CVE-2023-40574:** FreeRDP - Out-of-bounds write in `FreeRDP_Codecs` The recurrence of integer overflow vulnerabilities in FreeRDP virtual channel implementations (cf. CVE-2022-39316 - a prior audio input channel buffer overflow) underlines the systemic nature of the root cause and the importance of input validation at all server-to-client parameter boundaries. --- ## 18. Appendices ### Appendix A: Full ASAN Output The following is the complete AddressSanitizer output from execution of the standalone PoC (`test_audin_vuln.c`) compiled with GCC 13.3.0 on Ubuntu 24.04.4 LTS (kernel 6.17.0-20-generic, x86_64): ``` ================================================================= ==34207==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50200000001c at pc 0x7e50030fa97d bp 0x7ffe96773dd0 sp 0x7ffe96773578 WRITE of size 4096 at 0x50200000001c thread T0 #0 0x7e50030fa97c in memset ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87 #1 0x59eb5a46ff39 in main /home/[user]/poc/test_audin_vuln.c:148 #2 0x7e5002c2a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #3 0x7e5002c2a28a in __libc_start_main_impl ../csu/libc-start.c:360 #4 0x59eb5a46f2c4 in _start (/home/[user]/poc/test_audin_vuln+0x22c4) 0x50200000001c is located 0 bytes after 12-byte region [0x502000000010,0x50200000001c) allocated by thread T0 here: #0 0x7e50030fd340 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77 #1 0x59eb5a46f5bb in vulnerable_allocation /home/[user]/poc/test_audin_vuln.c:67 #2 0x59eb5a46fc6c in main /home/[user]/poc/test_audin_vuln.c:115 #3 0x7e5002c2a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #4 0x7e5002c2a28a in __libc_start_main_impl ../csu/libc-start.c:360 #5 0x59eb5a46f2c4 in _start (/home/[user]/poc/test_audin_vuln+0x22c4) SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87 in memset Shadow bytes around the buggy address: 0x501ffffffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x501ffffffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x501ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x501fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x501fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x502000000000: fa fa 00[04]fa fa fa fa fa fa fa fa fa fa fa fa 0x502000000080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x502000000100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x502000000180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x502000000200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x502000000280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==34207==ABORTING ``` **ASAN Shadow Byte Interpretation:** The shadow byte entry `00[04]` at the allocation address indicates: the first 8-byte shadow word covers 8 addressable bytes (shadow `00`), and the second 4-byte shadow word covers 4 addressable bytes plus 4 redzoned bytes (shadow `04`, meaning the first 4 bytes of this shadow word are valid and the remaining 4 bytes are redzoned). This is consistent with a `calloc(3, 4)` = 12-byte allocation: 8 addressable bytes (shadow `00`) + 4 addressable bytes in the partially-addressable shadow word (shadow `04`). The write of 4096 bytes begins immediately at the first redzoned byte at offset 12, triggering ASAN. ### Appendix B: Proof-of-Concept Source (test_audin_vuln.c) The proof-of-concept source code is provided as a separate file (`test_audin_vuln.c`) accompanying this report. It directly replicates the types and arithmetic of `audin_alsa.c:143` without any FreeRDP library dependency, and is suitable for immediate compilation and verification on any system with GCC and libasan. ### Appendix C: Affected Source Lines - Complete Reference | File | Line | Expression | Overflow Type | |------|------|-----------|---------------| | `channels/audin/client/alsa/audin_alsa.c` | 276 | `alsa->frames_per_packet = FramesPerPacket;` | No validation (source) | | `channels/audin/client/alsa/audin_alsa.c` | 143 | `calloc(frames_per_packet + nBlockAlign, bytes_per_frame)` | Addition overflow (sink) | | `channels/audin/client/alsa/audin_alsa.c` | 155 | `size_t frames = alsa->frames_per_packet;` | No overflow (divergence point) | | `channels/audin/client/sndio/audin_sndio.c` | 71 | `sndio->FramesPerPacket = FramesPerPacket;` | No validation (source) | | `channels/audin/client/sndio/audin_sndio.c` | 128 | `nbytes = FramesPerPacket * nChannels * (wBitsPerSample / 8)` | Multiplication overflow (sink) | | `channels/audin/client/sndio/audin_sndio.c` | 129 | `calloc((nbytes + sizeof(void*)), sizeof(BYTE))` | Secondary overflow possible | | `channels/audin/client/winmm/audin_winmm.c` | 363 | `winmm->frames_per_packet = FramesPerPacket;` | No validation (source) | | `channels/audin/client/winmm/audin_winmm.c` | 187 | `wBitsPerSample * nChannels * frames_per_packet` | Multiplication overflow (sink) | | `channels/audin/client/opensles/opensl_io.c` | 322 | `p->buffersize = bufferframes;` | Signed/unsigned conversion | | `channels/audin/client/opensles/opensl_io.c` | 347 | `buffersize * bits_per_sample / 8` | Multiplication overflow (sink) | | `channels/audin/client/opensles/opensl_io.c` | 348 | `buffersize * bits_per_sample / 8` (duplicate) | Multiplication overflow (sink) | ### Appendix D: Safe Implementation Reference Lines | File | Line | Pattern | Mechanism | |------|------|---------|-----------| | `channels/audin/client/oss/audin_oss.c` | 191–192 | `1ull * FramesPerPacket * nChannels * (wBitsPerSample / 8ull)` | `1ull` forces 64-bit arithmetic | | `channels/audin/client/pulse/audin_pulse.c` | 407–408 | `const size_t frag = bytes_per_frame * frames_per_packet; WINPR_ASSERT(frag <= UINT32_MAX);` | 64-bit multiplication + assertion | ### Appendix E: Test Environment | Parameter | Value | |-----------|-------| | Operating System | Ubuntu 24.04.4 LTS (Noble Numbat) | | Kernel | 6.17.0-20-generic | | Architecture | x86_64 (LP64: `sizeof(size_t) = 8`, `sizeof(unsigned int) = 4`, `sizeof(UINT32) = 4`) | | Compiler | GCC 13.3.0 | | ASAN Runtime | libasan8 (bundled with GCC 13.3.0) | | FreeRDP Version | 3.28.1-dev0 (HEAD at time of research, 2026-07-12) | | Build Configuration | `-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer -g -O0"` | ### Appendix F: Tools Used | Tool | Version / Source | Purpose | | ---------------------------------- | ----------------- | ------------------------------------------------------- | | GCC | 13.3.0 | Compilation of PoC and ASAN-instrumented FreeRDP builds | | AddressSanitizer (ASAN) | libasan8 (GCC 13) | Dynamic heap overflow detection | | CMake | 3.28+ | FreeRDP build configuration | | Python 3.12 / paramiko 5.0.0 | PyPI | Remote PoC coordination | --- ## Legal Disclaimer This vulnerability disclosure report is prepared and submitted for the exclusive purposes of security research, vendor notification, patch development, and protection of end users. All analysis, testing, and proof-of-concept activities described herein were conducted on systems owned and controlled by the reporting researcher, against locally compiled builds of the open-source FreeRDP software. No unauthorized access to any third-party system was performed, attempted, or implied at any point during this research. The information contained in this report is intended solely for the FreeRDP security team and authorized maintainers. Unauthorized use of the technical details herein - including but not limited to weaponization, exploitation of production systems without authorization, or distribution to parties not involved in remediation - is strictly prohibited. The proof-of-concept code (`test_audin_vuln.c`) included with this report is provided to enable maintainers to reproduce the vulnerability and verify proposed fixes. It is not intended for use against any system for which the user does not have explicit authorization. --- **Report Version:** 1.0 **Document Date:** 2026-07-12
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | FreeRDP (c/c++) | <= 3.28.0 | 3.29.0 | Patch available | GHSA-69xf-pqrw-596x |
- FreeRDP (c/c++) Vendor— Affected <= 3.28.0 Fixed in 3.29.0 Patch available GHSA-69xf-pqrw-596x
Remediation
Upgrade FreeRDP to version 3.29.0, which fixes the flaw.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-69xf-pqrw-596x FreeRDP (c/c++) Fixed in 3.29.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-69xf-pqrw-596x
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences