[security]KVE-2026-0676 폼메일 발신자 위장 및 Rate Limit 우회 수정

비회원 폼메일 발송 시 From 헤더를 관리자 이메일로 고정하고 사용자 입력은 Reply-To로 설정
formmail_send.php에 세션 기반 발송 횟수 제한 추가 (직접 POST 우회 방지)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
thisgun
2026-04-16 03:18:19 +00:00
co-authored by Claude Opus 4.6
parent 614b040960
commit df940f8168
2 changed files with 23 additions and 4 deletions
+20 -3
View File
@@ -9,6 +9,13 @@ if (!$config['cf_email_use'])
if (!$is_member && $config['cf_formmail_is_member'])
alert_close('회원만 이용하실 수 있습니다.');
// 발송 횟수 제한 (직접 POST 우회 방지)
$sendmail_count = (int)get_session('ss_sendmail_count') + 1;
set_session('ss_sendmail_count', $sendmail_count);
if ($sendmail_count > 3) {
alert_close('폼메일 발송 횟수를 초과하였습니다.');
}
$email_enc = new str_encrypt();
$to = $email_enc->decrypt($to);
@@ -40,13 +47,23 @@ if ($type) {
else
$mail_content = $content;
// 환경설정에서 폼메일 사용 여부가 회원만 사용에 체크되어 있으면
if ($config['cf_formmail_is_member']) {
// 발신자 정보 서버측 강제 설정
$reply_to_email = '';
if ($is_member) {
$fnick = (isset($member['mb_nick']) && $member['mb_nick']) ? $member['mb_nick'] : $member['mb_name'];
$fmail = $member['mb_email'];
} else {
// 비회원: From을 관리자 이메일로 고정 (발신자 위장 방지)
// 비회원이 입력한 이메일은 Reply-To로 설정하여 회신 기능 유지
$user_email = get_email_address(trim($fmail));
$fnick = strip_tags(trim($fnick));
$fmail = $config['cf_admin_email'];
if ($user_email) {
$reply_to_email = $user_email;
}
}
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file);
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file, '', '', $reply_to_email);
// 임시 첨부파일 삭제
if(!empty($file)) {
+3 -1
View File
@@ -5,7 +5,7 @@ include_once(G5_PHPMAILER_PATH.'/PHPMailerAutoload.php');
// 메일 보내기 (파일 여러개 첨부 가능)
// type : text=0, html=1, text+html=2
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="", $reply_to="")
{
global $config;
global $g5;
@@ -43,6 +43,8 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc=
$mail->addCC($cc);
if ($bcc)
$mail->addBCC($bcc);
if ($reply_to)
$mail->addReplyTo($reply_to);
//print_r2($file); exit;
if ($file != "") {
foreach ($file as $f) {