Miggo Logo

CVE-2025-58450: pREST has a Systemic SQL Injection Vulnerability

N/A

CVSS Score

Basic Information

EPSS Score
-
Published
9/8/2025
Updated
9/8/2025
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/prest/prest/v2go< 2.0.0-rc2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is a systemic SQL injection issue within the pREST application, affecting multiple code paths where SQL queries are dynamically constructed using user-provided input. The analysis of the provided patch confirms several vulnerable functions and the remediation strategies applied.

The root cause is the use of fmt.Sprintf and text/template to build SQL queries by concatenating or substituting unvalidated and unsanitized user input. This allows an attacker to inject arbitrary SQL code.

The provided commit 47d02b87842900f77d76fc694d9aa7e983b0711c addresses these issues in several key functions:

  1. ReturningByRequest: The _returning parameter was directly concatenated. The fix involves validating it as an identifier and then properly quoting it.
  2. JoinByRequest: The join type was taken directly from user input. The fix is to use a whitelist of allowed join types.
  3. GroupByClause: The HAVING clause value was not sanitized. The fix adds logic to differentiate between numeric and string values, and to escape single quotes in strings.
  4. ParseScript: SQL templates were rendered with user data without escaping. The fix moves towards parameterized queries by introducing new template functions that separate the query structure from the user-provided values.

These changes indicate that any runtime profile during exploitation would likely show these functions in the stack trace, as they are responsible for processing the malicious input and constructing the vulnerable SQL queries. The identified functions are the points where the application fails to properly neutralize special elements used in an SQL command.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

# Summ*ry pR*ST provi**s * simpl* w*y *or us*rs to *xpos* ****ss t**ir **t***s* vi* * R*ST-*ull *PI. T** proj**t is impl*m*nt** usin* t** *o pro*r*mmin* l*n*u*** *n* is **si*n** to *xpos* ****ss to Post*r*s **t***s* t**l*s. *urin* *n in**p*n**nt r*v

Reasoning

T** vuln*r**ility is * syst*mi* SQL inj**tion issu* wit*in t** pR*ST *ppli**tion, *****tin* multipl* *o** p*t*s w**r* SQL qu*ri*s *r* *yn*mi**lly *onstru*t** usin* us*r-provi*** input. T** *n*lysis o* t** provi*** p*t** *on*irms s*v*r*l vuln*r**l* *u