IPv4アドレスとポート番号、C言語のソースコードgate.c、ELFファイルgate、
そしてブラウザ上でLinuxのターミナルが使えるサービスのURLが与えられた。
gate.cを読むと、ローカル変数nameにscanf関数で文字列を読み込んだ後、
ローカル変数gateに格納されている文字列が"open"であれば./flagの内容を出力するようになっていることが読み取れた。
また、gateをobjdumpで逆アセンブルして読むと、
scanfで読み込んだデータの格納先は-0x20(%rbp)、"open"と比較されているのは-0x6(%rbp)であることが読み取れた。
これらの位置の差は0x1aバイト (26バイト) である。
これらを踏まえ、以下のコマンドを実行した。
An IPv4 address and a port number, a C source code gate.c, a ELF file gate,
and an URL of a service where we can use a Linux terminal on a Web browser was given.
Reading gate.c, I found it reading some string to a local variable name via the function scanf,
and then it will print the contents of ./flag if the string in the local variable gate is "open".
Also, disassenbling gate via objdump in scanf stores the data read to -0x20(%rbp),
and that what is compared to "open" is -0x6(%rbp).
The difference of their positions is 0x1a bytes (26 bytes).
Based on these information, I executed this command:
得られたbase64コマンドの出力をコピーし、ncコマンドの出力データが得られ、そこにflagが含まれていた。
I copied the output of the base64 command and pasted to the nc command and the flag was in the output.