CVE-2026-23892

Tick-Tock-Pwn: Timing Side-Channels in OctoPrint

Alon Barad
Alon Barad
Software Engineer

Jan 27, 2026·5 min read·5 visits

Executive Summary (TL;DR)

OctoPrint versions up to 1.11.5 used standard string comparison for API keys. This optimization leaks information about how much of the key is correct based on response time. An attacker on the LAN can exploit this to brute-force the API key and take full control of the printer.

A classic timing side-channel vulnerability in OctoPrint allows attackers on the local network to guess API keys character-by-character by measuring how long the server takes to say 'no'.

The Hook: Listening to the Tumblers

In the world of physical security, the quintessential image of a safecracker is a shadowy figure pressing a stethoscope against a cold steel door, listening for the faint click of a tumbler falling into place. In the digital world, we don't listen for clicks; we watch the clock.

OctoPrint, the beloved brain behind thousands of consumer 3D printers, recently found itself playing the role of that safe. CVE-2026-23892 isn't a buffer overflow or a SQL injection. It's a timing side-channel—a vulnerability that exists not because the logic is wrong, but because the code is too efficient for its own good.

By measuring the infinitesimal delay between sending a request and receiving a 403 Forbidden response, an attacker can reconstruct a valid API key one byte at a time. It’s the digital equivalent of guessing a password and having the guard hesitate slightly longer when you get the first letter right.

The Flaw: When Efficiency Is a Bug

The root cause here is a fundamental concept in computer science: optimization. When you compare two strings in most high-level languages (like Python), the runtime wants to give you an answer as fast as possible. This is called fail-fast or short-circuit logic.

Here is how a standard string comparison (==) works under the hood:

  1. Are the strings the same length? If no, return False immediately.
  2. Is the first character identical? If no, return False immediately.
  3. Is the second character identical? If no, return False immediately.

Do you see the problem? If the correct API key is SECRET, and I guess AAAAAA, the system checks S vs A, sees a mismatch, and rejects me instantly.

But if I guess SAAAAA, the system checks S vs S (match), moves to the next character, checks E vs A (mismatch), and then rejects me. That second check takes a few nanoseconds longer. In the vulnerable OctoPrint versions, this tiny discrepancy was measurable over a low-latency network (LAN).

The Code: The Smoking Gun

The vulnerability lived in src/octoprint/access/users.py. The developers were using Python's standard equality operator to validate sensitive credentials. It looked something like this:

# The Vulnerable Logic
if apikey == user._apikey:
    return user

It looks innocent, right? That's why these bugs are insidious. To fix it, you have to stop thinking like a developer optimizing for speed and start thinking like a cryptographer optimizing for constant time.

In patch 249fd80ab01bc4b7dabedff768230a0fb5d01a8c, the OctoPrint team switched to hmac.compare_digest. This function is designed to take the exact same amount of time to return False, regardless of whether the mismatch happens at the first character or the last.

# The Fix
import hmac
 
# ... inside the validation loop
if hmac.compare_digest(apikey, user._apikey):
    return user

> [!NOTE] > Comedy of Errors: The initial fix actually introduced a regression. hmac.compare_digest throws a fit if you feed it None. Since some users might not have generated an API key yet (user._apikey is None), the server started crashing. They had to push a follow-up commit (0bd35ddcf316668f9ba5335afbb4c07b4b2ad408) to handle null checks explicitly before the timing-safe comparison.

The Exploit: Statistical Witchcraft

Exploiting this isn't as simple as firing up a script and waiting 5 seconds. We are dealing with nanoseconds here. Network jitter, OS context switching, and background noise on the Raspberry Pi running OctoPrint will all drown out the signal.

To exploit this, we need statistics.

  1. Setup: The attacker sits on the same LAN (Wi-Fi or Ethernet) as the OctoPrint instance.
  2. The Guess: We want to guess the first character. We send 1,000 requests with the API key A..., 1,000 with B..., and so on.
  3. Filtering: We take the response times for each character, discard the outliers (spikes caused by network lag), and calculate the average response time.
  4. The Spike: If O... has a statistically significant higher average response time than the rest, we know O is the first character.
  5. Rinse and Repeat: Now we guess OA..., OB..., OC....

This is why the CVSS complexity is High (AC:H). You can't do this easily over the public internet (WAN) because the variance in internet routing latency is massive compared to the tiny CPU difference we are trying to measure. But on a quiet home network? It's open season.

The Impact: Printing Doom

So you spent hours brute-forcing an API key. What do you get?

Total Administrative Control.

With a valid API key, you bypass the login screen entirely. You can:

  • Upload G-code: Print unauthorized objects (or just a solid block to waste filament).
  • Webcam Access: Spy on the user's home or workshop.
  • Thermal Hazards: While firmware usually has thermal runaway protection, an attacker could manipulate temperature presets or cancel prints midway, potentially causing hardware damage or creating a fire hazard if the physical safety measures fail.

It transforms a helpful IoT device into a spy cam and a potential arsonist.

The Fix: Constant Time or Bust

If you are running OctoPrint, update to 1.11.6 immediately. This version implements hmac.compare_digest() across the board for API key validation.

For Developers: Take note. Never use == for secrets, tokens, or hashes. If the value is sensitive, use a constant-time comparison function. In Python, that's hmac.compare_digest(). In PHP, it's hash_equals(). In Go, subtle.ConstantTimeCompare().

For Users: Treat your 3D printer like a server. Don't expose it to the internet without a VPN or a reverse proxy like Authelia. Even if the code is perfect, you don't want the entire internet knocking on your printer's front door.

Fix Analysis (2)

Technical Appendix

CVSS Score
6.0/ 10
CVSS:4.0/AV:A/AC:H/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Affected Systems

OctoPrint <= 1.11.5

Affected Versions Detail

Product
Affected Versions
Fixed Version
OctoPrint
OctoPrint
<= 1.11.51.11.6
AttributeDetail
CWECWE-208 (Observable Timing Discrepancy)
CVSS v4.06.0 (Medium)
Attack VectorAdjacent (LAN)
Attack ComplexityHigh (Requires statistical analysis)
ImpactHigh (API Key Extraction)
Exploit StatusTheoretical / PoC Feasible
CWE-208
Observable Timing Discrepancy

The product performs a comparison that takes a variable amount of time depending on how many characters match, allowing an attacker to guess the value via timing discrepancies.

Vulnerability Timeline

Internal bugfix preparation begins
2025-12-01
Primary fix commit authored
2026-01-05
OctoPrint 1.11.6 Released / CVE Published
2026-01-27

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.