Severity:

HIGH RISK

(7.3)

SQL Injection in Online Reviewer System btn_functions.php

CVE-2026-2220

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Unauthorized Database Access and 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

Online Reviewer System 1.0 contains a SQL injection vulnerability in the assessments pretest handler, where the difficulty_id parameter is concatenated into database queries without proper sanitization.

A remote attacker can send crafted HTTP requests to manipulate the underlying SQL query, which may lead to unauthorized data access, modification, or other database abuse under typical configurations.

Affected context

The vulnerability occurs in the Online Reviewer System 1.0 within the administrative assessments pretest workflow, specifically in /system/system/admins/assessments/pretest/btn_functions.php.

It is exposed when user-controlled data from the difficulty_id argument is incorporated into SQL statements without adequate validation, encoding, or use of parameterized queries.

Any deployment that routes web requests to this script and relies on a relational database backend can be affected, depending on authentication and access controls around the endpoint.

Exploit preconditions

  • Attack surface: HTTP requests targeting /system/system/admins/assessments/pretest/btn_functions.php.
  • Required access: Ability to interact with the application endpoint that accepts the difficulty_id parameter (authentication requirements depend on the specific deployment and configuration).
  • Trigger point: Submission of a crafted difficulty_id value that alters the intended SQL query structure when processed by the PHP code.
  • Why exploitation is possible: The application builds SQL statements by directly embedding difficulty_id into the query text without strict type enforcement, escaping, or prepared statements, allowing control over query logic.

Why this happens

This issue stems from constructing SQL queries using string concatenation of user-supplied input.

When the difficulty_id parameter is trusted and interpolated into the SQL statement without parameter binding or context-appropriate escaping, it enables injection of additional SQL tokens and clauses.

This matches CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and also relates to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, as the database acts as a downstream interpreter of tainted data.

Potential impact

  • Extraction of sensitive data from database tables, including user records or assessment content
  • Modification or deletion of assessment data, questions, or user-related information
  • Bypassing of application-level authorization checks enforced via database queries
  • Potential creation of new administrative or privileged accounts within the system data
  • In some environments, possible execution of database-specific commands that could impact availability or integrity

General mitigation guidance

Effective mitigation focuses on systematically removing direct string concatenation of user input in SQL construction and reducing trust in all external parameters:

  • Use parameterized queries or prepared statements for all database access paths, ensuring difficulty_id is bound as a typed parameter, not interpolated into the query string.
  • Apply strict server-side validation of difficulty_id, such as enforcing numeric types and allowable ranges before it reaches any database layer.
  • Centralize database access through a data access layer that enforces safe query patterns by default, discouraging ad-hoc query building in controller or view code.
  • Limit database privileges of the application account to the minimum needed, so that even successful injections have reduced impact.
  • Adopt secure coding standards and code review checklists that explicitly prohibit dynamic SQL built from raw request parameters.

How teams detect issues like this

Organizations can detect and monitor for this vulnerability using a mix of development-time and runtime approaches:

  • Static application security testing (SAST) configured to flag SQL construction that concatenates user input, especially around difficulty_id and other request parameters.
  • Code review practices that look for direct interpolation of $_GET, $_POST, or other request variables into SQL strings in PHP scripts like btn_functions.php.
  • Security-focused linters or custom rules that enforce the use of prepared statements and parameter binding within the database abstraction layer.
  • Web application firewall (WAF) policies tuned to detect and alert on common SQL injection patterns in requests targeting assessment-related endpoints.
  • Runtime logging and anomaly detection on database queries to identify unusual query patterns or payloads indicative of injection attempts.

Sources

SourceLink
code-projects.orgcode-projects.org/
github.comgithub.com/tiancesec/CVE/issues/20
vuldb.comvuldb.com/?ctiid.344937
vuldb.comvuldb.com/?id.344937
vuldb.comvuldb.com/?submit.750020

Frequently asked

questions

Yes. The vulnerable parameter is exposed via web requests, so an attacker can exploit it remotely by sending crafted HTTP requests, subject to whatever authentication or access control is enforced around the endpoint.

The attacker needs the ability to reach and interact with the affected script that processes difficulty_id. In some deployments this may require authenticated access to administrative or instructor interfaces; in others it may be reachable with lower or no authentication, depending on configuration.

The most robust fix is to refactor all affected queries to use prepared statements with bound parameters, combined with strict validation of difficulty_id as a constrained, expected type (for example, an integer within a known range). Removing all dynamic SQL concatenation of user input is key.

Establish a standard data access layer that only exposes parameterized query APIs, enforce secure coding guidelines that forbid direct string-based SQL construction from request data, and integrate automated security testing (SAST/DAST) and security-focused code reviews into the development lifecycle to catch unsafe patterns early.

Find out what's already
exploitable in your codebase.