はまやんはまやんはまやん

hamayanhamayan's blog

Find That Data! [b01lers CTF bootcamp]

Find That Data!
Complete what Clu could not... Find the data in memory. https://www.youtube.com/watch?v=PQwKV7lCzEI
http://chal.ctf.b01lers.com:3001

ソースコードをとりあえず見てみる

<script>
    function login(username, password) {
    if (username == "CLU" && password == "0222") {
        window.location = "/maze";
    } else window.location = "/";
    }
</script>

/mazeへ行ってみよう。

f:id:hamayanhamayan:20201005190039p:plain

なんかすごい迷宮が出てくるけど、とりあえずソースコードを見る。 maze.jsがメインロジック。必要そうな所を以下に抜粋した。

function Token() {
  $.get("/token", function(data, status) {
    $("#token").html(data);
  });
}

function CreateAll() {
  Token();
  CreateGrid();
  add_x();
  add_o();
  CreateMaze();
}

window.addEventListener("load", function() {
  CreateAll();
  setInterval(CreateAll, 1000);
});

function check_data() {
  if (x === 1 && y === maxRows) {
    $.post("/mem", { token: $("#token").html() }).done(function(data) {
      alert("Memory: " + data);
    });
  }
}

ゴールについたら、/memにPOSTして確認するっぽい。
適当にPOSTしてみると、Try againと言われた。
ちゃんと投げたすぐ後に出さなきゃいけないか?

自動化すると通る。

import requests

token = requests.get('http://chal.ctf.b01lers.com:3001/token').text
res = requests.post('http://chal.ctf.b01lers.com:3001/mem', data={'token':token}).text
print(res)

flag{you_aren't_making_me_talk!}