Fortinet Document Library

Version:

Version:


Table of Contents

Administration Guide

Download PDF
Copy Link

CIFS support

Antivirus scanning on Common Internet File System (CIFS) traffic is supported in flow-based and proxy-based inspection. The file filter profile handles the configuration of file filtering on CIFS. The antivirus profile handles the antivirus configuration for CIFS scanning.

File filtering for CIFS is performed by inspecting the first 4 KB of the file to identify the file's magic number. If a match occurs, CIFS file filtering prevents the CIFS command that contains that file from running. The file filter functions differently for un-encrypted and encrypted CIFS traffic:

  • For un-encrypted CIFS traffic, the standalone file filter works in flow and proxy mode.
  • For encrypted CIFS traffic, the CIFS profile must be enabled in the firewall policy because the SMB server’s credential settings are still be configured in CIFS profile. Using the standalone file filter only works in proxy mode.

For a CIFS profile to be available for assignment in a policy, the policy must use proxy inspection mode. See Proxy mode inspection for details. Note that in proxy inspection mode, special condition archive files (encrypted, corrupted, mailbomb, and so on) marked by the antivirus engine are blocked automatically.

Configure file-type filtering and antivirus scanning on CIFS traffic

To configure file-type filtering and antivirus scanning on CIFS traffic:
  1. Configure a CIFS domain controller
  2. Configure a CIFS profile
  3. Configure an antivirus profile

Configure a CIFS domain controller

The domain controller must be configured when CIFS traffic is encrypted. The configuration tells the FortiGate the network location of the domain controller and the superuser credentials.

To configure the CIFS domain controller:
config credential-store domain-controller
    edit "SERVER_NAME"
        set domain-name "EXAMPLE.COM"
        set username "admin-super"
        set password ENC 1mKKNo0z95t/+9B9IisyLsSfevTNRePp6mFk+dtDdZ7r2V8CYUrXp7kcxVauWpdHYlQsrY8g2Ypo+UYDsBUxELDpfLYC7C31rCm6WD0jYiRcQ/kZhWpwB5Dl3W7Z9865r/ntVu1YCsWex/+MnnMYyzFXaNJriXuPLYKEv2fe79NpmSuvouEMvc6zgPPBbXE+28SHzA==
        set ip 172.16.201.40
    next
end

Configure a CIFS profile

To create a CIFS profile, configure the server credential type and create a file filter profile.

Set the CIFS server credential type

The CIFS server credential type can be none, credential-replication, or credential-keytab.

none

The CIFS profile assumes the CIFS traffic is unencrypted. This is the default value.

config cifs profile
    edit "cifs"
        set server-credential-type none
    next
end
credential-replication

To decrypt CIFS traffic, FortiOS obtains the session key from the domain controller by logging in to the superuser account. The domain controller must be configured.

config cifs profile
    edit "cifs"
        set server-credential-type credential-replication
        set credential-store domain-controller "SERVER_NAME"
    next
end

Variable

Description

domain-controller <string>

The previously configured domain to decrypt CIFS traffic for.

credential-keytab

To decrypt CIFS traffic, FortiOS uses a series of keytab values. This method is used when the SMB connection is authenticated by Kerberos. Keytab entries must be configured, and are stored in FortiOS in plaintext.

config cifs profile
    edit "cifs"
        set server-credential-type credential-keytab
        config server-keytab
            edit "keytab1"
                set keytab "BQIAAABFAAEAC0VYQU1QTEUuQ09NAAdleGFtcGxlAAAAAVUmAlwBABIAILdV5P6NXT8RrTvapcMJQxDYCjRQiD0BzxhwS9h0VgyM"
            next
        end
    next
end

Variable

Description

keytab <keytab>

Base64 encoded keytab file containing the credentials of the server.

Configure CIFS file filtering

Multiple rules can be added to a file filter profile. See File filter.

To configure a file filter for CIFS traffic:
config file-filter profile
    edit "cifs"
        set comment "block zip files on unencrypted cifs traffic"
        set feature-set flow
        set replacemsg-group ''
        set log enable
        config rules
            edit "rule1"
                set protocol cifs
                set action block
                set direction any
                set password-protected any
                set file-type zip
            next
        end
    next
end

Variable

Description

comment <string>

A brief comment describing the entry.

feature-set {flow | proxy}

Flow or proxy mode feature set (default = flow).

replacemsg-group <string>

Replacement message group.

log {enable | disable}

Enable/disable file filter logging (default = enable).

scan-archive-contents [enable | disable]

Enable/disable scanning of archive contents (default = enable).

protocol {http ftp smtp imap pop3 mapi cifs ssh}

Filter based on the specified protocol(s).

action {log-only | block}

The action to take for matched files:

  • log-only: Allow the content and write a log message (default).
  • block: Block the content and write a log message.

direction {incoming | outgoing | any}

Match files transmitted in the session's originating (incoming) and/or reply (outgoing) direction (default = any).

password-protected [yes | any]

Match only password-protected files (yes) or any file (default = any).

file-type <file_type>

The file types to be matched. See Supported file types for details.

Configure an antivirus profile

The antivirus profile handles the antivirus configuration for CIFS scanning.

To configure an antivirus profile:
config antivirus profile
    edit "av"
        ...
        config cifs
            set options {scan avmonitor quarantine}
            set archive-block {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}
            set archive-log {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}
            set emulator {enable | disable}
            set outbreak-prevention {disabled | files | full-archive}
        end
    next
end

Variable

Description

options {scan avmonitor quarantine}

Enable/disable CIFS antivirus scanning, monitoring, and quarantine.

archive-block {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}

Select the archive types to block:

  • encrypted: Block encrypted archives.
  • corrupted: Block corrupted archives.
  • partiallycorrupted: Block partially corrupted archives.
  • multipart: Block multipart archives.
  • nested: Block nested archives.
  • mailbomb: Block mail bomb archives.
  • fileslimit: Block exceeded archive files limit.
  • timeout: Block scan timeout.
  • unhandled: Block archives that FortiOS cannot open.
archive-log {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}

Select the archive types to log:

  • encrypted: Log encrypted archives.
  • corrupted: Log corrupted archives.
  • partiallycorrupted: Log partially corrupted archives.
  • multipart: Log multipart archives.
  • nested: Log nested archives.
  • mailbomb: Log mail bomb archives.
  • fileslimit: Log exceeded archive files limit.
  • timeout: Log scan timeout.
  • unhandled: Log archives that FortiOS cannot open.

emulator {enable | disable}

Enable/disable the virus emulator (default = enable).
outbreak-prevention {disabled | files | full-archive}

Enable the virus outbreak prevention service:

  • disabled: Disabled (default).
  • files: Analyze files as sent, not the content of archives.
  • full-archive: Analyze files, including the content of archives.

Log samples

File-type detection events generated by CIFS profiles are logged in the utm-cifs log category. Antivirus detection over the CIFS protocol generates logs in the utm-virus category. See the FortiOS Log Message Reference for more information.

Logs generated by CIFS profile file filter:
date=2019-03-28 time=10:39:19 logid="1800063001" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="notice" vd="vdom1" eventtime=1553794757 msg="File was detected by file filter." direction="incoming" action="passthrough" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33372 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="1154" filename="virus\\test.png" filtername="2" filetype="png"
date=2019-03-28 time=10:39:12 logid="1800063001" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="notice" vd="vdom1" eventtime=1553794751 msg="File was detected by file filter." direction="incoming" action="passthrough" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33370 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="81975" filename="virus\\screen.png" filtername="2" filetype="png"
date=2019-03-28 time=10:33:55 logid="1800063000" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="warning" vd="vdom1" eventtime=1553794434 msg="File was blocked by file filter." direction="incoming" action="blocked" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33352 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="28432" filename="filetypes\\mpnotify.exe" filtername="3" filetype="exe"
date=2019-03-28 time=10:33:45 logid="1800063000" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="warning" vd="vdom1" eventtime=1553794424 msg="File was blocked by file filter." direction="incoming" action="blocked" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33348 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="96528" filename="filetypes\\winmine.exe" filtername="3" filetype="exe"
Logs generated by AV profile for infections detected over CIFS:
date=2019-04-09 time=15:19:02 logid="0204008202" type="utm" subtype="virus" eventtype="outbreak-prevention" level="warning" vd="vdom1" eventtime=1554848342519005401 msg="Blocked by Virus Outbreak Prevention service." action="blocked" service="SMB" sessionid=177 srcip=10.1.100.11 dstip=172.16.200.44 srcport=37444 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=6 direction="incoming" filename="outbreak\\zhvo_test.com" quarskip="File-was-not-quarantined." virus="503e99fe40ee120c45bc9a30835e7256fff3e46a" dtype="File Hash" filehash="503e99fe40ee120c45bc9a30835e7256fff3e46a" filehashsrc="fortiguard" profile="av" analyticssubmit="false" crscore=50 craction=2 crlevel="critical"
date=2019-04-09 time=15:18:59 logid="0211008192" type="utm" subtype="virus" eventtype="infected" level="warning" vd="vdom1" eventtime=1554848339909808987 msg="File is infected." action="blocked" service="SMB" sessionid=174 srcip=10.1.100.11 dstip=172.16.200.44 srcport=37442 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=6 direction="incoming" filename="sample\\eicar.com" quarskip="File-was-not-quarantined." virus="EICAR_TEST_FILE" dtype="Virus" ref="http://www.fortinet.com/ve?vn=EICAR_TEST_FILE" virusid=2172 profile="av" analyticscksum="275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" analyticssubmit="false" crscore=50 craction=2 crlevel="critical"

CIFS support

Antivirus scanning on Common Internet File System (CIFS) traffic is supported in flow-based and proxy-based inspection. The file filter profile handles the configuration of file filtering on CIFS. The antivirus profile handles the antivirus configuration for CIFS scanning.

File filtering for CIFS is performed by inspecting the first 4 KB of the file to identify the file's magic number. If a match occurs, CIFS file filtering prevents the CIFS command that contains that file from running. The file filter functions differently for un-encrypted and encrypted CIFS traffic:

  • For un-encrypted CIFS traffic, the standalone file filter works in flow and proxy mode.
  • For encrypted CIFS traffic, the CIFS profile must be enabled in the firewall policy because the SMB server’s credential settings are still be configured in CIFS profile. Using the standalone file filter only works in proxy mode.

For a CIFS profile to be available for assignment in a policy, the policy must use proxy inspection mode. See Proxy mode inspection for details. Note that in proxy inspection mode, special condition archive files (encrypted, corrupted, mailbomb, and so on) marked by the antivirus engine are blocked automatically.

Configure file-type filtering and antivirus scanning on CIFS traffic

To configure file-type filtering and antivirus scanning on CIFS traffic:
  1. Configure a CIFS domain controller
  2. Configure a CIFS profile
  3. Configure an antivirus profile

Configure a CIFS domain controller

The domain controller must be configured when CIFS traffic is encrypted. The configuration tells the FortiGate the network location of the domain controller and the superuser credentials.

To configure the CIFS domain controller:
config credential-store domain-controller
    edit "SERVER_NAME"
        set domain-name "EXAMPLE.COM"
        set username "admin-super"
        set password ENC 1mKKNo0z95t/+9B9IisyLsSfevTNRePp6mFk+dtDdZ7r2V8CYUrXp7kcxVauWpdHYlQsrY8g2Ypo+UYDsBUxELDpfLYC7C31rCm6WD0jYiRcQ/kZhWpwB5Dl3W7Z9865r/ntVu1YCsWex/+MnnMYyzFXaNJriXuPLYKEv2fe79NpmSuvouEMvc6zgPPBbXE+28SHzA==
        set ip 172.16.201.40
    next
end

Configure a CIFS profile

To create a CIFS profile, configure the server credential type and create a file filter profile.

Set the CIFS server credential type

The CIFS server credential type can be none, credential-replication, or credential-keytab.

none

The CIFS profile assumes the CIFS traffic is unencrypted. This is the default value.

config cifs profile
    edit "cifs"
        set server-credential-type none
    next
end
credential-replication

To decrypt CIFS traffic, FortiOS obtains the session key from the domain controller by logging in to the superuser account. The domain controller must be configured.

config cifs profile
    edit "cifs"
        set server-credential-type credential-replication
        set credential-store domain-controller "SERVER_NAME"
    next
end

Variable

Description

domain-controller <string>

The previously configured domain to decrypt CIFS traffic for.

credential-keytab

To decrypt CIFS traffic, FortiOS uses a series of keytab values. This method is used when the SMB connection is authenticated by Kerberos. Keytab entries must be configured, and are stored in FortiOS in plaintext.

config cifs profile
    edit "cifs"
        set server-credential-type credential-keytab
        config server-keytab
            edit "keytab1"
                set keytab "BQIAAABFAAEAC0VYQU1QTEUuQ09NAAdleGFtcGxlAAAAAVUmAlwBABIAILdV5P6NXT8RrTvapcMJQxDYCjRQiD0BzxhwS9h0VgyM"
            next
        end
    next
end

Variable

Description

keytab <keytab>

Base64 encoded keytab file containing the credentials of the server.

Configure CIFS file filtering

Multiple rules can be added to a file filter profile. See File filter.

To configure a file filter for CIFS traffic:
config file-filter profile
    edit "cifs"
        set comment "block zip files on unencrypted cifs traffic"
        set feature-set flow
        set replacemsg-group ''
        set log enable
        config rules
            edit "rule1"
                set protocol cifs
                set action block
                set direction any
                set password-protected any
                set file-type zip
            next
        end
    next
end

Variable

Description

comment <string>

A brief comment describing the entry.

feature-set {flow | proxy}

Flow or proxy mode feature set (default = flow).

replacemsg-group <string>

Replacement message group.

log {enable | disable}

Enable/disable file filter logging (default = enable).

scan-archive-contents [enable | disable]

Enable/disable scanning of archive contents (default = enable).

protocol {http ftp smtp imap pop3 mapi cifs ssh}

Filter based on the specified protocol(s).

action {log-only | block}

The action to take for matched files:

  • log-only: Allow the content and write a log message (default).
  • block: Block the content and write a log message.

direction {incoming | outgoing | any}

Match files transmitted in the session's originating (incoming) and/or reply (outgoing) direction (default = any).

password-protected [yes | any]

Match only password-protected files (yes) or any file (default = any).

file-type <file_type>

The file types to be matched. See Supported file types for details.

Configure an antivirus profile

The antivirus profile handles the antivirus configuration for CIFS scanning.

To configure an antivirus profile:
config antivirus profile
    edit "av"
        ...
        config cifs
            set options {scan avmonitor quarantine}
            set archive-block {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}
            set archive-log {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}
            set emulator {enable | disable}
            set outbreak-prevention {disabled | files | full-archive}
        end
    next
end

Variable

Description

options {scan avmonitor quarantine}

Enable/disable CIFS antivirus scanning, monitoring, and quarantine.

archive-block {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}

Select the archive types to block:

  • encrypted: Block encrypted archives.
  • corrupted: Block corrupted archives.
  • partiallycorrupted: Block partially corrupted archives.
  • multipart: Block multipart archives.
  • nested: Block nested archives.
  • mailbomb: Block mail bomb archives.
  • fileslimit: Block exceeded archive files limit.
  • timeout: Block scan timeout.
  • unhandled: Block archives that FortiOS cannot open.
archive-log {encrypted corrupted partiallycorrupted multipart nested mailbomb fileslimit timeout unhandled}

Select the archive types to log:

  • encrypted: Log encrypted archives.
  • corrupted: Log corrupted archives.
  • partiallycorrupted: Log partially corrupted archives.
  • multipart: Log multipart archives.
  • nested: Log nested archives.
  • mailbomb: Log mail bomb archives.
  • fileslimit: Log exceeded archive files limit.
  • timeout: Log scan timeout.
  • unhandled: Log archives that FortiOS cannot open.

emulator {enable | disable}

Enable/disable the virus emulator (default = enable).
outbreak-prevention {disabled | files | full-archive}

Enable the virus outbreak prevention service:

  • disabled: Disabled (default).
  • files: Analyze files as sent, not the content of archives.
  • full-archive: Analyze files, including the content of archives.

Log samples

File-type detection events generated by CIFS profiles are logged in the utm-cifs log category. Antivirus detection over the CIFS protocol generates logs in the utm-virus category. See the FortiOS Log Message Reference for more information.

Logs generated by CIFS profile file filter:
date=2019-03-28 time=10:39:19 logid="1800063001" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="notice" vd="vdom1" eventtime=1553794757 msg="File was detected by file filter." direction="incoming" action="passthrough" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33372 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="1154" filename="virus\\test.png" filtername="2" filetype="png"
date=2019-03-28 time=10:39:12 logid="1800063001" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="notice" vd="vdom1" eventtime=1553794751 msg="File was detected by file filter." direction="incoming" action="passthrough" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33370 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="81975" filename="virus\\screen.png" filtername="2" filetype="png"
date=2019-03-28 time=10:33:55 logid="1800063000" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="warning" vd="vdom1" eventtime=1553794434 msg="File was blocked by file filter." direction="incoming" action="blocked" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33352 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="28432" filename="filetypes\\mpnotify.exe" filtername="3" filetype="exe"
date=2019-03-28 time=10:33:45 logid="1800063000" type="utm" subtype="cifs" eventtype="cifs-filefilter" level="warning" vd="vdom1" eventtime=1553794424 msg="File was blocked by file filter." direction="incoming" action="blocked" service="CIFS" srcip=10.1.100.11 dstip=172.16.200.44 srcport=33348 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=16 profile="cifs" filesize="96528" filename="filetypes\\winmine.exe" filtername="3" filetype="exe"
Logs generated by AV profile for infections detected over CIFS:
date=2019-04-09 time=15:19:02 logid="0204008202" type="utm" subtype="virus" eventtype="outbreak-prevention" level="warning" vd="vdom1" eventtime=1554848342519005401 msg="Blocked by Virus Outbreak Prevention service." action="blocked" service="SMB" sessionid=177 srcip=10.1.100.11 dstip=172.16.200.44 srcport=37444 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=6 direction="incoming" filename="outbreak\\zhvo_test.com" quarskip="File-was-not-quarantined." virus="503e99fe40ee120c45bc9a30835e7256fff3e46a" dtype="File Hash" filehash="503e99fe40ee120c45bc9a30835e7256fff3e46a" filehashsrc="fortiguard" profile="av" analyticssubmit="false" crscore=50 craction=2 crlevel="critical"
date=2019-04-09 time=15:18:59 logid="0211008192" type="utm" subtype="virus" eventtype="infected" level="warning" vd="vdom1" eventtime=1554848339909808987 msg="File is infected." action="blocked" service="SMB" sessionid=174 srcip=10.1.100.11 dstip=172.16.200.44 srcport=37442 dstport=445 srcintf="wan2" srcintfrole="wan" dstintf="wan1" dstintfrole="wan" policyid=1 proto=6 direction="incoming" filename="sample\\eicar.com" quarskip="File-was-not-quarantined." virus="EICAR_TEST_FILE" dtype="Virus" ref="http://www.fortinet.com/ve?vn=EICAR_TEST_FILE" virusid=2172 profile="av" analyticscksum="275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" analyticssubmit="false" crscore=50 craction=2 crlevel="critical"