Back to Blog
medium SEVERITY8 min read

HTTP Basic Auth Over Plain HTTP: How ESP32 Credentials Were Exposed on Your Wi-Fi

A medium-severity vulnerability in the ESP32-audioI2S library allowed audio streaming credentials to be transmitted via HTTP Basic Authentication over unencrypted HTTP connections, making them trivially recoverable by anyone on the same network. The fix gates the Authorization header behind an SSL/TLS check, ensuring credentials are only sent when the connection is encrypted. For embedded IoT devices where credentials are often hardcoded in firmware, this kind of passive interception risk is esp

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published May 28, 2026•Reviewed June 3, 2026

Answer Summary

HTTP Basic Auth credential exposure (CWE-319) in ESP32-audioI2S allowed credentials to be transmitted in cleartext over unencrypted HTTP connections. In embedded Arduino/C++ IoT code, this is fixed by gating the Authorization header behind an SSL/TLS check—only sending credentials when `https://` is used—preventing passive Wi-Fi sniffing attacks that could recover hardcoded firmware credentials.

Vulnerability at a Glance

cweCWE-319
fixGate credential transmission behind SSL/TLS connection verification
riskNetwork attackers can passively intercept authentication credentials
languageC++/Arduino (ESP32)
root causeAuthorization header sent regardless of connection encryption status
vulnerabilityCleartext Transmission of Sensitive Information (HTTP Basic Auth over plain HTTP)

Summary

A security vulnerability in the popular ESP32-audioI2S library (v3.0.6) allowed audio streaming server credentials to be silently leaked over the air. When connecting to a password-protected stream, the library would attach an Authorization: Basic header to the HTTP request — even when the connection was not encrypted. Any device passively sniffing traffic on the same Wi-Fi network could capture that header and decode the credentials in seconds. A one-line patch now ensures credentials are only sent over SSL/TLS-protected connections.


Introduction

If you've ever built an internet radio, a smart speaker, or a streaming audio project with an ESP32, there's a good chance you've used the ESP32-audioI2S library. It's a well-regarded, widely adopted library that handles the heavy lifting of connecting to audio streams, decoding formats, and pushing audio out over I2S to a DAC or amplifier.

Many audio streams — especially private or subscription-based ones — require authentication. The library supports this via HTTP Basic Authentication, a decades-old scheme where a username and password are Base64-encoded and attached to the HTTP request as a header.

Here's the problem: Base64 is not encryption. It's encoding. Anyone who captures the header can reverse it instantly. And if the HTTP connection itself isn't encrypted, that header travels across the network in plaintext, readable by any device within radio range.

For developers building hobby projects, this might sound academic. But in practice, IoT credentials are frequently:
- Hardcoded in firmware and difficult to rotate
- Reused across services (the same password used for the stream and for the user's email)
- Transmitted repeatedly on every connection attempt

This makes the exposure window wide and the consequences potentially serious.


The Vulnerability Explained

What Is HTTP Basic Authentication?

HTTP Basic Auth is defined in RFC 7617. When a client wants to authenticate, it sends a header like this:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

That long string is just username:password encoded in Base64. To decode it:

echo "dXNlcm5hbWU6cGFzc3dvcmQ=" | base64 --decode
# Output: username:password

That's it. No hashing. No encryption. No secret key. Anyone who sees the header has the credentials.

RFC 7617 itself explicitly states:

"This scheme is not considered to be a secure method of user authentication unless used in conjunction with some external secure system such as TLS."

What Was the Vulnerable Code Doing?

In Audio.cpp, the connecttohost() function builds an HTTP request and conditionally appends an Authorization header:

// BEFORE (vulnerable)
if (auth > 0) {
    strcat(rqh, "Authorization: Basic ");
    strcat(rqh, authorization);
    strcat(rqh, "\r\n");
}

The condition here only checks whether credentials were provided (auth > 0). It does not check whether the connection is using SSL/TLS. This means:

  • Connect to http://stream.example.com with credentials? → Header is sent in plaintext. ❌
  • Connect to https://stream.example.com with credentials? → Header is sent over TLS. ✅

Both cases triggered the same code path.

Real-World Attack Scenario

Imagine the following scenario:

  1. A developer builds a home audio player using an ESP32 and the audioI2S library.
  2. They subscribe to a private internet radio service that requires a username and password.
  3. They hardcode those credentials in their firmware and flash the device.
  4. The device sits on their home Wi-Fi network, connecting to http://radio.example.com every time it boots.

Now imagine a neighbor, a guest, or a compromised device on the same network runs a simple packet capture:

sudo tcpdump -i wlan0 -A port 80 | grep -i authorization

Within seconds of the ESP32 booting, they see:

Authorization: Basic dXNlcjpteXNlY3JldHBhc3N3b3Jk

Decoded: user:mysecretpassword

The attack requires no active intrusion, no brute forcing, no special tools beyond a laptop with Wi-Fi in monitor mode. It's entirely passive.

Why Is This Worse on Embedded Devices?

On a web application, if credentials are compromised, you can force a password reset. On an ESP32:

  • The credentials are likely compiled into the firmware binary
  • Updating firmware requires physical access or a working OTA pipeline
  • Users often don't know a compromise has occurred
  • The same credentials may protect other services

The blast radius of a single captured packet can be significant.


The Fix

The fix is elegant in its simplicity — a single additional condition:

// AFTER (fixed)
if (auth > 0 && m_f_ssl) {
    strcat(rqh, "Authorization: Basic ");
    strcat(rqh, authorization);
    strcat(rqh, "\r\n");
}

By adding && m_f_ssl, the Authorization header is now only appended when the connection is SSL/TLS-encrypted. If a caller tries to authenticate over a plain HTTP connection, the credentials are silently withheld rather than transmitted in the clear.

What Does m_f_ssl Represent?

In the ESP32-audioI2S library, m_f_ssl is a boolean member flag that is set to true when the library establishes a secure (HTTPS/SSL) connection rather than a plain HTTP one. It's already tracked internally by the library for other purposes — the fix simply reuses this existing signal to gate credential transmission.

The Full Diff

- if (auth > 0) {
+ if (auth > 0 && m_f_ssl) {
      strcat(rqh, "Authorization: Basic ");
      strcat(rqh, authorization);
      strcat(rqh, "\r\n");
  }

One line changed. One condition added. Credentials no longer travel over unencrypted connections.

Limitations to Be Aware Of

This fix prevents the leak but doesn't change the underlying authentication scheme. HTTP Basic Auth, even over TLS, still has weaknesses:

  • Credentials are sent on every request (no session tokens)
  • No protection against server-side compromise
  • No mutual authentication

For highest security, consider digest authentication or token-based schemes if your streaming server supports them. But for the vast majority of ESP32 audio projects, "only send credentials over TLS" is a practical and sufficient improvement.


Conclusion

This vulnerability is a textbook example of how a small oversight in authentication logic can have outsized consequences on embedded systems. The ESP32-audioI2S library correctly implemented the mechanics of HTTP Basic Auth — encoding credentials, attaching the header — but missed the critical precondition: Basic Auth is only safe when the transport is encrypted.

The fix is a single line, but the lesson is broader:

Authentication and encryption are not the same thing. You need both.

For embedded IoT developers, the stakes are higher than on traditional platforms. Credentials are hard to rotate, devices are often unmonitored, and network environments (shared Wi-Fi, guest networks, coffee shops) are frequently untrusted. Building in transport security checks from the start — and having automated tools that catch regressions — is not optional. It's essential.

If you're using the ESP32-audioI2S library in a project that authenticates against a streaming server, update to the patched version and ensure your stream URLs use https://.


This vulnerability was identified and fixed by OrbisAI Security as part of an automated security scanning pipeline. Automated security tooling caught what human code review missed — a reminder that layered security practices, including static analysis and AI-assisted scanning, are worth investing in.

Prevention and further reading

Frequently Asked Questions

Is Base64 encoding enough to protect HTTP Basic Auth credentials?

No. Base64 is encoding, not encryption. Any attacker who captures the traffic can instantly decode Base64 credentials. TLS encryption is required for protection.

Related Articles

medium

path-to-regexp 0.1.12 DoS: Catastrophic Backtracking on Malformed URL

path-to-regexp version 0.1.12 contains a regular expression engine vulnerability where maliciously crafted URL parameters trigger exponential backtracking, causing CPU exhaustion and service unavailability. Upgrading to version 0.1.13 eliminates the vulnerable pattern from the parsing logic.

critical

CVE-2026-59873: node-tar 7.5.11 DoS via Crafted Gzip Bomb

node-tar versions 7.5.11 through 7.5.18 are vulnerable to a denial-of-service attack through maliciously crafted gzip archives that decompress to disproportionately large sizes. An attacker can exploit this to exhaust memory and CPU resources by submitting a small, highly compressed archive that expands beyond configured limits during extraction.

high

MapManager.get() Race Condition Duplicates API Requests

The MapManager's `get(mapUid, cache)` method used a check-then-act pattern that permitted multiple concurrent requests to pass the cache miss check simultaneously, triggering redundant API calls and risking cache corruption. The fix introduces a `_pending` promise map to deduplicate in-flight fetches for identical map UIDs.

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.