commit 63c45fc: Add MIME_BASE64_TEXT_BOGUS rule

Steve Freegard steve at abusix.com
Wed Jul 3 13:14:03 UTC 2019


Author: Steve Freegard
Date: 2019-06-29 00:30:17 +0100
URL: https://github.com/rspamd/rspamd/commit/63c45fc5aa22f95b2e68a138f3045d43dc9a9347

Add MIME_BASE64_TEXT_BOGUS rule

---
 rules/headers_checks.lua | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

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


More information about the Commits mailing list