New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tighten rspamd's attachment policy #4656
Tighten rspamd's attachment policy #4656
Conversation
This avoids confusion and enqueries to the rspamd project, if it is made clear that the decision to score certain attachments high has been incorporated from a well-known third party, such as Google's or Microsoft's attachment handling policy.
These are as follows: - htc: HTML Component File - pyc: Compiled Python Script - pyo: Optimized Compiled Python Module - pyw: Python Script To Be Executed With Suppressed Terminal Window - pyz: Python Zip Application - pyzw: Python Zip Application - vhd: Virtual Hard Disk - vhdx: Virtual Hard Disk Extended - wsf: Windows Script File Note that the Python file types remain unscored in archives, so distribution of these in source tarballs and the like is not affected by this commit. Source: https://support.microsoft.com/en-us/office/blocked-attachments-in-outlook-434752e1-02d3-4e90-9124-8b81e49a8519?ui=en-us&rs=en-us&ad=us
These are already banned in most environments, including GMail and Outlook. We may as well bump this score up to 4 eventually.
- app: Executable Application, blocked in Outlook by default - aspx: Active Server Page Extended, blocked in Outlook by default - dll: Dynamic-link Library - dqy: Microsoft Query File, blocking recommended in MS365 - iqy: ditto - mht: MHTML File, often abused for phishing and exploit attempts - mhtml: ditto - oqy: Microsoft Query File, blocking recommended in MS365 - rqy: ditto - slk: Microsoft Symbolic Link - wim: Windows Imaging Format
src/plugins/lua/mime_types.lua
Outdated
@@ -53,7 +53,7 @@ local settings = { | |||
|
|||
bad_extensions = { | |||
cue = 2, | |||
exe = 1, | |||
exe = 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO 2 is too much for default configuration as it will affect some legitimate messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I just reverted the offending commit.
src/plugins/lua/mime_types.lua
Outdated
-- In contrast to HTML MIME parts, dedicated HTML attachments are considered harmful | ||
htm = 1, | ||
html = 1, | ||
shtm = 1, | ||
shtml = 1, | ||
-- Have you ever seen that in legit email? | ||
ace = 4, | ||
app = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already listed.
+ luacheck -q --no-color .
Checking src/plugins/lua/mime_types.lua 1 warning
src/plugins/lua/mime_types.lua:66:5: (W314) value assigned to field 'app' is overwritten on line 110 before use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grr, my bad. Fixed, thank you!
This merge request seeks to clean up the current list of bad attachments in order to make it clear that these decision have been incorporated from third parties whenever possible, adds a couple of additional bad attachment types from Microsoft's Outlook attachment handling policy, as well as a couple of attachment types never observed in legitimate e-mails.
The latter was triggered by a recent onslaught in phishing e-mails leveraging MHTML.