vLLM, Timing Attack on API Key, CVE-2024-53500 (Critical)

Listen to this Post

The vulnerability (CVE-2024-53500) in vLLM’s OpenAI-compatible API server stems from a non-constant-time string comparison used for API key validation. The function `_validate_api_key` compared the provided key with the valid one using a standard `==` operator in Python. This operation compares strings character-by-character and stops at the first mismatch. Consequently, an attacker can perform a timing attack by sending numerous requests with carefully crafted keys. When the attacker guesses the first character correctly, the comparison takes a fraction of a microsecond longer because it proceeds to check the second character. By analyzing the response times across many requests, an attacker can iteratively determine each character of the API key. This method drastically reduces the number of attempts needed to discover the full key from a brute-force scenario (e.g., 62^N) to a linear problem (e.g., 62N), making it feasible to extract long API keys.
Platform: vLLM
Version: < 0.4.2

Vulnerability : Timing Attack

Severity: Critical

date: 2024-11-25

Prediction: 2024-12-16

What Undercode Say:

Simulating timing measurement for a single character
for char in {a..z} {A..Z} {0..9}; do
key_attempt="a${char}xxxxxx"
start=$(date +%s%N)
curl -H "Authorization: Bearer $key_attempt" https://vllm-server/v1/models
end=$(date +%s%N)
echo $((end-start)) >> timings.log
done
Conceptual code showing vulnerable comparison
def _validate_api_key(request_api_key, valid_key):
Vulnerable comparison
return request_api_key == valid_key

How Exploit:

Measure response times.

Correlate longer delays.

Iteratively reconstruct key.

Protection from this CVE

Use `secrets.compare_digest`.

Upgrade to vLLM >=0.4.2.

Implement external API gateway.

Impact:

Authentication Bypass

API Key Discovery

Unauthorized Model Access

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

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