postgres-protocol, Unbounded SCRAM Iteration Count DoS, RUSTSEC-2026-0179 (High) -DC-Aug2026-1845

Listen to this Post

A critical vulnerability has been identified in the Rust `postgres-protocol` crate, which is used by popular PostgreSQL clients like `tokio-postgres` and rust-postgres. The flaw resides in the SASL SCRAM-SHA-256 authentication handshake, specifically in how the client processes the server’s advertised PBKDF2 iteration count (i value) during the server-first-message.
During SCRAM authentication, the server sends a message containing a salt and an iteration count. The client must then perform PBKDF2 key derivation using these parameters. In vulnerable versions, the `postgres-protocol` crate does not impose any upper bound on this iteration count. A malicious, compromised, or man-in-the-middle (MITM) server can exploit this by sending an arbitrarily large number, such as billions or even trillions. The client library then executes the PBKDF2-SHA-256 computation inline, with this extreme iteration count, on a `tokio` worker thread.
For each connection attempt, this causes the worker thread to be pinned for minutes at a time, performing intensive CPU-bound cryptographic hashing. Because tokio‘s runtime relies on a limited number of worker threads to handle all asynchronous tasks, a single malicious connection can stall the entire async runtime, leading to a complete denial of service for the application. This vulnerability is particularly dangerous for applications that connect to untrusted or user-supplied databases, or where the network connection can be intercepted. The issue is acknowledged as a high-severity flaw with a CVSS v4 score of 8.7.

DailyCVE Form:

Platform: Rust (postgres-protocol)
Version: 0.3.0 – 0.6.12
Vulnerability: CPU-exhaustion DoS
Severity: High (8.7)
date: 2026-06-12

Prediction: 2026-06-12

What Undercode Say:

Under this heading, we provide analytical data, bash commands, and code snippets relevant to the blog .

Analytics (Vulnerable Code Analysis):

The vulnerable code path is in the `ScramSha256::update` function within the `sasl.rs` file. The library parses the `i` value from the server message and passes it directly to the PBKDF2 function without validation.

Bash Command to Check Installed Version:

cargo tree | grep postgres-protocol

Code Snippet of the Vulnerability (Educational Purposes!):

The following pseudocode illustrates the vulnerable logic:

// In postgres-protocol/src/authentication/sasl.rs (Vulnerable)
fn handle_server_first_message(&mut self, data: &[bash]) {
let iterations = parse_iterations(data); // No upper bound check
let salt = parse_salt(data);
// Inline, blocking PBKDF2 computation on the tokio worker thread
let salted_password = pbkdf2_sha256(password, salt, iterations);
// ...
}

How Exploit: (Educational Purposes!)

An attacker can exploit this vulnerability by setting up a rogue PostgreSQL server or performing a MITM attack.
1. Prerequisites: The attacker must be able to control the `server-first-message` sent to the client. This can be achieved by:

Running a malicious PostgreSQL server.

Compromising a legitimate server.

Performing a man-in-the-middle (MITM) attack on the network connection.
2. Crafting the Malicious Message: During the SCRAM authentication handshake, the server constructs the server-first-message. The attacker modifies this message to include an extremely high value for the iteration count (i), for example, `i=2147483647` (INT_MAX) or higher.
3. Launching the Attack: The attacker establishes a connection to the target client application using the malicious server. The client, using a vulnerable version of postgres-protocol, receives the message and begins the PBKDF2 computation.
4. Denial of Service: The client’s `tokio` worker thread becomes occupied with the CPU-intensive hashing for an extended period (minutes per connection). By opening multiple such connections, the attacker can exhaust all worker threads, causing the entire async runtime to stall and making the application unresponsive.

Protection: from this CVE

To protect against this vulnerability, the following measures should be taken:
1. Upgrade Immediately: The primary and most effective mitigation is to upgrade the `postgres-protocol` crate to version 0.6.12 or later. This version introduces a hard cap on the accepted SCRAM iteration count.
2. Verify the Fix: The fix implements a maximum iteration count of 100_000, which is approximately 24 times the PostgreSQL default of 4096 and matches the cap adopted by the PostgreSQL JDBC driver (pgjdbc) for the same issue.
3. Apply Patches: For applications that cannot be immediately updated, consider backporting the patch from the official commit (d40097a36a85068ea50a3afbf0ce154ba439e7f0).
4. Network Security: As a defense-in-depth measure, ensure that connections to databases are made over a trusted network and use TLS encryption to prevent MITM attacks.

Impact

  • Confidentiality: None. This is a denial-of-service vulnerability and does not lead to data exposure.
  • Integrity: None. The attacker cannot modify data through this flaw.
  • Availability: High. A successful attack can completely stall the application’s async runtime, making it unresponsive to all requests. The attack is easy to execute remotely without authentication.
  • Scope: Applications written in Rust that use the `postgres-protocol` crate (e.g., via tokio-postgres, rust-postgres) and connect to untrusted or potentially malicious databases are affected. The vulnerability is also present in the PostgreSQL JDBC driver (pgjdbc), identified as CVE-2026-42198.

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top