EASY7

Lord of the SQL 6번 본문

Project/Lord of SQL

Lord of the SQL 6번

E.asiest 2019. 8. 4. 14:32

Lord of the SQL 6번

 

<?php 
  
include "./config.php"
  
login_chk(); 
  
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 = @mysql_fetch_array(mysql_query($query)); 
  if(
$result['id']) echo "<h2>Hello {$result[id]}</h2>"
  if(
$result['id'] == 'admin'solve("darkelf"); 
  
highlight_file(__FILE__); 
?>

 

#코드 해석

'/prob|_|\.|\(\)/i 

table명인 prob 안돼~

_언더바 안돼~

.안돼~

()안돼~

 

/or|and/i

i는 대소문자 구분하지않는 다는 뜻.

or, and, OR, AND 쓰면 HeHe 나옴. 웃지마!!

 

' || '1'='1

OR 대신 || 넣으니 됐다 하지만 admin이 아닌 guest가 나온다.

 

' || id='admin하니까 성공!

 

 

 

'Project > Lord of SQL' 카테고리의 다른 글

Lord of the SQL 9번  (0) 2019.08.04
Lord of the SQL 8번  (0) 2019.08.04
Lord of the SQL 7번  (0) 2019.08.04
Lord of SQL 5번  (0) 2019.08.04
Lord of SQL 4번  (0) 2019.07.29
Comments