/

CVE-2025-65135

Severity:

CRITICAL RISK

(9.8)

SQL Injection in School Management System Report Filter

CVE-2025-65135

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Compromise and Data Exfiltration

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

A time-based blind SQL injection vulnerability in the School-management-system 1.0 allows attacker-controlled input from the fromdate POST parameter to be embedded into SQL queries without proper sanitization.

When an attacker can send crafted requests to the /studentms/admin/between-date-reprtsdetails.php endpoint, they may infer database content and manipulate queries by measuring response delays, even without direct error messages.

Affected context

The vulnerability occurs in the admin reporting functionality of the School-management-system 1.0 application, specifically in the /studentms/admin/between-date-reprtsdetails.php script.

It is exposed when the application:

  • Accepts fromdate as a POST parameter to filter data between dates
  • Incorporates this value into SQL statements without parameterization or robust validation
  • Executes the resulting query on a relational database handling student or administrative data

The issue is most relevant in deployments where the admin panel is reachable over the network and database accounts have broad read or write privileges.

Exploit preconditions

  • Attack surface: HTTP POST requests to /studentms/admin/between-date-reprtsdetails.php
  • Required access: Ability to send requests to the admin report endpoint (e.g., authenticated admin session or exposed endpoint with weak access controls)
  • Trigger point: Submission of the fromdate POST parameter containing crafted SQL fragments or time-delay functions
  • Why exploitation is possible: The application constructs SQL queries by concatenating the fromdate value directly into the query string, allowing attackers to influence query logic and use time-based operations to infer data without visible errors.

Why this happens

The underlying bug is a classic SQL injection pattern where user-supplied input is concatenated into SQL text without using bound parameters or safe query builders.

In the affected script, the fromdate POST parameter is treated as trusted and interpolated into a date filter clause, which maps directly to CWE-89: Improper Neutralization of Special Elements Used in an SQL Command ('SQL Injection').

Because the database engine interprets the combined string as executable SQL, attackers can append conditions that introduce artificial delays (such as database-specific sleep or benchmark functions), enabling time-based blind inference of database structure and contents even when errors are suppressed.

Potential impact

  • Extraction of sensitive student, staff, or administrative records from the database
  • Enumeration of database schema, including table names, columns, and user accounts
  • Modification or deletion of records, potentially impacting grades, attendance, or financial data
  • Use of the database connection as a pivot to access other application data or features
  • In some configurations, potential execution of database-level procedures that could affect underlying systems

General mitigation guidance

Effective mitigation focuses on eliminating direct string concatenation in SQL and reducing the trust placed in incoming request data:

  • Use parameterized queries or prepared statements for all database access, especially where user input influences WHERE, ORDER BY, or LIMIT clauses.
  • Apply strict server-side validation for date fields, ensuring inputs conform to expected formats and rejecting unexpected characters or patterns.
  • Centralize data access through a database abstraction layer or ORM that defaults to binding parameters rather than constructing raw SQL.
  • Apply least-privilege principles to database accounts used by the application, limiting them to only the operations and tables required by the reporting functionality.
  • Consider implementing application-level query-building utilities that make unsafe concatenation harder than using safe APIs.

How teams detect issues like this

Detection generally combines code-level analysis with runtime monitoring:

  • Static analysis: Scan the codebase for SQL query construction using string concatenation, especially where variables like $_POST['fromdate'] are inserted directly into query strings without binding.
  • Code review: Manually review report-generating scripts and admin endpoints for:
  • Raw database calls built from request parameters
  • Missing input validation on date or filter fields
  • Inconsistent use of prepared statements across similar code paths
  • Dynamic testing: Use automated security testing tools or manual penetration testing to send crafted fromdate values and measure response times for evidence of time-based behavior.
  • Policy enforcement: Introduce development policies or pre-commit hooks that flag usage of low-level query APIs without parameter binding, encouraging the use of safer database access patterns.

Sources

SourceLink
github.comgithub.com/TREXNEGRO/Security-Advisories/tree/main/CVE-2025-65135
github.comgithub.com/TREXNEGRO/Security-Advisories/blob/main/CVE-2025-65135/poc.md

Frequently asked

questions

Yes, if the /studentms/admin/between-date-reprtsdetails.php endpoint is accessible over the network and an attacker can reach it (for example, via a compromised or weak admin account), the SQL injection can be exploited remotely using crafted HTTP POST requests.

In many deployments, access to admin reporting pages is expected to require authentication.

However, if access control is weak, misconfigured, or bypassed, an unauthenticated attacker might still reach the vulnerable endpoint.

The key requirement is the ability to send POST requests to the affected script.

The most robust fix is to refactor all affected queries to use parameterized statements or prepared queries and to enforce strict validation for inputs like dates.

Removing direct string concatenation and centralizing database access through safe APIs significantly reduces the risk of SQL injection.

Adopting secure coding practices and automated checks is critical:

  • Mandate prepared statements for all database interactions.
  • Use validation layers to enforce type and format constraints on all request parameters.
  • Integrate static analysis and security testing into the development pipeline to catch unsafe query construction early.
  • Provide developers with secure coding guidelines and examples for common patterns like report filters and search forms.
Find out what's already
exploitable in your codebase.