web-dev-qa-db-ja.com

サーバーからスパムを送信しているのは誰または何ですか(CentOS / Apache / suPHP)

サーバーから大量のスパムが送信されており、問題を何時間も検索しました。グーグルした後、彼らがこれについて話し、eximログにDigに言及したフォーラムを見つけたので、そうして、メールが[username] @ vps1。[hostname]。[tld]から送信されていることがわかりました。フォーラムでは、これは使用済みの電子メールアドレスではないため、電子メールはおそらく私のサーバーから送信されたと彼らは言いました。彼らはまた、phpログを掘り下げることにも言及しました。

これを試しましたが何も見つかりませんでした。そのため、電子メールヘッダーを介して、これらすべての電子メールを送信するスクリプトを検出しようとしています。それは私が今立ち往生していたことです。

次のルールを追加してphp.iniを変更しました。

mail.add_x_header = On
mail.log = /var/log/phpmail.log

また、次の行を追加してexim.confを追加しました。

+arguments \

EximとApacheを再起動しましたが、eximログにX-PHP-Scriptヘッダーが表示されず、phpメールログが作成されません。

私が見るのは、eximログのXヘッダーだけです。

X=TLSv1:RC4-SHA:128

誰かが次に何をすべきか教えてもらえますか?

[〜#〜]編集[〜#〜]

Eximログからのいくつかの行は次のとおりです。

bash-3.2# cat /var/log/exim/mainlog | grep 1W9FsC-0003qq-S2
2014-01-31 16:19:16 1W9FsC-0003qq-S2 <= [email protected] U=instijl P=local S=816 T="Re:  It's good to see you," from <[email protected]> for [email protected]
2014-01-31 16:19:16 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1W9FsC-0003qq-S2
2014-01-31 16:19:17 1W9FsC-0003qq-S2 ** [email protected] F=<[email protected]> R=lookuphost T=remote_smtp: SMTP error from remote mail server after initial connection: Host extmail.bigpond.com [61.9.168.122]: 554 nskntcmgw02p BigPond Inbound IB103. Connection refused. 141.138.199.65 has a poor reputation on the Cloudmark Sender Intelligence (CSI) list. Please visit http://csi.cloudmark.com/reset-request/?ip=141.138.199.65 to request a delisting.
2014-01-31 16:19:17 cwd=/var/spool/exim 7 args: /usr/sbin/exim -t -oem -oi -f <> -E1W9FsC-0003qq-S2
2014-01-31 16:19:17 1W9FsD-0003r9-H9 <= <> R=1W9FsC-0003qq-S2 U=mail P=local S=2006 T="Mail delivery failed: returning message to sender" from <> for [email protected]
2014-01-31 16:19:17 1W9FsC-0003qq-S2 Completed

bash-3.2# cat /var/log/exim/mainlog | grep 1W9FsC-0003qc-M7
2014-01-31 16:19:16 1W9FsC-0003qc-M7 <= [email protected] U=instijl P=local S=822 T="Re:  It's good to see you," from <[email protected]> for [email protected]
2014-01-31 16:19:16 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1W9FsC-0003qc-M7
2014-01-31 16:19:17 1W9FsC-0003qc-M7 ** [email protected] F=<[email protected]> R=lookuphost T=remote_smtp: SMTP error from remote mail server after end of data: Host gmail-smtp-in.l.google.com [173.194.65.26]: 550-5.7.1 [141.138.199.65      12] Our system has detected that this message is\n550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail,\n550-5.7.1 this message has been blocked. Please visit\n550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for\n550 5.7.1 more information. y48si18631040eew.58 - gsmtp
2014-01-31 16:19:17 cwd=/var/spool/exim 7 args: /usr/sbin/exim -t -oem -oi -f <> -E1W9FsC-0003qc-M7
2014-01-31 16:19:17 1W9FsD-0003r1-BS <= <> R=1W9FsC-0003qc-M7 U=mail P=local S=2146 T="Mail delivery failed: returning message to sender" from <> for [email protected]
2014-01-31 16:19:17 1W9FsC-0003qc-M7 Completed

bash-3.2# cat /var/log/exim/mainlog | grep 1W9Frw-0003oS-Gd
2014-01-31 16:19:00 1W9Frw-0003oS-Gd <= [email protected] U=instijl P=local S=823 T="FW:  Yo" from <[email protected]> for [email protected]
2014-01-31 16:19:00 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1W9Frw-0003oS-Gd
2014-01-31 16:19:02 1W9Frw-0003oS-Gd SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [98.136.217.203]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html
2014-01-31 16:19:03 1W9Frw-0003oS-Gd SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [98.136.216.26]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html
2014-01-31 16:19:04 1W9Frw-0003oS-Gd SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [66.196.118.36]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html
2014-01-31 16:19:06 1W9Frw-0003oS-Gd SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [98.138.112.33]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html
2014-01-31 16:19:07 1W9Frw-0003oS-Gd SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [66.196.118.35]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html
2014-01-31 16:19:07 1W9Frw-0003oS-Gd == [email protected] R=lookuphost T=remote_smtp defer (-45): SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1866: Host mta6.am0.yahoodns.net [66.196.118.35]: 421 4.7.1 [TS03] All messages from 141.138.199.65 will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html

bash-3.2# cat /var/log/exim/mainlog | grep 1W9Frg-0003mP-S6
2014-01-31 16:18:44 1W9Frg-0003mP-S6 <= [email protected] U=instijl P=local S=814 T="call me" from <[email protected]> for [email protected]
2014-01-31 16:18:44 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1W9Frg-0003mP-S6
2014-01-31 16:18:45 1W9Frg-0003mP-S6 => [email protected] F=<[email protected]> R=lookuphost T=remote_smtp S=837 H=mx-ha03.web.de [213.165.67.104] X=TLSv1:AES256-SHA:256 C="250 Requested mail action okay, completed: id=0Le6s0-1VUM4v1jno-00pvEX"
2014-01-31 16:18:45 1W9Frg-0003mP-S6 Completed
2
Tim Baas

トラブルシューティング手順の概要

/ var/log/exim/mainlogの抜粋から表示される "U = instijl"は、メールを送信しているものはすべてユーザーとして実行されていることを示しています- instijl。まず、ユーザーがシェルでログインしているかどうかを確認します。 2番目に'ps aux'を使用して、そのユーザーが実行しているプロセスがあるかどうかを確認します。 3番目に、Apacheアクセスログを調べて、上記の4つのメールと同時にApacheに送信されているトラフィックを確認します。悪用されている安全でない「フィードバックを送信」フォームがあると思われます(着信httpリクエストで送信者、受信者、メッセージ本文を設定できるため、安全ではありません)。

この要求を処理および受け入れている仮想ホストに独自のアクセスログエントリがない場合、一般アクセスログには記録されません(これはおそらくあなたが見つけたものです)。そのユーザーの要求に応答している特定のセクションを見つけて、アクセスログエントリを追加します(または、すでにログに記録されている場合は、ファイル名を確認します)。 'httpd -S'を実行すると、Apacheは基本的な仮想ホスト構成を出力して、そのセクションが制御/構成されている構成ファイルの場所をより簡単に見つけられるようにします。

もう1つできることは、'yum install ngrep'(epelなどの外部リポジトリにある可能性があります)を実行して'ngrep -n -q port 80'を実行し、トラフィックを確認することです。着信要求のみを表示するより具体的なコマンドは、"ngrep -q -s 240'GET | POST 'port 80"です。リクエストの大部分を表示する場合は240を上下に調整し、リクエスト全体を表示する場合は省略します。

2
Todd Lyons