phpmailer 是許多套件採用的 PHP 類別, 用來提供傳遞電子郵件的功能。
phpmailer 在 sendmail_send 函式的處理有 bug,可造成執行任意程式碼的漏洞。
修補方法: 利用 escapeshellcmd 和 escapeshellarg 做安全過濾。
方法一: 自行手動修改
XOOPS 2.0.x 的使用者,請編輯 class/mail/phpmailer/class.phpmailer.php
把:
function SendmailSend($header, $body) {
if ($this->Sender != "")
$sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
else
$sendmail = sprintf("%s -oi -t", $this->Sendmail);
function SendmailSend($header, $body) {
if ($this->Sender != "")
$sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
else
$sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
XOOPS 2.2.x 的使用者,請編輯 class/mail/phpmailer/class.phpmailer.php
把:
function sendmail_send($header, $body) {
if ($this->Sender != "")
$sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
else
$sendmail = sprintf("%s -oi -t", $this->Sendmail);
改成:
function sendmail_send($header, $body) {
if ($this->Sender != "")
$sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
else
$sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
====
方法二:
或者把以下的修正檔放入 class/mail/phpmailer 目錄中, 解壓覆蓋掉 class.phpmailer.php
XOOPS 2.0.x 的使用者,請下載:
http://xoops.tnc.edu.tw/uploads/xoops-2.0-phpmailer-class.zipXOOPS 2.2.x 的使用者,請下載:
http://xoops.tnc.edu.tw/uploads/xoops-2.2-phpmailer-class.zip消息來源:
http://h.root.tw/modules/news/article.php?storyid=40