Skip to content

Commit

Permalink
8/14加筆
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeKato committed Aug 15, 2024
1 parent e088298 commit 0d7bf31
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 9 deletions.
Binary file added images/2024/20240814_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2024/20240814_6.png.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2024/20240814_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2024/20240814_7.png.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 96 additions & 9 deletions markdown/2024/0814.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- title=AlpacaHackで始めるCTF入門2:DreamhackでCTF入門
- description=個人戦CTFを開催するプラットフォーム「AlpacaHack」を通じてCTFに入門してみようと思います。DreamHackも利用します。
- date=2024年8月14日(水)
- update=2024年8月14日(水
- update=2024年8月15日(木
- math=false

## はじめに
Expand Down Expand Up @@ -101,10 +101,12 @@ Dream Beginnersのコンテンツ
- Dreamhackでは基本的にDH{...}の形式(例外あり)

### 練習問題:Welcome-Beginners
- 問題によっては説明文や参考リンク、ヒントなどがあったりなかったりする
- 「Request a VM」ボタンを押すと仮想環境のサーバが立つ
- 「Download」ボタンを押すと仮想環境で動いているプログラムが手に入る
- 下記のコマンドを実行してflagを取得
以下解き方

- やること:ncコマンドでサーバと通信してflagを取得する
- 1. 「Request a VM」ボタンを押すと仮想環境のサーバが立つ
- 2. 「Download」ボタンを押すと仮想環境で動いているプログラムが手に入る
- 3. 下記のコマンドを実行してflagを取得

```
$ nc host3.dreamhack.games 23044
Expand All @@ -127,17 +129,102 @@ https://encoding.tools/
Encoding Tools

### 練習問題:64se64
- 「Download」ボタンを押してzipファイルを取得
- index.htmlを開くとbase64の文字列が見つかるのでエンコード
- Pythonスクリプトが取得できるので実行するとflagが手に入る
以下解き方

- やること:データ内のbase64の文字列をエンコードしてflagを取得する
- 1. 「Download」ボタンを押してzipファイルを取得
- 2. index.htmlを開くとbase64の文字列が見つかるのでエンコード
- 3. Pythonスクリプトが取得できるので実行するとflagが手に入る

2024/20240814_5.png

エンコードの様子

### Linux
- Linuxの基礎知識も大事(シェル、基本的なコマンド、パイプライン、権限など)
- ディレクトリ構成も大事(/bin、/boot、/dev、/etc、/lib、/opt、/root、/homeなど)

### 練習問題:baby-linux
以下解き方

- やること:ブラウザでウェブサイトにアクセスしてflag.txtの中身を取得する
- 1. 「Request a VM」ボタンを押すと仮想環境のサーバが立つ
- 2. ブラウザでサーバにアクセス
- 3. 下記のコマンドをウェブサイト上で実行してflagを取得
- ※app.pyを見るとコマンド内に「flag」という文字列があると弾かれるっぽいのでワイルドカードを使う

```sh
cat dream/hack/hello/f*g.txt
```

baby-linuxのウェブサイト↓

2024/20240814_6.png

baby-linuxのウェブサイト

### 練習問題:SSH
以下解き方

- やること:SSHでサーバにアクセスしてflagを取得
- 1. 「Request a VM」ボタンを押すと仮想環境のサーバが立つ
- 2. 下記コマンドを実行

```sh
$ ssh [email protected] -p 22929
$ cat flag
```

### 練習問題:Docker
以下解き方

- やること:Dockerfileからイメージをビルドしてコンテナを作成する
- 1. 「Download」ボタンを押してzipファイルを取得
- 2. ファイルを展開してターミナルでそのディレクトリへ移動
- 3. 下記コマンドを実行

```sh
$ sudo docker build .
$ sudo docker run -it de6557187714 /bin/bash
$ cat flag
```

### 練習問題:blue-whale
以下解き方

- やること:diveを使ってDockerfileを解析する
- 1. diveをインストール
- 2. 「Download」ボタンを押してzipファイルを取得
- 3. ファイルを展開してターミナルでそのディレクトリへ移動
- 4. 下記コマンドを実行
- 5. diveでflagが削除される前のレイヤーを表示すればflagが見つかる
- ※diveの使い方はREADMEに記載してある

インストール方法はdiveのREADMEを参照

https://github.com/wagoodman/dive

diveのGitHubリポジトリ

```sh
$ sudo docker pull dreamhackofficial/blue-whale:1
$ sudo dive 87a96c7a8db0
# TABキーでレイヤーを移動
# 矢印キーで項目を移動
# ctrl+Fで検索ワードを指定
```

2024/20240814_7.png

dive使用時の様子

### その他
- Virtual BoxやWSLなどを利用して仮想環境を作るとよい
- 問題によっては説明文や参考リンク、ヒントなどがあったりなかったりする
- ネイティブのUbuntuを用意、あるいはVirtual BoxやWSLなどでの仮想環境を作るとよい
- Dockerの知識は必須っぽい
- コンピュータサイエンスの基礎も大事(バイナリ、ビット演算、文字コード、OSなど)
- コーディングはVisual Studio Codeがおすすめ
- テキストエディタではVimもおすすめ

## おわりに
今日はDreamhackに挑戦してみました。
Expand Down

0 comments on commit 0d7bf31

Please sign in to comment.