PostgreSQL Client Library Vulnerability: libpq Internal State Reset Flaw

postgresql Updated 02 Oct 2025

Summary

09/08/2018
N/A
Yes i
High
7.5

ALPINE-CVE-2018-10915: A vulnerability was found in libpq, the default PostgreSQL client library where libpq failed to properly reset its internal state between connections. Affects postgresql versions < 10.5-r0. Fixed in 10.5-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PostgreSQL is a powerful, open-source relational database system that uses and extends the SQL language. It is known for its robustness, extensibility, and support for advanced data types. The libpq library is the default client library for PostgreSQL, enabling applications to connect and interact with PostgreSQL databases. However, a vulnerability has been identified in libpq that affects its internal state management, potentially compromising connection security.

Vulnerability Detail

A vulnerability was discovered in the libpq client library where it fails to properly reset its internal state between connections. This flaw can be exploited if an affected version of libpq is used with 'host' or 'hostaddr' connection parameters derived from untrusted input. Attackers could bypass client-side connection security features, gain access to higher privileged connections, or execute SQL injection attacks by causing the PQescape() functions to malfunction. This vulnerability affects PostgreSQL versions prior to 10.5, 9.6.10, 9.5.14, 9.4.19, and 9.3.24.

How To Fix

Minimum fixed version

10.5-r0

This is the first release that contains the fix.

sudo apk add --upgrade postgresql

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid using untrusted input for 'host' or 'hostaddr' connection parameters. Implement strict input validation to ensure that only trusted sources are allowed to provide connection parameters.

Conclusion

In summary, a critical vulnerability in the libpq client library of PostgreSQL can lead to severe security risks if not addressed. Users are strongly advised to update to the latest patched versions and implement input validation as a temporary measure to mitigate risks.

See every vulnerability recorded for postgresql →

Share this vulnerability

FAQ

PostgreSQL versions prior to 10.5, 9.6.10, 9.5.14, 9.4.19, and 9.3.24 are affected by this vulnerability.

The vulnerability can lead to bypassing client-side connection security, unauthorized access to higher privileged connections, and possible SQL injection attacks.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The CVSS score of this vulnerability is 7.5, indicating a high severity level.

If immediate updates are not possible, ensure to validate all input for connection parameters and avoid using untrusted sources.

Related vulnerabilities

Recent vulnerabilities recorded for postgresql.

How To Fix

Minimum fixed version

10.5-r0

This is the first release that contains the fix.

sudo apk add --upgrade postgresql

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback