[TIL] 스팸메일 발송에 의한 사이트 다운 현상

몇일전부터 블로그가 자꾸 죽는 문제가 발생해서 프로세스 목록을 살펴보니 sendmail 프로세스 수십개가 떠 있었다.

혹시나 싶어서 로그를 열어보니…

tail -f /var/log/maillog

뭐지? 이쎄한 느낌은,… 172…로 보내는건 내가 보내고 있는거잖아! -_-;…

Oct 18 03:49:50 ip-172-31-5-227 sendmail[4724]: v9I3nobO004724: to=brownjerry359@yahoo.com, ctladdr=armaan.h@miconblog.com (498/498), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32155, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4725]: v9I3noaq004725: Authentication-Warning: ip-172-31-5-227.ap-northeast-1.compute.internal: nginx set sender to armaan.h@miconblog.com using -f
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4725]: v9I3noaq004725: from=armaan.h@miconblog.com, size=2125, class=0, nrcpts=1, msgid=<d8462c873023f84d2f56c38bc80cd9b2@miconblog.com>, relay=nginx@localhost
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4725]: v9I3noaq004725: to=rdsjets@gmail.com, ctladdr=armaan.h@miconblog.com (498/498), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32125, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4726]: v9I3nosf004726: Authentication-Warning: ip-172-31-5-227.ap-northeast-1.compute.internal: nginx set sender to armaan.h@miconblog.com using -f
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4726]: v9I3nosf004726: from=armaan.h@miconblog.com, size=2184, class=0, nrcpts=1, msgid=<51ad53d80a417ec81c68421db28d9432@miconblog.com>, relay=nginx@localhost
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4726]: v9I3nosf004726: to=livingvampire@hotmail.com, ctladdr=armaan.h@miconblog.com (498/498), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32184, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4727]: v9I3noQL004727: Authentication-Warning: ip-172-31-5-227.ap-northeast-1.compute.internal: nginx set sender to armaan.h@miconblog.com using -f
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4727]: v9I3noQL004727: from=armaan.h@miconblog.com, size=2127, class=0, nrcpts=1, msgid=<dd97de13b625fd97de59cf2a002743c9@miconblog.com>, relay=nginx@localhost
Oct 18 03:49:50 ip-172-31-5-227 sendmail[4727]: v9I3noQL004727: to=hanklan@hotmail.com, ctladdr=armaan.h@miconblog.com (498/498), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32127, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

해킹 당한건가? 그럴리가 없는데,.. 80포트 밖에 열어둔게 없는데 이런게 가능한걸까?

다행인건 sendmail 설정이 유효하지 않아서 발송된 메일이 전부 거절 당했다. 덕분에 보내진 메일은 응답을 받기위해 프로세스를 들고 있다가 타임아웃이 하나둘 걸리면서 행이 걸린거 같다. 줵일~

샌드메일 발송부터 해결하자.

일단 급한대로 sendmail 데몬부터 내렸다.

$> service sendmail stop 

그리고 매번 리부팅할때마다 샌드메일 데몬이 뜨길래 아예 지워버렸다.

$> yum remove sendmail

원인이 뭐였을까?

기억을 더듬어 봤다. 아마도 예전에 워드프레스에서 댓글이 달리거나 이럴때 메일을 받았으면 해서 직접 sendmail을 설정해볼까 싶어서 설치했던 기억이 났다.
그리고 아니나다를까 워드프레스 플러그인 항목에 버젓이 Check email 플러그인이 똭~!!
아마도 이 녀석이 범인인것 같다. access 로그에도 남았겠다싶어서 확인해봤다.

[18/Oct/2017:03:52:30 +0000] 200 211.243.39.14 http://miconblog.com/wp-admin/tools.php GET /wp-admin/tools.php?page=checkemail HTTP/1.1 9689 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
[18/Oct/2017:03:52:31 +0000] 200 211.243.39.14 http://miconblog.com/wp-admin/tools.php?page=checkemail GET /wp-json/jetpack/v4/jitm?message_path=wp%3Atools_page_checkemail%3Aadmin_notices&query=page%253Dcheckemail&_wpnonce=4bad6409be HTTP/1.1 12 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
[18/Oct/2017:03:53:31 +0000] 200 211.243.39.14 http://miconblog.com/wp-admin/tools.php?page=checkemail POST /wp-admin/admin-ajax.php HTTP/1.1 58 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
[18/Oct/2017:03:53:32 +0000] 200 211.243.39.14 http://miconblog.com/wp-admin/tools.php?page=checkemail GET /wp-admin/options-general.php HTTP/1.1 21614 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

역시나 뭔가 흔적이 남아있다. checkemail 플러그인을 바로 삭제하고 범인 수색을 더 해봐야겠다. 블로그를 독립시키던가 해야지 이 녀석 때문에 엄한 내 다른 서비스들도 같이 피해를 봤다 -_-;..
DB서버를 독립시키든지 블로그를 독립시키든지 빠른시일에 해야겠다.. 아우~ 귀찮아.

불꽃남자

UI 개발자

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.