/

CVE-2026-86162

Severity:

HIGH RISK

(7.3)

SQL Injection (CWE-89) in SourceCodester Voting System

CVE-2026-86162

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Database Access, Authentication Bypass, and Data Manipulation

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

A SQL injection vulnerability in the SourceCodester Online Voting System 1.0 may allow an attacker to manipulate database queries through the Username parameter of the login endpoint.

Because the affected endpoint is remotely accessible, an attacker who can reach it may be able to bypass authentication, retrieve data, or alter database records depending on database permissions and application behavior.

Affected context

The vulnerability occurs in the remote login handler at /ajax.php?action=login when the Username argument is incorporated into a database query without sufficient separation between application data and SQL syntax. Risk depends on whether the endpoint is exposed to untrusted network clients, how database errors and results are handled, and the privileges assigned to the application database account.

Exploit preconditions

  • Attack surface: The remotely accessible login endpoint at /ajax.php?action=login
  • Required access: Ability to send requests to the affected application; valid credentials may not be required
  • Trigger point: Processing of the Username parameter during authentication
  • Why exploitation is possible: User-controlled input may influence SQL query structure when parameter binding or equivalent query protection is insufficient

Why this happens

The underlying bug is a failure to treat the Username value strictly as data when constructing or executing a database query. If application input is concatenated into SQL statements or otherwise reaches a query interpreter without reliable parameterization, crafted input can alter the intended query logic.

This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). The related CWE-74 classification reflects the broader failure to neutralize interpreter-relevant input before it reaches a command language.

Potential impact

  • An attacker could bypass authentication controls
  • Sensitive database records may be disclosed
  • Database records could be modified, deleted, or corrupted
  • Application behavior or voting results may be manipulated
  • The application database account could be used to affect other database resources

General mitigation guidance

Mitigation generally focuses on ensuring that user input cannot change SQL statement structure.

Common defensive patterns include:

  • Using parameterized queries or prepared statements for every database operation
  • Applying allowlist-based validation appropriate to the expected username format
  • Avoiding dynamic SQL construction from request parameters
  • Returning generic authentication errors without exposing database details
  • Assigning the application database account only the privileges it requires
  • Separating administrative, voting, and authentication data access where practical
  • Treating client-side validation as supplemental rather than a security boundary

How teams detect issues like this

Organizations can identify SQL injection risks through:

  • Static analysis rules that flag string concatenation or interpolation in SQL statements
  • Code review checks for direct use of request parameters in database queries
  • Dynamic testing of authentication and data-entry endpoints with safe, controlled test inputs
  • Database and application logging that highlights abnormal query errors, response patterns, or repeated malformed requests
  • Policy enforcement requiring prepared statements and approved database-access abstractions

Neutral automated code-review and application-security testing tools may help detect unsafe query construction before deployment.

Sources

SourceLink
github.comgithub.com/Aurora-Song/cve/issues/1
vuldb.comvuldb.com/cve/CVE-2026-86162
vuldb.comvuldb.com/submit/895450
vuldb.comvuldb.com/vuln/399287
vuldb.comvuldb.com/vuln/399287/cti
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. The affected login endpoint is described as remotely accessible, so an attacker who can reach the application may be able to submit input to the vulnerable parameter.

Not necessarily. The issue affects a login request parameter, and valid authentication may not be required. Actual impact depends on endpoint behavior, filtering, and database permissions.

Use parameterized queries or prepared statements so the Username value is always handled as data rather than executable SQL syntax.

Combine parameterized database access with allowlist validation, least-privilege database accounts, secure error handling, code review, and automated static and dynamic security testing.

Find out what's already
exploitable in your codebase.