Skip to content

File uploads, antivirus and virtual patches ​

Symptoms of file upload checks (types, names, archives, web shells, hash lists), the ICAP antivirus servers they call, scanner report imports and virtual patches made from scan findings.

A legitimate upload is refused with a file.* event ​

  • Cause: read the event's rule ID and message. file.size: the file is over the rule's max_size. file.type.not_allowed: the type found by content is not in allow (a PHP or JavaScript file is script, not text; a .docx is office). file.mismatch: the content is clearly another kind than the name or declared type says (a spreadsheet exported with an .xls name but holding HTML is text). file.name: a double extension such as report.php.pdf, a trailing dot or space, or a configuration file name. file.webshell: source code with several shell indicators (decode-then-eval, or request data passed to eval). file.archive: a member path that leaves its directory, a zip that unpacks to more than 10 times its size, or an encrypted member (with encrypted: block).
  • Check: the event's file name, content type found, declared type, size and SHA-256; the member path for archives; waap_file_findings_total.
  • Fix: add the family or type to allow. For one rule on one path, add an exception (ignore_rules: [file.mismatch], from the event's False positive action). Set names, mismatch, scripts or webshells to log while you tune. Use encrypted: allow, or a hash_lists.allow list for files you trust.

Every large upload fails with 413 before any file check ​

  • Cause: the request body is over the application's limits.request_body. The limits check refuses it before the files module runs, and a rule's max_size does not raise it.
  • Fix: add an exception on the upload paths with limits: {request_body: 12MiB} (at most 64 MiB), at least the rule's max_size plus about 64 KiB of form overhead.

Uploads are refused with file.limit ("larger than the request body limit") ​

  • Cause: the data plane cut the body at its buffer limit, so the files in it cannot be checked, and the upload is refused rather than passed unchecked. The same rule reports more than 32 files or 1,000 parts in one request.
  • Fix: raise limits.request_body for the path as above, or split the upload.

file.malformed for uploads that work in a browser ​

  • Cause: the multipart body is one that our strict reader refuses: a missing closing boundary, or a header with a NUL byte or an invalid line. Lenient servers would accept such a body, which is how a file is smuggled past a checker, so it is refused in block mode.
  • Check: the client library; send the same upload with curl -F.
  • Fix: correct the client. If it cannot be fixed, add an exception ignoring file.malformed on that path. The files in such a body are then not checked.

A file shows in the event as flood:... ​

  • Cause: a text upload holds more than 64 occurrences of the trigger words of one strong web shell indicator (gzinflate, str_rot13, $_POST and so on), more than the scan can examine one by one. Source files of large legacy PHP applications can do this.
  • Fix: add an exception for file.webshell on that path, or set webshells: log.

Web shell checks miss a shell ​

  • Cause: the file is not text-like (a NUL byte in its first 8 KiB); the shell sits after the first 256 KiB; the rule is in detect mode; the file's type is image or pdf (those are checked for hidden scripts instead); or the indicators do not cover that shell.
  • Check: upload the sample to a test path with webshells: block, and read the event.
  • Fix: keep deny: [script] and keep allow narrow, so that unexpected types never reach the scan. Add a hash of the sample to a hash_lists.deny list.

A fetched file list stays empty or shows an error ​

  • Cause: only the active node fetches lists. The URL must be https (redirects to http are refused), must answer within 30 seconds, and must hold at most 50 MiB and 1,000,000 values. A page whose lines are not SHA-256 values is refused as "not a list", and the last good copy stays in use.
  • Check: the File lists page under Shared lists (count, last fetched, error), or waap file-lists get; the control plane's log ("fetching a list failed").
  • Fix: correct the URL or the feed format (one value per line, or sha256sum output), then choose Fetch now, or run waap file-lists refresh -name LIST. For a site without internet access, write the values inline.

A file on a deny list still passes ​

  • Cause: the upload's path is not covered by an upload rule, so nothing is checked there. The list is not named in the application's hash_lists.deny. The file is also on a hash_lists.allow list (trusted wins). The list was fetched less than a few seconds ago (each inspection node loads new copies every few seconds). Or the application is in detect mode.
  • Check: waap files test -app APP -path PATH -f FILE shows the SHA-256 and whether a rule covers the path. Compare the value with the list (waap file-lists get).
  • Fix: add a rule for the path, name the list, or remove the value from the allow list.

An ICAP server shows "failing", or uploads are refused with 503 (file.av.unavailable) ​

  • Cause: the inspection node cannot use the server. Possible reasons: a connection that is refused or times out (wrong URL or port, a firewall, or the antivirus service is down); an answer that is not valid ICAP (a wrong service path: the URL's path must be the service name, such as /avscan or /srv_clamav); or a scan slower than the server's timeout. With on_failure: closed (or inherit with a fail-closed application) the upload is refused with 503. With open, it passes and the event is only logged.
  • Check: the Antivirus servers page (state and last error), waap icap get -check, then waap icap test -name SERVER. The event's message names the reason. From the node, try the address with nc -vz HOST 1344.
  • Fix: correct the URL or start the service. Raise timeout for large files (at most 61 seconds). Decide on_failure deliberately: closed protects, while open keeps uploads working during an outage.

The ICAP servers page says the state is unknown, and there is no Test button ​

  • Cause: the state and the test come from the inspection service's own connection to the server, so they exist only in a process that runs it (waap run, or a node that runs both roles). The process serving the page runs the control plane alone, because the roles are separate.
  • Check: the page says "This process runs no inspection service". waap icap get on the inspection node's own management socket shows the state.
  • Fix: nothing is needed for scanning, because inspection nodes scan and fail by their own policy. To test a server, run waap icap test -name SERVER against a node that runs the inspection service, or look at waap_icap_requests_total and the events (file.av.unavailable).

ICAP test says "defined but not applied on the inspection node yet" or the state is "pending" ​

  • Cause: the server was just added. The inspection node receives each configuration version within seconds. A node that never applies it has a configuration problem; see its log ("ICAP server not usable", or a TLS file that does not load).
  • Check: waap config versions (acknowledged by the node?), and the inspection log.
  • Fix: wait a moment and test again. Fix the file or URL named in the log.

An ICAP test fails: EICAR "not as expected", or "not scanned" ​

  • Cause: the server answered but does not flag the EICAR test string. The antivirus engine has no signatures loaded yet, or the ICAP service only passes files through. Or it flags the clean file (a broken signature set). Or a probe was not scanned (busy, timeout or error, as shown).
  • Check: waap icap test -name SERVER shows each verdict. Try the same file with the server's own client (c-icap-client), and check the antivirus engine's signature update.
  • Fix: update the signatures, or fix the service name. Until then, use on_failure: closed only if you can accept refused uploads.

Uploads are slow, or show busy errors ​

  • Cause: the server scans more slowly than uploads arrive. Every connection (max_concurrent, lowered to the server's own Max-Connections) stays in use until the scan deadline, and then the file counts as unavailable (busy in waap_icap_requests_total).
  • Check: the latency column of the Antivirus servers page, waap_icap_duration_seconds, and waap_icap_requests_total{result="busy"}.
  • Fix: give the antivirus server more workers, add a second server for other applications, or lower the uploaded size (icap.max_size). Raise max_concurrent only if the server allows it.

Large uploads are not scanned (file.av.not_scanned) ​

  • Cause: the file is larger than icap.max_size (default 32 MiB), or a request carried more than 32 files. oversize: block refuses it in block mode, and allow lets it through and reports it.
  • Fix: raise icap.max_size. The antivirus server's own limit and the request body limit also apply. Or accept allow for those paths.

The ICAP server's TLS certificate is not accepted ​

  • Cause: icaps:// always verifies the certificate: against the uploaded CA bundle, otherwise against the system's roots, and against the server name (the URL's host, or tls.server_name). A private CA must be uploaded, and a certificate for another name fails.
  • Check: the last error on the Antivirus servers page ("certificate signed by unknown authority" or "does not match"), waap icap get, and the TLS files column.
  • Fix: run waap icap ca -name SERVER -f ca.pem, and set tls.server_name to a name on the certificate. For mutual TLS, run waap icap client-cert -name SERVER -cert c.pem -key k.pem.

An event's request capture has no body for an upload ​

  • Cause: by design. A body that carries uploaded files is never kept in an event (body_omitted: files), because files can be personal documents. The reasons name each file, its types, size and SHA-256, and the archive member.
  • Fix: none is needed. To look at a file, have the uploader send it again to a test system, or test a copy with waap files test.

A raw upload (PUT) is refused by a signature rule ​

  • Cause: the path has no upload rule with raw: true, so the body is parsed as form fields and its type is judged by the CRS rules (920420, "content type not allowed"). Or the body is sent as a form, JSON or XML, which stays arguments on purpose.
  • Fix: add an upload rule for the path with raw: true and the accepted types. The file module then judges the file by its content, and the signatures skip its body.

A scanner report is refused on import ​

  • Cause: the format is not recognised. Supported formats are ZAP's traditional JSON or XML report, Nuclei JSON lines, Burp's XML issues export, and waap-findings/v1. Or the file is over 50 MiB or has more than 10,000 findings. Or it is malformed: parsing is strict, and waap-findings/v1 rejects unknown fields.
  • Check: the error names the problem. ZAP's other report templates (HTML, Markdown, "modern") are not accepted. Burp must be exported as XML ("Report selected issues", then XML).
  • Fix: export a supported format, split a large report, or convert another tool's findings to waap-findings/v1.

A finding is "not patchable" ​

  • Cause: no attack class fits it. Passive findings, such as missing headers, cookies without flags, or business logic, have no class. Or its path or parameter name has characters that a patch cannot match exactly (quotes, spaces, / or | in a name).
  • Check: the reason column (waap vpatch show). rules/vpatch/classes.yaml lists the scanner rules and CWEs that map to a class.
  • Fix: passive findings are handled by the other protections (response headers and cookie protection). Write a patch by hand under Edit patches, with a broader target (any_arg) or a path prefix.

A virtual patch refuses normal requests ​

  • Cause: the parameter carries values that look like the patch's attack class. Examples: code in a developer tool, URLs in a field patched against inclusion, or other sites in a redirect target that legitimately points elsewhere.
  • Check: the event names the patch (vp-N), its rule and the value (redacted). waap vpatch list shows the patch's target and paths.
  • Fix: narrow the patch (exact path, method), add an exception for its rule range on the path or field, stage its rules while you check, or, for open redirects, add the other host name to the application's hostnames.

A virtual patch does not refuse the reported attack ​

  • Cause: the signatures are in detect mode (patches follow it). An exception or staged rule names the patch's rules. The request goes to another path, method or parameter than the patch: for example, the scanner reported /search but the attack also works on /search/. Or an earlier module decided first, such as API protection refusing an XML document type as api.xml.dtd.
  • Check: the event for the request (or trace the client); waap vpatch list; waap rules get -app NAME -list exceptions.
  • Fix: switch signatures to block, widen the path with a prefix (/search*), or widen the target to any_arg.

A patch shows "fixed upstream?" although the weakness remains ​

  • Cause: the newer report did not scan that page (a shorter scan, or a login that failed), or it found the weakness under another method or parameter location, so its key differs.
  • Check: waap vpatch show for both reports; compare the keys.
  • Fix: keep the patch until a full scan confirms the fix. The mark removes nothing by itself.