CWE-208 Base Incomplete

Observable Timing Discrepancy

This vulnerability occurs when an application takes measurably different amounts of time to perform different operations, such as checking a password or processing a request. An attacker can observe…

Definition

What is CWE-208?

This vulnerability occurs when an application takes measurably different amounts of time to perform different operations, such as checking a password or processing a request. An attacker can observe these timing differences to learn sensitive information, like whether a username is valid or a cryptographic key guess is correct.
Timing discrepancies act as a side channel, leaking information through the back door of performance. Even tiny, millisecond differences in response times can be statistically analyzed by an attacker to map out internal application logic, bypassing intended security controls. This is especially dangerous in authentication, authorization, and cryptographic functions where a 'fast fail' for an incorrect input can reveal its validity. To exploit this, attackers don't need direct access to error messages or data—they simply measure how long operations take. For example, a string comparison that stops at the first mismatched character will return faster for a wrong password starting with an incorrect letter than for one starting with the correct letter. Over many requests, this allows an attacker to gradually infer secrets, piece by piece, by observing which operations take longer to complete.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-208

  • Java-oriented framework compares HMAC signatures using String.equals() instead of a constant-time algorithm, causing timing discrepancies

  • Smartphone OS uses comparison functions that are not in constant time, allowing side channels

  • Password-checking function in router terminates validation of a password entry when it encounters the first incorrect character, which allows remote attackers to obtain passwords via a brute-force attack that relies on timing differences in responses to incorrect password guesses, aka a timing side-channel attack.

  • SSL implementation does not perform a MAC computation if an incorrect block cipher padding is used, which causes an information leak (timing discrepancy) that may make it easier to launch cryptographic attacks that rely on distinguishing between padding and MAC verification errors, possibly leading to extraction of the original plaintext, aka the "Vaudenay timing attack."

  • Virtual machine allows malicious web site operators to determine the existence of files on the client by measuring delays in the execution of the getSystemResource method.

  • Product uses a shorter timeout for a non-existent user than a valid user, which makes it easier for remote attackers to guess usernames and conduct brute force password guessing.

  • Product immediately sends an error message when a user does not exist, which allows remote attackers to determine valid usernames via a timing attack.

  • FTP server responds in a different amount of time when a given username exists, which allows remote attackers to identify valid usernames by timing the server response.

Wie Angreifer es ausnutzen

Angreiferpfad Schritt für Schritt

  1. 1

    Consider an example hardware module that checks a user-provided password to grant access to a user. The user-provided password is compared against a golden value in a byte-by-byte manner.

  2. 2

    Since the code breaks on an incorrect entry of password, an attacker can guess the correct password for that byte-check iteration with few repeat attempts.

  3. 3

    To fix this weakness, either the comparison of the entire string should be done all at once, or the attacker is not given an indication whether pass or fail happened by allowing the comparison to run through all bits before the grant_access signal is set.

  4. 4

    In this example, the attacker observes how long an authentication takes when the user types in the correct password.

  5. 5

    When the attacker tries their own values, they can first try strings of various length. When they find a string of the right length, the computation will take a bit longer, because the for loop will run at least once. Additionally, with this code, the attacker can possibly learn one character of the password at a time, because when they guess the first character right, the computation will take longer than a wrong guesses. Such an attack can break even the most sophisticated password with a few hundred guesses.

Verwundbares Codebeispiel

Vulnerable Verilog

Consider an example hardware module that checks a user-provided password to grant access to a user. The user-provided password is compared against a golden value in a byte-by-byte manner.

Verwundbar Verilog
always_comb @ (posedge clk)

 begin

```
   assign check_pass[3:0] = 4'b0;
   for (i = 0; i < 4; i++) begin
  	 if (entered_pass[(i*8 - 1) : i] eq golden_pass([i*8 - 1) : i])
  		 assign check_pass[i] = 1;
  		 continue;
  	 else
  		 assign check_pass[i] = 0;
  		 break;
  	 end
   assign grant_access = (check_pass == 4'b1111) ? 1'b1: 1'b0;
 end
Sicheres Codebeispiel

Secure Verilog

To fix this weakness, either the comparison of the entire string should be done all at once, or the attacker is not given an indication whether pass or fail happened by allowing the comparison to run through all bits before the grant_access signal is set.

Sicher Verilog
always_comb @ (posedge clk)
 begin

```
   assign check_pass[3:0] = 4'b0;
   for (i = 0; i < 4; i++) begin
  	 if (entered_pass[(i*8 - 1) : i] eq golden_pass([i*8 -1) : i])
  		 assign check_pass[i] = 1;
  		 continue;
  	 else
  		 assign check_pass[i] = 0;
  		 continue;
  	 end
   assign grant_access = (check_pass == 4'b1111) ? 1'b1: 1'b0;
 end
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Präventions-Checkliste

How to prevent CWE-208

  • Architecture Use safe-by-default frameworks and APIs that prevent the unsafe pattern from being expressible.
  • Implementation Validate input at trust boundaries; use allowlists, not denylists.
  • Implementation Apply the principle of least privilege to credentials, file paths, and runtime permissions.
  • Testing Cover this weakness in CI: SAST rules + targeted unit tests for the data flow.
  • Operation Monitor logs for the runtime signals listed in the next section.
Erkennungssignale

How to detect CWE-208

SAST High

Führe statische Analyse (SAST) auf der Codebasis aus und suche im Datenfluss nach dem unsicheren Muster.

DAST Moderate

Führe dynamische Application-Security-Tests gegen den Live-Endpoint aus.

Runtime Moderate

Beobachte Runtime-Logs auf ungewöhnliche Exception-Traces, fehlerhafte Eingaben oder Versuche, Autorisierung zu umgehen.

Code review Moderate

Code Review: Markiere jeden neuen Code, der Eingaben von dieser Oberfläche ohne validierte Framework-Helper verarbeitet.

Plexicus Auto-Fix

Plexicus erkennt CWE-208 automatisch und öffnet in unter 60 Sekunden einen Fix-PR.

Codex Remedium scannt jeden Commit, identifiziert genau diese Schwachstelle und liefert einen reviewer-ready Pull Request mit dem Patch. Keine Tickets. Keine Hand-offs.

Häufig gestellte Fragen

Frequently asked questions

Was ist CWE-208?

This vulnerability occurs when an application takes measurably different amounts of time to perform different operations, such as checking a password or processing a request. An attacker can observe these timing differences to learn sensitive information, like whether a username is valid or a cryptographic key guess is correct.

Wie gravierend ist CWE-208?

MITRE hat für diese Schwachstelle keine Exploit-Wahrscheinlichkeit veröffentlicht. Behandle sie als mittlere Auswirkung, bis dein Threat Model anderes belegt.

Welche Sprachen oder Plattformen sind von CWE-208 betroffen?

MITRE hat für diese CWE keine betroffenen Plattformen spezifiziert — sie kann in den meisten Anwendungs-Stacks auftreten.

Wie kann ich CWE-208 verhindern?

Use safe-by-default frameworks, validate untrusted input at trust boundaries, and apply the principle of least privilege. Cover the data-flow signature in CI with SAST.

Wie erkennt und behebt Plexicus CWE-208?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-208 bei jedem Commit. Bei einem Treffer öffnet unser Codex-Remedium-Agent einen Fix-PR mit korrigiertem Code, Tests und einer einzeiligen Zusammenfassung für den Reviewer.

Wo erfahre ich mehr über CWE-208?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/208.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.

Verwandte Schwachstellen

Weaknesses related to CWE-208

CWE-203 Parent

Observable Discrepancy

This vulnerability occurs when an application responds differently to unauthorized users based on internal conditions. Attackers can…

CWE-1300 Sibling

Improper Protection of Physical Side Channels

This vulnerability occurs when a hardware device lacks adequate safeguards against physical side-channel attacks. Attackers can exploit…

CWE-1303 Sibling

Non-Transparent Sharing of Microarchitectural Resources

This vulnerability occurs when a processor's internal performance features, like caches and branch predictors, are unintentionally shared…

CWE-204 Sibling

Observable Response Discrepancy

This vulnerability occurs when an application responds differently to similar requests, unintentionally leaking details about its internal…

CWE-205 Sibling

Observable Behavioral Discrepancy

This vulnerability occurs when an application behaves differently in ways that unauthorized users can detect. These observable differences…

CWE-385 Kann vorausgehen

Covert Timing Channel

A covert timing channel is a security flaw where an attacker can deduce secret information by observing how long certain operations take…

CWE-327 Kann vorausgehen

Use of a Broken or Risky Cryptographic Algorithm

The software relies on a cryptographic algorithm or protocol that is either fundamentally flawed or considered too weak by modern security…

CWE-1254 Child

Incorrect Comparison Logic Granularity

This vulnerability occurs when a system compares sensitive data, like passwords or authentication tokens, piece-by-piece instead of as a…

Bereit, wenn du es bist

Schluss mit dem Bezahlen pro Entwickler.
Schließ den Kreislauf.

Plexicus ist die KI-native ASPM, die scannt, filtert, fixt, pentestet und erklärt — autonom. Unbegrenzte Entwickler, unbegrenzte Repos, Fair-Use-KI-Aktionen. Echter kostenloser Tarif, €269/mo jährlich, wenn du bereit bist.