write-up(web)/webhacking.kr

[Webhacking.kr] old-01

chanchand 2022. 12. 31. 20:15
반응형

문제


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

 

 

 

 

문제풀이


SetCookie("user_lv","1",time()+86400*30,"/challenge/web-01/");
# ‘user_lv’의 쿠키 값이 1로 설정되어 있음

 

쿠키 값이 4보다 작고, 3보다 크면 문제 해결

 

 

반응형

'write-up(web) > webhacking.kr' 카테고리의 다른 글

[Webhacking.kr] old-41  (1) 2023.01.02
[Webhacking.kr] old-40  (0) 2023.01.02
[Webhacking.kr] old-39  (0) 2022.12.31
[Webhacking.kr] old-38  (0) 2022.12.31
[Webhacking.kr] old-37  (0) 2022.12.31