Engineer working on a laptop connected to a device test rig, surrounded by wiring harnesses and test hardware

Firmware vulnerabilities & fixes

How to fix authentication bypass in embedded firmware

Last updated:

Authentication bypass covers two closely related MITRE weaknesses: CWE-287 (Improper Authentication), where "the product does not prove or insufficiently proves" a claimed identity, and CWE-306 (Missing Authentication for Critical Functionality), where a sensitive function has no authentication check at all. Both pages read 2026-10-29. In embedded firmware, the pattern is usually a secondary channel: a device authenticates correctly on its main web UI, then exposes the same privileged function over a second interface — a raw API, a local serial or Bluetooth link, or a mobile-app-only endpoint — that the login check never covers.

Key takeaways

  • MITRE's 2025 CWE Top 25 ranks CWE-306 (Missing Authentication for Critical Functionality) 21st, with 11 CVEs mapped to it in CISA's Known Exploited Vulnerabilities catalog.
  • MITRE marks CWE-287 as discouraged for mapping and points to its children.
  • A simple inventory keeps the search complete.
  • Segment functionality into tiers and route every tier through one authentication mechanism.

Why does authentication bypass matter for device makers?

MITRE's 2025 CWE Top 25 ranks CWE-306 (Missing Authentication for Critical Functionality) 21st, with 11 CVEs mapped to it in CISA's Known Exploited Vulnerabilities catalog. The CWE-306 entry rates its likelihood of exploit as High. Its neighbour CWE-862 (Missing Authorization) ranks fourth. That one is a different bug: the device knows who the user is but does not check what that user may do. Keeping the two apart matters when you choose the fix and when you write the advisory (our CWE Top 25 guide explains the ranking).

Authentication is also written into product law:

  • The UK's PSTI Regulations 2023, Schedule 1, require passwords on consumer connectable products to be unique per product or defined by the user. Unique passwords must not be based on incremental counters, on public information, or on identifiers such as serial numbers, unless an accepted encryption method or keyed hash is used.
  • ETSI EN 303 645 opens with provision 5.1, no universal default passwords; see our ETSI EN 303 645 guide.
  • The EU Cyber Resilience Act's Annex I Part I asks for protection from unauthorised access through authentication and access control; see CRA Annex I explained.

Which CWE fits your finding?

MITRE marks CWE-287 as discouraged for mapping and points to its children. The table below lists the children that come up most often in device reports, so you can name the specific weakness and pick the first fix.

CWE What it looks like in firmware First fix
CWE-306 Missing Authentication for Critical Functionality An admin, update or reset endpoint with no check at all Route it through the central check
CWE-288 Authentication Bypass Using an Alternate Path or Channel The same function also reachable via a second port, the app API or a local console Enforce the same check on every channel
CWE-1390 Weak Authentication A check exists but can be satisfied without proving identity Fix the verification logic; use a vetted library
CWE-798 Use of Hard-coded Credentials A fixed support or service account in the image Remove it; see how to fix hard-coded credentials
CWE-307 Improper Restriction of Excessive Authentication Attempts Unlimited password guessing, or a lockout on the web UI only Throttle in the shared authentication module
CWE-294 Authentication Bypass by Capture-replay A captured login message or token replayed on the LAN or over BLE Challenge-response with a fresh nonce, or a protected session
CWE-862 Missing Authorization A logged-in low-privilege user reaches an admin function Tier check after login (an authorization fix)

CWE-288 describes the classic device case: "the product requires authentication, but the product has an alternate path or channel that does not require authentication." Its observed examples include gaining privileges "by directly requesting the web management URL."

1. Detect

  • Enumerate every network- and locally-reachable interface the device exposes (main web UI, any legacy or secondary web port, mobile-app API, local serial/UART/Bluetooth/debug interface, any undocumented port found by scanning the firmware or the running device), not just the primary admin login path.
  • For each interface, check whether every function that should require a "provable user identity" — admin settings, firmware update, factory reset, credential or key export — actually enforces an authentication check on the device itself, server-side.
  • Specifically test whether any client-side check (a disabled button, a hidden menu, a mobile-app-only screen) is the only thing preventing access to a function, by calling the underlying API directly without going through the client.
  • Grep custom authentication code for ad hoc, per-endpoint login logic rather than a single shared authentication module — repeated, slightly different implementations are where bypass bugs most often diverge from the intended behaviour.

A simple inventory keeps the search complete. Fill it from the web server configuration, the CGI directory in the image, the listening sockets on a running unit, and the board's debug headers:

Interface Where to find it What to test
Main web UI Server config, page list Every page and form action without a session cookie
CGI or API paths CGI directory and route list in the image Direct requests that skip the UI, including POST to upload and reset handlers
Companion-app API App traffic, API prefix in the image Calls with no token, an expired token, another device's token
Other TCP/UDP services Listening sockets on a running unit Vendor management protocols, legacy ports, discovery services that accept commands
Local interfaces UART, JTAG, USB, BLE Console login prompt, BLE characteristics that write settings

2. How do you fix it?

  1. Segment functionality into tiers and route every tier through one authentication mechanismPer MITRE's CWE-306 guidance: divide the product into anonymous, normal-user, privileged and administrative functionality, decide which tier each function belongs to, and enforce authentication centrally for everything above "anonymous" — rather than deciding per-endpoint whether a check is needed.
  2. Authenticate every channel independentlyIf a function is reachable over more than one interface (web UI and a raw API; main network and a local debug port), each interface needs its own enforcement of the same check — do not assume a secondary channel is private just because it wasn't designed to be user-facing.
  3. Never trust a client-side check aloneDuplicate every security-relevant check on the device/server side; a client-side-only check (hidden UI, disabled button) stops casual use but not a deliberate bypass.
  4. Use a vetted authentication framework, not a custom routineMITRE cites OWASP ESAPI's Authentication feature as an example of a maintained library that avoids common implementation mistakes; the same principle applies to any well-reviewed authentication library suited to your platform and language.
  5. For CWE-287-style insufficient proof of identity specifically, check the actual verification logic for logic errors — a comparison that can be satisfied with an empty or null value, a token check that doesn't verify signature/expiry, or a state machine that can be driven into an "already authenticated" branch without completing the prior steps, the pattern MITRE's own CWE-287 definition describes as insufficient proof of identity.

Worked example: how do you close a missed endpoint for good?

Synthetic example. The device, paths and code are invented for this guide and are not taken from any product.

A hypothetical network video recorder calls check_session() at the top of each page handler. A firmware-upload CGI added in a later release forgot the call, and a researcher reports that POST /cgi-bin/fw_upload installs an image without a login. Adding the missing line closes this report. It does not stop the next new handler from forgetting it too. The durable fix moves the decision into the dispatcher and makes "no rule" mean "no access":

/* SYNTHETIC - one route table, a tier per route, deny by default */
enum tier { ANON, USER, ADMIN };
struct route { const char *path; enum tier need; int (*fn)(struct req *); };

static const struct route routes[] = {
    { "/login",             ANON,  h_login     },
    { "/api/status",        USER,  h_status    },
    { "/api/config",        ADMIN, h_config    },
    { "/cgi-bin/fw_upload", ADMIN, h_fw_upload },
};

int dispatch(struct req *r) {
    for (size_t i = 0; i < sizeof routes / sizeof routes[0]; i++) {
        if (strcmp(r->path, routes[i].path) != 0) continue;
        if (session_tier(r) < routes[i].need) return reply(r, 401);
        return routes[i].fn(r);
    }
    return reply(r, 404);   /* unknown path: no handler runs */
}

The rest of the fix follows the inventory:

  • List every path the web server can serve, including every file in the CGI directory, and give each one a tier in the table.
  • Serve the companion-app API through the same dispatcher. The device reads the role from its own session record, never from an isAdmin field sent by the app.
  • Close the local console. Production builds either require a login on the UART console or disable it, with factory access protected by a credential unique to each device.
  • Add a build-time test that fails if any CGI file or registered path has no entry in the route table, and a run-time test that sends each non-anonymous route a request with no session and expects 401.
  • Keep the old per-handler checks until the dispatcher tests pass; then they become a second layer, not the only one.

Which logic errors break a login check that does exist?

These are the CWE-1390 cases, where a check runs but proves nothing:

  • Length taken from the input. strncmp(input, secret, strlen(input)) matches an empty password, because zero characters are compared.
  • Presence instead of validity. The handler checks that a session cookie exists, not that it names a live session.
  • Unverified tokens. A token is decoded but its signature, expiry or device binding is not checked.
  • Fail-open errors. If reading the credential store fails, the code falls through to the protected branch.
  • Re-enterable set-up flows. A first-boot wizard or password-reset step stays reachable after set-up. CWE-288 lists "direct request of installation file allows attacker to create administrator accounts" among its observed examples.
  • Throttling on one channel only. CWE-288 also cites a user who avoids lockouts "by using an API instead of the GUI." Put the counter in the shared module. NIST SP 800-63B-4 caps consecutive failed attempts on one account at 100 for the systems it covers, a useful upper bound for a device too.
  • Revealing error messages. The OWASP Authentication Cheat Sheet asks for a generic error whether the user ID or the password was wrong.

3. Verify

  • Re-test the originally reported bypass path and confirm it is closed, then independently test every other interface identified in Detection for the same missing or bypassable check — the fix is only complete when every equivalent path is covered, not just the one in the report.
  • Attempt the client-side bypass test again (calling the API directly, skipping the UI) against the patched firmware and confirm the server-side check now rejects the unauthenticated call.
  • Add both the original and the equivalent-path test cases to your regression suite.

What are the common pitfalls?

  • Patching the reported URL only. The researcher found one path; the inventory finds the rest.
  • Mapping everything to CWE-287. MITRE discourages it. Name CWE-306, CWE-288 or CWE-1390 when you know which one applies, so customers and scanners can match the advisory.
  • Confusing authentication with authorization. A route table with only "logged in / not logged in" leaves CWE-862 open for low-privilege accounts.
  • Treating the LAN as trusted. A device on a flat network is reachable by anything else on that network.
  • Leaving a factory or support login in production images, which turns the bypass into a hard-coded credential problem.
  • Shipping a fix for the web UI but not for the same code in the app API or a sister model.

4. Ship an update

Authentication-bypass fixes often touch more than one interface at once (web UI plus API plus any secondary channel); scope the release to cover all of them in a single update rather than patching one path and leaving another open. Confirm affected models and firmware versions with your firmware SBOM before scoping the rollout.

5. Disclose via PSIRT

An authentication bypass on an internet-reachable admin or update function is a common CISA KEV candidate once public — treat disclosure timing accordingly and check exploitation signals via KEV + EPSS prioritization. Run the advisory through your coordinated disclosure process (CVD process explained; PSIRT setup for a hardware company if you don't have one yet), and check the Cyber Resilience Act's 24-/72-hour reporting duty for EU-market products if there is evidence of active exploitation (CRA 24h/72h reporting).

What can SoftWSP check, and what needs interface testing?

A missing check in your own handlers is found by the inventory and tests above. SoftWSP covers the third-party components in the image. It extracts a software bill of materials from the firmware as CycloneDX JSON and matches components against NVD, CISA KEV, FIRST EPSS and CISA ICS advisories. A published authentication-bypass CVE in an embedded web server, SDK or open-source daemon you ship then appears together with its exploitation signals. An AI-drafted report cites each source, and an engineer reviews it before you receive it. SoftWSP does not probe your device's interfaces or test login logic. See device & firmware security.

This guide summarises public MITRE CWE guidance; it is not a substitute for a full interface-by-interface security review, and does not constitute legal advice.

Put this guide to work

Frequently asked questions

What is the difference between CWE-287 and CWE-306?

MITRE's CWE-287 (Improper Authentication) is the broad case: "when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct." CWE-306 (Missing Authentication for Critical Functionality) is the more specific, and in embedded devices more common, case: "the product does not perform any authentication for functionality that requires a provable user identity" — an admin API, a firmware-update endpoint, or a debug interface reachable with no login check at all, found via an undocumented path, a second network interface, or a protocol the primary web UI doesn't cover. MITRE actually marks CWE-287's own mapping as "DISCOURAGED for real-world vulnerability mapping," recommending the more specific child weakness (like CWE-306, or CWE-1390 Weak Authentication) wherever it is known — which is itself a useful diagnostic question when triaging a finding.

How does authentication get bypassed even when a login screen exists?

MITRE's CWE-306 mitigation guidance points at the most common real-world pattern: a secondary channel. A device may authenticate correctly on its main web UI, then expose the same administrative function over a second interface — a raw API endpoint, a local serial/Bluetooth/UART interface, or a mobile-app-only API — that the developer assumed was private and never wired into the same authentication check. MITRE's own wording: developers "sometimes mistakenly believe that [a secondary] channel is only accessible by... legitimate parties," when in practice every channel through which authenticated state persists needs its own enforcement.

What about client-side checks — can the firmware trust those?

No. MITRE's CWE-306 mitigations call this out directly: "duplicate any client-side security checks on the server side," because any check performed only in a browser, mobile app or other client can be bypassed by an attacker who skips the client entirely and talks to the device's API directly (MITRE cross-references this failure mode as CWE-602). Every critical device function needs its authentication enforced on the device itself, not assumed from client behaviour.

What is the recommended architectural fix?

MITRE's CWE-306 guidance recommends segmenting the product's functionality into anonymous, normal-user, privileged and administrative tiers, deciding up front which tier each function belongs to, and routing every function in a tier above "anonymous" through one centralized authentication mechanism rather than re-implementing login checks ad hoc per endpoint. Both CWE-287 and CWE-306 also recommend using a vetted authentication framework or library (MITRE cites OWASP ESAPI's Authentication feature as an example) instead of a custom-built login routine, which is where subtle bypass bugs most often creep in.

How do we verify the fix covers every path, not just the one that was reported?

Enumerate every network-reachable interface the device exposes — main web UI, any secondary/legacy API, mobile companion app endpoints, local serial/Bluetooth/debug interfaces — and confirm each one independently enforces the same authentication check for the same function, since the original report usually names only the one path a researcher happened to find, not every equivalent path that may share the same missing check.

Sources

  1. MITRE CWE-287: Improper Authentication
  2. MITRE CWE-306: Missing Authentication for Critical Function
  3. OWASP: Enterprise Security API (ESAPI) Project
  4. MITRE CWE-288: Authentication Bypass Using an Alternate Path or Channel
  5. MITRE CWE-1390: Weak Authentication
  6. MITRE: 2025 CWE Top 25 Most Dangerous Software Weaknesses
  7. UK legislation: The Product Security and Telecommunications Infrastructure (Security Requirements for Relevant Connectable Products) Regulations 2023, Schedule 1
  8. NIST SP 800-63B-4: Digital Identity Guidelines — Authentication and Authenticator Management
  9. OWASP Cheat Sheet Series: Authentication Cheat Sheet
Was this guide helpful?

In this cluster