☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-68657

CVE-2025-68657 Double Free in Espressif
📅 PUBLISHED: 2026-01-12 17:26 UTC 🔄 UPDATED: 2026-09-23 20:27 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.16%
👁️
0.16% probability
3.9× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
6.4
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-68657 is a critical memory corruption vulnerability in the Espressif ESP-IDF USB Host HID (Human Interface Device) driver. The flaw resides in the hid_host_device_close() function, which can free the same usb_transfer_t object twice (double-free) due to a race condition. The shared hid_iface_t state is accessed by both the USB event callback and user code without proper locking, allowing both to tear down a READY interface simultaneously. This corrupts heap metadata within the ESP USB host stack, potentially leading to denial of service (DoS) or arbitrary code execution on the ESP32/ESP32-S series microcontrollers. The vulnerability affects all versions prior to 1.1.0. No public exploit code or proof-of-concept is currently available, but the risk is elevated due to the widespread use of ESP-IDF in IoT and embedded systems.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability is not in a typical software package manager (NPM, PyPI, Go, Ruby) but is part of the Espressif IoT Development Framework (ESP-IDF) component registry. The affected component is usb_host_hid. Users should verify their ESP-IDF version and update the component to version 1.1.0 or later. The supply chain risk is moderate, as the component is often included as a submodule or via the ESP-IDF component manager.

CVSS Breakdown & Threat Level

  • CVSS Score: 6.4 (Medium)
  • Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
  • Attack Vector (AV): Local (L) – The attacker must have local access to the USB host interface.
  • Attack Complexity (AC): Low (L) – The race condition is easily triggered by concurrent operations.
  • Privileges Required (PR): Low (L) – Requires user-level code execution on the device.
  • User Interaction (UI): None (N) – No user action needed beyond triggering the race.
  • Scope (S): Unchanged (U) – The vulnerability affects only the USB host stack.
  • Confidentiality (C): None (N) – No direct data leak.
  • Integrity (I): High (H) – Heap corruption can lead to arbitrary writes.
  • Availability (A): High (H) – Double-free can crash the system or cause persistent denial of service.

Threat Level: Medium. While the CVSS score is moderate, the impact on embedded systems (e.g., IoT devices, industrial controllers) can be severe, potentially allowing an attacker to crash the device or execute arbitrary code.

Deep Dive & Mechanics

The vulnerability is a classic double-free race condition in the ESP-IDF USB Host HID driver. The core issue is in the hid_host_device_close() function, which is called to tear down an HID device connection. The function frees a usb_transfer_t object that was previously allocated for USB transfers. However, the shared state (hid_iface_t) is accessed without synchronization between the USB event callback (running in the USB host stack's context) and the user code (running in the application's context).

Race Condition Flow:

  1. User code calls hid_host_device_close() to close an HID device.
  2. Simultaneously, the USB event callback (e.g., USB_HOST_CLIENT_EVENT_DEV_GONE) is triggered due to a device disconnection or error.
  3. Both paths check the interface state (e.g., READY) and proceed to tear down the same usb_transfer_t.
  4. The first path frees the transfer, the second path frees it again, causing a double-free.
  5. The heap metadata is corrupted, leading to crashes, memory corruption, or potential exploitation.

Affected Component: usb_host_hid component in ESP-IDF, specifically the hid_host_device_close() function and the event callback handler.

Root Cause: Missing mutex or lock around the shared hid_iface_t state. The fix in version 1.1.0 introduces proper locking to ensure only one path can tear down the interface at a time.

Vulnerable vs. Patched Code

Vulnerable Code (simplified, pre-1.1.0):

// No locking around shared state
esp_err_t hid_host_device_close(hid_host_device_handle_t hid_device_handle)
{
    hid_iface_t *hid_iface = (hid_iface_t *)hid_device_handle;
    // ... check state ...
    if (hid_iface->state == HID_IFACE_STATE_READY) {
        // Free transfer without checking if already freed
        usb_host_transfer_free(hid_iface->transfer);
        hid_iface->state = HID_IFACE_STATE_CLOSED;
    }
    // ...
}

// Event callback also frees the same transfer
static void hid_host_event_cb(hid_iface_t *hid_iface)
{
    if (hid_iface->state == HID_IFACE_STATE_READY) {
        usb_host_transfer_free(hid_iface->transfer); // Double-free possible
        hid_iface->state = HID_IFACE_STATE_CLOSED;
    }
}

Patched Code (version 1.1.0):

// Mutex added to protect shared state
static SemaphoreHandle_t hid_mutex = NULL;

esp_err_t hid_host_device_close(hid_host_device_handle_t hid_device_handle)
{
    hid_iface_t *hid_iface = (hid_iface_t *)hid_device_handle;
    xSemaphoreTake(hid_mutex, portMAX_DELAY);
    if (hid_iface->state == HID_IFACE_STATE_READY) {
        usb_host_transfer_free(hid_iface->transfer);
        hid_iface->state = HID_IFACE_STATE_CLOSED;
    }
    xSemaphoreGive(hid_mutex);
    // ...
}

static void hid_host_event_cb(hid_iface_t *hid_iface)
{
    xSemaphoreTake(hid_mutex, portMAX_DELAY);
    if (hid_iface->state == HID_IFACE_STATE_READY) {
        usb_host_transfer_free(hid_iface->transfer);
        hid_iface->state = HID_IFACE_STATE_CLOSED;
    }
    xSemaphoreGive(hid_mutex);
}

Exploitation & Lab Setup

Red Team (Exploitation)

Prerequisites:

  • An ESP32/ESP32-S device running ESP-IDF with the vulnerable usb_host_hid component (< 1.1.0).
  • Ability to connect a malicious USB HID device (e.g., a Teensy or custom firmware) that can trigger rapid disconnection/reconnection.
  • Local code execution on the ESP32 (e.g., via a compromised application or debug interface).

Exploitation Steps:

  1. Setup: Flash the vulnerable ESP-IDF firmware to the target device.
  2. Trigger: Connect a USB HID device (e.g., keyboard) and then rapidly disconnect/reconnect it while the application calls hid_host_device_close() in a loop.
  3. Race Condition: The race between the event callback and user code will cause a double-free.
  4. Heap Corruption: The double-free corrupts the heap metadata. With careful heap grooming, an attacker can overwrite function pointers or control structures to achieve arbitrary code execution.
  5. Payload: Use the corrupted heap to redirect execution to a shellcode payload (e.g., exfiltrate data, open a backdoor).

Note: No public exploit code is available. This is a theoretical exploitation path.

Blue Team (Defense & Detection)

Detection:

  • Monitor for USB device disconnection/reconnection events at high frequency.
  • Use ESP-IDF's heap debugging tools (e.g., heap_caps_check_integrity()) to detect heap corruption.
  • Enable memory protection features (e.g., MPU) to limit the impact of heap corruption.

Mitigation:

  • Update to ESP-IDF USB Host HID driver version 1.1.0 or later.
  • Apply the patch manually if updating the entire framework is not possible.
  • Implement input validation and rate limiting on USB device events.
  • Use a watchdog timer to reset the device if a crash is detected.

Indicators of Compromise (IOCs)

  • Memory Corruption: Heap metadata corruption detected by heap_caps_check_integrity().
  • Crash Logs: ESP-IDF panic handler output showing double-free or heap corruption errors (e.g., CORRUPT HEAP: Bad tail magic).
  • USB Events: High frequency of USB_HOST_CLIENT_EVENT_DEV_GONE events followed by application crashes.
  • Firmware Version: ESP-IDF version < 1.1.0 with usb_host_hid component.

Detection Engineering

YARA Rule

rule CVE_2025_68657_ESP_IDF_Double_Free {
    meta:
        description = "Detects vulnerable code pattern in ESP-IDF USB Host HID driver (double-free in hid_host_device_close)"
        author = "Valters IT"
        date = "2025-04-10"
        cve = "CVE-2025-68657"
    strings:
        $func1 = "hid_host_device_close" ascii wide
        $func2 = "usb_host_transfer_free" ascii wide
        $pattern = "HID_IFACE_STATE_READY" ascii wide
    condition:
        all of ($func*) and #pattern > 0
}

Sigma Rule

title: CVE-2025-68657 - ESP-IDF USB Host HID Double-Free Detection
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects potential exploitation of double-free vulnerability in ESP-IDF USB Host HID driver via crash logs.
author: Valters IT
date: 2025-04-10
logsource:
    product: esp-idf
    service: crash_log
detection:
    selection:
        - "CORRUPT HEAP: Bad tail magic"
        - "double free"
        - "usb_host_transfer_free"
    condition: selection
falsepositives:
    - Legitimate heap corruption from other bugs
level: high

Suricata Rule

alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"CVE-2025-68657 - ESP-IDF USB Host HID Double-Free Attempt"; flow:to_server; content:"|48 49 44 5f 49 46 41 43 45 5f 53 54 41 54 45 5f 52 45 41 44 59|"; nocase; sid:1000001; rev:1;)

Note: This Suricata rule is a placeholder for network-based detection of HID protocol anomalies. In practice, the vulnerability is local, so network detection is limited.

Remediation & Mitigation

Immediate Actions:

  1. Update the component: Upgrade the usb_host_hid component to version 1.1.0 or later using the ESP-IDF component manager (idf.py add-dependency "espressif/usb_host_hid^1.1.0").
  2. Patch manually: If updating is not possible, apply the mutex-based locking fix to hid_host_device_close() and the event callback as shown in the patched code section.
  3. Disable USB HID: If the USB HID functionality is not required, disable it in the ESP-IDF configuration (make menuconfig -> Component config -> USB Host -> Disable HID support).

Long-Term Mitigations:

  • Implement heap integrity checks in production firmware.
  • Use ESP-IDF's memory protection features (e.g., MPU, stack canaries).
  • Conduct regular security audits of third-party components.
  • Monitor for updates from Espressif's advisory channels.

Valters IT Signature

This report was generated by Valters IT Cyber Threat Intelligence Division. For questions, contact cti@valters-it.com.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-68657/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.