CrushMFT Documentation

Malware scanning of uploads#

CrushMFT can have every upload scanned for malware before it is stored. An upload a scanner refuses never reaches the folder, not even for a moment: no user, job, sync client or other program that watches the folder can see or take it. The settings are in Malware Scanning, a section of Preferences.

The scanning is done by a scanner you already run, or a free one: an ICAP server (most commercial virus scanners and appliances offer ICAP), ClamAV's clamd, or a scanner that is a program, such as Microsoft Defender. Beside them, CrushMFT's own content rules can refuse programs, Office macros, active PDFs and archive bombs.

How an upload is scanned#

  1. The upload's bytes are held by the server, not written to the folder: the first 8 MB in memory, the rest in a file in scan_staging/ in the CrushMFT folder, encrypted with a key that exists only in memory. What lies on the disk is unreadable, so a scanner on the server machine does not react to it either.
  2. As the bytes arrive they are sent to a scanner, so the scan is nearly finished when the last byte is.
  3. When the scanner says clean, the file is written to the folder (or to the S3 bucket, the SFTP server or whatever storage the folder is), and only then is the client told that the upload succeeded.
  4. When the scanner refuses the file, the held bytes are dropped (or kept in the quarantine), nothing is written, and the client is told why. A file of that name that was there before stays as it was.

When no scanner answers, the upload is refused and the client is told to try again later. When no scanner answers (Policy) can store such uploads instead, marked as not scanned.

What the uploader is told#

Client A refused file No scanner answered
FTP, FTPS 550 Rejected: malware found (Eicar-Test-Signature) 451 Upload not accepted: malware scanner unavailable, which tells the client to try again
The web interface the upload list shows the reason for that file, such as "Rejected: malware found (Eicar-Test-Signature)", and goes on with the next file the same, with "malware scanner unavailable"
S3 clients (the S3 listener) 403 MalwareDetected with the reason, for a PUT, a copy and the end of a multipart upload 503 ServiceUnavailable, which S3 clients retry
SFTP, SCP, WebDAV, SMB and the rest the upload fails when the client closes the file the same

The reasons:

Reason When
Rejected: malware found (threat) a scanner found malware, or the file is on the Always refuse list
Rejected: the file could not be scanned for malware a scanner could not read the file and Files the scanner cannot read is Refuse them
Rejected: larger than the malware scanning limit the file is over the size limit, or the scanner's own, and Larger files is Refuse them
Rejected: the malware scanner changed the file an echo-mode scanner cleaned the file and A file an echo-mode scanner changed is Refuse it
Rejected by the malware scanning's content rules: rule a content rule set to Refuse found what it looks for
Upload not accepted: malware scanner unavailable no scanner answered

The server's log has a line for every refusal, with the user, address, protocol, file and verdict, and the refusal is listed under Detections.

Things to know#

  • The client waits a little longer at the end. Success comes after the scanner's verdict and the copy into storage. Status and detections shows how long uploads waited on average after their last byte; with a scanner on the same network it is usually a fraction of a second, plus the time to write the file.
  • Replacing a file. An upload over an existing file replaces it only when it is clean. The old file is moved to the recycle bin, or kept as a revision, at that moment, not when the upload starts.
  • Temporary names. With a temporary extension for uploads (Misc), the file appears under the temporary name only while it is written, after the clean verdict. A folder that is watched by a job or the Folder Monitor never sees a refused file.
  • Resumed and partial uploads. A resumed upload is scanned as the whole file it makes, the part stored before together with the new bytes: malware split over two uploads is found. An interrupted upload is scanned as far as it got, and that part is kept for a resume only if it is clean.
  • Encrypted folders. The scanner sees the file as the user sent it: before the server encrypts it for storage, and after a folder's PGP decryption of uploads. With the server's own encryption at rest, what is stored stays encrypted.
  • DMZ servers store nothing; the internal server scans the uploads that reach it through the DMZ.
  • Storage errors come at the end. Since the storage is opened only after the clean verdict, a full disk or a storage that is down shows when the upload ends, not when it starts.
  • Memory and disk. Held in memory per upload (MB) (Policy, 8 MB) per upload in progress, at most 256 MB for all uploads together, then disk in scan_staging/. After a crash, what was held is unreadable without its key, and it is removed after a day.
  • The same file twice. A verdict is remembered by the file's SHA-256 for Remember a verdict for (24 hours): a file sent to 500 users is scanned once. New signatures on an ICAP or ClamAV scanner make it ask again.
  • The scanner's own log names the CrushMFT user, the client's address and the file's path for every file sent over ICAP.

What is not scanned#

  • Downloads, and files already stored before scanning was turned on.
  • Files that other software puts into a folder on the server's disk or in its storage, since they are not uploaded through CrushMFT. A job with the MalwareScan task scans them where they are.
  • What jobs write, unless Also scan what jobs write (Policy) is on.
  • A folder set not to be scanned in the User Manager (Extra Permissions).
  • Empty files, and a write of no bytes at a position (a client setting a file's length).

Setting it up#

  1. In Preferences, Malware Scanning, add a scanner: ICAP server, ClamAV (clamd) or Command line, and fill in its address or program.
  2. Press Test, then Send EICAR and Send a clean file. Both should say "As expected".
  3. Tick Scan uploads and press Save.
  4. As a test user, upload the EICAR test file (its 68 characters are on the EICAR web site) over FTP or the web interface. The upload is refused, the file is not in the folder, and it is listed under Status and detections.
  5. Add an alert of the type Malware Found and one of the type Malware Scanner Unavailable in Alerts, so that you hear of both.

Which scanner to use:

Situation Scanner
a commercial virus scanner or a security appliance on the network ICAP server: its ICAP service, usually on port 1344
a server on Linux, without a commercial scanner ClamAV (clamd), on the same machine (its Unix socket) or another
a server on Windows, with Microsoft Defender Command line with MpCmdRun.exe, see the example
more than one several scanners in the list: the next one is asked when one does not answer, or each in turn

Alerts#

Type Fires when
Malware Found a scanner found malware in an upload. The mail names the file, user, address, protocol, threat, scanner, SHA-256 and size ({scan_path}, {scan_user_name}, {scan_user_ip}, {scan_protocol}, {scan_threat}, {scan_engine}, {scan_sha256}, {scan_size}).
Malware Scanner Unavailable a scanner stopped answering: once, not for every upload. {scan_engine} and {scan_detail} say which and why.
Malware Scanner Back it answers again

Repeated uploads of malware#

Ban an address after this many infected uploads in an hour (Policy) bans an address that keeps sending malware, for For (minutes), with the reason "malware uploads" in Banning. It is off (0) on a new server. Addresses in Never ban these IPs are not banned.