Severity:

HIGH RISK

(7.3)

SQL Injection in Login Component of Simple Responsive

CVE-2026-3746

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Authentication Bypass and Data Exposure via SQL Injection

Severity:

HIGH RISK

(7.3)

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

The Simple Responsive Tourism Website 1.0 application contains a SQL injection vulnerability in the Login component, specifically in the /tourism/classes/Login.php?f=login endpoint.

By manipulating the Username parameter, a remote attacker can inject SQL queries into the backend database, potentially bypassing authentication or accessing sensitive data when the application fails to properly sanitize user input.

Affected context

This vulnerability appears in deployments of SourceCodester Simple Responsive Tourism Website 1.0 where the login functionality is exposed over a network (e.g., public or internal web access).

It affects the PHP-based login handler at /tourism/classes/Login.php?f=login when it constructs SQL statements using the Username parameter directly or with insufficient sanitization.

The risk is higher when the application uses powerful database accounts, stores sensitive customer or booking data, or lacks additional access control layers beyond simple username/password checks.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the login endpoint at /tourism/classes/Login.php?f=login.
  • Required access: Network access to the web application; no prior authentication is necessary to reach the login form.
  • Trigger point: Submission of crafted values in the Username parameter in login requests.
  • Why exploitation is possible: The server-side code appears to interpolate the Username parameter into SQL queries without using parameterized statements or robust escaping, allowing attacker-controlled input to alter the intended SQL logic.

Why this happens

The root cause is the construction of SQL queries by concatenating or embedding raw user input from the Username parameter into SQL statements within Login.php.

This insecure pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where special characters (such as quotes, operators, or comment markers) are not safely handled.

The presence of CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component further reflects that data sent to the database (a downstream component) is not properly neutralized, enabling crafted input to be interpreted as part of the SQL command instead of data.

Potential impact

  • An attacker may bypass authentication and gain unauthorized access to user or administrative accounts.
  • An attacker could read sensitive information stored in the database, such as user details, booking records, or configuration data.
  • An attacker might modify or delete records, affecting the integrity and availability of tourism-related content or bookings.
  • In some deployments, SQL injection could be leveraged to execute additional database functions, potentially escalating to remote code execution depending on the environment and database configuration.

General mitigation guidance

Mitigation generally focuses on eliminating direct concatenation of user input into SQL queries and enforcing strict separation between code and data.

Recommended defensive patterns include:

  • Using parameterized queries or prepared statements for all database access in the login component and elsewhere, ensuring that input is always treated as data.
  • Applying centralized input validation for authentication fields (e.g., usernames), restricting allowed characters to a minimal safe set appropriate to the domain.
  • Implementing output encoding and query-building helpers that encapsulate safe database interaction, reducing the likelihood of ad hoc query construction.
  • Running the database with least-privilege accounts so that even if a query is manipulated, accessible operations and data are minimized.
  • Introducing layered defenses such as application-level access controls and rate limiting to reduce the impact of automated attacks.

How teams detect issues like this

Detection typically involves both code-centric and behavior-centric approaches:

  • Static analysis: Configure code scanners or linters to flag instances of dynamic SQL construction using variables (e.g., string concatenation in PHP with $_POST['Username'] or similar patterns), especially in authentication code paths.
  • Code review: During manual reviews, pay close attention to login and user input handling, looking for unparameterized SQL, custom escaping routines, or direct interpolation of request parameters into queries.
  • Dynamic testing: Use application security testing tools or targeted penetration tests to send crafted input through the login interface to identify injection behavior and confirm remediation.
  • Runtime monitoring: Enable database query logging and anomaly detection to spot unusual patterns such as queries containing injected operators, comments, or always-true conditions originating from the login endpoint.

Sources

SourceLink
github.comgithub.com/CH0ico/CVE_choco_7
github.comgithub.com/CH0ico/CVE_choco_7/blob/main/report.md
vuldb.comvuldb.com/?ctiid.349724
vuldb.comvuldb.com/?id.349724
vuldb.comvuldb.com/?submit.767882
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. Any user with network access to the web application's login page can attempt to exploit the SQL injection by submitting crafted values in the Username field.

No. The vulnerable parameter is part of the login request itself, so exploitation does not require prior authentication; the attacker interacts with the public login interface.

Refactor all affected database calls in the login logic to use parameterized queries or prepared statements, and ensure that no user-controlled data is concatenated directly into SQL strings. Combine this with restrictive validation for username input.

Adopt a development standard that mandates parameterized database access, centralize database interaction through vetted helper functions or ORM layers, incorporate static analysis into CI pipelines to catch dynamic query construction, and perform regular secure code reviews focused on input handling and authentication flows.

Find out what's already
exploitable in your codebase.