TinyWeb Socket Counter Imbalance Re-enables Slowloris Connection Exhaustion

Security Advisory. Published: July 18, 2026. Fixed in TinyWeb v2.05 (July 18, 2026).

Summary

TinyWeb HTTP Server tracks the number of live client connections in a global counter (SocksCount) to enforce the CMaxConnections = 512 limit that protects the server against Slowloris-style connection and thread exhaustion (the mitigation added in v2.02, CVE-2026-27630). In versions up to and including 2.04, TSocket.Destroy decremented SocksCount unconditionally, including for sockets that were never counted because they were rejected by a Startup failure or by the CMaxConnections guard itself. Each such rejected connection drove the counter one below the true value, so over time the counter drifts negative and the CMaxConnections check no longer trips at the intended threshold. The Slowloris protection is thereby weakened or disabled, and a remote, unauthenticated attacker who repeatedly opens and drops connections can exhaust worker threads and deny service to legitimate clients.

Severity: High (CVSS 3.1 Base Score: 7.5)

Vulnerability Details

GitHub Security Advisory GHSA-rprm-fpv2-mwwf
Vulnerability Type Uncontrolled Resource Consumption (CWE-400), Slowloris connection exhaustion
Attack Type Remote
Attack Vector Network (unauthenticated HTTP connections)
Vendor/Maintainer Maxim Masiutin
Product TinyWeb HTTP Server for Windows
Affected Versions Version 2.04 and below
Fixed Version 2.05 (July 18, 2026)
Impact Denial of Service (Thread/Connection Exhaustion)

CVSS Score

CVSS Version Score Severity Vector String
CVSS 3.1 7.5 High AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Technical Details

Root Cause

The connection limit introduced in v2.02 relies on a single global counter, SocksCount. MainLoop increments the counter when it accepts a connection and hands it to a worker thread. TSocket.Destroy was responsible for decrementing the counter when a connection ends. The decrement was unconditional: it ran for every TSocket instance that was destroyed, even for connections that were never counted in the first place.

Mechanism

A socket is created but never counted when it is rejected before it becomes an active worker connection, for example when the underlying Startup (socket setup) fails, or when the CMaxConnections guard refuses the connection because the server is already at its limit. In these paths the counter was never incremented, yet TSocket.Destroy still decremented it. Every rejected connection therefore left SocksCount one lower than the true number of live connections.

Because the imbalance is cumulative, the counter drifts steadily negative under normal operation and much faster under attack. Once SocksCount is below zero, the comparison against CMaxConnections can no longer reach the limit at the intended point, so the guard stops rejecting new connections. The Slowloris protection that v2.02 added is effectively neutralized.

Attack Scenario

A remote, unauthenticated attacker repeatedly opens TCP connections and drops them (or triggers the CMaxConnections rejection path), driving SocksCount negative. The attacker then holds many slow connections open. With the counter drifted below zero, the server admits far more concurrent connections than CMaxConnections was meant to allow, exhausting worker threads and stack memory and denying service to legitimate clients, exactly the condition the v2.02 mitigation was designed to prevent.

Fix Applied in Version 2.05

The problem has been patched in version 2.05. TSocket now carries a Counted flag, and TSocket.Destroy decrements SocksCount only when a matching increment occurred in MainLoop. Sockets rejected by a Startup failure or by the CMaxConnections guard are never counted and are never decremented, so the counter can no longer drift and the connection limit holds at its intended threshold.

Workarounds

If upgrading to v2.05 is not immediately possible, consider the following mitigations:

  • Restart the server periodically to reset SocksCount to its true value.
  • Place TinyWeb behind a reverse proxy or firewall that caps the number of concurrent connections per source address, so the drifting internal counter cannot be exploited from a single client.

Timeline

July 18, 2026 Vulnerability identified by Maxim Masiutin
July 18, 2026 Fix implemented and committed to master (v2.05)
July 18, 2026 Security advisory published (GHSA-rprm-fpv2-mwwf)

References

Other TinyWeb CVEs

GHSA-wxxh-8845-3c89 Log Injection via Control Characters in Request URI (CWE-117, CWE-93) - Fixed in v2.05. CVSS 5.3 Medium. Advisory
GHSA-56x3-254q-j68q HTTP Request Smuggling via Unsupported Transfer-Encoding (CWE-444) - Fixed in v2.05. CVSS 5.9 Medium. Advisory
CVE-2026-29046 HTTP Header Control Character Injection into CGI Environment (CWE-113) - Fixed in v2.04. CVSS 8.8 High. Advisory
CVE-2026-28497 Integer Overflow / HTTP Request Smuggling (CWE-190, CWE-444) - Fixed in v2.03. CVSS 8.7 High. Advisory
CVE-2026-27633 Content-Length Memory Exhaustion (CWE-400) - Fixed in v2.02. CVSS 8.7 High. Advisory
CVE-2026-27630 Thread/Connection Exhaustion Slowloris (CWE-400) - Fixed in v2.02. CVSS 8.7 High. Advisory
CVE-2026-27613 CGI Parameter Injection (CWE-78, CWE-88) - Fixed in v2.01. CVSS 9.3 Critical. Advisory
CVE-2024-34199 Buffer Overflow (CWE-787) - Fixed in v1.99. CVSS 8.6 High. Advisory
CVE-2024-5193 CRLF Injection (CWE-93) - Fixed in v1.99. CVSS 5.3 Medium. Advisory
CVE-2004-2636 Path Traversal (CWE-22) - Fixed in v1.93. CVSS 5.0 Medium. Advisory
CVE-2003-1510 Denial of Service (CWE-400) - Fixed in v1.93. CVSS 7.8 High. Advisory