Skip to main content
Vulnerability Database/CVE-2026-83742

CVE-2026-83742: wolfSSL wolfSSH Buffer Overflow Vulnerability

CVE-2026-83742 is a buffer overflow flaw in wolfSSL wolfSSH that allows authenticated attackers to write out-of-bounds data. This post explains the technical details, affected versions, impact, and mitigation steps.

Published:

CVE-2026-83742 Overview

CVE-2026-83742 is an unsigned integer underflow vulnerability in the wstrncat() function located in src/port.c of wolfSSL's wolfSSH implementation. The flaw affects wolfSSH versions v1.4.11 through v1.5.0 on non-Windows platforms. An authenticated remote attacker can write a single out-of-bounds null byte past the end of a stack buffer by sending a crafted SFTP path. The issue stems from wolfSSH_RealPath() in src/ssh.c passing a remaining-size bound rather than the full destination size to strncat(), which causes a size_t computation to wrap near SIZE_MAX.

Critical Impact

Authenticated SFTP users can trigger a one-byte stack buffer overwrite that may corrupt adjacent stack values and crash the process, enabling denial of service against wolfSSH-based servers.

Affected Products

  • wolfSSL wolfSSH v1.4.11
  • wolfSSL wolfSSH versions through v1.5.0
  • Non-Windows platform deployments of wolfSSH

Discovery Timeline

  • 2026-10-07 - CVE CVE-2026-83742 published to NVD
  • 2026-10-07 - Last updated in NVD database

Technical Details for CVE-2026-83742

Vulnerability Analysis

The vulnerability is a classic stack-based buffer overflow [CWE-121] caused by unsigned integer underflow in boundary arithmetic. The wstrncat() helper computes free space as n - strlen(s1) - 1 without validating that strlen(s1) is less than n. When the accumulated path reaches half of the output buffer, the subtraction underflows and produces a value near SIZE_MAX. The subsequent strncat() call then operates with an effectively unbounded size parameter.

The caller's own length check limits the data copied inside the buffer, so the overflow is confined to a single terminating null byte written one position past the buffer end. That byte can corrupt an adjacent stack value and crash the process. Applications that invoke the public wolfSSH_RealPath() with an output buffer smaller than the input path face an additional exposure because the word32 expression outSz - segSz in that length check also wraps.

Root Cause

The root cause is the use of n - strlen(s1) - 1 without a precondition check that strlen(s1) < n. Combined with wolfSSH_RealPath() passing outSz - curSz as the bound to WSTRNCAT, the chained unsigned subtractions wrap once curSz exceeds outSz/2.

Attack Vector

An authenticated SFTP client sends a crafted path containing enough components to drive the accumulated length past half of the server's output buffer. Each subsequent path component is then appended with an effectively unbounded size, allowing a component to exactly fill the remaining buffer and place its null terminator one byte beyond the buffer.

c
/* Patched wstrncat() in src/port.c - adds precondition check
 * to prevent unsigned underflow in free space calculation. */
char* wstrncat(char* s1, const char* s2, size_t n)
{
    size_t s1_len = strlen(s1);
    size_t freeSpace;

    if (s1_len >= n) {
        return NULL;
    }

    freeSpace = n - s1_len - 1;

    if (freeSpace >= strlen(s2)) {
        #ifndef USE_WINDOWS_API

Source: wolfSSL Commit 822e446

c
/* Patched wolfSSH_RealPath() in src/ssh.c - guards subtraction
 * against underflow and passes full buffer size to WSTRNCAT. */
word32 sepSz = (curSz != 1) ? 1 : 0;

/* Need room for the optional separator, the segment, and the
 * terminating null. Guard the subtraction against underflow. */
if (segSz >= outSz || curSz + sepSz >= outSz - segSz) {
    return WS_INVALID_PATH_E;
}

if (curSz != 1) {
    if (WSTRNCAT(out, "/", outSz) == NULL) {
        return WS_INVALID_PATH_E;
    }
    curSz++;
}
if (WSTRNCAT(out, seg, outSz) == NULL) {
    return WS_INVALID_PATH_E;
}
curSz += segSz;

Source: wolfSSL Commit fbc7cd8

Detection Methods for CVE-2026-83742

Indicators of Compromise

  • Unexpected crashes or segmentation faults in wolfSSH server processes following SFTP sessions.
  • SFTP session logs containing authenticated clients submitting unusually long or deeply nested path arguments to realpath requests.
  • Core dumps indicating stack corruption in call frames associated with wolfSSH_RealPath().

Detection Strategies

  • Inspect SFTP protocol telemetry for path arguments whose length approaches or exceeds the server's configured output buffer size.
  • Correlate authenticated SFTP sessions with subsequent abnormal termination of the wolfSSH service.
  • Deploy build-time instrumentation such as AddressSanitizer in test environments to catch the one-byte out-of-bounds write.

Monitoring Recommendations

  • Enable verbose logging of SFTP SSH_FXP_REALPATH requests and alert on paths with abnormal component counts.
  • Monitor process restart counts and crash reports for wolfSSH-based services and treat repeated crashes from the same authenticated principal as suspicious.
  • Track inventory of wolfSSH library versions across deployed products and firmware to identify unpatched instances.

How to Mitigate CVE-2026-83742

Immediate Actions Required

  • Upgrade wolfSSH to a release that includes the fixes in commits 822e446 and fbc7cd8.
  • Audit downstream applications and firmware that embed wolfSSH to confirm which linked version they ship.
  • Restrict SFTP access to trusted authenticated principals until patched builds are deployed.

Patch Information

wolfSSL has published fixes across three commits merged via wolfSSL Pull Request 1084. The core fix for the underflow is in wolfSSL Commit 822e446, which rewrites the free-space calculation in wstrncat(). The hardening of wolfSSH_RealPath() is in wolfSSL Commit fbc7cd8. Additional review feedback is captured in wolfSSL Commit 513e52b.

Workarounds

  • Disable the SFTP subsystem on wolfSSH servers until patched versions are available.
  • Enforce stricter authentication policies and limit SFTP accounts to the minimum necessary set.
  • Place wolfSSH-based services behind network segmentation that restricts reachable principals.
bash
# Verify installed wolfSSH version and rebuild from patched source
git clone https://github.com/wolfSSL/wolfssh.git
cd wolfssh
git log --oneline | grep -E '822e446|fbc7cd8|513e52b'
./autogen.sh && ./configure && make && sudo make install

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.