TCPサーバの接続情報と、ファイル symcalc.py が与えられた。
サーバに接続してみると、まず単語の入力を要求された。
ここで入力した単語が表すオブジェクトが _ の初期値になるようであった。
その後は、記号と数字のみからなるPythonの式を入力して実行できるようだった。
まず、__import__("os").system("/bin/sh") の8進数表記を求めた。
Information to connect to a TCP server and a file symcalc.py were given.
Connecting to the server, firstly I was asked to enter a word.
The object that corresponds to this word looked used as the initial value of _.
After that, it accepted Python expressions that consist of only digits and marks to execute.
Firstly, I obtained the octal representation of __import__("os").system("/bin/sh") using
最初の単語として eval を入力し、続いて以下の式を実行することで、シェルを起動できた。
I succeeded to launch the shell by entering eval as the first word, and then executing this expression:
起動したシェルで ls -al コマンドを実行することで、ファイル flag.txt があることがわかった。
cat flag.txt コマンドを実行すると、flagが得られた。
I found that a file flag.txt exists via ls -al command on the shell.
I obtained the flag via cat flag.txt command.