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?

[picoCTF_WriteUP]「Piece by Piece」

0
Posted at

はじめに

picoCTFの問題「Piece by Piece」を解いた記録です。

問題

  • 難易度:EASY
  • カテゴリ:GeneralSkills
  • 説明
    After logging in, you will find multiple file parts in your home directory. These parts need to be combined and extracted to reveal the flag.
    ログイン後、ホームディレクトリに複数のファイル断片が表示されます。これらの断片を結合して抽出することで、フラグが明らかになります。
  • インスタンス立ち上げ時の挙動*
    SSHで接続するホスト名、ポート名、ログインユーザ名、パスワードが表示されます。

使用したツール

SSH、WSL、Linux基本コマンド(cat)

中身の把握

WSLにてsshコマンドで接続しました。

ssh (ユーザー名)@(ホスト名) -p (ポート名)
#本当に接続するか聞かれるのでyes
#インスタンス起動メッセージのパスワードを入力

ls でファイル一覧を確認すると、6個のファイルが表示されます。

ls
>instructions.txt  part_ab  part_ad
part_aa           part_ac  part_ae

txtファイルの中身を見ると、ヒントが書かれていました。

cat instructions.txt
>
- The flag is split into multiple parts as a zipped file.
フラグは分割されたZipファイルの中にある。
- Use Linux commands to combine the parts into one file.
Linuxコマンドを使って、バラバラのパーツを1つのファイルに合体させよ。
- The zip file is password protected. Use this "***" password to extract the zip file.
Zipにはパスワードがかかっている。パスワードは ***。
- After unzipping, check the extracted text file for the flag.
解凍して出てきたテキストファイルの中にフラグがある。

このヒントの通り、part_a~dのファイルを結合したzipファイルを解凍すればよさそうです。

実践

WSLのcatコマンドで、part_aと前方一致するファイルをすべて結合してflag.zipという新しいファイルを作ります。

cat part_a* > flag.zip
#これでpart_aa、part_ab、part_ac、part_adの4ファイルが結合する

結合した直後の file flag.zip を解凍すると、flag.txtが得られました。

unzip flag.zip
Archive:  flag.zip
[flag.zip] flag.txt password:(instructions.txt内のパスワード)
>extracting: flag.txt

flag.txtの中を表示させると、flag文字列が得られました。

cat flag.txt

最後に

picoCTF問題ページを翻訳するとSSHパスワードがうまく表示されず、何回かSSH接続失敗しました。
パスワードは原文ページにして確認しましょう。

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?