0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

お題は不問!Qiita Engineer Festa 2024で記事投稿!
Qiita Engineer Festa20242024年7月17日まで開催中!

EC2のApacheサーバーでDDoS攻撃を食らった話

Last updated at Posted at 2024-06-28

前提

Webサイトとアプリを一つのEC2で立ち上げて、業務効率化のWebシステムを開発していた。Apacheのproxy設定でlocalhostを指定して、Fast APIのweb APIをlocalhostで立ち上げて、ルーティングしていた。

ある日、Webアプリを修正するため、リクエストを送ってみたが、サーバー側で受信されなかった。特に設定は変えてなく、前日は普通に動いていた。

ログの確認

とりあえず、何か悪さしているジョブがないか、topしてみた。
あれ、、、なんかhttpd多くね、、、
まだリリース前なのに、なんかWebサーバーにアクセスしている奴沢山いるわ、、、

 1935 apache    20   0   80572   8016   4944 S   0.3  0.2   0:00.21 httpd
 2003 apache    20   0   80572   8016   4944 S   0.3  0.2   0:00.22 httpd
 2097 apache    20   0   80572   8016   4944 S   0.3  0.2   0:00.21 httpd
 2159 apache    20   0   80688   9344   6180 S   0.3  0.2   0:00.21 httpd
 2276 apache    20   0   80572   8016   4944 S   0.3  0.2   0:00.22 httpd
 2282 apache    20   0   80572   8016   4944 S   0.3  0.2   0:00.21 httpd

次にApacheのアクセスログを確認すると、大量のプロキシサーバーとしてのリクエストが来ていた。。。

sudo tail -f /var/log/httpd/access_log
79.142.76.244 - - [28/Jun/2024:12:05:42 +0000] "CONNECT ivanoel.pt:443 HTTP/1.0" 405 224 "-" "-"
213.152.161.229 - - [28/Jun/2024:12:05:43 +0000] "CONNECT www.etelligencemarketing.com:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.203 - - [28/Jun/2024:12:05:43 +0000] "CONNECT www.feliceconserve.com:443 HTTP/1.0" 405 224 "-" "-"
31.3.152.100 - - [28/Jun/2024:12:05:44 +0000] "CONNECT seattlechristiancounseling.com:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:45 +0000] "CONNECT asfinca.es:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.203 - - [28/Jun/2024:12:05:45 +0000] "CONNECT fimatex.pt:443 HTTP/1.0" 405 224 "-" "-"
79.142.76.244 - - [28/Jun/2024:12:05:46 +0000] "CONNECT www.ocri.it:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.187 - - [28/Jun/2024:12:05:47 +0000] "CONNECT sophia-jung.com:443 HTTP/1.0" 405 224 "-" "-"
185.104.184.43 - - [28/Jun/2024:12:05:47 +0000] "CONNECT bk-deutz.de:443 HTTP/1.0" 405 224 "-" "-"
141.98.102.179 - - [28/Jun/2024:12:05:47 +0000] "CONNECT myofferoftheday.online:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:47 +0000] "CONNECT sierraair.com:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:47 +0000] "CONNECT jjtuk.com:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:49 +0000] "CONNECT dorporchlokipark.tk:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:50 +0000] "CONNECT leccebiodiversity2023.com:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:50 +0000] "CONNECT necyouth.org:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:51 +0000] "CONNECT srut.org:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:53 +0000] "CONNECT www.eastwestrecordsusa.com:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:53 +0000] "CONNECT mariofliega.sk:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:54 +0000] "CONNECT casademariamg.com.br:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.203 - - [28/Jun/2024:12:05:54 +0000] "CONNECT www.destincondorent.com:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.203 - - [28/Jun/2024:12:05:54 +0000] "CONNECT www.italialatina.it:443 HTTP/1.0" 405 224 "-" "-"
31.3.152.100 - - [28/Jun/2024:12:05:55 +0000] "CONNECT summer-dry.com:443 HTTP/1.0" 405 224 "-" "-"
62.102.148.130 - - [28/Jun/2024:12:05:56 +0000] "CONNECT en-sight.com:443 HTTP/1.0" 405 224 "-" "-"
79.142.76.244 - - [28/Jun/2024:12:05:56 +0000] "CONNECT constructivemediagroup.com:443 HTTP/1.0" 405 224 "-" "-"
185.104.184.43 - - [28/Jun/2024:12:05:56 +0000] "CONNECT bk-deutz.de:443 HTTP/1.0" 405 224 "-" "-"
134.19.179.187 - - [28/Jun/2024:12:05:57 +0000] "CONNECT carinehotels.me:443 HTTP/1.0" 405 224 "-" "-"
31.3.152.100 - - [28/Jun/2024:12:05:58 +0000] "CONNECT odontointegral.com.mx:443 HTTP/1.0" 405 224 "-" "-"
82.102.27.163 - - [28/Jun/2024:12:05:58 +0000] "CONNECT centkeffupejos.gq:443 HTTP/1.0" 405 224 "-" "-"
79.142.76.244 - - [28/Jun/2024:12:05:59 +0000] "CONNECT cviveinmobiliaria.com:443 HTTP/1.0" 405 224 "-" "-"
185.104.184.43 - - [28/Jun/2024:12:05:59 +0000] "CONNECT www.esteticalia.it:443 HTTP/1.0" 405 224 "-" "-"

送り元のIPは、下記の固定の9つだった。
31.3.152.100
62.102.148.130
79.142.76.244
82.102.27.163
134.19.179.187
165.232.90.60
185.104.184.43
206.189.7.194
213.152.161.229

whoisのサイトで送り元IPを調べてみた。

下記はNO(ノルウェー)のIPだった。他にもシンガポール、フィンランドと様々だった。

inetnum:        82.102.27.0 - 82.102.27.255
netname:        M247-LTD-OSLO
descr:          M247 LTD Oslo Infrastructure
country:        NO
geoloc:         59.91 10.75
admin-c:        GBXS23-RIPE
tech-c:         GBXS23-RIPE
status:         LIR-PARTITIONED PA
mnt-by:         GLOBALAXS-MNT
remarks:        ---- LEGAL CONCERNS ----
remarks:        For any legal requests, please send an email to
remarks:        ro-legal@m247.ro for a maximum 48hours response.
remarks:        ---- LEGAL CONCERNS----
created:        2017-10-10T15:06:29Z
last-modified:  2018-11-29T12:33:13Z
source:         RIPE

対策

今回は特定のIPだったので、ネットワークACLで対象のIPを拒否する設定を追加した。

ACL3333.PNG

まとめ

いやー、本当にDDoS攻撃とかされるなんて思ってなかったから、半日くらい設定とか調べてしまった。
ドメイン名が単語二つをつなげただけなので、ランダムな攻撃に当たりやすかったのかな?

あとがき

なんか、アウトバウンドの通信が一切できなくなった、、、
結局、EC2を再度立ち上げなおした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?