Cracking the Lens: Targeting HTTP's Hidden Attack-Surface

BBlack Hat
253,000
97,779 views
2,034 likes
Nov 2017
44:06

Description

James Kettle demonstrates how to identify and exploit the hidden attack surface of HTTP intermediaries like load balancers and analytics systems. This presentation covers OAST techniques, routing vulnerabilities, and the exploitation of backend crawlers to gain internal network access.

Cracking the Lens: Targeting HTTP's Hidden Attack-Surface

Modern web architecture is rarely a direct line between a client and a server. Instead, requests pass through a complex "lens" of transparent systems: load balancers, reverse proxies, caching layers, and analytics engines. In his landmark Black Hat USA 2017 talk, James Kettle (Head of Research at PortSwigger) reveals that this invisible infrastructure is rife with exploitable vulnerabilities. This post explores how these hidden systems can be transformed from performance enhancers into gateways for internal network compromise.

The Methodology: OAST and Speculative Attacks

Traditional penetration testing often focuses on the application logic. However, identifying infrastructure flaws requires a different approach known as Out-of-Band Application Security Testing (OAST). The goal of OAST is to send payloads that don't necessarily change the application's response but instead trigger an external interaction—a "pingback"—to a server you control.

To hunt these flaws at scale, Kettle utilized several key strategies:

  1. Collaborator Everywhere: A Burp Suite extension that injects unique identifiers into common headers (like Host, X-Forwarded-For, and Referer) to correlate delayed pingbacks with specific requests.
  2. Massive-Scale Reconnaissance: Using tools like ZGrab and Masscan combined with Rapid7’s Project Sonar dataset, Kettle scanned millions of hosts across authorized bug bounty programs.
  3. Speculative Payloads: By sending intentionally malformed requests to 50,000+ servers simultaneously, researchers can iteratively find and refine new exploit primitives.

Vector 1: Front-End Routing Attacks

Front-end systems like load balancers decide where to route a request based on the Host header. If these systems are misconfigured, an attacker can manipulate that header to access internal services that were never intended for public exposure.

The Yahoo Case Study

Kettle demonstrated a high-impact exploit against Yahoo by simply changing the Host header to point to an internal IP and port (8082). This revealed an Apache Traffic Overseer instance. Because this was a routing attack rather than a standard SSRF, Kettle had full control over the HTTP method. By changing the method to HELP and then SET, he could potentially rewrite cache rules or enable a SOCKS proxy, providing full IP-level access to Yahoo's internal network.

Exploiting Libraries: Apache HTTP Components

Beyond misconfigurations, specific software flaws can lead to misrouting. Kettle identified a vulnerability in the Apache HTTP Components library. The library failed to mandate that paths start with a /. Consequently, a request like GET @internal-system HTTP/1.1 could be rewritten by the application code into an unintentional request to an attacker-controlled server or a different internal endpoint, effectively bypassing security logic.

Vector 2: Backend Helper Systems

Many modern applications employ backend "crawlers" for analytics or performance monitoring. These systems often automatically fetch URLs found in the Referer or X-Forwarded-For headers.

Exploiting the Crawler

When a backend system fetches your URL, it acts as a client. This opens up a unique attack surface:

  • Credential Harvesting: Using tools like Responder, an attacker can attempt to trick the connecting crawler into leaking NTLM hashes or other credentials.
  • Client-Side Exploits: If the crawler is an outdated version of a library or a headless browser (like PhantomJS), it may be vulnerable to memory corruption (e.g., Heartbleed) or JavaScript-based attacks.
  • Blind-Reflected Server-Side XSS: If the crawler renders the page, you can serve a malicious JavaScript payload. This script runs within the context of the internal network, potentially allowing it to scan the internal network, bypass the Same-Origin Policy (SOP), or read local sensitive files like /proc/self/environ.

Technical Deep Dive: The Caching Trap

One of the most creative exploits mentioned involves "Enthusiastic Caching." Kettle discovered a military system using a reverse proxy that scanned responses for image tags and automatically cached the linked resources.

By finding a simple reflected XSS in the application, Kettle injected a fake image tag: <img src="/internal-admin-panel/config.php?a=.jpg">. The proxy, seeing the .jpg extension, fetched the internal config page and cached the result. Kettle then simply requested the cached "image" URL to download the internal configuration file.

Mitigation and Defense

Defending against infrastructure-level attacks requires a shift in how we architect networks:

  1. Isolate Intermediaries: Reverse proxies and load balancers are designed to talk to the internet. They should be placed in a strictly defined DMZ with no access to unauthenticated internal management interfaces.
  2. Sandbox Crawlers: Any system that fetches user-supplied URLs should be treated as a high-risk asset. These crawlers should be sandboxed, have limited network egress, and run with minimal privileges.
  3. Header Validation: Validate and sanitize all incoming headers. Do not trust X-Forwarded-For or Host headers for sensitive routing logic unless they have been explicitly set by a trusted upstream proxy.

Conclusion

"Cracking the Lens" serves as a powerful reminder that the infrastructure we rely on for security and performance is itself a target. By looking at the lens rather than through it, security researchers can uncover a vast world of hidden vulnerabilities. For organizations, the lesson is clear: visibility into your intermediate systems is just as important as the security of your application code.

AI Summary

In this Black Hat USA 2017 presentation, James Kettle, Head of Research at PortSwigger, explores the vulnerabilities inherent in the intermediate systems that sit between users and web applications—what he calls the 'lens' of the internet. This includes load balancers, reverse proxies, and analytics systems. The core thesis is that these systems are often overlooked during security audits because they are perceived as transparent or 'boring,' yet they frequently contain critical flaws that can lead to internal network exposure. Kettle introduces the concept of Out-of-Band Application Security Testing (OAST), which involves sending payloads designed to trigger an external interaction (like a DNS or HTTP request) from a vulnerable system back to a researcher-controlled server. To facilitate this at scale, he developed and released 'Collaborator Everywhere,' a Burp Suite extension that automatically injects unique pingback payloads into every request. For massive-scale research, he utilized tools like ZGrab and Masscan to scan millions of hosts found in Project Sonar that were within the scope of bug bounty programs. The talk details two primary attack vectors. The first focuses on front-end routing attacks. By manipulating the 'Host' header or using malformed request lines, Kettle demonstrates how to trick reverse proxies into routing requests to internal, unauthenticated administration panels. Notable examples include a $15,000 exploit against Yahoo's infrastructure where he gained access to an Apache Traffic Overseer system, and similar findings across Department of Defense (DoD) servers and English ISPs. He specifically highlights a flaw in the Apache HTTP Components library that allowed for request misrouting due to a failure in requiring paths to start with a forward slash. The second vector targets backend 'helper' systems. Many sites use analytics crawlers that fetch URLs found in the 'Referer' or 'X-Forwarded-For' headers. While these interactions are often blind (no direct response to the attacker), Kettle shows they can be exploited using tools like 'Responder' to capture credentials or 'Pacemaker' to exploit client-side vulnerabilities like Heartbleed on the crawler itself. He also introduces 'blind-reflected server-side XSS,' where a backend system renders a page (using a tool like PhantomJS), allowing an attacker to execute JavaScript within the internal network to read local files or bypass internal origin policies. The presentation concludes with a demonstration of 'Collaborator Everywhere' and recommendations for defense, emphasizing that intermediate systems should be placed in a DMZ and backend crawlers should be heavily sandboxed.

Related Videos

DEF CON 33 - 7 Vulns in 7 Days - Breaking Bloatware Faster Than It’s Built - Leon 'leonjza' Jacobs
39:56
Science & Technologyresearch-presentationpracticalwindows
Impostor Syndrome - Hacking Apple MDMs Using Rogue Device Enrolments
34:53
Travel & Eventsresearch-presentationhybridapple
DEF CON 33  Recon Village -  A Playbook for Integration Servers - Ryan Bonner, Guðmundur Karlsson
22:01
Science & Technologyresearch-presentationhybridwebmethods
DEF CON 33 Recon Village - Discord OSINT - Zach Malinich
37:49
Science & Technologyresearch-presentationhybriddiscord
Keynote: Cyber Threats in the Age of AI
41:45
Travel & Eventskeynotehybridai
Powered by Kuboid

We break your app
before they do.

Kuboid is a cybersecurity agency that finds hidden vulnerabilities before real attackers can exploit them. Proactive security testing, so you can ship with confidence.

Get in Touch

Trusted by the security community • Visit kuboid.in