CVE-2021-41104: Esphome Basic Auth Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-48mj-p7x2-5jfm
CVSS 7.5
CWE-306
Published
Advisory Summary

CVE-2021-41104 is a HIGH (CVSS 7.5) basic auth bypass vulnerability (CWE-306: Missing Authentication for Critical Function) affecting Esphome libraries in the PyPI ecosystem. The issue involves basic auth bypass in esphome. Remediation is available by upgrading affected packages to version 2021.9.2.

CVE-2021-41104 at a Glance

CVE Identifier CVE-2021-41104
GHSA Identifier GHSA-48mj-p7x2-5jfm
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-306: Missing Authentication for Critical Function
Affected Product Esphome
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2021-41104

To remediate this vulnerability, upgrade all affected Esphome dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

esphome fixed: 2021.9.2
pip install esphome>=2021.9.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show esphome

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-41104, inspect your installed packages using pip:

pip show esphome

Analyze the terminal output to locate any version of Esphome in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2021.9.2), your application is affected.

Note: The pip show esphome command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-306: Missing Authentication for Critical Function, where the product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources. In Esphome, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Anyone with web_server enabled and HTTP basic auth configured on 2021.9.1 or older `web_server` allows OTA update without checking user defined basic auth username & password ### Patches Patch released in 2021.9.2 ### Workarounds Disable/remove `web_server`

CVE-2021-41104 Affected Esphome Versions

1 component(s)
Fixed Versions:
2021.9.2
Product / Package Ecosystem Affected Versions Fixed Version
esphome
PyPI
< 2021.9.2
2021.9.2

References

Frequently Asked Questions

What is CVE-2021-41104?
CVE-2021-41104 is a security vulnerability in Esphome involving Basic auth bypass in esphome under CWE-306: Missing Authentication for Critical Function.
Which Esphome versions are affected?
Affected versions include releases prior to 2021.9.2 across affected packages: esphome.
What version fixes CVE-2021-41104?
Upgrading to 2021.9.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is esphome affected?
Yes, esphome is affected in releases prior to 2021.9.2. Upgrade your dependency to 2021.9.2 or later.
What is the CVSS score of CVE-2021-41104?
CVE-2021-41104 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2021-41104?
CVE-2021-41104 is classified under CWE-306: Missing Authentication for Critical Function (The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.).
How can I check PyPI dependencies for CVE-2021-41104?
Run the dependency tree command: 'pip show esphome'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-48mj-p7x2-5jfm",
  "modified" : "2024-09-20T17:35:20Z",
  "published" : "2021-09-29T17:09:14Z",
  "aliases" : [ "CVE-2021-41104" ],
  "summary" : "Basic auth bypass in esphome",
  "details" : "### Impact\n\nAnyone with web_server enabled and HTTP basic auth configured on 2021.9.1 or older\n\n`web_server` allows OTA update without checking user defined basic auth username & password\n\n### Patches\n\nPatch released in 2021.9.2\n\n### Workarounds\n\nDisable/remove `web_server`\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "esphome"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2021.9.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/esphome/esphome/security/advisories/GHSA-48mj-p7x2-5jfm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41104"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/esphome/esphome/pull/2409"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/esphome/esphome/commit/2234f6aacf8cc653307fed80f3750317a82c4f83"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/esphome/esphome/commit/be965a60eba6bb769e2a5afdbc8eed132f077a59"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/esphome/esphome"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/esphome/esphome/releases/tag/2021.9.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/esphome/PYSEC-2021-351.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-306" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-28T21:10:08Z",
    "nvd_published_at" : "2021-09-28T16:15:00Z"
  }
}