CVE-2025-29744
BaseFortify
Publication date: 2025-06-12
Last updated on: 2025-07-02
Assigner: MITRE
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| vitaly-t | pg-promise | to 11.5.5 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-89 | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2025-29744 is a SQL Injection vulnerability in the pg-promise library before version 11.5.5. It occurs due to improper handling of negative numeric parameters in simple query mode with PostgreSQL. When a numeric placeholder is immediately preceded by a minus sign and the parameter is a negative number, the resulting query contains two consecutive minus signs (e.g., '--42'), which PostgreSQL interprets as the start of a comment. This causes part of the query to be ignored, allowing an attacker to inject malicious SQL code by controlling both the negative number and a string parameter on the same query line. This breaks the security assumption of parameterized queries and enables execution of arbitrary SQL statements. [1]
How can this vulnerability impact me? :
This vulnerability allows an attacker to execute arbitrary SQL statements on the database using pg-promise. It can lead to unauthorized data extraction, modification, or deletion. Because PostgreSQL supports stacked queries by default, attackers can inject multiple SQL statements, potentially compromising sensitive data or the integrity of the database. Even if stacked queries are disabled, attackers can still manipulate queries to extract data, making this a serious security risk. [1]
How can this vulnerability be detected on my network or system? Can you suggest some commands?
Detection involves identifying usage of vulnerable pg-promise versions (before 11.5.5) and queries where numeric placeholders are immediately preceded by a minus sign (e.g., `result = -$1`). You can audit your application code for such query patterns. Additionally, monitoring database logs for suspicious queries containing double minus signs (`--`) followed by unusual SQL fragments or unexpected comments may help. There are no specific commands provided, but reviewing queries like `SELECT * FROM example WHERE result = -$1 OR name = $2;` with attacker-controlled parameters could indicate vulnerability. [1]
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include upgrading pg-promise to version 11.5.5 or later, where the issue is fixed by wrapping negative numbers in parentheses to prevent `--` comment sequences. Alternatively, you can modify your queries to insert spaces before negative numbers or always wrap negative integers in parentheses manually to avoid the vulnerability. [1]