2
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] MY GIT

2
Posted at

概要

ジャンル: General Skills
難易度: Easy
問題文:
I have built my own Git server with my own rules!
Additional details will be available after launching your challenge instance.
「独自のルールでGitサーバーを構築した。READMEを確認してフラグを入手せよ。」

解法

インスタンスを立ちあげると問題文にgit clone SSHコマンドが出現する。
WSLで実行すると、カレントディレクトリにリポジトリがクローンされる。

Bash
git clone ssh://git@<server-address>

作成されたchallengeフォルダに移動すると、中にreadmeファイルがある。
catコマンドで中を確認すると、中にはrootユーザーがflag.txtだけをpushしたと書かれている。

cd challenge
ls
cat README.md

rootユーザーになりすまして、flag.txtをサーバーにPushしてみる。

git config user.name "(readmeに書かれているユーザ名)"
git config user.email "(readmeに書かれているメールアドレス)"

適当な内容で flag.txt を作成し、ローカルリポジトリに記録(コミット)する。
インスタンスサーバが立ち上がっている間でないとcommitは成功しないので注意。
インスタンスサーバが時間切れになってしまった場合は、作成したchallengeフォルダを削除し、
再度インスタンスサーバ立ち上げとgit clone sshコマンドから打ち直す。

echo "give me the flag" > flag.txt
git add flag.txt
git commit -m "push flag as root"#インスタンスサーバ停止していると失敗する
git push origin master
送信時のパスワード入力後、サーバー側の判定スクリプトによりフラグが表示された。

結果

pushが成功すると、flag文を含む内容が出力される。

2
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
2
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?