File upload protection
Many attackers try to upload malicious code, virus, or malware as file attachments during multi-form submission. It is important to protect our network and overcome such threats. To prevent such malicious file uploads, a Citrix ADC admin can now configure a set of allowable file upload formats in the WAF profile. By doing this, you restrict file uploads to specific formats and protect the appliance against malicious file uploads. But, the protection works only when you disable the “ExcludeFileUploadFormChecks” option in the WAF profile.
How file upload works
When you configure allowable file upload formats, the component interaction is as follows:
- Client request has a form submission with a file upload type, for example PDF.
- As part of security check, WAF inspects the request payload and validates the file type (based on magic signature numbers).
- If the file type is an allowable file format, the corresponding action based on file type binding is applied.
- To validate the file type the appliance inspects the payload and checks for the known magic numbers at known offsets. Each file type has a sequence of magic numbers that validates the file type.
- Only if the validation passes, WAF identifies the file as an allowable format and the associated action is applied.
Configure file type upload by using Citrix ADC CLI
To configure allowable file formats, the appliance uses a WAF profile that is bound to file upload parameters.
- Configure Web Application Firewall profile
To configure a web application firewall profile, type the following:
set appfw profile <profile_name> [-fileUploadTypesAction <fileUploadTypesAction>]<fileUploadTypesAction> = ( none | block | log | stats )
Example
set appfw profile profile1 –fileUploadTypesAction block
- Bind Web Application Firewall profile with file upload parameters. The command binds the specified exemption (relaxation) or rule to the specified application firewall profile.
To bind a profile with file upload parameters, type the following:
bind appfw profile <profile_name> - fileUploadType <form_field > <form_action_url> -fileType <fileType> ( pdf | msdoc | text | image | any)
Configure file upload security protection by using Citrix ADC GUI
Follow the procedure below to set the file upload settings.
- In the navigation pane, navigate to Security > Profiles.
- In the Profiles page, click Add.
- In the Citrix Web App Firewall Profile page, click Security Checks under Advanced Settings.
-
In the Security Checks section, go to File Upload Types settings.
- Select the check box and click Action Settings.
- In the File Upload Types Settings page, set the file upload action.
- Click OK.
-
In the Citrix Web App Firewall Profile page, click OK and Done.
Configure file upload relaxation rule by using Citrix ADC GUI
You can relax a file upload security protection to avoid false positives. For example, the appliance might block file uploads but you can add a relaxation rule to allow file uploads from specific websites. By doing this, the appliance bypasses security inspection for the specified form field and allow users to upload files from the website mentioned in the action URL.
Follow the procedure below to create a relaxation rule.
- In the navigation pane, navigate to Security > Citrix Web App Firewall < Profiles.
- In the Profiles page, click Add.
- In the Citrix Web App Firewall Profile page, click Relaxation Rules under Advanced Settings.
-
In the Relaxation Rules section, select File Upload Types and click Edit.
- In the File Upload Types Rexalation Rules page, click Add.
-
In the File Upload Types Relaxation Rule page, set the following parameters:
- Enabled. Select this check box to enable the relaxation rule.
- Form Field Name. Enter the field name that does not require security check.
- Action URL. The form submission URL that must be exempted from security check.
- File Type. File type that must be allowed for the user to upload.
- Comments. A brief description about the file upload.
-
Click Create.
-
In the Citrix Web App Firewall Profile page, click OK and Done.