Rednote
GuidebooksTerminalCode
  • Welcome!
  • Utility
    • General
    • Server
    • Transferring File
      • Main
      • Code
      • Miscellaneous
    • Reverse & Bind Shells
      • Havoc
    • Metasploit
    • Service
      • FTP (21)
      • SSH (22)
      • DNS (53)
      • HTTP/HTTPS (80-443)
      • SMTP (25-465-587)
      • POP3 (110-995)
      • IMAP (143-993)
      • MySQL (3306)
      • MSSQL (1433-2433)
      • SMB (139-445)
      • RDP (3389)
      • WinRM (5985-5986)
      • WMI (135)
      • LLMNR & NBT-NS (5355-137)
      • NFS (111-2049)
      • SNMP (161-162)
      • VNC (5900)
      • Rsync (873)
      • R-Service (512-513-514)
      • IPMI (623)
      • Oracle TNS (1521)
  • Pentesting Process
    • Information Gathering
      • Passive
      • Active
      • OSINT
    • Vulnerability
    • Web Attacks
      • GENERAL
      • Crawling/Spidering & Fuzzing
      • Information Disclosure
      • Command Injection
      • Unrestricted File Upload
      • File Inclusion/Path Traversal
      • Request Smuggling
      • Clickjacking
      • Web Cache Poisoning
      • Web Cache Deception
      • Insecure Deserialization
      • Prototype Pollution
      • OAuth 2.0
      • JWT
      • SQLi
        • sqlmap
      • NoSQLi
      • GraphQL
      • XSS
      • SSRF
      • XXE
      • IDOR
      • API
      • SSTI
      • CSRF
      • CORS
      • AJP
      • SSI
      • ESI
      • XSLT
      • Cloud
      • LLM Prompt Security
    • Software Attacks
      • Binary
      • Shellcode
      • AV Evasion & Obfuscation
    • Network Attacks
      • ARP Poisoning
      • Local DNS Cache Poisoning
      • Baby Local DoS
    • Crypto Attacks
      • Utility
      • RSA
      • DSA/DSS
      • PRNG
        • LGC
        • MT
        • LFSR
    • Misc Attacks
    • Social Engineering
    • Password Cracking
      • Wordlist
      • Offline
      • Online
    • Pivoting & Tunneling
    • Local Enumeration
      • Linux
      • Windows
    • Privilege Escalation
      • Linux
        • Linux Privilege Escalation with Groups
        • Linux Privilege Escalation with Library
      • Windows
        • Windows Privilege Escalation with Groups and Privileges
        • Windows Privilege Escalation with DLL Hijacking
    • Active Directory
      • Enumeration
      • Abuse ACL
      • Extract Hash & Password
      • Pass The Hash
      • Pass The Ticket
      • Overpass the Hash
      • Relay Attack
      • Password Spraying Attack
      • AS-REP Roasting
      • Kerberoasting
      • Silver Ticket
      • Golden Ticket
      • DC Synchronization
      • AD Certificates
      • Attacking Domain Trusts
    • Reports
      • Bug Bounty Report
    • CVE
      • Linux
      • Windows
    • OTHER
      • CMS
        • WordPress
        • Joomla
        • Drupal
      • Tomcat
      • Jenkins
      • Splunk
      • Web Service
      • Navigating Python Objects
      • JavaScript Deobfuscation
  • Extra
    • My Books
    • My Exploits
    • Compiled Binaries
Powered by GitBook
On this page
  • Cachebuster
  • Headers
  • Third-Party Cache
  • Cache Key Flaws

Was this helpful?

  1. Pentesting Process
  2. Web Attacks

Web Cache Poisoning

Last updated 4 months ago

Was this helpful?

The cache sits between the server and the user, where it saves (caches) the responses to particular requests, usually for a fixed amount of time. If another user then sends an equivalent request, the cache simply serves a copy of the cached response directly to the user, without any interaction from the back-end. Websites are vulnerable to web cache poisoning if they handle unkeyed input in an unsafe way and allow the subsequent HTTP responses to be cached. This vulnerability can be used as a delivery method for a variety of different attacks.

Cache Keys: Subset of the request's components to determine whether there is a cached response. Unkeyed: Components of the request that are not included in the cache key.

Steps:

  • Identify a cache oracle

  • Adding (make sure that they will only be served to you)

  • Identify and evaluate unkeyed inputs to generate harmful response (Param Miner, Guess headers)

  • Evaluate exactly how the website processes it, studying how the cache behaves.

  • Once you work out how to get a response cached that contains your malicious input, you are ready to deliver the exploit to potential victims.

Cachebuster

GET /?cachebuster=1 HTTP/1.1
Accept-Encoding: gzip, deflate, cachebuster
Accept: */*, text/cachebuster
Cookie: cachebuster=1
Origin: https://cachebuster.vulnerable-website.com
etc.

Headers

In the responses you can have (possible)

Cache-Control: max-age=30
Age: 1
X-Cache: hit/miss/dynamic/refresh
Vary: User-Agent

The Vary header specifies a list of additional headers that should be treated as part of the cache key even if they are normally unkeyed.

We can test Headers

We can find Headers with Param Miner, Guess headers

X-Forwarded-Host
X-Forwarded-Scheme
X-Original-Url
X-Host
X-Forwarded-Server
X-HTTP-Host-Override
Forwarded

We can test Host Header with:

  • 2 Host Header

  • Host: vulnerable-website.com:bad-stuff-here Host: notvulnerable-website.com Host: hacked-subdomain.vulnerable-website.com etc.

  •      Host: bad-stuff-here
    Host: vulnerable-website.com
  • Absolute URL in the request GET https://vuln-website/path HTTP/2

  • GET @private-intranet/example HTTP/1.1

  • Servers that only perform thorough validation on the first request they receive over the same connection.

Third-Party Cache

If you can identify that a specific third-party cache is being used, you can also consult the corresponding documentation. This may contain information about how the default cache key is constructed. You might even stumble across some handy tips and tricks, such as features that allow you to see the cache key directly.

Pragma: x-get-cache-key
Pragma: akamai-x-get-cache-key

Cache Key Flaws

  • Unkeyed port

  • Unkeyed query string

  • Unkeyed query parameters (All or only some, ex. utm_content)

  • Parameter Cloaking (? & ;)

  • Unkeyed HTTP method (pretty rare) or use "fat" GET (simply adding a body to a GET request). You can try also with X-HTTP-Method-Override: POST header if is unkeyed.

  • URL normalization (unexploitable XSS in path with unencoded> maybe have the same cached key to the URL-encoded %22)

cachebuster