A method, device and storage medium for preventing database ransomware

By building a data collection buffer pool in the database system and loading the advanced host controller interface driver, combined with the long and short-term memory model for real-time prediction, the problem of difficulty in identifying new ransomware based on signature detection is solved, and effective detection of ransomware is achieved. and defense, ensuring data security and business stability.

CN118468273BActive Publication Date: 2024-09-06SHANGHAI LANDER SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410926764.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-09-06
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

Signature-based ransomware detection methods are difficult to detect new ransomware and its variants, resulting in inability to effectively prevent data encryption and loss.

Method used

By building a data collection buffer pool, loading the advanced host controller interface driver, monitoring the CPU clock cycle, collecting database file parameters, and using the long and short-term memory model to make real-time predictions, determine whether the file status is abnormal, and trigger defense mechanisms to prevent ransomware attacks. .

Benefits of technology

It realizes real-time detection and blocking of known and unknown ransomware, prevents data encryption, ensures business continuity, and reduces data loss and economic losses caused by ransomware attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118468273B
    Figure CN118468273B
Patent Text Reader

Abstract

The present invention discloses a method, device and storage medium for preventing database from extortion, comprising the following steps: S1, constructing a data acquisition buffer pool to save the collected file data; S2, loading an advanced host controller interface driver; S3, constructing a thread monitoring table by stealing the clock cycle of the CPU, recording the monitoring thread running status to detect whether the process and thread accessing the database are abnormal; S4, regularly collecting the storage file parameters of the database through the advanced host controller interface driver without affecting the normal operation of the CPU; S5, constructing a storage parameter matrix according to the parameter type of the database file storage parameters collected regularly; S6, loading a long short-term memory model training and outputting the detection result. The device of the present invention uses a deep learning algorithm to analyze the behavior of ransomware, and can detect and prevent the attack behavior of known ransomware in real time to prevent data from being encrypted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database anti-ransomware, and in particular to a method, device and storage medium for database anti-ransomware. Background Art

[0002] Ransomware has become one of the most notorious malware targeting end users, governments, and commercial organizations by encrypting high-value data such as files, documents, and images and subsequently demanding a ransom to restore access to the data.

[0003] Methods for detecting ransomware can be roughly divided into signature-based methods and behavior-based methods. Commercial antivirus products usually use signature-based methods. Signature-based detection systems use specific byte sequences or hash values ​​contained in samples for detection. It is a relatively mature method with a low false positive rate. However, the number of ransomware variants has continued to increase in recent years, making it increasingly difficult to create signatures for all new ransomware variants. Therefore, signature-based detection methods can only detect a limited range of ransomware, and there is a problem of difficulty in detecting new ransomware and its variants. Summary of the invention

[0004] An object of the present invention is to provide a method, device and storage medium for preventing database ransomware, comprising the following steps:

[0005] S1, build a data collection buffer pool to save the collected file data;

[0006] S2, load the advanced host controller interface driver;

[0007] S3, build a thread monitoring table by stealing CPU clock cycles, record the running status of the monitoring thread, and detect whether the process and thread accessing the database are abnormal;

[0008] S4, collecting storage file parameters of the database regularly without affecting the normal operation of the CPU through the advanced host controller interface driver;

[0009] S5, constructing a storage parameter matrix according to the parameter type of the database file storage parameters collected regularly;

[0010] S6. Load the long short-term memory model training and output the detection results, input the storage parameter matrix into the long short-term memory anti-ransomware prediction model, train and predict in real time whether the current database file status is normal or abnormal, and trigger the ransomware blocking mechanism and database protection mechanism based on the evaluation detection results.

[0011] Optionally, the S1 specifically includes:

[0012] S11, allocating initial memory space in the device memory area to form a dynamic memory buffer pool;

[0013] S12, using a memory buffer pool to store file data collected in real time from a database system, wherein the file data includes parameters such as file name, file path, file size, file type, and file modification time;

[0014] S13, setting a memory upper limit threshold of the buffer pool. When the memory usage of the buffer pool reaches the set threshold, triggering a data cleanup or transfer mechanism, transferring the data in the buffer pool to a specified storage location to prevent memory overflow;

[0015] S14. Determine the memory usage of the buffer pool:

[0016] ;

[0017] in, Indicates the memory usage of the buffer pool. Indicates The size of the file, Indicates the number of files currently stored in the buffer pool;

[0018] S15. Dynamically adjust the memory allocation strategy of the buffer pool to optimize the space allocation of the memory buffer pool according to the load and memory usage of the database system.

[0019] Optionally, the S2 specifically includes:

[0020] S21, after the device is started, detecting the current system environment to determine whether the advanced host controller interface driver is supported;

[0021] S22, when the system environment supports the advanced host controller interface driver, loading the advanced host controller interface driver from the specified storage location into the memory, and initializing the advanced host controller interface driver to implement access to the serial advanced technology attachment storage device;

[0022] S23, establishing a communication connection with the advanced technology attachment storage device through the advanced host controller interface driver to confirm whether the device is operating normally and can accept data read and write operations;

[0023] S24, setting working parameters of the advanced host controller interface driver, including data transmission rate, access priority and cache strategy, to optimize data transmission performance and system response speed;

[0024] S25. Regularly monitor the running status of the advanced host controller interface driver and calculate the data transmission rate:

[0025] ;

[0026] in, Indicates the data transmission rate, Indicates the amount of data transferred. Indicates the time taken for transmission;

[0027] S26. When an abnormal situation is detected, an error log is recorded through the advanced host controller interface driver and a system administrator is notified for troubleshooting and repair.

[0028] Optionally, the S3 specifically includes:

[0029] S31, start the custom function RDTSC for obtaining the clock cycles consumed by CPU execution;

[0030] S32, according to the CPU clock cycle, obtain all processes and threads running on the CPU;

[0031] S33, create a thread monitoring table, allocate storage space in the system memory, and record the processes and threads running on the CPU;

[0032] S34. Obtain the start clock cycle and end clock cycle of each process and thread through the RDTSC function, and calculate the running time and suspension time of each process and thread. The formula is as follows:

[0033] ;

[0034] in, Indicates The average running time of a process or thread, Indicates The process or thread in The end clock cycle of the measurement, Indicates The process or thread in The starting clock cycle of the measurement, Indicates the number of measurements;

[0035] ;

[0036] in, Indicates The average hang time of a process or thread, Indicates The process or thread in The measured suspended clock cycles, Indicates The process or thread in The measured recovered clock period, Indicates the number of measurements;

[0037] S35, record the suspension time of each process and thread, monitor the running status of the process and thread on the CPU, and detect whether there is a timing attack behavior;

[0038] S36, analyzing the recorded process and thread information, monitoring the running status of all processes and threads operating the database file, and determining whether the suspension time of the process and thread and the specified timeout operation are abnormal;

[0039] S37. When abnormal behavior is detected, the detailed information of the abnormal behavior is recorded, including thread ID, abnormal type, occurrence time and impact scope, and the preset defense mechanism is triggered to prevent further attacks by the ransomware.

[0040] Optionally, the S4 specifically includes:

[0041] S41, start the advanced host controller interface driver to access the database storage medium;

[0042] S42, obtaining the storage address of the database file, and establishing a storage path mapping table of the database file and directory;

[0043] S43, collecting database file information and calculating the entropy information of each database file and directory, the entropy information calculation formula is as follows:

[0044] ;

[0045] in, Indicates Entropy information of a file or directory, Indicates of the file or directory The probability of a state, Indicates the total number of states;

[0046] S44, collecting the storage access timestamp of each database file and directory in nanoseconds, recording the creation time, modification time and access time of the file;

[0047] S45, collecting the data block address and distribution sector of each database file and directory on the storage medium, and establishing a data block address and sector distribution map;

[0048] S46, collecting storage capacity changes of each database file and directory in seconds, including the amount of data written;

[0049] S47, record the entropy information calculated in S43, the storage access timestamp collected in S44, the data block address and distribution sector collected in S45, and the storage capacity change collected in S46 in the database file storage parameter record table, and update the record table in real time:

[0050] Create a database file containing the data of S43, S44, S45 and S46. Every time new data is collected, update the records corresponding to the file or directory, and record the entropy information, timestamp, data block address and distribution, storage capacity change and other data in time series;

[0051] S48. Based on the data in the database file storage parameter record table, a preliminary analysis is performed to identify files with abnormal storage parameter changes, providing basic data support for the long-short term memory model analysis and prediction in subsequent steps.

[0052] Optionally, the S5 specifically includes:

[0053] S51, constructing a storage parameter matrix according to the database file storage parameters collected in S4 and according to the parameter types;

[0054] S52. Define storage parameter matrix ,in The rows represent different database files, and the columns represent different types of storage parameters;

[0055] S53, filling the storage parameters of each file into the storage parameter matrix in sequence, specifically including:

[0056] ;

[0057] in, Indicates of the files storage parameters, Indicates of the files storage parameter values;

[0058] S54. Normalize the storage parameter matrix to eliminate the dimensional differences between different storage parameters:

[0059] ;

[0060] in, Represents the normalized storage parameter value, and Respectively represent The column stores the minimum and maximum values ​​of the parameter;

[0061] S55, smoothing the normalized storage parameter matrix to reduce the impact of noise:

[0062] ;

[0063] in, Represents the storage parameter value after smoothing. is the smoothing coefficient, ranging from 0 to 1;

[0064] S56. Perform principal component analysis (PCA) on the smoothed storage parameter matrix to reduce the dimension of the data and extract the main features:

[0065] ;

[0066] in, represents the storage parameter matrix after dimensionality reduction, represents the storage parameter matrix after smoothing, represents the principal component matrix;

[0067] S57, inputting the storage parameter matrix after dimension reduction into the long short-term memory model for training and prediction to detect the storage status of the database file;

[0068] S58. According to the prediction result of the long short-term memory model, determine whether the current database file has abnormal storage behavior, and trigger the corresponding defense mechanism.

[0069] Optionally, the S6 specifically includes:

[0070] S61, storing the constructed database file parameter matrix As input data, Indicates the database file storage parameters at any moment;

[0071] S62, start the long short-term memory algorithm model for training and prediction, and store the parameter matrix Input into the LSTM algorithm model:

[0072] ;

[0073] in, Represents the long short-term memory algorithm model at time step The hidden state of Indicates that at time step The input storage parameters are: and Represents the time step The hidden state and memory cell state of

[0074] S63, output result is abnormal probability value , post-process the prediction results of the long short-term memory algorithm model to generate the evaluation results of the database file storage status:

[0075] ;

[0076] in, Indicates that at time step The storage state evaluation results are between 0 and 1, and the sigmoid function is used to convert the prediction results into probability values;

[0077] S64. Based on the evaluation results , determine whether the storage status of the current database file is abnormal. Exceeding the preset threshold Abnormal behavior is considered to exist when:

[0078] ;

[0079] in, Represents the preset anomaly detection threshold. Exceeding the threshold When the

[0080] S65. Based on the evaluation results of the long short-term memory algorithm model, dynamically adjust the defense strategy to improve the security and robustness of the system.

[0081] A database anti-ransomware device, comprising:

[0082] The data acquisition module builds a dynamic memory buffer pool after the device is started and saves the collected file data, including a memory allocation unit, a data storage unit, and a buffer pool management unit;

[0083] A driver loading module is used to load an advanced host controller interface driver program to access a serial advanced technology attachment storage device;

[0084] The timestamp acquisition unit starts the custom function RDTSC to obtain the clock cycles consumed by the CPU execution, and calibrates the timestamp counter value:

[0085] ;

[0086] in, is the original timestamp counter value, It is the preset system overhead time;

[0087] Thread recording unit, records the running time and suspension time of each process and thread:

[0088] ;

[0089] in, Indicates The average running time of a process or thread, Indicates The process or thread in The end clock cycle of the measurement, Indicates The process or thread in The starting clock cycle of the measurement, Indicates the number of measurements;

[0090] ;

[0091] in, Indicates The average hang time of a process or thread, Indicates The process or thread in The measured suspended clock cycles, Indicates The process or thread in The measured recovered clock period, Indicates the number of measurements;

[0092] The parameter collection module collects the storage parameters of the database files regularly through the driver program and records the changes of the storage parameters of each file;

[0093] The parameter matrix construction module smoothes the normalized storage parameter matrix to reduce the impact of noise;

[0094] The model prediction module inputs the storage parameter matrix into the long short-term memory model for training and prediction, and generates the evaluation results of the database file storage status, including:

[0095] Model input unit, which will store the parameter matrix Input into the long short-term memory model;

[0096] Evaluation output unit, which post-processes the prediction results of the long short-term memory model to generate evaluation results ;

[0097] The anomaly detection unit determines whether there is abnormal behavior based on the evaluation results. Exceeding the preset threshold When abnormal behavior is considered

[0098] The defense mechanism triggering module includes an exception recording unit that records detailed information of abnormal behavior, a process termination unit that terminates all processes and threads related to abnormal files, a backup unit that backs up the current status of abnormal files, and a notification unit that notifies the system administrator and provides a detailed report of abnormal behavior and recommended processing measures.

[0099] According to a method, device and storage medium for database anti-ransomware of an embodiment of the present invention, the present invention analyzes the access pattern of ransomware samples to database files on storage devices based on the characteristics of ransomware accessing database files and directories on storage devices and encrypting files in a short period of time, and detects the behavior of ransomware through a deep learning algorithm, thereby achieving the purposes of pre-prediction, in-process detection and post-event protection.

[0100] The beneficial effects of the present invention are:

[0101] The device of the present invention uses a deep learning algorithm to analyze the behavior of ransomware, and can detect and prevent the attack behavior of known ransomware in real time to prevent data from being encrypted. At the same time, because deep learning has self-training and self-learning skills, the device of the present invention is also capable of detecting the attack behavior of unknown variant ransomware and has good prediction capabilities. The device of the present invention can also automatically restore data to the state before the attack, ensuring business continuity and avoiding data loss, business interruption and losses caused by ransomware attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0102] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0103] Figure 1 It is a flow chart of a method for implementing database anti-ransomware using a deep learning algorithm provided by the present invention.

[0104] Figure 2 It is a schematic diagram of the process of creating a thread monitoring table provided by the present invention.

[0105] Figure 3 It is a schematic diagram of a flow chart of collecting database file storage parameters provided by the present invention.

[0106] Figure 4 It is a flow chart of loading LSTM model training and outputting detection results provided by the present invention. DETAILED DESCRIPTION

[0107] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0108] refer to Figure 1 , a method, device and storage medium for preventing database ransomware, comprising the following steps:

[0109] S101, constructing a data collection buffer pool to store the collected file data;

[0110] In this implementation, S101 specifically includes:

[0111] S11, allocating initial memory space in the device memory area to form a dynamic memory buffer pool;

[0112] S12, using a memory buffer pool to store file data collected in real time from a database system, wherein the file data includes parameters such as file name, file path, file size, file type, and file modification time;

[0113] S13, setting a memory upper limit threshold of the buffer pool. When the memory usage of the buffer pool reaches the set threshold, triggering a data cleanup or transfer mechanism, transferring the data in the buffer pool to a specified storage location to prevent memory overflow;

[0114] S14. Determine the memory usage of the buffer pool:

[0115] ;

[0116] in, Indicates the memory usage of the buffer pool. Indicates The size of the file, Indicates the number of files currently stored in the buffer pool;

[0117] S15. Dynamically adjust the memory allocation strategy of the buffer pool to optimize the space allocation of the memory buffer pool according to the load and memory usage of the database system.

[0118] S102, loading the advanced host controller interface driver;

[0119] In this implementation, S102 specifically includes:

[0120] S21, after the device is started, detecting the current system environment to determine whether the advanced host controller interface driver is supported;

[0121] S22, when the system environment supports the advanced host controller interface driver, loading the advanced host controller interface driver from the specified storage location into the memory, and initializing the advanced host controller interface driver to implement access to the serial advanced technology attachment storage device;

[0122] S23, establishing a communication connection with the advanced technology attachment storage device through the advanced host controller interface driver to confirm whether the device is operating normally and can accept data read and write operations;

[0123] S24, setting working parameters of the advanced host controller interface driver, including data transmission rate, access priority and cache strategy, to optimize data transmission performance and system response speed;

[0124] S25. Regularly monitor the running status of the advanced host controller interface driver and calculate the data transmission rate:

[0125] ;

[0126] in, Indicates the data transmission rate, Indicates the amount of data transferred. Indicates the time taken for transmission;

[0127] S26. When an abnormal situation is detected, an error log is recorded through the advanced host controller interface driver and a system administrator is notified for troubleshooting and repair.

[0128] S103, constructing a thread monitoring table by stealing CPU clock cycles, recording the running status of the monitoring threads, and detecting whether the processes and threads accessing the database are abnormal;

[0129] In this implementation, S103 specifically includes:

[0130] S31, start the custom function RDTSC for obtaining the clock cycles consumed by CPU execution;

[0131] S32, according to the CPU clock cycle, obtain all processes and threads running on the CPU;

[0132] S33, create a thread monitoring table, allocate storage space in the system memory, and record the processes and threads running on the CPU;

[0133] S34. Obtain the start clock cycle and end clock cycle of each process and thread through the RDTSC function, and calculate the running time and suspension time of each process and thread. The formula is as follows:

[0134] ;

[0135] in, Indicates The average running time of a process or thread, Indicates The process or thread in The end clock cycle of the measurement, Indicates The process or thread in The starting clock cycle of the measurement, Indicates the number of measurements;

[0136] ;

[0137] in, Indicates The average hang time of a process or thread, Indicates The process or thread in The measured suspended clock cycles, Indicates The process or thread in The measured recovered clock period, Indicates the number of measurements;

[0138] S35, record the suspension time of each process and thread, monitor the running status of the process and thread on the CPU, and detect whether there is a timing attack behavior;

[0139] S36, analyzing the recorded process and thread information, monitoring the running status of all processes and threads operating the database file, and determining whether the suspension time of the process and thread and the specified timeout operation are abnormal;

[0140] S37. When abnormal behavior is detected, the detailed information of the abnormal behavior is recorded, including thread ID, abnormal type, occurrence time and impact scope, and the preset defense mechanism is triggered to prevent further attacks by the ransomware.

[0141] S104, regularly collecting storage file parameters of the database through the advanced host controller interface driver without affecting the normal operation of the CPU;

[0142] In this implementation, S104 specifically includes:

[0143] S41, start the advanced host controller interface driver to access the database storage medium;

[0144] S42, obtaining the storage address of the database file, and establishing a storage path mapping table of the database file and directory;

[0145] S43, collecting database file information and calculating the entropy information of each database file and directory, the entropy information calculation formula is as follows:

[0146] ;

[0147] in, Indicates Entropy information of a file or directory, Indicates of the file or directory The probability of a state, Indicates the total number of states;

[0148] S44, collecting the storage access timestamp of each database file and directory in nanoseconds, recording the creation time, modification time and access time of the file;

[0149] S45, collecting the data block address and distribution sector of each database file and directory on the storage medium, and establishing a data block address and sector distribution map;

[0150] S46, collecting storage capacity changes of each database file and directory in seconds, including the amount of data written;

[0151] S47, record the entropy information calculated in S43, the storage access timestamp collected in S44, the data block address and distribution sector collected in S45, and the storage capacity change collected in S46 in the database file storage parameter record table, and update the record table in real time:

[0152] Create a database file containing the data of S43, S44, S45 and S46. Every time new data is collected, update the records corresponding to the file or directory, and record the entropy information, timestamp, data block address and distribution, storage capacity change and other data in time series;

[0153] S48. Based on the data in the database file storage parameter record table, a preliminary analysis is performed to identify files with abnormal storage parameter changes, providing basic data support for long-term and short-term memory model analysis and prediction in subsequent steps.

[0154] S105, constructing a storage parameter matrix according to the parameter type of the database file storage parameters collected regularly;

[0155] In this implementation, S105 specifically includes:

[0156] S51, constructing a storage parameter matrix according to the database file storage parameters collected in S4 and according to the parameter types;

[0157] S52. Define storage parameter matrix ,in The rows represent different database files, and the columns represent different types of storage parameters;

[0158] S53, filling the storage parameters of each file into the storage parameter matrix in sequence, specifically including:

[0159] ;

[0160] in, Indicates of the files storage parameters, Indicates of the files Store parameter values;

[0161] S54. Normalize the storage parameter matrix to eliminate the dimensional differences between different storage parameters:

[0162] ;

[0163] in, Represents the normalized storage parameter value, and Respectively represent The column stores the minimum and maximum values ​​of the parameter;

[0164] S55, smoothing the normalized storage parameter matrix to reduce the impact of noise:

[0165] ;

[0166] in, Represents the storage parameter value after smoothing. is the smoothing coefficient, ranging from 0 to 1;

[0167] S56. Perform principal component analysis (PCA) on the smoothed storage parameter matrix to reduce the dimension of the data and extract the main features:

[0168] ;

[0169] in, represents the storage parameter matrix after dimensionality reduction, represents the storage parameter matrix after smoothing, represents the principal component matrix;

[0170] S57, inputting the storage parameter matrix after dimension reduction into the long short-term memory model for training and prediction to detect the storage status of the database file;

[0171] S58. According to the prediction result of the long short-term memory model, determine whether the current database file has abnormal storage behavior, and trigger the corresponding defense mechanism.

[0172] S106, load the long short-term memory model training and output the detection results, input the storage parameter matrix into the long short-term memory anti-ransomware prediction model, train and predict in real time whether the current database file status is normal or abnormal, and trigger the ransomware blocking mechanism and database protection mechanism according to the evaluation detection results.

[0173] In this implementation, S106 specifically includes:

[0174] S61, storing the constructed database file parameter matrix As input data, Indicates the database file storage parameters at any moment;

[0175] S62, start the long short-term memory algorithm model for training and prediction, and store the parameter matrix Input into the LSTM algorithm model:

[0176] ;

[0177] in, Represents the long short-term memory algorithm model at time step The hidden state of Indicates that at time step The input storage parameters are: and Represents the time step The hidden state and memory cell state of

[0178] S63, output result is abnormal probability value , post-process the prediction results of the long short-term memory algorithm model to generate the evaluation results of the database file storage status:

[0179] ;

[0180] in, Indicates that at time step The storage state evaluation results are between 0 and 1, and the sigmoid function is used to convert the prediction results into probability values;

[0181] S64. Based on the evaluation results , determine whether the storage status of the current database file is abnormal. Exceeding the preset threshold Abnormal behavior is considered to exist when:

[0182] ;

[0183] in, Represents the preset anomaly detection threshold. Exceeding the threshold When the

[0184] S65. Based on the evaluation results of the long short-term memory algorithm model, dynamically adjust the defense strategy to improve the security and robustness of the system.

[0185] A database anti-ransomware device, comprising:

[0186] The data acquisition module builds a dynamic memory buffer pool after the device is started and saves the collected file data, including a memory allocation unit, a data storage unit, and a buffer pool management unit;

[0187] A driver loading module is used to load an advanced host controller interface driver program to access a serial advanced technology attachment storage device;

[0188] The timestamp acquisition unit starts the custom function RDTSC to obtain the clock cycles consumed by the CPU execution, and calibrates the timestamp counter value:

[0189] ;

[0190] in, is the original timestamp counter value, It is the preset system overhead time;

[0191] Thread recording unit, records the running time and suspension time of each process and thread:

[0192] ;

[0193] in, Indicates The average running time of a process or thread, Indicates The process or thread in The end clock cycle of the measurement, Indicates The process or thread in The starting clock cycle of the measurement, Indicates the number of measurements;

[0194] ;

[0195] in, Indicates The average hang time of a process or thread, Indicates The process or thread in The measured suspended clock cycles, Indicates The process or thread in The measured recovered clock period, Indicates the number of measurements;

[0196] The parameter collection module collects the storage parameters of the database files regularly through the driver program and records the changes of the storage parameters of each file;

[0197] The parameter matrix construction module smoothes the normalized storage parameter matrix to reduce the impact of noise;

[0198] The model prediction module inputs the storage parameter matrix into the long short-term memory model for training and prediction, and generates the evaluation results of the database file storage status, including:

[0199] Model input unit, which will store the parameter matrix Input into the long short-term memory model;

[0200] Evaluation output unit, which post-processes the prediction results of the long short-term memory model to generate evaluation results ;

[0201] The anomaly detection unit determines whether there is abnormal behavior based on the evaluation results. Exceeding the preset threshold When abnormal behavior is considered

[0202] The defense mechanism triggering module includes an exception recording unit that records detailed information of abnormal behavior, a process termination unit that terminates all processes and threads related to abnormal files, a backup unit that backs up the current status of abnormal files, and a notification unit that notifies the system administrator and provides a detailed report of abnormal behavior and recommended processing measures.

[0203] Embodiment 1:

[0204] like Figure 1 As shown, the method for implementing database anti-ransomware based on deep learning algorithm provided in this embodiment includes the following steps:

[0205] Step S101: construct a data acquisition buffer pool.

[0206] In this embodiment, after the embodiment is started, a memory buffer pool will first be constructed in the memory area. The buffer pool can automatically expand the buffer pool capacity according to the amount of data collected to ensure the storage of real-time collected data.

[0207] Step S102: Load the ACHI driver.

[0208] Furthermore, this embodiment will load an ACHI (Advanced Host Controller Interface) driver, which plays the role of a universal interface between the system memory bus and the internal logic of the Serial ATA device, and is used to implement access to the Serial Advanced Technology Attachment (SATA) storage device.

[0209] Step S103: Create a thread monitoring table.

[0210] Specifically, Figure 2 As shown, it mainly includes the following steps:

[0211] S301: Start the RDTSC function, which is a custom function for obtaining the clock cycles consumed by the CPU execution.

[0212] S302: According to the CPU clock cycle, obtain the processes and threads running on the CPU.

[0213] S303: Create a thread monitoring table to record the processes and threads running on the CPU.

[0214] S304: Record the running time and suspension time of each running process and thread. The purpose of this step is to monitor the running status (running or suspension) of all threads operating the database file. Since the suspension time and specified timeout of the thread may be used as a timing attack, monitoring the thread running status can detect whether the storage mode of accessing the database is abnormal.

[0215] Step S104: Collect database file storage parameters.

[0216] Furthermore, through the ACHI driver, the embodiment of the present invention will regularly collect the storage parameters of the database without affecting the normal operation of the CPU;

[0217] Specifically, Figure 3 As shown, it mainly includes the following steps:

[0218] S401: Start the ACHI driver to access the database storage medium.

[0219] S402: Obtain the database file storage address.

[0220] S403: Collect database file information and calculate the entropy information of each database file and directory.

[0221] S404: Collect the storage access timestamp of each database file and directory in nanoseconds.

[0222] S405: Collect the data block address and distribution sector of each database file and directory on the storage medium.

[0223] S406: Collect the storage capacity changes of each database file and directory in seconds, including the amount of data written.

[0224] Step S105: construct a database file parameter matrix.

[0225] Furthermore, the database file parameters collected regularly are used to construct a parameter matrix. In the embodiment of the present invention, five types of information are collected, including storage address, entropy information, data block size, sector information, and data volume change information, and the file parameter matrix is ​​constructed in units of categories.

[0226] Step 106: Load the LSTM model training and output the detection results.

[0227] Furthermore, the storage parameter matrix is ​​input into the LSTM anti-ransomware prediction model to train and predict in real time whether the current database file status is normal or abnormal, and trigger the database protection mechanism based on the evaluation detection results.

[0228] Specifically, Figure 4 As shown, it mainly includes the following steps:

[0229] S601: The constructed database file storage parameter matrix is ​​used as input data, wherein x1, x2, ..., xn represent the database file storage parameters at any moment.

[0230] S602: Start the LSTM algorithm model for training and prediction.

[0231] S603: The output result is an abnormal probability value, where y1, y2, ..., yn are the evaluation values ​​of discovering the ransomware work at any time.

[0232] Furthermore, the device of the present invention searches for and kills abnormal threads according to the thread control table based on the probability of being identified as ransomware, and simultaneously starts the database protection and disaster preparedness mechanism.

[0233] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that comply with the claims of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

[0234] Embodiment 2:

[0235] In January 2023, a large financial institution in City A urgently needed an effective anti-ransomware measure in its database management system. The system contained sensitive information of more than 5 million customers and more than 100,000 financial transaction data per day. Once attacked by ransomware, it could lead to serious data leakage and economic losses. In order to ensure data security and system stability, the institution decided to apply a database anti-ransomware method based on deep learning algorithms.

[0236] Scenario description:

[0237] The database system of a financial institution processes various transaction requests and customer information query requests 24 hours a day. Due to frequent operations, the system needs to monitor the storage status of the database in real time to detect and defend against ransomware attacks in a timely manner. This embodiment uses the long short-term memory (LSTM) model to perform real-time analysis and prediction of database storage parameters, detect abnormal behavior, and take corresponding defense measures.

[0238] Application in this scenario:

[0239] First, after the system starts, a dynamic memory buffer pool is built in the memory area to save the collected file data. Then, the system loads the Advanced Host Controller Interface (ACHI) driver to access the Serial Advanced Technology Attachment (SATA) storage device. Subsequently, the CPU clock cycle is obtained through the custom RDTSC function, and a thread monitoring table is created to record the running status of all processes and threads.

[0240] The storage parameters of the database files are collected regularly every day, including file size, creation time, modification time, access time, data block address, and distribution sectors. These data are stored in the memory buffer pool and constructed into a storage parameter matrix. In order to eliminate the dimensional differences between different parameters, the system normalizes the storage parameter matrix and uses principal component analysis (PCA) technology to reduce the dimension and extract the main features.

[0241] The reduced storage parameter matrix is ​​input into the pre-trained LSTM model, which predicts the storage status of the current database file in real time and outputs the probability value of anomalies. On January 15, 2023, when the system performed a routine check at 3 a.m., it was found that the storage status evaluation results of some files continued to be higher than the preset threshold. The abnormal probability values ​​output by the model were 0.85, 0.92, and 0.95, respectively, indicating that these files have a high risk of abnormality.

[0242] To verify the effectiveness of this method, we conducted several experiments in February of the same year. Experimental data showed that after applying this method, the system successfully detected and blocked multiple ransomware attacks. For example, in a simulated attack on February 10, the ransomware attempted to encrypt database files between 3 and 4 a.m. Traditional protection measures failed to respond in time, resulting in the encryption of some files. After applying this method, the system detected abnormal behavior at 3:15 a.m. and immediately triggered the defense mechanism, terminating the processes and threads related to the abnormal files, backing up the current status of the affected files, and notifying the system administrator. Post-analysis showed that the accuracy of anomaly detection reached more than 95%, and the false alarm rate was less than 2%.

[0243] Table 1 Experimental environment data table

[0244]

[0245] Table 2 Experimental time data table

[0246]

[0247] Table 3 Detection effect data table

[0248]

[0249] Table 4 Performance index data table

[0250]

[0251] Referring to the above table, through this embodiment, the system can efficiently and accurately monitor and protect the storage status of database files without affecting normal operations, ensuring data security and system stability. This method not only improves the accuracy of anomaly detection, but also significantly reduces the false alarm rate, effectively solving the problem that traditional methods are difficult to respond in real time under high-frequency operations, and showing significant beneficial effects.

[0252] In summary, the successful application of this embodiment in the database management system of a financial institution verifies the effectiveness and reliability of the database anti-ransomware method based on the deep learning algorithm. By real-time collection and analysis of multi-dimensional storage parameters of the database and using the LSTM model to predict abnormal behavior, automatic detection and defense against ransomware attacks are achieved, providing a strong guarantee for the data security of financial institutions.

[0253] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for preventing database ransomware, characterized in that: The steps include: S1. Build a data collection buffer pool to save the collected file data; S2, load the advanced host controller interface driver; S3, build a thread monitoring table by stealing CPU clock cycles, record the running status of the monitoring thread, and detect whether the process and thread accessing the database are abnormal; S4, collecting storage file parameters of the database regularly without affecting the normal operation of the CPU through the advanced host controller interface driver; S5, constructing a storage parameter matrix according to the parameter type of the database file storage parameters collected regularly; S6. Load the long short-term memory model training and output the detection results, input the storage parameter matrix into the long short-term memory anti-ransomware prediction model, train and predict in real time whether the current database file status is normal or abnormal, and trigger the ransomware blocking mechanism and database protection mechanism according to the evaluation detection results; The S3 specifically includes: S31, start the custom function RDTSC for obtaining the clock cycles consumed by CPU execution; S32, according to the CPU clock cycle, obtain all processes and threads running on the CPU; S33, create a thread monitoring table, allocate storage space in the system memory, and record the processes and threads running on the CPU; S34. Obtain the start clock cycle and end clock cycle of each process and thread through the RDTSC function, and calculate the running time and suspension time of each process and thread. The formula is as follows: ; in, Indicates The average running time of a process or thread, Indicates The process or thread in The end clock cycle of the measurement, Indicates The process or thread in The starting clock cycle of the measurement, Indicates the number of measurements; ; in, Indicates The average hang time of a process or thread, Indicates The process or thread in The measured suspended clock cycles, Indicates The process or thread in The measured recovered clock period, Indicates the number of measurements; S35, record the suspension time of each process and thread, monitor the running status of the process and thread on the CPU, and detect whether there is a timing attack behavior; S36, analyzing the recorded process and thread information, monitoring the running status of all processes and threads operating the database file, and determining whether the suspension time of the process and thread and the specified timeout operation are abnormal; S37. When abnormal behavior is detected, the detailed information of the abnormal behavior is recorded, including thread ID, abnormal type, occurrence time and impact scope, and the preset defense mechanism is triggered to prevent further attacks by ransomware; The S4 specifically includes: S41, start the advanced host controller interface driver to access the database storage medium; S42, obtaining the storage address of the database file, and establishing a storage path mapping table of the database file and directory; S43, collecting database file information and calculating the entropy information of each database file and directory, the entropy information calculation formula is as follows: ; in, Indicates Entropy information of a file or directory, Indicates of the file or directory The probability of a state, Indicates the total number of states; S44, collecting the storage access timestamp of each database file and directory in nanoseconds, recording the creation time, modification time and access time of the file; S45, collecting the data block address and distribution sector of each database file and directory on the storage medium, and establishing a data block address and sector distribution map; S46, collecting storage capacity changes of each database file and directory in seconds, including the amount of data written; S47, record the entropy information calculated in S43, the storage access timestamp collected in S44, the data block address and distribution sector collected in S45, and the storage capacity change collected in S46 in the database file storage parameter record table, and update the record table in real time: Create a database file containing the data of S43, S44, S45 and S46. Every time new data is collected, update the records corresponding to the file or directory, and record the entropy information, timestamp, data block address and distribution, and storage capacity change data in time series; S48. Based on the data in the database file storage parameter record table, a preliminary analysis is performed to identify files with abnormal storage parameter changes, providing basic data support for the long-short term memory model analysis and prediction in subsequent steps.

2. A method for preventing database ransomware according to claim 1, characterized in that: The S1 specifically includes: S11, allocating initial memory space in the device memory area to form a dynamic memory buffer pool; S12, using a memory buffer pool to store file data collected in real time from a database system, wherein the file data includes parameters such as file name, file path, file size, file type, and file modification time; S13, setting a memory upper limit threshold of the buffer pool. When the memory usage of the buffer pool reaches the set threshold, triggering a data cleanup or transfer mechanism, transferring the data in the buffer pool to a specified storage location to prevent memory overflow; S14. Determine the memory usage of the buffer pool: ; in, Indicates the memory usage of the buffer pool. Indicates The size of the file, Indicates the number of files currently stored in the buffer pool; S15. Dynamically adjust the memory allocation strategy of the buffer pool to optimize the space allocation of the memory buffer pool according to the load and memory usage of the database system.

3. A method for preventing database ransomware according to claim 1, characterized in that: The S2 specifically includes: S21, after the device is started, detecting the current system environment to determine whether the advanced host controller interface driver is supported; S22, when the system environment supports the advanced host controller interface driver, loading the advanced host controller interface driver from the specified storage location into the memory, and initializing the advanced host controller interface driver to implement access to the serial advanced technology attachment storage device; S23, establishing a communication connection with the advanced technology attachment storage device through the advanced host controller interface driver to confirm whether the device is operating normally and can accept data read and write operations; S24, setting working parameters of the advanced host controller interface driver, including data transmission rate, access priority and cache strategy, to optimize data transmission performance and system response speed; S25. Regularly monitor the running status of the advanced host controller interface driver and calculate the data transmission rate: ; in, Indicates the data transmission rate, Indicates the amount of data transferred. Indicates the time taken for transmission; S26. When an abnormal situation is detected, an error log is recorded through the advanced host controller interface driver and a system administrator is notified for troubleshooting and repair.

4. A method for preventing database ransomware according to claim 1, characterized in that: The S5 specifically includes: S51, constructing a storage parameter matrix according to the database file storage parameters collected in S4 and according to the parameter types; S52. Define storage parameter matrix ,in The rows represent different database files, and the columns represent different types of storage parameters; S53, filling the storage parameters of each file into the storage parameter matrix in sequence, specifically including: ; in, Indicates of the files storage parameters, Indicates of the files Store parameter values; S54. Normalize the storage parameter matrix to eliminate the dimensional differences between different storage parameters: ; in, Represents the normalized storage parameter value, and Respectively represent The column stores the minimum and maximum values ​​of the parameter; S55, smoothing the normalized storage parameter matrix to reduce the impact of noise: ; in, Represents the storage parameter value after smoothing. is the smoothing coefficient, ranging from 0 to 1; S56. Perform principal component analysis (PCA) on the smoothed storage parameter matrix to reduce the dimension of the data and extract the main features: ; in, represents the storage parameter matrix after dimensionality reduction, represents the storage parameter matrix after smoothing, represents the principal component matrix; S57, inputting the storage parameter matrix after dimension reduction into the long short-term memory model for training and prediction to detect the storage status of the database file; S58. According to the prediction result of the long short-term memory model, determine whether the current database file has abnormal storage behavior, and trigger the corresponding defense mechanism.

5. A method for preventing database ransomware according to claim 1, characterized in that: The S6 specifically includes: S61, storing the constructed database file parameter matrix As input data, Indicates the database file storage parameters at any moment; S62, start the long short-term memory algorithm model for training and prediction, and store the parameter matrix Input into the LSTM algorithm model: ; in, Represents the long short-term memory algorithm model at time step The hidden state of Indicates that at time step The input storage parameters are: and Represents the time step The hidden state and memory cell state of S63, output result is abnormal probability value , post-process the prediction results of the long short-term memory algorithm model to generate the evaluation results of the database file storage status: ; in, Indicates that at time step The storage state evaluation results are between 0 and 1, and the sigmoid function is used to convert the prediction results into probability values; S64. Based on the evaluation results , determine whether the storage status of the current database file is abnormal. Exceeding the preset threshold Abnormal behavior is considered to exist when: ; in, Represents the preset anomaly detection threshold. Exceeding the threshold When the S65. Based on the evaluation results of the long short-term memory algorithm model, dynamically adjust the defense strategy to improve the security and robustness of the system.