MALICIOUS DOCUMENT IDENTIFICATION TOOL BASED ON MACHINE LEARNING DESIGN AND IMPLEMENTATION
Abstract: with the further improvement of networking and informatization, advanced persistent threats (Advanced Identify large-scale malicious document files). The number of Advanced Persistent Threat (APT) incidents has been increasing, posing a serious threat and huge threat to the security development of the country and enterprises. In the breakthrough stage, the most commonly used network attack technology is to use malicious documents implanted with remote Trojans, so it is effective. APT attacks can cause huge economic losses. It is necessary to detect and identify malicious documents. After a thorough investigation of the current situation, this article proposes a method based on machine learning by combining virtual sandbox to dynamically analyze unknown documents, a new malicious document detection method is designed and implemented. To enhance detection performance, the suggested approach combines feature extraction methodologies with classification algorithms. A thorough dataset of classified hostile and benign texts is used to train the machine learning model, guaranteeing a reliable classification system. The evaluation measures show that the strategy performs better than conventional signature-based detection techniques.
Keywords: malicious documents, machine learning, feature vector, virtual sandbox.
Introduction.In recent years, Advanced Persistent Threat (APT) attacks have become a hot topic of social concern. When the attack is launched, it is mainly divided into four key stages (as shown in Figure 1):Figure 1. Malicious document attack link example map.Arbitrary code execution, bypassing system security mitigation strategies, anti-security product detection, and execution function. The following focuses on the key technologies in the four stages.
Symantecs 2016 Cyber Threat Report shows that with the reduction of pointed out that with attack costs, the main targets of APT attacks have gradually shifted from large enterprises to small and medium-sized enterprises, which means that more and more companies are facing the threat of such attacks.Scholars at home and abroad have conducted a lot of research on APT attacks. It was found that malicious documents are the most commonly used technical means in the single- point breakthrough stage of APT attacks, and play a significant role in the success rate of the overall attack. If malicious documents are captured and identified in advance in links such as email phishing, it will be able to effectively prevent and combat APT attacks. However, most methods for identifying malicious documents are unsatisfactory, either with low accuracy and high false alarm rates, or unable to detect encrypted documents.
Conventional rule-based detection methods are less successful against novel, yet unforeseen threats because they are unable to adjust to the constantly changing nature of APT attacks. To this end, this paper proposes a malicious document detection method based on machine learning. This method uses the key points of the malicious document attack chain as features, places the detection samples in a virtual sandbox system for dynamic operation, and combines machine learning methods to train a malicious document classification model. Experimental results show that the method proposed in this paper The malicious document detection method has a high accuracy rate, among which office The accuracy rate of the file is 95.75%, the accuracy rate of the pdf file is 96.34%, and the accuracy rate of the swf file is 88.41%.
The model exhibits enhanced generalization skills by utilizing ensemble learning strategies including random forests and gradient boosting, which lowers the possibility of misclassification and increases resistance to hostile attacks.Literature review.1.1 An examination of the existing malicious document attack chainIn order to study malicious document detection technology, it is necessary to Detailed understanding and analysis of the attack chain. Using malicious documents to attack Figure 1: Example of a malicious document attack chain1) Breaking through DEP/ASLR protection technology. DEP (Data Protection Execution) and ASLR (Address Space Layout Randomization) technologies use the exception handling mechanism and random distribution of code module entry points in the operating system to prevent the execution of malicious code. Attackers circumvent these safeguards by employing strategies like return-oriented programming (ROP) and jump-oriented programming (JOP), which permits malicious payloads to run even when DEP/ASLR is activated.2) Breaking through the sandbox protection technology.
Sandbox technology is simply Allow programs to run in a restricted environment with the minimum permissions they need. For example, a web browsing process is only responsible for image rendering and does not need to have the permission to execute system commands. Even if a program running in sandbox protection mode is successfully attacked, the permissions it obtains are very low and it cannot read and write files normally. To get around these limitations, attackers use sandbox evasion strategies include environmental fingerprinting, delayed execution, and taking advantage of flaws in the sandbox itself.3) Exploiting arbitrary memory address read and write vulnerabilities.
Once the arbitrary memory address read and write vulnerability is successfully triggered, the read and write permissions of the entire memory area are obtained. After obtaining this permission, it is equivalent to having a memory patch generator when the program is running. It can apply arbitrary patches to the program and obtain full control of the program. This enables attackers to escalate privileges, insert malicious code, and alter program execution, ultimately resulting in a complete system breach.4) Module address leakage technology.
The biggest flaw of ASLR is that although the entry address of the code module is randomly assigned, the relative offset within the code module is fixed. If a vulnerability can be found to leak any address in the code module, then the entry address of the entire code module can be calculated based on the fixed offset, thereby making ASLR protection completely ineffective. Return-oriented programming (ROP) attacks are frequently made easier with this technique, which enables attackers to consistently run arbitrary code.5) Anti-debugging technology. After the payload is executed, relevant technologies are used to determine whether the current program is being debugged.
If so, the function code will no longer be executed or the debugging code will be interfered with to prevent further analysis. Common anti-debugging methods include monitoring system APIs like IsDebuggerPresent, identifying software breakpoints, and determining whether debugging tools are present.1.2Malicious Document Detection Technology at Home and Abroad There are many related technologies that can be used to identify unknown malicious code and its variants. There are mainly three types:1.2.1Static heuristic scanning technology.This technology refers to identifying malicious code by analyzing characteristic instruction sequences (such as API sequences) in suspicious documents when the code is not running dynamically. Antivirus software and intrusion detection systems frequently employ static analysis techniques to swiftly search for known threats.Literature identifies malicious PDF documents by extracting JavaScript codes in PDF documents and performing feature analysis.
Analyzing JavaScript activity is an essential step in static detection since embedded JavaScript is used for attacks in many malicious PDF documents. These methods have achieved good recognition results in non-encrypted deformed malicious documents, but the recognition results in encrypted documents are not significant. Combining static and dynamic analysis is required for higher detection rates because attackers frequently utilize encryption and obfuscation techniques to evade static detection. With the help of machine learning methods, using large-scale training sample sets to build intelligent models can efficiently and accurately solve the security problems caused by current large-scale attacks.
However, different algorithms are good at dealing with very different areas, so it is very important to choose the right machine learning algorithm. The following compares the advantages and disadvantages of machine learning algorithms:1.2.2Code-based dynamic behavior analysis technologyThe key point of this technology is to monitor the operation of the code during operation. Dynamic analysis, as opposed to static analysis, runs the document in a controlled setting to see how it behaves. Behaviors, including file operations, network connection behaviors, etc. weak classifiers, and multiple weak classifiers can be cascaded to form a strong classifier, making the classification very accurate.
The disadvantage is that the number of AdaBoost iterations, that is, the number of weak classifiers, is difficult to set, and Huang et al. proposed to identify malicious behavior by observing the key values of the system registry, network connection behavior, and abnormal changes in file IO operations when suspicious documents are running dynamically. By altering its execution path at runtime, this method enables the discovery of malware that avoids static analysis. The advantages of this method are simplicity and efficiency, and it can detect unknown malicious documents to a certain extent without worrying about whether the malicious code is encrypted, the disadvantages are high false positive and false negative rates. Analysis is further complicated by the fact that malware writers create their payloads to recognize sandbox settings and alter behavior accordingly.
Data imbalance leads to decreased classification accuracy.2 Malicious Document Detection Solution.2.1 Model selection and solution design.With the help of machine learning methods, using large-scale training sample sets to build intelligent models can efficiently and accurately solve the security problems caused by current large-scale attacks. However, different algorithms are good at dealing with very different areas, so it is very important to choose the right machine learning algorithm. The benefits and drawbacks of many machine learning techniques employed in harmful document identification are contrasted in the section that follows:1) KNN algorithm. The KNN algorithm is simple in theory and easy to implement.
But when the sample size is large, the data set calculation is relatively large, and the sample is unbalanced The prediction deviation is relatively large.2) Support vector machine (SVM). Its advantage is that it is good at solving nonlinear problems. It can solve machine learning problems under small sample conditions, has no local minimum problem, can handle high-dimensional data sets well, and has strong generalization ability. The disadvantage is that it has poor explanatory power for high-dimensional mapping of kernel functions, especially radial basis functions, and is sensitive to missing data.3) Decision trees.
The advantages are that they are easy to understand and interpret, can be analyzed visually, are easy to extract rules from, and can handle both nominal and numerical data. They run faster when testing data sets. Decision trees can scale well to large databases, and their size is independent of the data. The performance of generalization may be impacted by decision trees propensity for overfitting.4) Naive Bayes algorithm.
The advantage is that it can be used for large-scale training and The query has a high speed and supports incremental operations. The disadvantage is that the sample attributes need to be independent of each other, and the effect is not good when there is a correlation.5) Artificial neural network. The advantages are high classification accuracy and learning it has strong ability, associative ability, can approximate any nonlinear relationship, and has strong robustness and fault tolerance to noise data.2.2 Extraction and classification of feature vectors.The extraction of feature vectors is an important factor affecting the recognition results of decision trees. This method extracts feature vectors based on the behavioral characteristics of the current malicious document attack chain.
Feature vector extraction is mainly divided into two aspects: static feature vector extraction and dynamic behavior feature vector extraction. APIs. ÿ Memory behavior. ROP chain operations that bypass DEP and ASLR. Such as abnormal access to the export table or MZ header of the Kernel 32 module.Anti-security product detection behavior feature vectors such as anti-hook, anti-debugging, anti-virtual machine, etc. function behavior feature vectors Network behavior.
Establishing network links and downloading data traffic. File behavior. Creating executable files. Process behavior.
Creating processes. System aspect. Calling sensitive APIs to obtain system environment information. Registry aspect.
Creating services or setting automatic startup.2.3 Collect training sample sets, namely malicious document samples and non-malicious document samples. 2018 Issue 8 Level Protection2) The document samples in the training sample set are input into the scheduling module Virtual Sandbox.3) Run the document sample in the virtual sandbox to capture the document sample operating behavior.4) Categorize the document samples according to their running behaviors, including 7 categories: network behavior, file behavior, memory behavior, thread behavior, process behavior, system behavior, and registry behavior.5) Count the number of behaviors in each category and calculate the behavior feature value based on the number, and combine the behavior feature values of the 7 categories into the sample The dynamic behavior feature vector of .6) Extract the dynamic behavior feature vectors of all samples in the training sample set, calculate the information gain rate of the feature vector, select the feature vector with the largest information gain rate, use the behavior feature obtained from the feature vector as the classification feature, and establish sub-nodes according to the feature division.Two functions: File format recognition is based on file magic, and magic matching uses the currently open source YARA rule matching. When the target process has too many behaviors, traditional sandboxes are seriously affected. In order to improve the host efficiency, a virtual sandbox is used to capture the dynamic runtime behavior of the samples. QEMU is selected for design and implementation, and is managed uniformly through libvirt.
QEMU is a simulated processor that uses the GPL license to distribute source code. It supports multiple architectures, has a fast simulation speed, and is quick and easy to install and configure. The machine learning recognition subsystem mainly trains known malicious documents training, extracting behavioral features and building decision tree rules. The tree-based rules match and identify unknown malicious samples.
The processing flow of the malicious document identification tool based on machine learning is as follows: Level of Protection 2018 Issue 81) The sample files to be tested are uploaded to the front-end visualization subsystem. Upload the interface to the backend. The captured dynamic behavior features are combined into a dynamic behavior feature vector to build a decision tree.2) The task scheduling subsystem receives the sample file to be tested and3) Confirm the sample opening execution method based on the identified file format packaged into ISO format.4) Restore the virtual machine snapshot and mount the detected sample via CD Load it into the virtual machine and execute it.5) Dynamic behaviors captured by the virtual sandbox behavior capture subsystem Sent to the machine learning-based recognition subsystem.6) The machine learning recognition subsystem classifies and cleans the behaviors based on the machine learning algorithm, sends them to the decision tree, calculates the final detection results through the decision tree algorithm and writes them into the database. Test Dataset in order to evaluate the performance of the system, the experiment mainly considers two aspects of performance: (1) Testing the recognition accuracy and false alarm rate of the test system for unknown samples, (2) Testing the stability of the system under large-scale sample input. 245 malicious samples (including 112 office files, 96 PDF files, and 37 SWF files) were downloaded from virustotal and 200 normal samples (including 100 office files, 68 PDF files, and 32 SWF files) were collected and sorted locally as experimental data for system accuracy and false alarm rate testing.
In addition, 3,000 sample data were randomly collected as experimental data for system stability testing. 3.2 Accuracy and False Alarm Rate Experiment3 Materials and methods.3.1 Experimental Preparation.1. Experimental Environment is on the google colab with a100 gpu, its software environment includes common document software such as office and adobe reader. In order to stop malicious payloads from propagating outside of the test setup, the virtual sandbox utilized in this study is also set up with a restricted execution environment that limits external network access. This guarantees secure testing of extremely complex malware that may try to be exploited in the real world.2.
Training data set Collect 50 malicious documents and 50 normal documents to form a sample training set. Use a virtual sandbox system to capture dynamic behavior features. The dangerous samples were chosen from a variety of sources, such as threat intelligence feeds and open-source malware repositories, to guarantee a representative and varied dataset. These samples included a range of attack methods, including obfuscated code in SWF files, JavaScript vulnerabilities in PDFs, and malware placed in Office files that was based on macros.
However, in order to prevent biased categorization, the standard documents were gathered from reports, open-access scholarly articles, and templates that are often used.According to the test results, it can be found that the system still has the following major problem:The sample behavior simulation is not perfect. Through the analysis of the test results It can be found that the systems recognition accuracy for swf files is only 88.41%, which is much lower than 95.75% for office files and 96.34% for pdf files. The complexity of SWF execution, which frequently entails dynamic loading of extra code and dependencies, is probably the cause of this disparity, making static and behavioral analysis more challenging. Adding a richer emulator that can better comprehend ActionScript code should be one of the future enhancements.In addition, an in-depth analysis of the sample files revealed that when the swf sample has input parameters or internal code encryption, the system does not handle it perfectly, making it difficult to fully capture all behaviors of this type of sample.
Using dynamic instrumentation tools to trace API calls associated with self-modification and monitor runtime decryption procedures might be one possible approach. Further research is needed on how to fully restore the actual running scenario of the sample and comprehensively and accurately capture the sample running behavior. 2018 Issue 8 Level Protection.In order to evaluate the performance of the system, the experiment mainly considers two aspects of performance:(1) Testing the recognition accuracy and false alarm rate of the system for unknown samples.(2) Testing the stability of the system under large-scale sample input.The experiment was carried out in a variety of execution contexts, including many operating system versions (Windows 7, Windows 10, and Windows 11), to guarantee robustness and take into consideration differences in security protocols and API behavior among various platforms.245 malicious samples (including 112 office files, 96 pdf files, and 37 swf files) downloaded from virustotal and 200 normal samples (including 100 office files, 68 pdf files, and 32 swf files) collected and sorted from local as experimental data for system accuracy and false alarm rate testing. In addition, 3000 sample data were randomly collected as experimental data for system stability testing.Furthermore, 3,000 document samples were used in a stress test to assess system stability under high-volume processing circumstances. The purpose of this test was to evaluate processing bottlenecks, possible memory leaks, and performance deterioration.3.2 Accuracy and false alarm rate experiment.The system in this paper was used to detect 245 malicious samples downloaded from virustotal and 200 normal samples collected and sorted from local.
The test results are shown in Table 2.Table 2. Test results.These findings clearly demonstrate how well the system detects malicious Office and PDF files. The comparatively lower accuracy for SWF files, however, suggests that SWF analysis methods need to be improved even further, especially when it comes to handling obfuscated and encrypted scripts.Conclusion.The system in this paper is based on machine learning and combines virtual sandboxes to perform dynamic behavior analysis on unknown documents, which can efficiently process and identify large-scale document files. The approach reduces dependency on conventional signature-based detection techniques by efficiently classifying and identifying harmful document behavior patterns through the use of decision tree algorithms.In the detection of real document samples, a high accuracy rate and a low false alarm rate were achieved.
However, the system in this paper still needs a large-scale training sample set to solve the problem of failure to identify some unknown samples during the malicious document identification process.Future research will concentrate on:Adding more harmful document types to the collection, including more recent attacks that target newly popular document formats like OneNote files and Office documents that use XML.Enhancing the sandbox behavior simulation by adding AI-driven anomaly detection to better catch minute changes in malevolent behavior.Improving feature extraction methods to find more intricate patterns in harmful texts by utilizing deep learning models like Transformers or Convolutional Neural Networks (CNNs).The next step will be to address the problem of incomplete sample training sets and imperfect simulation of file behavior. By collecting more training samples, in addition to using adversarial training methods to strengthen resistance to malware evasion tactics, we will study how to capture sample operation behaviors more comprehensively and accurately to further improve system performance.
Полная версия статьи PDF
Номер журнала «Вестник науки» № 4 (85) том 2
Ссылка для цитирования:
MALICIOUS DOCUMENT IDENTIFICATION TOOL BASED ON MACHINE LEARNING DESIGN AND IMPLEMENTATION // Журнал «Вестник науки» от 13 апреля 2025 г. № 4 (85) том 2. С. 622 - 634. 2025 г. ISSN 2712-8849 // Электронный ресурс: https://www.вестник-науки.рф/article/22256 (дата обращения: 29.11.2026 г.)
Альтернативная ссылка латинскими символами: vestnik-nauki.com/article/22256
Нашли грубую ошибку (плагиат, фальсифицированные данные или иные нарушения научно-издательской этики) ?
- напишите письмо в редакцию журнала: zhurnal@vestnik-nauki.com
