Detection of infected objects by File Monitor

File Monitor also supports detection of suspicious objects. Information covered in this topic also relates to detection of suspicious objects providing that the disinfection limitations for this type of objects are taken into considerations. All the limitations valid for handling suspicious object by on-demand scanning functionality are also effective for File Monitor. Disinfection of suspicious objects is not supported by File Monitor.

This section describes what happens in the situation when the kaveLoadMonitor function is called with the enMonitorType argument of the MONITOR_TYPE enumeration type is set to FILE_MONITOR value. It plots the diagram outlining the key moments of malware detection procedure performed by File Monitor while it runs. It shows how you can configure your application to react on events occurring during the File Monitor runtime via callback functions.

Make sure to verify that the KLIF.sys driver is registered with the system and running. This driver is required for File Monitor to work.

Actions performed by the File Monitor can be split into two parts:

The following section discusses each stage in more detail.

Interception stage

As the user works on their computer, many file I/O operations are performed. The File Monitor component running on the end-user's computer intercepts the following operations:

Open—The File Monitor intercepts any attempt to open a file on residing on a local disk.

Close—Each time an application tries to close a file on a local disk, the File Monitor intercepts the operation of closing the file performed by an application.

The File Monitor does not intercept open and close operations for files residing on network drives.

Execute—Attempts to start an executable file will also be automatically intercepted by the File Monitor.

The File Monitor will also intercept actions to run applications from network drives and network shared folders.

The interception is performed by the KLIF.sys driver. This driver is loaded by the KL1.sys driver that starts at the very beginning of the operating system boot stage. When an application on the user's computer attempts to open a file, close or execute it, the KLIF.sys driver freezes the application thread that performed the operation. After the thread is frozen, the KLIF.sys looks for the full path to the file that tried to be accessed by an application and passes this path to the KAV SDK. The KAV SDK passes the given path and some additional information such as process identifier (PID) to the KAV Engine (KLAV engine, enabled by KAV_SHT_ENGINE_KLAV and KAV_SHT_ENGINE_KLAVEMU scanner host type flags) running in a thread of your application. The interception process stage finishes and detection stage begins.

Detection stage

On the detection stage the KAV Engine accesses the target file that was tried to be accessed in order to scan it for malware.

Access to the file that has to be scanned is performed by File Monitor exactly as implemented for the scanning funcitons when using the on-demand scan.

The actions performed by File Monitor after it detects an infected file are determined by the cleaning mode specified by dwCleaningMode parameter when calling a scanning function.

When a scanning function is called with the KAV_REQUEST scanning mode and infected object is detected, the corresponding callback function (there can be several callback functions) is automatically called with the first parameter set to EVENT_REQUEST; the information on the infected object and the malware name are passed as other callback function parameters. For more information about using various cleaning modes, see section "Cleaning modes".

From this step the File Monitor process workflow goes like the typical detection flow implemented in scanning and cleaning modes.

The procedure finishes when File Monitor returns with one of the following events:

Compared to scanning functions, File Monitor does not return the EVENT_RESULT event.

If the target file is classified as clean and File Monitor has not detected a malware within it, the File Monitor will return control to the frozen thread of the user application that has initially been accessing the file.

The diagram below demonstrates the sequence of callback function calls assuming that the File Monitor is running in the KAV_REQUEST cleaning mode. That is, the monitor was initialized with the dwCleaningMode parameter defined within the KAV_FILE_MONITOR_SETTINGS2 structure set to KAV_REQUEST.

File Monitor Detection for KAV_REQUEST cleaning mode

File Monitor detection workflow for KAV_REQUEST cleaning mode

Page top