ADC

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 configures 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. The protection works only when you disable theExcludeFileUploadFormChecksoption 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 the security check, WAF inspects the request payload and validates the file type (based on magic signature numbers).
  • 如果文件类型不受支持的格式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.

Configure file type upload by using Citrix ADC CLI

To configure allowable file formats, the appliance uses a WAF profile that is bound to the file upload parameters.

  1. Configure Web Application Firewall profile

At the command prompt, type:

set appfw profile [-fileUploadTypesAction ] = ( none | block | log | stats )

Example

set appfw profile profile1 –fileUploadTypesAction block

  1. Bind Web Application Firewall profile with file upload parameters. The command binds the specified exemption (relaxation) or rule to the specified application firewall profile.

At the command prompt, type:

bind appfw profile - fileUploadType [-isNameRegex ( REGEX | NOTREGEX )] -fileType ( pdf | msdoc | text | image | any)

Note:

The form field name is a regular expression type. The default value isNOTREGEX.

Example

> bind appfw profile test -fileuploadType file "http://10.10.10.10/fileupload_sample/upload.php" -isNameRegex NOTREGEX -filetype image

Configure file upload security protection by using Citrix ADC GUI

  1. In the navigation pane, navigate toSecurity>Citrix Web App Firewall>Profiles.
  2. In theProfilespage, clickAdd.
  3. In theCitrix Web App Firewall Profilepage, clickSecurity ChecksunderAdvanced Settings.
  4. In theSecurity Checkssection, selectFile Upload Typesand clickAction Settings.

    Configuring file upload security settings

  5. In theFile Upload Types Settingspage, set the file upload action.
  6. ClickOK.

    Configuring file upload security settings

  7. In theCitrix Web App Firewall Profilepage, clickOKandDone.

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.

Note:

The file upload validation fails if theFile Upload Types Rexalation Ruleis not enabled.

Perform the following procedure to create a relaxation rule.

  1. In the navigation pane, navigate toSecurity>Citrix Web App Firewall>Profiles.
  2. In theProfilespage, clickAdd.
  3. In theCitrix Web App Firewall Profilepage, clickRelaxation RulesunderAdvanced Settings.
  4. In theRelaxation Rulessection, selectFile Upload Typesand clickEdit.

    Configuring file upload security settings

  5. In theFile Upload Types Rexalation Rulespage, clickAdd.
  6. In theFile Upload Types Relaxation Rulepage, set the following parameters:

    1. Enabled - Select to enable the relaxation rule.
    2. Is Form Field Name Regex - Select to update a regex pattern for the form field name.
    3. Form Field Name - Enter the file name that does not require a security check.
    4. Action URL - The form submission URL that must be exempted from security checks.
    5. File Type - Supported file format that can be uploaded.
    6. Comments - A brief description about the file upload.
  7. ClickCreate.

    Configuring file upload security settings

  8. In theCitrix Web App Firewall Profilepage, clickOKandDone.

    Configuring file upload security settings

File upload protection