🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Upload Virus Scan Premium Add-on Setup Guide

Updated 9 min read Gravity Forms Files, Storage & Databases
On this page
  1. Video walkthrough
  2. What You Get
  3. Requirements
  4. Quick Start
  5. Choosing a Scanner
  6. ClamAV on your server
  7. Cloudmersive Virus Scan API
  8. VirusTotal
  9. What Happens to a File
  10. The Later Scan for Large Files
  11. Entries, Notes, Merge Tag and Notification
  12. The Scan Log
  13. Privacy and Security
  14. Limits to Know
  15. Troubleshooting
  16. Test connection says ClamAV is not available
  17. Cloudmersive or VirusTotal says the key was refused
  18. Good files are flagged as not scanned
  19. A visitor sees the second message
  20. Can I test it?
  21. What happens when I uninstall the add-on?

Video walkthrough

Gravity Forms Upload Virus Scan Setup Guide: ClamAV, Cloudmersive, VirusTotal (WordPress Side)
Video setup guide: Gravity Forms Upload Virus Scan Watch on YouTube

The Gravity Forms Upload Virus Scan Premium Add-on checks every file that a visitor sends through a File Upload field before the entry is saved. If a file is infected, the form is not submitted: the visitor sees a message that you wrote, the temporary file is deleted, and the event is written to a log. You choose the scanner: ClamAV on your own server, the Cloudmersive Virus Scan API, or VirusTotal.

A Gravity Forms form with a File Upload field after an infected file was sent: a red box says there was a problem and the Document field shows the message that the file looks unsafe
An infected file is refused with the message you wrote, and it is not listed again on the form.

A File Upload field is an open door. Gravity Forms already checks the file type and the size, but a file with an allowed extension can still carry a macro, a script or a payload. The add-on adds the missing check without changing how your forms look or work. Clean files go through as before, and an infected file stops at the form.

What You Get

  • Three scanners, chosen in the settings, each with a Test connection button that uses the harmless EICAR test file.
  • ClamAV on your server: the add-on talks to the clamd daemon over a socket or TCP with the INSTREAM command, or runs the clamscan or clamdscan program, and finds out by itself which one is there. When ClamAV is not available you get a clear notice.
  • Cloudmersive and VirusTotal with API keys that are stored encrypted. VirusTotal can run in fingerprint only mode, which sends nothing but the SHA-256 of the file.
  • Scanning at validation time for single files, multiple files (the uploader that sends files one by one) and files uploaded on an earlier page of a multi-page form.
  • A message for the visitor that you can change, the temporary file deleted, and a log line with the file name, the form, the scanner and the signature name. No file content is stored.
  • A policy for the day the scanner is down or too slow: allow the submission and flag the entry (the default) or block it, with a time limit you set.
  • A later scan for large files: the entry is saved as pending scan, and the file is scanned in the background. An infected file is then deleted or moved to a protected quarantine folder, the admin is alerted and the entry gets a note.
  • The scan result on every entry as a note and as entry meta, a merge tag {virus_scan_status} and a notification event called File infected.
  • A privacy text, a requirement notice and a clean uninstall.

Requirements

Gravity Forms 2.9 or newer, WordPress 6.5 or newer, PHP 7.4 or newer, an active license key, and OpenSSL with AES-256-GCM, which every common host has, for storing the API keys encrypted. The ClamAV scanner needs the ClamAV daemon or the clamscan program on the server. Shared hosting usually does not have it. The settings page shows a short list of the requirements and tells you what is missing. Nothing is sent to an outside service unless you choose Cloudmersive or VirusTotal.

Quick Start

  1. Install and activate the add-on, then activate your license key under Forms, Settings, Upload Virus Scan.
  2. Choose a scanner in the Scanner section. Without a choice nothing is scanned, and a notice at the top of the page says so.
  3. For ClamAV leave the address as auto. For Cloudmersive or VirusTotal paste the API key and press Save key.
  4. Press Test connection. You should see that the EICAR test file was detected.
  5. Press Save Settings. Every form with a File Upload field is now protected.
The Scanner settings of the Upload Virus Scan add-on: the scanner choice, the ClamAV address, the VirusTotal mode, the API key boxes and the Test connection result
The scanner settings with the API key boxes and the result of Test connection.

Choosing a Scanner

ClamAV on your server

ClamAV is free software and your files never leave your server. With auto the add-on tries the usual clamd sockets, then localhost on port 3310, then the clamscan or clamdscan program. It sends the file with the INSTREAM command of the clamd protocol: the command, the file in chunks that each start with their length, and a zero length at the end. clamd answers that the stream is OK or names the signature it found. You can also enter a socket path such as unix:///var/run/clamav/clamd.ctl, an address such as tcp://10.0.0.5:3310, or the path of a clamscan program. clamd has no login, so only use a TCP address on a private network. A file bigger than the StreamMaxLength of your clamd is reported as too large and follows your policy.

If your host has no ClamAV, Test connection says so in plain words and lists what it tried. Pick another scanner in that case.

Cloudmersive Virus Scan API

Cloudmersive scans the file in its cloud. The add-on sends the file to the scan endpoint with your key and reads the answer: clean, or the name of the virus. The whole file is sent, so choose this scanner only when that is acceptable for your data. The address can be changed if Cloudmersive gave you a dedicated one. The size limit depends on your plan, so set Largest file to scan to match it.

VirusTotal

VirusTotal checks a file against many engines. In the default fingerprint only mode the add-on sends only the SHA-256 of the file and reads the last report for it, so nothing private leaves your site. The limit of this mode: a file that VirusTotal has never seen cannot be judged. You decide what happens to such a file: allow it and flag the entry, or reject the submission. In upload mode an unknown file is uploaded (up to 32 MB), the add-on waits for the analysis, and reads the verdict. An uploaded file becomes visible to VirusTotal and its partners, so read the privacy section before you turn this on.

The free public key allows 4 requests per minute, and the add-on keeps a counter and never sends more than the number you set. A request that would go over the limit is held back and treated like an unavailable scanner. The free public key is meant for non-commercial use under the terms of VirusTotal. For a business site use a key from a plan that allows it. You can raise the threshold of engines that must report a threat if you want to ignore single false alarms.

What Happens to a File

Each file goes through the same steps. The add-on first looks at the SHA-256 in a short-lived cache, so a file that was already checked is not sent again, for example when a visitor corrects a typo and submits a second time. If there is no result, the file is scanned. Then:

Result What the add-on does
Clean The submission goes on. The entry gets a note and the status Clean.
Infected The submission is refused with your message, the temporary file is deleted, a log line is written, an alert is sent and the notification event File infected fires.
Scanner unavailable, too slow, key refused, or file too large Your policy decides. Allow: the entry is saved and flagged as not scanned, with a note and a log line. Block: the submission is refused with the second message.
VirusTotal does not know the file (fingerprint mode) Allow and flag, or reject, as you chose.
Large file with the later scan on The entry is saved as pending scan and the file is scanned in the background.

The Later Scan for Large Files

Turn on Scan large files after the entry is saved and set the size from which a file counts as large. The visitor does not wait. WordPress scans the file a few seconds later with a longer time limit. If it is clean, the status becomes Clean. If it is infected, the file is deleted or moved to a quarantine folder inside your uploads folder, where it is renamed so it cannot run and protected with deny rules, the entry gets a note, you get an alert and the notification event fires. You can also have such an entry marked as spam. When the scanner is busy or unreachable the scan is tried again later, up to three times, and then the entry says not scanned.

Entries, Notes, Merge Tag and Notification

A Gravity Forms entry screen with the Notes box showing the note Virus scan: board-minutes.txt: Clean
A saved entry carries a note with the scan result of every file.

Every entry with an uploaded file gets a note such as Virus scan: board-minutes.txt: Clean and an entry meta value with the status: clean, pending, not scanned, or infected. Use the merge tag {virus_scan_status} in a confirmation or a notification to print it. For the case where a file is refused there is no entry, so the add-on also offers a notification event. Open a notification of the form, choose the event File infected, and write the message to the person who should know. The merge tag works in that notification too. A short alert e-mail to the address you set (or to the site administrator) is sent as well. It names the form, the file and the signature and contains no file content.

The Scan Log

The log on the settings page shows the last events: the time, the form, the file name, the signature, the scanner and what happened (blocked, allowed unscanned, deleted later, quarantined). It keeps the last 200 lines and you can clear it with one button. It never stores file content.

Privacy and Security

  • Nothing is scanned and nothing leaves your server until you choose a scanner and save.
  • With ClamAV the files never leave the server. With Cloudmersive the whole file is sent to Cloudmersive. With VirusTotal only the fingerprint is sent, unless you chose upload mode.
  • The add-on stores no file content. The cache keeps only the SHA-256 for a few hours, and the log keeps names and signature names.
  • API keys are encrypted with AES-256-GCM before they are stored, are never printed on the settings page (only the last four characters) and are never put in the settings array.
  • The buttons of the settings page check a nonce and the Gravity Forms capability for settings.
  • A form can opt out of scanning with a switch in its settings, for the rare form that must never send a file to a scanner.
  • Requests to Cloudmersive and VirusTotal always use https with certificate checks.

Limits to Know

  • A virus scanner finds known threats. No scanner finds everything, so keep your other protections and keep allowed file types short.
  • Only File Upload fields are scanned, at the moment a form is submitted. Files added by other means, and files that are already in the media library, are not.
  • A scan adds waiting time to the submit. Use a local ClamAV for speed, keep the time limit short and turn on the later scan for big files.
  • The add-on is a premium feature: while the license is not active, files are not scanned.

Troubleshooting

Test connection says ClamAV is not available

Your server has no clamd daemon on a known socket or on localhost port 3310, and no clamscan program. Ask your host, install ClamAV, enter the right socket or address, or choose Cloudmersive or VirusTotal.

Cloudmersive or VirusTotal says the key was refused

Paste the key again with Save key. The key must have no spaces. For VirusTotal check that the key is the one from your own account.

Good files are flagged as not scanned

The scanner was not reachable or too slow, or the file is over the size limit, or the free VirusTotal rate limit was used up. The note on the entry and the log line say which. Raise the time limit, raise the limit of VirusTotal requests if your plan allows it, or change the policy.

A visitor sees the second message

The policy is set to block and the file could not be checked. Switch the policy to allow and flag, or fix the scanner.

Can I test it?

Yes. The EICAR test file is a harmless standard text that every antivirus reports as a test virus. Save a text file with that content, upload it to a form and the add-on refuses it. Do not use real malware.

What happens when I uninstall the add-on?

Its options, the encrypted keys, the log and the per-form switch are removed. Entries, files and forms are not touched.

See the Upload Virus Scan add-on

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr