CVE-2026-56871: Panic in github.com/lib/pq Due to Malformed Backend Frame Length

github.com/lib/pq Updated 18 Aug 2026

Summary

18/08/2026
No i
Unrated
Not published

CVE-2026-56871: Malformed backend frame length causes panic in github.com/lib/pq. Affects github.com/lib/pq versions >= 1.0.0. No fix is published. 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

The github.com/lib/pq package is a pure Go Postgres driver that provides a way for Go applications to interact with PostgreSQL databases. It is widely used for its simplicity and efficiency in handling database connections and queries. However, it is vulnerable to a specific issue where it improperly handles backend frame lengths, leading to potential runtime panics.

Vulnerability Detail

The vulnerability arises from the package's trust in the unsigned 32-bit length of every PostgreSQL backend frame. When the length is between zero and three, the package subtracts four without verifying that the length is at least four. This results in a negative payload length, which causes the recvMessage function to slice the connection scratch buffer with a negative bound. Consequently, this leads to an unrecovered runtime panic that terminates the calling goroutine and the entire process, potentially disrupting application functionality.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, ensure that your application validates the backend frame lengths before processing them. This can be done by implementing checks to ensure that the length is greater than or equal to four before proceeding with any operations that rely on the frame length.

Conclusion

The CVE-2026-56871 vulnerability in the github.com/lib/pq package poses a significant risk due to its potential to cause runtime panics. It is crucial for developers using this package to update to the latest version to mitigate the risk. Additionally, implementing validation checks can serve as a temporary workaround while transitioning to the patched version.

See every vulnerability recorded for github.com/lib/pq →

Share this vulnerability

FAQ

CVE-2026-56871 is a vulnerability in the github.com/lib/pq package that can cause a panic due to malformed backend frame lengths.

If your application uses the affected version of the github.com/lib/pq package, it may experience runtime panics, leading to crashes and disrupted functionality.

Yes, a patched version of the github.com/lib/pq package is available. Updating to the latest version will resolve the issue.

You can use Vulert, which monitors and alerts in real-time for open-source vulnerabilities in your software. It requires only the Gopkg.lock file for tracking.

Yes, you can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/lib/pq.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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