How to Protect .NET Web Applications From Viruses and Zero-Day Threats

Nowadays, cyber-attacks on APIs and net functions have gotten more and more frequent; attackers are usually not solely importing viruses, however they’re additionally establishing specialised threats to add by way of your public web site or utility. As soon as the malicious content material has been uploaded, it may filter its method into your methods, together with cloud storage or databases, and might finally get executed.

Whereas anti-virus software program can present safety in opposition to viruses and malware, this, sadly, leaves a gap for these customized threats. For instance, scripts are one sort of menace that’s thriving within the present social media surroundings; resulting from their easy design, they’ll make the most of in style websites to introduce their malignant content material, which permits them to propagate at an alarming charge. If a scripting virus is woven into the code of a web based video, when the video is performed the script is executed and the unsuspecting person’s machine is now contaminated.

On this article, we will likely be discussing a virus scanning resolution that can present 360-degree content material protections throughout viruses, malware, and even zero-day threats. Zero-day threats pose one of many largest dangers resulting from their immunity to regular definition-based virus scanning, and their often-tailored method to your web site. To supply a protection in opposition to these and different assaults, this API resolution goes past primary anti-virus safety by performing the next actions:

  • Scanning for viruses and malware.
  • Detecting executables.
  • Detecting scripts.
  • Detecting encrypted/password-protected recordsdata.
  • Detecting macros.
  • Detecting XML exterior entities.
  • Validating the enter file to make sure it’s a actual content material file.
  • Proscribing the add to solely particular file varieties that we want to assist (e.g., PDF).


To get issues began in C#, we’ll first set up the .NET Framework:

Set up-Bundle Cloudmersive.APIClient.NET.VirusScan -Model 3.0.4

Now, we’ll scan the file in our .NET utility to make sure it’s secure, previous to permitting it into storage. If it’s not secure, we’ll launch the reminiscence, log particulars of the menace, and warn the person. Whether it is secure, we’ll proceed with the standard processing logic. This may be achieved by including the next code to our controller:

utilizing System;
utilizing System.Diagnostics;
utilizing Cloudmersive.APIClient.NET.VirusScan.Api;
utilizing Cloudmersive.APIClient.NET.VirusScan.Consumer;
utilizing Cloudmersive.APIClient.NET.VirusScan.Mannequin;

namespace Instance

    public class ScanFileAdvancedExample
        public void foremost()
         Set to false to dam macros and different threats embedded in doc recordsdata, comparable to Phrase, Excel and PowerPoint embedded Macros, and different recordsdata that comprise embedded content material threats.  Set to true to permit these file varieties.  Default is fake (advisable). (elective) 
            var restrictFileTypes = restrictFileTypes_example;  // string 

To make sure the method runs easily and you’ve got scanned for all of the relevant threats, the next parameters needs to be met:

  • Enter File — the file to carry out the operation on.
  • Permit Executables — set to false to dam executable recordsdata (program code) from being allowed within the enter file.
  • Permit Invalid Recordsdata — set to false to dam invalid recordsdata, comparable to a PDF file that isn’t actually a sound PDF file.
  • Permit Scripts — set to false to dam script recordsdata comparable to PHP recordsdata, Python scripts, and so on. from being embedded within the file.
  • Permit Password Protected Recordsdata — set to false to dam password-protected and encrypted recordsdata that try and keep away from scanning by way of passwords.
  • Permit Macros — set to false to dam macros and different threats embedded in doc recordsdata comparable to Phrase, Excel, and PowerPoint.
  • Permit XML Exterior Entities — set to false to dam XXE assaults embedded in XML recordsdata.
  • Prohibit File Varieties — specify a restricted set of file codecs to permit as clear as a comma-separated record of file codecs (e.g., .pdf, .png, and so on.) set to null or empty string to disable.
  • API Key — your private API key; this may present 800 calls/month and could be retrieved by registering for a free account on the Cloudmersive web site.


Now the method is full! If any of the parameters return a ‘true’ consequence, it’s an indicator that the file incorporates malicious content material and needs to be rejected.

By absolutely configuring your system to guard in opposition to the ever-growing array of viruses, malware, and zero-day threats, you may be forward of the sport in making certain the safety of each your organization and person info.

Supply hyperlink


Check Also

Kidnappers in Nigeria Release 28 Schoolchildren, Another 81 Still Held, Says Negotiator | World News

KADUNA, Nigeria (Reuters) – Kidnappers who raided a boarding college in northern Nigeria earlier this …

Leave a Reply

Your email address will not be published. Required fields are marked *