0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【HackpackCTF 2023】Cat Me if You Can

Last updated at Posted at 2023-04-15

概要

HackPackCTFに参加しました。
自身のチームは381チーム中67位でした。(Top17%ほど?)

クリプトやバイナリ系が弱いと分かったので、もっと頑張ります!
あとWebも。全部じゃん

image.png

Cat Me if You Can

There's a flag hiding in plain sight, Our cat has been trying to get it for a while now, but it keeps escaping him at the last moment. Can you help him out? Author: Chika

僕の大好きなBash × Miscの問題です。

アプローチとしては、Catが使えなくなってしまったので、Catを自作してやる必要があります。

┌──(ayato㉿AyatoDesktop)-[~]
└─$ nc cha.hackpack.club 41708
bash-5.1$ ls
flag.txt
bash-5.1$ cat flag.txt
hissssss
cat: flag.txt
bash-5.1$ cat *
hissssss
cat: flag.txt

BashでCatを再実装するには以下のようなコマンドでできます。

alias cat='while IFS= read -r line || [[ -n $line ]]; do echo "$line"; done < '

それではやってみましょう。

bash-5.1$ alias cat='while IFS= read -r line || [[ -n $line ]]; do echo "$line"; done < '
bash: alias: command not found

Aliasが使えないようなので直接読み込ませます。

bash-5.1$ while IFS= read -r line || [[ -n $line ]]; do echo "$line"; done < flag.txt
flag{(^._.^)_m3ow_me0w_(^._.^)}

まとめ

とても面白い問題でした!
やっぱりBashは楽しい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?