/

CVE-2026-25241

Severity:

CRITICAL RISK

(9.8)

SQL Injection in PEAR <version> Endpoint

CVE-2026-25241

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Remote Database Compromise

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 critical SQL injection vulnerability in the PEAR framework's /get/<package>/<version> endpoint allows unauthenticated remote attackers to inject arbitrary SQL through a crafted package version string.

When the vulnerable endpoint processes attacker-controlled version values without proper sanitization, it can lead to arbitrary query manipulation against the backend database, enabling data exposure, modification, or full compromise of the PEAR service's data layer.

Affected context

The vulnerability affects PEAR deployments that expose the /get/<package>/<version> endpoint and rely on a backend SQL database to serve package metadata or artifacts.

It manifests when the endpoint passes the version path parameter directly into SQL queries without robust parameterization or filtering.

Any publicly reachable PEAR instance using a vulnerable PEAR version and a relational database backend may be at risk if network controls do not restrict access to this endpoint.

Exploit preconditions

  • Attack surface: Public HTTP(S) interface exposing /get/<package>/<version>
  • Required access: None; the vulnerability is exploitable without authentication
  • Input vector: The <version> component in the URL path, which the server interprets as part of a database query
  • Trigger point: Server-side logic that builds and executes SQL queries using the supplied version string
  • Why exploitation is possible: The version parameter is concatenated or interpolated into SQL statements without using safe query parameterization or strict validation, allowing attacker-controlled SQL syntax to be executed by the database engine.

Why this happens

This issue stems from constructing SQL statements using untrusted input taken directly from the URL path without proper binding or sanitization.

Instead of using prepared statements with parameter placeholders, the vulnerable code likely interpolates the version value into the query string, enabling attackers to break out of intended query structure and append arbitrary SQL.

Conceptually, this maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where control characters and SQL operators from user input are not neutralized before query execution.

Potential impact

  • Attackers may read sensitive data from the PEAR database, including package metadata or associated user information.
  • Database contents could be modified, corrupted, or deleted, impacting package integrity and availability.
  • An attacker could create or alter records to distribute malicious or tampered packages via the PEAR infrastructure.
  • Under certain database configurations, SQL injection may be leveraged to execute OS-level commands or pivot to other internal systems.
  • The overall integrity of the package distribution supply chain can be undermined, affecting downstream users of PEAR-hosted components.

General mitigation guidance

Effective mitigation focuses on eliminating direct use of untrusted data in SQL query construction and constraining how version identifiers are handled:

  • Use parameterized queries or prepared statements for all database interactions involving user- or path-supplied data, including package names and versions.
  • Normalize and validate version strings against a strict whitelist pattern (for example, semantic version formats) before they are used in any query.
  • Apply a data access layer or ORM that discourages raw query concatenation and enforces safe binding practices by default.
  • Implement least-privilege database accounts so that the application's DB user has only the minimal permissions required (e.g., read-only for public endpoints where feasible).
  • Separate read and write operations and restrict write capabilities from publicly exposed read endpoints to limit impact if an injection flaw occurs.

How teams detect issues like this

Detection efforts can combine code-level analysis with runtime monitoring:

  • Use static analysis tools or linters configured with rules to flag dynamic SQL construction, string concatenation in query contexts, and direct interpolation of request parameters into SQL.
  • During code review, look for endpoints that use URL path segments or query parameters directly in SQL statements, especially in download or metadata retrieval routes like /get/<package>/<version>.
  • Implement defensive logging and monitoring for anomalous SQL patterns, such as unexpected use of logical operators, UNION, subqueries, or comment markers originating from requests to the /get/ endpoint.
  • Integrate Web Application Firewall (WAF) rules to detect and block common SQL injection payload patterns in the version component of the URL.
  • Employ regression tests and security test suites that explicitly attempt SQL injection via all externally supplied parameters, including path segments.

Sources

SourceLink
github.comgithub.com/pear/pearweb/security/advisories/GHSA-63fv-vpq5-gv8p

Frequently asked

questions

Yes. If the PEAR instance is exposed over the internet or any untrusted network, remote attackers can exploit the vulnerability by sending crafted HTTP requests to the /get/<package>/<version> endpoint.

No. The vulnerability is described as unauthenticated, meaning no prior login or valid account is required. Any party that can reach the endpoint can attempt exploitation.

The most robust fix pattern is to replace any dynamically constructed SQL strings with prepared statements that use bound parameters for all inputs, coupled with strict validation of route parameters like version strings against known-safe formats. Avoid concatenating or interpolating raw request data directly into SQL under all circumstances.

Establish coding standards that mandate parameterized database access, introduce a shared data access layer that abstracts raw SQL construction, and enforce automated checks in CI/CD pipelines to detect dynamic query construction. Complement this with regular security reviews, threat modeling for new endpoints, and targeted tests that attempt injection through every externally influenced parameter, including URL paths.

Find out what's already
exploitable in your codebase.