/

CVE-2020-36951

Severity:

HIGH RISK

(8.2)

SQL Injection in Phpscript-sgh Admin Interface

CVE-2020-36951

Awaiting Analysis

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Confidentiality and Integrity Compromise of Backend Database

Severity:

HIGH RISK

(8.2)

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

Phpscript-sgh 0.1.0 contains a time-based blind SQL injection vulnerability in the admin interface via the id parameter, allowing attackers to influence backend database queries.

By abusing conditional time delays (e.g., sleep functions), an attacker can infer and extract sensitive data from the database without directly seeing query results.

Affected context

The vulnerability occurs within the administrative interface of Phpscript-sgh 0.1.0 where user-supplied input from the id parameter is incorporated into SQL statements.

It manifests when:

  • The admin interface is exposed over a network (e.g., internet or internal LAN),
  • The id parameter is processed without proper input validation or parameterization,
  • The backend database responds in a way that allows timing differences to be observed by the client.

The issue may affect any deployment where this admin endpoint is accessible and the database account has access to sensitive tables.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints in the admin interface that accept the id parameter.
  • Required access: Network access to the admin interface; in some deployments, this may require authentication, but misconfigurations can expose it more broadly.
  • Trigger point: Submission of crafted id values that alter SQL logic and introduce conditional delays (e.g., through sleep or heavy operations).
  • Why exploitation is possible: The application constructs SQL queries incorporating id directly (or through weak sanitization) into the query string, enabling attackers to inject additional SQL fragments that control timing behavior. The application behavior differs measurably based on whether a condition is true or false, leaking information despite not returning detailed error messages.

Why this happens

This vulnerability stems from constructing SQL queries using string concatenation or interpolation with untrusted data from the id parameter.

Rather than using parameterized queries or prepared statements, the application appears to directly embed the value into the WHERE clause or similar query components, which maps directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

In a time-based blind variant, the application does not reveal query results directly, but the injected SQL can still control database functions that introduce measurable delays, allowing the attacker to infer data bit by bit.

Potential impact

  • Extraction of sensitive information such as user records, credentials (e.g., password hashes), or configuration data from the database.
  • Enumeration of database schema, including table names, column names, and privilege structures.
  • Modification or deletion of data, potentially affecting application integrity and availability.
  • Escalation of privileges within the application if role or permission data can be manipulated.
  • Potential pivot to underlying infrastructure if the database account has elevated privileges (e.g., file access or stored procedure execution).

General mitigation guidance

Effective mitigation focuses on removing direct control of SQL syntax from user input and constraining database privileges:

  • Adopt parameterized queries / prepared statements for all database interactions, ensuring user input is passed as data, not query text.
  • Apply centralized input handling with strict type enforcement for identifiers like id (e.g., integer casting, whitelisting of allowed formats).
  • Introduce least-privilege database accounts, granting only the minimum required permissions for the admin interface.
  • Implement application-level validation and normalization for request parameters, rejecting inputs that do not conform to expected patterns.
  • Use secure-by-default ORM or query builder abstractions that discourage or prevent raw string concatenation for SQL.
  • Limit exposure of administrative endpoints through network segmentation, access control, and strong authentication to reduce the attack surface.

How teams detect issues like this

Detection typically combines code-centric and behavior-centric approaches:

  • Static code analysis: Search for SQL query construction using string concatenation or interpolation with request parameters (e.g., $_GET['id'], $_POST['id']) and lack of prepared statements.
  • Targeted code review: Inspect admin interface handlers for direct usage of the id parameter in SQL, focusing on areas where input validation is absent or inconsistent.
  • Dynamic application security testing (DAST): Use tools capable of timing-based probing to detect blind SQL injection, monitoring response delays to injected payloads.
  • Database monitoring: Employ query logging and anomaly detection to spot unusual patterns, such as frequent sleep function calls or syntactically odd queries.
  • Security policy enforcement: Integrate coding standards into CI/CD pipelines (e.g., required usage of parameterized queries, banned patterns for raw SQL assembly) and automatically flag violations.

Sources

SourceLink
github.comgithub.com/geraked/phpscript-sgh
exploit-db.comexploit-db.com/exploits/49192
vulncheck.comvulncheck.com/advisories/phpscript-sgh-time-based-blind-sql-injection

Frequently asked

questions

Yes, if the admin interface is reachable over a network and the vulnerable endpoint is accessible, an attacker can exploit it remotely via HTTP(S) requests, even without seeing direct SQL errors.

It depends on the deployment. In many cases, the admin interface is authenticated, which limits exposure, but misconfigurations or credential reuse can make it accessible to external attackers. The vulnerability exists regardless; access control only influences who can reach it.

Refactor the affected code to use parameterized queries or an ORM that binds parameters safely, enforce strict typing for the id parameter, and ensure the database account used by the admin interface operates with least privilege. Avoid any direct concatenation of user-controlled data into SQL strings.

Establish a project-wide standard mandating parameterized queries, adopt frameworks that make secure patterns the default, integrate static and dynamic security checks into CI/CD, and require security-focused code reviews for any changes involving database access or query construction.

Find out what's already
exploitable in your codebase.