Giter Site home page Giter Site logo

hartl3y94 / macromilter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sbidy/macromilter

0.0 0.0 0.0 2 MB

This python based milter (mail-filter) checks an incoming mail for suspicious VBA macro code in MS 20xx Office attachments (doc, xls, ppt ...).

License: MIT License

Python 88.01% Shell 11.99%

macromilter's Introduction

Version 3.6.1

Build Status

Changelog 3.6.1:

  • Fix for tmp filehandle error
  • Add new config option for dumping the mail body for forensics

Changelog 3.6:

  • fixing multiple issues and bugs (#41 , #38, #37, #35, #31, #30)
  • Add MIME header for the different stages.
  • The hash db is updated to SHA256 instead of MD5. Old MD5 hashes still supported.

Contributing

I need some code review and help to make this milter better! If you find some bugs or the code is "creepy" -> feel free to contribute :) To contribute, please fork this repository and make pull requests to the master or testing branch.

Branches

master = production grade and tested implementation

testing = only for testing and non-prod. environments

Abstract

This python based milter for the Sendmail and Postfix e-mail servers (mail-filter) checks an incoming mail for MS 20xx Office attachments. If a MS Office file is attached to the mail it will be scanned for suspicious VBA macro code. Documents with malicious macros are removed and replaced by harmless text files or will be rejected to the sender (see config.ini).

Supported Office formats:

  • Word 97-2003 (.doc, .dot), Word 2007+ (.docm, .dotm)
  • Excel 97-2003 (.xls), Excel 2007+ (.xlsm, .xlsb)
  • PowerPoint 97-2003 (.ppt), PowerPoint 2007+ (.pptm, .ppsm)
  • Word 2003 XML (.xml)
  • Word/Excel Single File Web Page / MHTML (.mht)
  • Publisher (.pub)

Paper (german only) -> download link

Video / Talk (german only) -> HdM-events

Chemnitzer Linux Tage 2018 - Talk -> CLT2018

The repo is optimized for Visual Studio

Features

  • Parsing VBA macros for suspicious code and function calls
  • Uses the milter interface at postfix and sendmail
  • Easy to implement
  • Not based on virus heuristics (high detection rate)
  • Whitelisting
  • Creates a hashtable for already scanned files (prevents rescans)
  • Runs at the pre-queue at postfix

Dependencies

This milter use the functionality from the oletools (https://bitbucket.org/decalage/oletools) and pymilter (https://pythonhosted.org/milter/) projects.

Installation

Debian and Ubuntu

Download the "install_ubuntu.sh" script from the repo - install_ubuntu.sh. It creates and downloads all required files and packages. Please use for Ubunut 14.10 and higher the "old" systemd script part! For 14.0x and older please use the upstart part!

Fedora

dnf install macromilter
systemctl enable --now macromilter.service

postconf -e smtpd_milters=inet:127.0.0.1:3690 milter_default_action=accept
systemctl reload postfix.service

Red Hat Enterprise Linux and CentOS

yum install epel-release  # Only if EPEL is not already enabled

yum install macromilter
systemctl enable --now macromilter.service

postconf -e smtpd_milters=inet:127.0.0.1:3690 milter_default_action=accept
systemctl reload postfix.service

User whitelist

To allow a user or whole domain to send false-positive VAB-Macro-Mails, enter only the user mail address ([email protected]) or the domain (@domain.com). See config.ini for more details.

Macro whitelist

To allow only a special and wellknown macro code, add the SHA256 hash to the Macrohash part in the configuration file. You will find the raw macro hash in the macromilter log file INFO [ID] The macro hash is: <the sha256 value>. Please use only this one! Keep in mind, that the file hash has also to be deleted form the "hashdatabse".

TBD

  • Config-File error handling
  • HTML-Dashboard
  • Setup-package for pip

Authors

Stephan Traub - Sbidy -> https://github.com/sbidy

Robert Scheck - robert-scheck -> https://www.robert-scheck.de/

Credits

Philippe Lagadec https://github.com/decalage2 - oletools

Stuart D. Gathman https://github.com/sdgathman - pymilter

License

The MIT License (MIT)

macromilter's People

Contributors

gulaschcowboy avatar heinrichheine avatar robert-scheck avatar sbidy avatar selvanair avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.