The Kaspersky Control Flow Monitor (KCFM) component is designed to monitor and control the performance of processes by monitoring the control flow.
The KCFM component lets you do the following in a KasperskyOS-based solution:
How the KCFM component works
By using the source code of a program that needs to be monitored, you can build a control flow graph (CFG) for the program. This graph defines the complete set of system calls and calls to library functions that can be executed while the program is running, and all possible sequences of their execution. The CFG is built during program build.
While a process (program) is running, function calls and IPC calls made by the process are monitored. If program behavior is unexpected (anomalous), the KCFM component lets you stop and restart the monitored program.
Important! The KCFM component is experimental and subject to limitations described below. The component is available to users for testing purposes and for providing feedback.
Limitations in the experimental version of the KCFM component
The KCFM component has the following limitations:
Contents of the KCFM component
The component consists of the following files:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/toolchain/bin and /opt/KasperskyOS-Community-Edition-<platform>-<version>/sysroot-*-kos/bin./opt/KasperskyOS-Community-Edition-<platform>-<version>/sysroot-*-kos/include/kcfm.CMake libraries for adding KCFM component modules to the solution located in /opt/KasperskyOS-Community-Edition-<platform>-<version>/toolchain/lib/cmake/kcfm_tool./opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/.Building a program control flow graph
The control flow graph is built during application build if the CMake command kcfm_generate_signature() has been added to the CMakeLists.txt file for building the program.
For more details, refer to kcfm_hello example.
Security audit data is used to monitor IPC calls made by the monitored program. To allow the KCFM component to access the security audit data of the monitored program and configure the Klog system program, add the CMake command kcfm_generate_audit_policy() to the CMakeLists.txt program build file.
The monitored program code can use static or dynamic libraries. In this case, these libraries must also be built via CMake, and the CMake commands kcfm_make_graph_lib() for building the call flow graphs of these libraries must be added to the build script.
For more details, refer to kcfm_http_server example.
Anomaly detection
Anomaly detection is performed by the FlowChecker module from the KCFM component. To add the FlowChecker module to a solution:
The FC_GRAPH_FILENAME environment variable is used to specify the path to the file of the control flow graph built for the monitored program.
For more details, refer to kcfm_http_server example.
Anomaly processing
A detected anomaly is processed by the FlowMonitor module from the KCFM component. To add the FlowMonitor module to a solution:
The name of the monitored process is defined in the FM_ENTITY_NAME environment variable.
The monitored process must not be started using Einit because it will be started by the FlowMonitor module, which uses the ExecutionManager system program for this purpose.
The FlowMonitor module performs the following actions:
ExecutionManager.ExecutionManager.ExecutionManager.FlowChecker module. In this case, the FlowMonitor module performs the following actions:Security policy generation
The KCFM component also lets you automatically generate part of the solution security policy in the form of a PSL file based on the program source code. The PSL file will list and allow all IPC calls to core endpoints and VFS system program interfaces that are used in the program code. The security policy is formed so as to allow the program to access the IPC calls in use and deny access to all of the unused ones.
To generate the PSL file, add the CMake command kcfm_generate_audit_policy() to the CMakeLists.txt file for building the program. The generated PSL file must be included in the solution security policy description.
For more details, refer to kcfm_hello example.
Page top