/

CVE-2026-16227

Severity:

HIGH RISK

(7.3)

SQL Injection (CWE-89) in Class Timetabling System

CVE-2026-16227

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Unauthorized Data Access and Modification

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

SourceCodester Class and Exam Timetabling System 1.0 contains a SQL injection flaw in /edit_subject.php where the ID parameter is not safely handled before being used in database queries.

A remote attacker can manipulate this parameter to interfere with SQL statements, potentially exposing or modifying application data when the vulnerable script is accessible.

SourceCodester Class and Exam Timetabling System 1.0 contains a SQL injection flaw in /edit_subject.php where the ID parameter is not safely handled before being used in database queries.

A remote attacker can manipulate this parameter to interfere with SQL statements, potentially exposing or modifying application data when the vulnerable script is accessible.

Affected context

The vulnerability occurs in the /edit_subject.php endpoint of the Class and Exam Timetabling System when user-controlled input from the ID parameter is incorporated into SQL queries without proper neutralization.

It is typically relevant in deployments where:

  • The application is exposed over a network or the internet
  • Database accounts used by the application have broad privileges on the underlying schema
  • Input validation and query parameterization are incomplete or inconsistently applied

The vulnerability occurs in the /edit_subject.php endpoint of the Class and Exam Timetabling System when user-controlled input from the ID parameter is incorporated into SQL queries without proper neutralization.

It is typically relevant in deployments where:

  • The application is exposed over a network or the internet
  • Database accounts used by the application have broad privileges on the underlying schema
  • Input validation and query parameterization are incomplete or inconsistently applied

Exploit preconditions

  • Attack surface: HTTP interface to /edit_subject.php
  • Required access: Ability to send crafted requests to the vulnerable endpoint (usually unauthenticated or low-privilege web access, depending on deployment)
  • Trigger point: Submission of a malicious ID parameter value that is incorporated into SQL queries
  • Why exploitation is possible: The server-side code appears to concatenate the ID parameter directly into SQL statements without using parameterized queries or sufficient input sanitization, enabling injection of attacker-controlled SQL syntax
  • Attack surface: HTTP interface to /edit_subject.php
  • Required access: Ability to send crafted requests to the vulnerable endpoint (usually unauthenticated or low-privilege web access, depending on deployment)
  • Trigger point: Submission of a malicious ID parameter value that is incorporated into SQL queries
  • Why exploitation is possible: The server-side code appears to concatenate the ID parameter directly into SQL statements without using parameterized queries or sufficient input sanitization, enabling injection of attacker-controlled SQL syntax

Why this happens

This issue stems from dynamically constructing SQL statements using raw user input from the ID parameter in /edit_subject.php.

Instead of using parameterized queries or robust escaping, the code likely interpolates the ID value directly into the query string, allowing injected SQL fragments to change the query logic.

This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and is related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, since unsafe data is forwarded to the database engine without appropriate neutralization.

This issue stems from dynamically constructing SQL statements using raw user input from the ID parameter in /edit_subject.php.

Instead of using parameterized queries or robust escaping, the code likely interpolates the ID value directly into the query string, allowing injected SQL fragments to change the query logic.

This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and is related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, since unsafe data is forwarded to the database engine without appropriate neutralization.

Potential impact

  • Disclosure of sensitive information stored in the database (e.g., user accounts, schedules, or exam details)
  • Unauthorized modification or deletion of records, potentially corrupting timetables and subject data
  • Creation of new application-level accounts or escalation of privileges through manipulated data
  • Potential execution of administrative database operations if the application's DB user has elevated rights
  • Indirect impact on availability through data corruption or forced errors leading to service disruption
  • Disclosure of sensitive information stored in the database (e.g., user accounts, schedules, or exam details)
  • Unauthorized modification or deletion of records, potentially corrupting timetables and subject data
  • Creation of new application-level accounts or escalation of privileges through manipulated data
  • Potential execution of administrative database operations if the application's DB user has elevated rights
  • Indirect impact on availability through data corruption or forced errors leading to service disruption

General mitigation guidance

Risk reduction for this class of vulnerability generally centers on strong input handling and safe database access patterns:

  • Use parameterized queries or prepared statements for all database interactions, ensuring that user input is treated strictly as data
  • Apply strict server-side validation on ID and similar parameters (e.g., enforcing numeric types, length limits, and allowed patterns)
  • Centralize database access logic in a data access layer that enforces safe query construction by default
  • Limit database privileges for the application account to only the operations and tables it requires
  • Introduce defense-in-depth measures such as web application firewalls (WAFs) configured to detect common SQL injection patterns

Risk reduction for this class of vulnerability generally centers on strong input handling and safe database access patterns:

  • Use parameterized queries or prepared statements for all database interactions, ensuring that user input is treated strictly as data
  • Apply strict server-side validation on ID and similar parameters (e.g., enforcing numeric types, length limits, and allowed patterns)
  • Centralize database access logic in a data access layer that enforces safe query construction by default
  • Limit database privileges for the application account to only the operations and tables it requires
  • Introduce defense-in-depth measures such as web application firewalls (WAFs) configured to detect common SQL injection patterns

How teams detect issues like this

Organizations can detect and monitor this issue using a combination of review and testing techniques:

  • Static analysis: Scan source code for string-concatenated SQL queries and direct interpolation of request parameters into query strings
  • Code review: Flag any use of raw $_GET/$_POST values (or equivalents) in SQL contexts, and confirm consistent use of prepared statements
  • Dynamic testing: Use security testing tools or manual penetration testing to submit crafted payloads in the ID parameter and observe database error messages or anomalous responses
  • Runtime monitoring: Enable database and application logging to identify unusual query patterns, especially those containing tautologies, UNION operations, or stacked statements

Organizations can detect and monitor this issue using a combination of review and testing techniques:

  • Static analysis: Scan source code for string-concatenated SQL queries and direct interpolation of request parameters into query strings
  • Code review: Flag any use of raw $_GET/$_POST values (or equivalents) in SQL contexts, and confirm consistent use of prepared statements
  • Dynamic testing: Use security testing tools or manual penetration testing to submit crafted payloads in the ID parameter and observe database error messages or anomalous responses
  • Runtime monitoring: Enable database and application logging to identify unusual query patterns, especially those containing tautologies, UNION operations, or stacked statements

Sources

SourceLink
github.comgithub.com/fichterclapsaddle879-rgb/MyCve/issues/2
vuldb.comvuldb.com/cve/CVE-2026-16227
vuldb.comvuldb.com/submit/858246
vuldb.comvuldb.com/vuln/380049
vuldb.comvuldb.com/vuln/380049/cti
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. As long as the /edit_subject.php endpoint is reachable over the network, an attacker can exploit the vulnerability by sending crafted HTTP requests.

Not necessarily. Exploitation depends on how access to /edit_subject.php is controlled in a given deployment. If the endpoint is publicly reachable or accessible with low-privilege access, an attacker can attempt injection without administrative credentials.

The most robust fix is to refactor database interactions to use parameterized queries or prepared statements everywhere, removing all string concatenation of user input in SQL, and enforcing strict validation on parameters such as ID.

Adopt a secure coding standard that mandates prepared statements by default, encapsulate database access in well-reviewed helper functions or ORMs, perform regular security-focused code reviews and automated scans, and ensure developers are trained to treat all external input as untrusted data.

Yes. As long as the /edit_subject.php endpoint is reachable over the network, an attacker can exploit the vulnerability by sending crafted HTTP requests.

Not necessarily. Exploitation depends on how access to /edit_subject.php is controlled in a given deployment. If the endpoint is publicly reachable or accessible with low-privilege access, an attacker can attempt injection without administrative credentials.

The most robust fix is to refactor database interactions to use parameterized queries or prepared statements everywhere, removing all string concatenation of user input in SQL, and enforcing strict validation on parameters such as ID.

Adopt a secure coding standard that mandates prepared statements by default, encapsulate database access in well-reviewed helper functions or ORMs, perform regular security-focused code reviews and automated scans, and ensure developers are trained to treat all external input as untrusted data.

Find out what's already
exploitable in your codebase.