基于文件 Hash 的 AV 豁免
基于文件 Hash 的 AV 豁免
重要
该功能在 FortiOS 7.2.4 及以上版本支持。
网络需求
在反病毒功能的使用中,如果有安全的文件被反病毒功能误判并阻止,用户需要向 FortiGuard 提交误报信息,然后等待官方确认和修复,需要等待一定的时间。需要可以对误判文件进行豁免操作,以允许即时传输该文件。
功能介绍
FortiGate 允许对反病毒误判的文件进行豁免。用户可以指定文件的 MD5、SHA1 或 SHA256 哈希值进行匹配,当匹配 FortiGate AV 的白名单时,该文件会被 Bypass。
重要
豁免列表功能不适用于 Outbreak Prevention、Machine-Learning、FortiNDR 和 FortiSandbox inline scans。
配置方法
此功能仅支持在 CLI 下配置。
config antivirus exempt-list
edit <name>
set hash-type {md5 | sha1 | sha256}
set hash <string>
set status {enable | disable}
next
end配置步骤与配置验证
获取被误判文件的 Hash 值,这里以一个 Eicar 文件
csm-eicar.com为例,该文件的 MD5 值为44d88612fea8a8f36de82e1278abb02f,该文件位于www.csm-testcenter.org网站。按需在“安全配置文件 → 反病毒”页面中配置反病毒配置文件,这里以“default”配置文件为例。

在防火墙策略中引用该反病毒配置文件。
重要
FortiOS 7.2.X 版本需要防火墙策略的“检测模式”使用
proxy(基于代理)模式才能生效。FortiOS 7.4.X 版本的防火墙策略“检测模式”没有要求。
:::

config firewall policy edit 1 set name "LAN_to_Internet" set srcintf "internal5" set dstintf "virtual-wan-link" set action accept set srcaddr "all" set dstaddr "all" set schedule "always" set service "ALL" set utm-status enable set ssl-ssh-profile "certificate-inspection" set av-profile "default" set nat enable next end此时使用客户端 PC 使用 HTTP 穿过 FortiGate 下载该文件,下载失败。
root@Ubuntu # wget http://www.csm-testcenter.org/csm-eicar.com --2025-11-11 16:03:51-- http://www.csm-testcenter.org/csm-eicar.com 正在解析主机 www.csm-testcenter.org (www.csm-testcenter.org)... 85.215.35.144 正在连接 www.csm-testcenter.org (www.csm-testcenter.org)|85.215.35.144|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:68 [application/octet-stream] 正在保存至: “csm-eicar.com.1” csm-eicar.com.1 0%[ ] 0 --.-KB/s 用时 0s 2025-11-11 16:03:52 (0.00 B/s) - 在 0/68 字节处发生读取错误 (Connection reset by peer)。重试中。 --2025-11-11 16:03:53-- (尝试次数: 2) http://www.csm-testcenter.org/csm-eicar.com 正在连接 www.csm-testcenter.org (www.csm-testcenter.org)|85.215.35.144|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 403 Forbidden 2025-11-11 16:03:53 错误 403:Forbidden。该文件下载时被 FortiGate 的反病毒模块拦截,如下所示 AV 拦截日志。

date=2025-11-11 time=16:03:54 eventtime=1762848233896917415 tz="+0800" logid="0211008192" type="utm" subtype="virus" eventtype="infected" level="warning" vd="root" policyid=1 poluuid="7933a8ea-da0e-51ee-d747-443a0247aebe" policytype="policy" msg="File is infected." action="blocked" service="HTTP" sessionid=48151480 srcip=192.168.100.177 dstip=85.215.35.144 srcport=60122 dstport=80 srccountry="Reserved" dstcountry="Germany" srcintf="internal5" srcintfrole="undefined" dstintf="wan1" dstintfrole="undefined" srcuuid="477325da-a1dc-51ed-ecdd-9add8d1533e2" dstuuid="477325da-a1dc-51ed-ecdd-9add8d1533e2" proto=6 direction="incoming" filename="csm-eicar.com" checksum="6851cf3c" quarskip="No-skip" virus="EICAR_TEST_FILE" viruscat="Virus" dtype="cached" ref="https://fortiguard.com/encyclopedia/virus/2172" virusid=2172 url="http://www.csm-testcenter.org/csm-eicar.com" profile="default" agent="Wget/1.21.4" httpmethod="GET" analyticscksum="275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" analyticssubmit="false" crscore=50 craction=2 crlevel="critical"在 CLI 下配置反病毒豁免列表,Hash 类别为 MD5,将该文件的 MD5 值填入其中。
config antivirus exempt-list edit "csm-eicar.com" set hash-type md5 set hash "44d88612fea8a8f36de82e1278abb02f" next end再次使用客户端 PC 通过 FortiGate 下载该文件,下载成功。
root@Ubuntu # wget http://www.csm-testcenter.org/csm-eicar.com --2025-11-11 16:08:04-- http://www.csm-testcenter.org/csm-eicar.com 正在解析主机 www.csm-testcenter.org (www.csm-testcenter.org)... 85.215.35.144 正在连接 www.csm-testcenter.org (www.csm-testcenter.org)|85.215.35.144|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:68 [application/octet-stream] 正在保存至: “csm-eicar.com.2” csm-eicar.com.2 100%[=================================================>] 68 331 B/s 用时 0.2s 2025-11-11 16:08:05 (331 B/s) - 已保存 “csm-eicar.com.2” [68/68])该文件下载时被 FortiGate 的反病毒模块放通,如下所示 AV 拦截日志,日志中提示被该文件“Exempted by AV exempt list”。

date=2025-11-11 time=16:08:06 eventtime=1762848485808819095 tz="+0800" logid="0202008206" type="utm" subtype="virus" eventtype="exempt-hash" level="notice" vd="root" policyid=1 poluuid="7933a8ea-da0e-51ee-d747-443a0247aebe" policytype="policy" msg="Exempted by AV exempt list." action="passthrough" service="HTTP" sessionid=48156818 srcip=192.168.100.177 dstip=85.215.35.144 srcport=62065 dstport=80 srccountry="Reserved" dstcountry="Germany" srcintf="internal5" srcintfrole="undefined" dstintf="wan1" dstintfrole="undefined" srcuuid="477325da-a1dc-51ed-ecdd-9add8d1533e2" dstuuid="477325da-a1dc-51ed-ecdd-9add8d1533e2" proto=6 direction="incoming" filename="csm-eicar.com" quarskip="File-was-not-quarantined" virus="csm-eicar.com" viruscat="File Hash" dtype="av-engine" filehash="44d88612fea8a8f36de82e1278abb02f" url="http://www.csm-testcenter.org/csm-eicar.com" profile="default" agent="Wget/1.21.4" httpmethod="GET" analyticssubmit="false"