aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorSteve Freegard <steve@abusix.com>2019-06-29 00:30:17 +0100
committerSteve Freegard <steve@abusix.com>2019-06-29 00:30:17 +0100
commit63c45fc5aa22f95b2e68a138f3045d43dc9a9347 (patch)
treeb49d8b57230fd34911206b5304e23a074c9acf7b /rules
parent648b027ccac1448659ede3224f66b356adfadd95 (diff)
downloadrspamd-63c45fc5aa22f95b2e68a138f3045d43dc9a9347.tar.gz
rspamd-63c45fc5aa22f95b2e68a138f3045d43dc9a9347.zip
Add MIME_BASE64_TEXT_BOGUS rule
Diffstat (limited to 'rules')
-rw-r--r--rules/headers_checks.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua
index d8e4b5903..0874d889f 100644
--- a/rules/headers_checks.lua
+++ b/rules/headers_checks.lua
@@ -1064,6 +1064,26 @@ rspamd_config.MIME_BASE64_TEXT = {
type = 'mime',
}
+rspamd_config.MIME_BASE64_TEXT_BOGUS = {
+ callback = function(task)
+ local parts = task:get_text_parts()
+ if (not parts) then return false end
+ -- Check each part and look for base64 encoded text parts
+ -- where the part does not have any 8bit characters within it
+ for _, part in ipairs(parts) do
+ local mimepart = part:get_mimepart();
+ if (check_for_base64_text(mimepart) and not part:has_8bit()) then
+ return true
+ end
+ end
+ return false
+ end,
+ description = 'Has text part encoded in base64 that does not contain any 8bit characters',
+ score = 1.0,
+ group = 'headers',
+ type = 'mime',
+}
+
local function is_8bit_addr(addr)
if addr.flags and addr.flags['8bit'] then
return true