diff options
-rw-r--r-- | rules/misc.lua | 19 | ||||
-rw-r--r-- | rules/regexp/misc.lua | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/rules/misc.lua b/rules/misc.lua index 1e587d093..4363d037f 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -456,15 +456,22 @@ rspamd_config.SPOOF_REPLYTO = { -- First check for a Reply-To header local rt = task:get_header('Reply-To') if not rt then return false end - -- Get From header domain - local fromdom = ((task:get_from(2) or E)[1] or E).domain - if not fromdom then return false end + -- Get From and To headers + local from = task:get_from(2) + local to = task:get_recipients(2) + if not (from and from[1] and from[1].addr) then return false end + if (to and to[1] and to[1].addr) then + -- Handle common case for Web Contact forms of From = To + if util.strequal_caseless(from[1].addr, to[1].addr) then + return false + end + end -- SMTP recipients must contain From domain local to = task:get_recipients(1) if not to then return false end local found_fromdom = false for _, t in ipairs(to) do - if util.strequal_caseless(t.domain, fromdom) then + if util.strequal_caseless(t.domain, from[1].domain) then found_fromdom = true break end @@ -474,8 +481,8 @@ rspamd_config.SPOOF_REPLYTO = { local parsed = ((util.parse_mail_address(rt) or E)[1] or E).domain if not parsed then return false end -- Reply-To domain must be different to From domain - if not util.strequal_caseless(parsed, fromdom) then - return true, fromdom, parsed + if not util.strequal_caseless(parsed, from[1].domain) then + return true, from[1].domain, parsed end return false end, diff --git a/rules/regexp/misc.lua b/rules/regexp/misc.lua index 5f5b437b6..2da59ef7f 100644 --- a/rules/regexp/misc.lua +++ b/rules/regexp/misc.lua @@ -41,7 +41,7 @@ reconf['DATA_URI_OBFU'] = { } reconf['INTRODUCTION'] = { - re = '/\\b(?:my name is\\b|(?:i am|this is)\\s+(?:mr|mrs|ms|miss|master|sir|prof(?:essor)?|d(?:octo)?r|rev(?:erend)?)(\.|\\b))/{sa_body}i', + re = '/\\b(?:my name is\\b|(?:i am|this is)\\s+(?:mr|mrs|ms|miss|master|sir|prof(?:essor)?|d(?:octo)?r|rev(?:erend)?)(?:\\.|\\b))/{sa_body}i', description = "Sender introduces themselves", score = 2.0, group = 'scams' |