-
Notifications
You must be signed in to change notification settings - Fork 14
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
New ZIP walk leaks content of nested ZIP files to /tmp #31
Comments
See the tempfile module to create temporary files more securely, and to clean up afterwards: |
Now the I put a note to the backlog to re-implement this function in a later release. But the actual implementation works as expected (for zip archives). I'm open for some suggestions or implementation ideas 😉 . |
I am sorry, but the actual implementation is securitywise still bad, given the 7b. Content is leaked to world readable |
OK, I didn't noticed that problem. |
I've updated the method with the MacroMilter/macromilter/macromilter.py Line 377 in 828ee30
|
I'm not a python guy…how does this work logically now? Reading documentation |
I used the Now, the |
implemented and released with 3.6 |
With 7d018ef, the new ZIP walk was introduced. Unfortunately it also leaks the content of nested ZIP files to
/tmp
directory – world readable by default. Reproducer:cd MacroMilter/test_mails/
zip test1.zip zipwithinfectedandnotinfectedword.zip
zip test2.zip test1.zip
zip test3.zip test2.zip
zip test4.zip test3.zip
zip test5.zip test4.zip
zip test6.zip test5.zip
ls -l /tmp/*.zip
From my point of view, MacroMilter should in any case clean up afterwards and it should not directly use
/tmp
, but a collision-free directory. Hardcoding e.g./tmp/macromilter
might lead to new issues (a local user could create that directory with modified permissions to gain the content), thus I would suggest something like either/var/lib/macromilter/tmp
(similar like amavisd-new does) or the usage of something similar likemktemp
(but in Python), while still applying more restrictive directory permissions.A regular user might mitigate this issue by setting in
/usr/lib/systemd/system/macromilter.service
e.g.which however still keeps the extracted files until logrotate (while nested ZIP files are hopefully not that common).
The text was updated successfully, but these errors were encountered: