利用缓存与服务器不匹配的新网页缓存欺骗攻击技术
文章探讨了Web缓存欺骗攻击,通过利用CDN与原服务器的缓存规则差异,攻击者将私有端点存储为静态资源并随意访问,可能导致敏感内容泄露。 2025-8-27 09:39:21 Author: cyberpress.org(查看原文) 阅读量:0 收藏

Web cache deception is a subtle yet powerful technique whereby attackers manipulate caching rules to expose sensitive content.

By exploiting inconsistencies between a content delivery network (CDN) or cache server (CF) and the origin web server, adversaries can trick the cache into storing private endpoints under static asset rules—then retrieve them at will.

How Cache Rules Diverge

CDNs often differentiate between static assets (images, CSS, JavaScript) and dynamic pages. Static files usually carry permissive headers such as Cache-Control: public and generous max-age directives, while dynamic endpoints use no-store or private.

However, when a URL path mimics a static resource—by appending file extensions or delimiters—the CDN may cache it, whereas the origin will still treat it as a dynamic page.

Key Header Behaviors

DirectiveCDN BehaviorOrigin Behavior
Cache-Control: publicCaches response at CDN and browser cacheNo special handling
Cache-Control: privateBrowser-only cache; no shared cacheNo special handling
Cache-Control: no-storeNo caching anywhereNo caching anywhere
Extension mapping (e.g., .css)Treated as static asset; cachedServed dynamically; no caching
Path normalizationMay ignore traversal sequences (../)Strict normalization then resolve

Exploitation Techniques

  1. Extension Confusion
    By adding a false extension—such as /user/profile.html.css—the CDN caches the endpoint under its static rules, but the origin still processes it as /user/profile.html.css, exposing HTML responses via the cache.
  2. Delimiter Discrepancies
    Delimiters like semicolons (;) or URL fragments (#) are inconsistently handled. A request to /account;123%2Fsettings.css can be cached under /account;123/settings.css by the CDN, while the origin strips or normalizes the path differently, serving private pages.
  3. Path Traversal Confusion
    Encoded traversal sequences %2E%2E%2F bypass CDN normalization, tricking the cache into believing the resource sits under a cacheable directory. Meanwhile, the backend sees the true path and returns sensitive content.

Practical Lab Example

In a PortSwigger lab, the attacker found that /robots.txt was cached with max-age=30. By issuing:

textGET /robots.txt%2F HTTP/2
Host: vulnerable.example.com

The CDN cached it (because it saw /robots.txt/ under the static rule), yet the origin server rejected other variants. Ultimately, the payload:

textGET /my-account;%2F%2E%2E%2Frobots.txt?secret HTTP/2
Host: vulnerable.example.com

forced the cache to store the sensitive robots.txt Under account context, then allowed the retrieval of user account data.

Mitigations and Best Practices

  • Enforce identical normalization and routing logic at both CDN and origin.
  • Serve private pages Cache-Control: no-store at all layers.
  • Strip or reject requests containing ambiguous delimiters or double file extensions.
  • Audit cache configuration for wildcard rules that may inadvertently include sensitive directories.

By adhering to consistent path handling and strict header policies, organizations can eliminate the gap that web cache deception relies upon, safeguarding dynamic content from unintended exposure.

Find this Story Interesting! Follow us on LinkedIn and X to Get More Instant Updates

AnuPriya

AnuPriya

Any Priya is a cybersecurity reporter at Cyber Press, specializing in cyber attacks, dark web monitoring, data breaches, vulnerabilities, and malware. She delivers in-depth analysis on emerging threats and digital security trends.


文章来源: https://cyberpress.org/new-cache-deception-attack-exploits-mismatch-between-cache-and-web-server/
如有侵权请联系:admin#unsafe.sh