코드 소스
1. index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>핵미사일 시스템</title>
<style>
.missile-button {
display: inline-block;
padding: 10px 20px;
background-color: #f00;
color: #fff;
text-decoration: none;
font-size: 18px;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Nuclear Missile!</h1>
<a class="missile-button" href="process1.php">퐈이어</a>
</body>
</html>
|
cs |
2. process1.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>핵미사일 시스템</title>
<style>
.missile-button {
display: inline-block;
padding: 10px 20px;
background-color: #f00;
color: #fff;
font-size: 18px;
text-decoration: none;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Nuclear Missile!</h1>
<h3>관리자만 이용가능합니다. 관리자인 경우만 확인 버튼을 클릭하고 계속 진행해주세요</h3>
<a class="missile-button" href="process2.php">확인</a>
</body>
</html>
|
cs |
3. process2.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>핵미사일 시스템</title>
<style>
button {
display: inline-block;
padding: 10px 20px;
background-color: #f00;
color: #fff;
font-size: 18px;
text-decoration: none;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Nuclear Missile!</h1>
<h3>관리자 인증이 필요합니다.</h3>
<p>
<form action="login.php" method="post">
<input type="password" id="password" name="admin-pass" placeholder="비밀번호를 입력해주세요.">
</p>
<p>
<button type="submit">확인</button>
</form>
</p>
</body>
</html>
|
cs |
4. process3.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>핵미사일 시스템</title>
<style>
.missile-button {
display: inline-block;
padding: 10px 20px;
background-color: #f00;
color: #fff;
font-size: 18px;
text-decoration: none;
border-radius: 5px;
}
</style>
<script>
function launchMissile() {
alert("done!");
}
</script>
</head>
<body>
<h1>Nuclear Missile!</h1>
<h3>발사를 원하시면 아래 버튼을 클릭하세요.</h3>
<a class="missile-button" onclick="launchMissile()">퐈이어!</a>
</body>
</html>
|
cs |
5. login.php
<?php
$passwd = $_POST['password'];
if(intval($passwd) === 1001) {
$_SESSION['password'] = $passwd;
header('Location: process3.php');
} else {
echo "<script>window.alert('로그인 실패')
history.go(-1)</script>";
}
?>
|
cs |
풀이
핵미사일 쏴버리자
위에서 "퐈이어"를 클릭했을 때, process1.php로 이동된다.
확인을 클릭하면 패스워드를 입력해야 하는 폼이 나온다.
주소가 페이지 이동될 때마다 process1.php, process2.php,... 와 같이 바뀌고 있으니 인증 성공했을 때
이동될 페이지는 process3.php 일 것이다. 따라서 이 주소를 직접 입력해서 들어가면 된다.
process3.php 코드를 살펴보면, 세션을 검사하지 않고 있다.
로그인 성공했을 때 설정되는 세션이 아닌 경우 접속을 차단하는 코드가 필요하다.
'Hacking_study > 해킹과제' 카테고리의 다른 글
워게임 만들기! (Lv2. 응답변조. 미완..) (0) | 2023.04.16 |
---|---|
워게임 만들기! (Lv1. 브루트포스) (2) | 2023.04.16 |
워게임 만들기! (Lv0. 쿠키변조) (0) | 2023.04.16 |
SQL select 구문 / 로그인 유형 2가지 / SQL injection (0) | 2023.04.14 |
워게임 만들기! (쿠키 변조 맛보기) (0) | 2023.04.12 |