/

CVE-2026-71231

Severity:

CRITICAL RISK

(9.8)

SQL Injection (CWE-89) in IOTSmartHome gui/login.php

CVE-2026-71231

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Authentication Bypass and Sensitive Data Exposure

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

IOTSmartHome's login flow incorporates a client-controlled cookie value into an authentication SQL query without sanitizing or parameterizing the decoded input. An unauthenticated attacker may exploit this flaw to bypass login checks and could retrieve sensitive database contents, including user credentials.

Affected context

The vulnerability occurs in the web application's login handling when the lastLogin cookie is accepted from the client, decoded, and used to construct a database query. Deployments are at risk when this value reaches the database through string concatenation without parameter binding, query constraints, or equivalent server-side validation.

Exploit preconditions

  • Attack surface: The IOTSmartHome web login endpoint
  • Required access: Network access to submit requests; authentication is not required
  • Trigger point: Processing of the client-supplied lastLogin cookie during checkCookie()
  • Why exploitation is possible: The decoded cookie value is concatenated into an SQL statement, allowing database query syntax to influence authentication and result handling

Why this happens

The underlying bug is the construction of an SQL query by concatenating decoded, client-controlled input into the statement. Base64 decoding only transforms the representation and does not make the resulting value trustworthy; without parameterized queries or an equivalent safe query-construction mechanism, database syntax can be interpreted as executable SQL. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

Potential impact

  • An attacker may bypass authentication.
  • The application could disclose arbitrary records accessible to its database account.
  • Usernames, password hashes, or other credentials may be exposed.
  • Database integrity could be affected if the database account permits modification.
  • Compromised credentials could enable further attacks against connected services.

General mitigation guidance

Mitigation generally focuses on removing executable query syntax from data values and reducing trust in client-controlled authentication state.

Common defensive patterns include:

  • Use parameterized queries or prepared statements for all database operations.
  • Treat decoded cookies and other client-provided values as untrusted input.
  • Replace client-controlled login state with server-side sessions or signed, integrity-protected tokens.
  • Apply strict type, length, and format validation before values reach application logic.
  • Restrict database accounts to the minimum permissions required by the application.
  • Avoid returning detailed database errors or query results through authentication responses.
  • Rotate potentially exposed credentials and review data-access permissions when compromise is suspected.

How teams detect issues like this

Organizations can identify similar risks through:

  • Static analysis rules for SQL query construction using string concatenation or interpolation.
  • Code review checks for database calls that receive decoded cookies, headers, or request parameters directly.
  • Testing that verifies authentication queries use bound parameters rather than assembled SQL.
  • Web-application monitoring for abnormal login-cookie values, repeated authentication failures, and unusual query errors.
  • Database auditing for unexpected authentication queries, broad record reads, or access to credential-related tables.
  • CI policy enforcement that rejects unsafe query APIs or requires approved database-access abstractions.

Sources

SourceLink
github.comgithub.com/thebradleysanders/IOTSmartHome

Frequently asked

questions

Yes. An attacker generally needs network access to the login endpoint but does not need a valid account when the vulnerable cookie is processed before successful authentication.

The key requirement is the ability to send a crafted lastLogin cookie to the affected web application. Database exposure depends on the permissions granted to the application's database account.

Use parameterized queries or prepared statements and ensure that client-controlled cookie values cannot alter SQL structure. Server-side session state can further reduce reliance on mutable client input.

Combine secure database-access abstractions, strict input validation, least-privilege database permissions, code review, automated static analysis, and monitoring for anomalous authentication and database activity.

Find out what's already
exploitable in your codebase.