Blocking Upload of Webmail Attachments using Application Firewall
03/26/2020 34 11892
This article describes the method to block uploading of email attachements in webmail. This method uses the HTTP Request Custom Header option in Application Firewall Objects. HTTP Request Custom Header field allows users to configure HTTP request headers and their respective values for Application Firewall to filter traffic. For more info on HTTP Headers refer RFC 2616.
The method we use here is the HTTP Request header "Content-Disposition". The Content-Disposition header field contains the disposition-type and disposition-parm (parameter). The following screen-capture shows the wireshark capture of a webmail attachment upload in gmail.com.
NOTE: Although the solution described here has been tested, there is a possibility that it may affect traffic other than webmail. Client DPI-SSL required, if using HTTPS.
Here's how to block the upload of email attachements in webmail:
- Login to the SonicWall Management GUI.
- Go to Firewall > Match Objects.
- In SonicOS Versions earlier than 22.214.171.124, this menu is located under Application Firewall > Application Objects.
- Click on Add New Object and enter the following information:
- Object Name: Attachment
- Match Object Type: HTTP Request Custom Header
- Custom Header Name: Content-Disposition
- Match Type: Partial Match
- Input Representation: Alphanumeric
- Content: filename=
- Go to Firewall > App Rules.
- Check the box under Enable App Rules.
- Click on Add New Policy and create the following policy:
- Policy Name: Block Attachment
- Policy Type: HTTP Client
- Service: HTTP
- Match Object: Attachment
- Action Object: Reset/Drop
- Connection Side: Client Side
- Direction: Basic, Both
How to Test:
From a workstation behind the SonicWall, log into webmail. Try to upload an attachment. Check SonicWall logs and you will find logs similar to the one below.