Web/Webhacking.kr

challenge old-01

Claude97 2024. 6. 6. 14:13

Webhacking 문제의 조상격인 Webhacking.kr...

 

<?php
  include "../../config.php";
  if($_GET['view-source'] == 1){ view_source(); }
  if(!$_COOKIE['user_lv']){
    SetCookie("user_lv","1",time()+86400*30,"/challenge/web-01/");
    echo("<meta http-equiv=refresh content=0>");
  }
?>
<html>
<head>
<title>Challenge 1</title>
</head>
<body bgcolor=black>
<center>
<br><br><br><br><br>
<font color=white>
---------------------<br>
<?php
  if(!is_numeric($_COOKIE['user_lv'])) $_COOKIE['user_lv']=1;
  if($_COOKIE['user_lv']>=4) $_COOKIE['user_lv']=1;
  if($_COOKIE['user_lv']>3) solve(1);
  echo "<br>level : {$_COOKIE['user_lv']}";
?>
<br>
<a href=./?view-source=1>view-source</a>
</body>
</html>

 

<veiw-source> 를 눌러서 페이지 소스코드를 보면

쿠키 값 'user_lv' 이 초기값 1로, 4보다 클때는 1로 설정,

3 초과 4 미만의 값이면 solve(1) 로 넘어가는걸 확인할 수 있다.

 

 

크롬 확장프로그램 "EditThisCookie" 으로 간단하게 쿠키 값 변조로 해결