Automated Threat Modeling

D-Link R18 A1 CVE-2026-138365: a Pre-Authentication Stack Buffer Overflow in is_session_valid

CVE-2026-138365 is a remote, unauthenticated stack-based buffer overflow in the is_session_valid function of /bin/httpd on the D-Link R18 A1 (firmware 1.20.B01). This covers the public proof-of-concept details and the offset data from the researcher submission.

CVE Analysis

6 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-29

D-Link R18 A1 CVE-2026-138365: a Pre-Authentication Stack Buffer Overflow in is_session_valid

Introduction

A remotely reachable memory corruption flaw in the D-Link R18 A1 router exposes the device's HTTP management daemon to control-flow hijacking before any password check completes. The vulnerable copy sits inside a function named is_session_valid, so it is tempting to assume an attacker must authenticate first. The researcher data shows the opposite, and that distinction is what makes CVE-2026-138365 worth examining carefully.

The D-Link R18 A1 is a consumer and small-office wireless router. The vulnerability lives in its embedded web server, /bin/httpd, which exposes the DHMAPI management interface on a MIPS-based platform. These devices are internet-facing by role, which is why a pre-authentication flaw in the session validation path carries the maximum assessed severity.

Technical Information

The root cause is a classic stack-based buffer overflow (CWE-121, with CWE-119 memory corruption) in the is_session_valid function inside /bin/httpd on firmware 1.20.B01. According to the accepted VulDB submission #1075954, credited to the VulDB user Legion_TL, the function copies an attacker-controlled API-AUTH hash token into a fixed 68-byte stack buffer, and it does this copy before performing the HMAC comparison that would validate the session. The validation step the function name implies never gets a chance to reject the request, because the overflow happens during the copy that precedes it.

The submission provides precise offset data consistent with a MIPS target (note the $sp and $ra register notation):

  • The hash-token buffer begins at $sp+0x7c.
  • The saved return address ($ra) is stored at $sp+0x2e4.
  • The distance between them is 0x268, which is 616 bytes from the start of the hash token to the saved return address.

That 616-byte offset gives an attacker precise control over $ra, enabling control-flow hijacking. The briefing notes this matches the pattern of prior D-Link httpd API-AUTH overflows, such as the G416 cases.

Attack flow

The published reproduction is a two-stage interaction with the DHMAPI web interface:

  1. The attacker sends a Login request with Action=request. The server responds with a Cookie, a Challenge, and a PublicKey, and it does so without requiring proof of the administrator password. This leaves the attacker in a pre-authentication state but holding a usable cookie.
  2. The attacker then sends an authenticated-action request using that cookie together with an oversized API-AUTH hash token. When is_session_valid copies the token into the 68-byte stack buffer, the stack overflows, overwriting the saved return address at offset 616.

No administrator credential is needed to reach the vulnerable copy, so the available evidence supports critical remote, unauthenticated exposure. The reviewed sources establish the mechanism and offsets but do not demonstrate a specific shell payload, execution privilege, or persistence outcome, so we describe the flaw as a control-flow hijacking primitive rather than a proven end-to-end compromise.

Severity

The official CVE record rates the issue CVSS 10.0 Critical under both CVSS 4.0 and 3.1. The CVSS 4.0 vector is:

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P

The trailing E:P records that the exploit maturity is Proof-of-Concept. VulDB also reports its own meta scores (base 10.0, temporary 9.1), which are proprietary values and should not be substituted for the CVSS ratings.

Proof of Concept

A public proof-of-concept is confirmed. VulDB classifies the exploit maturity as Proof-of-Concept, and the published CVE record (CNA: VulDB) tags the GitHub repository https://github.com/FoundTL/D-LINK-R18A1-FW120B01- with the exploit reference tag. The vulnerability was reported by the VulDB user Legion_TL in submission #1075954 (submitted 11/05/2026, accepted 11/29/2026).

The verified exploitation mechanism, as described in the accepted submission, is the two-stage sequence covered above: obtain a Cookie, Challenge, and PublicKey through a Login request with Action=request, then send an oversized API-AUTH token that is_session_valid copies into the 68-byte stack buffer before the HMAC comparison. The offset data ($sp+0x7c for the token buffer, $sp+0x2e4 for the saved $ra, giving a 616-byte offset) provides precise control over the return address.

As for the PoC artifact itself: the FoundTL repository (created 2026-11-05, default branch main) currently contains a single committed artifact, an archive named D-link R18A1-FW120B01.zip (approximately 869 KB), offered as the downloadable advisory/exploit. The repository exposes no README, description, or plaintext exploit script via the GitHub API. The exploit code and write-up are bundled inside the ZIP, whose contents could not be independently extracted or executed during verification. So no exact exploit source snippet can be reproduced here. The public-PoC verdict rests on the explicit CVE exploit tagging, the VulDB Proof-of-Concept classification, and the reproduction and offset data in submission #1075954, rather than on observed code execution.

Affected Systems and Versions

  • Vendor: D-Link
  • Product: R18 A1
  • Explicitly affected firmware: 1.20.B01
  • Vulnerable executable: /bin/httpd
  • Vulnerable function: is_session_valid

The CVE record explicitly marks 1.20.B01 as affected and leaves the default version status unknown. The available sources do not establish whether other firmware versions or hardware revisions are vulnerable or safe, so conclusions should stay tied to the documented 1.20.B01 configuration. D-Link firmware V1.20 (dated 11 August 2026) resolved an unrelated 5 GHz reboot issue and does not reference this CVE, so the existence of that release is not evidence of a fix.

Vendor Security History

D-Link maintains a formal disclosure process through its Product Security Team, which receives reports, investigates issues, and publishes advisories. Its historical record includes a 2019 US Federal Trade Commission settlement titled "D-Link Agrees to Make Security Enhancements to Settle FTC Litigation," which concerned routers and internet-connected cameras. The company has also documented cases where it retires and replaces a product rather than patching it, as in advisory SAP10519 for the DSL-224, which lists no fixed firmware and records support termination on 5 November 2025. These are context for vendor governance. None of them establishes the R18's support status or a corrective release for CVE-2026-138365.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization