repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
timing-attacks.mdMarkdown104 lines7.5 KiBsource raw download

title: "Timing Attacks" section: "Web Pentesting" sectionSlug: "pentesting-web" sourcePath: "src/pentesting-web/timing-attacks.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/pentesting-web/timing-attacks.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Timing Attacks#

[!WARNING] For obtaining a deep understanding of this technique check the original report from https://portswigger.net/research/listen-to-the-whispers-web-timing-attacks-that-actually-work[1]

Basic Information#

The goal of a timing attack is to answer difficult questions or discover hidden functionality by measuring consistent response-time differences between almost identical requests.

Traditionally this was very hard because the interesting server-side signal was drowned in network jitter and server noise. However, after the single-packet / synchronized-request techniques, it became practical to remove most transport noise from the equation and isolate tiny server-side timing deltas.[1]

This page is focused on server-side web timing oracles. For browser-side / cross-origin timing leaks check XS-Search / XS-Leaks.

Making Timing Attacks Practical#

A modern workflow is usually:[1]

  1. Build two requests that differ in exactly one hypothesis (header present/absent, valid/invalid hostname, duplicated parameter, valid/invalid structured payload, etc.).
  2. Send both requests with the same connection and the same release point so the network path is shared.
  3. Alternate the order of the pair to avoid bias caused by sticky ordering or server-side queue effects.
  4. Repeat enough times to compare paired deltas / medians, not single measurements.
  5. Tune the probe so one branch forces extra work such as DNS resolution, cache misses, parsing, validation, logging, deserialization, or a backend fetch.

Useful notes:

Discoveries#

Hidden Attack Surface#

Timing is excellent for discovering hidden parameters, headers, cookies, or routes even when the visible response looks identical.

In the PortSwigger research, simply adding the right hidden input changed the timing by about 5ms, which was enough to identify functionality that was otherwise invisible. This is now a natural fit for Param Miner.[1]

These time differences may appear because:

Something you need to remember when performing these attacks is that the surface is hidden, so you often detect the existence of extra server-side logic first, and only understand the root cause afterwards.

Server-Side Injection Oracles#

Timing is also useful for vulnerabilities where the application parses attacker-controlled data server-side, but the error or output is redacted.[1]

Once you confirm that timing is exposing internal parsing, move to the more specific exploitation pages instead of overloading this one:

Parameter Pollution

Reverse Proxy Misconfigurations#

Timing is especially powerful for finding scoped SSRFs and other reverse-proxy mistakes where the application behaves the same externally, but the backend does extra work only for allowed destinations.[1]

Just checking the time difference when an allowed domain is used versus when a disallowed domain is used can reveal that you found an open proxy even if the HTTP response looks identical.

A very practical pattern is:

Once a scoped open proxy is discovered, you can often pivot into:

Once you find that kind of proxy behaviour, combine it with the methodology from SSRF, HTTP Request Smuggling, and hidden parameter discovery.

Useful Tooling#

References#