Charging pile vulnerability mining method and device and electronic equipment
Generate test cases through the target generation adversarial network model and mutation strategy, and conduct fuzzy testing, which solves the problem of low accuracy caused by incomplete considerations in charging pile vulnerability mining, and improves the security of charging piles.
Patent Information
- Application Number
- CN202410863790.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-29
- Publication Date
- 2024-10-29
AI Technical Summary
The existing technology does not consider comprehensive factors when mining charging pile vulnerabilities, resulting in low accuracy of vulnerability mining and poor system operation security.
Using the target generation adversarial network model and mutation strategy, by obtaining the target communication message data between the charging pile and the charging object, the first test case and the second test case are generated, and added to the fuzz test environment for fuzz testing. Determine if a security vulnerability exists.
It improves the accuracy of charging pile vulnerability mining, improves the safety of charging pile use, and solves the problem of low accuracy of vulnerability mining caused by incomplete consideration of factors.
Smart Images

Figure CN118862084A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart grid technology, and in particular to a charging pile vulnerability mining method, device and electronic equipment. Background Art
[0002] Vulnerability mining refers to the use of various technical means and system tools to find security vulnerabilities in software programs, communication protocols, etc. Unlike vulnerability detection technology, which can only detect known types of vulnerabilities, vulnerability mining targets security vulnerabilities of unknown existence, unknown type, and unknown impact. Vulnerability mining methods in related technologies only rely on a single generative model to learn the distribution of real data, mainly including variational autoencoders (VAE), flow-based models, and probabilistic diffusion models. However, the above methods do not take into account all factors, resulting in low accuracy of vulnerability mining and poor system operation security.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a charging pile vulnerability mining method, device and electronic device to at least solve the technical problem in the related art that factors are not fully considered when mining charging pile vulnerabilities, resulting in low accuracy of vulnerability mining.
[0005] According to one aspect of an embodiment of the present invention, a charging pile vulnerability mining method is provided, comprising: obtaining target communication message data between a charging pile and a charging object; based on the target communication message data, using a target generative adversarial network model to obtain a first test case, wherein the target generative adversarial network model has pre-learned the distribution relationship between the communication message data and the test case; mutating the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data, and an adding position of the mutation operator; adding the first test case and the second test case to a fuzzy test environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0006] According to another aspect of an embodiment of the present invention, a charging pile vulnerability mining device is also provided, including: a data acquisition module, used to acquire target communication message data between a charging pile and a charging object; a first test case generation module, used to obtain a first test case based on the target communication message data using a target generation adversarial network model, wherein the target generation adversarial network model has pre-learned the distribution relationship between the communication message data and the test case; a second test case generation module, used to mutate the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data, and an adding position of the mutation operator; a fuzzy testing module, used to add the first test case and the second test case to a fuzzy testing environment for fuzzy testing, and obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0007] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the charging pile vulnerability mining methods.
[0008] In an embodiment of the present invention, target communication message data between a charging pile and a charging object is obtained; based on the target communication message data, a target generative adversarial network model is used to obtain a first test case, wherein the target generative adversarial network model pre-learns the distribution relationship between the communication message data and the test case; the target communication message data is mutated based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data, and an adding position of the mutation operator; the first test case and the second test case are added to a fuzzy test environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered, thereby achieving the purpose of generating test cases based on a generative adversarial network model and a mutation strategy respectively, and performing fuzzy testing based on the generated test cases to accurately determine whether there is a security vulnerability in the communication between the charging pile and the charging object, thereby achieving the technical effect of improving the accuracy of charging pile vulnerability mining, and then improving the safety of charging pile use, thereby solving the technical problem of accurate low vulnerability mining caused by incomplete consideration of factors when mining charging pile vulnerabilities in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0010] Figure 1 is a flow chart of a charging pile vulnerability mining method according to an embodiment of the present invention;
[0011] Figure 2 is a flow chart of an optional charging pile vulnerability mining method according to an embodiment of the present invention;
[0012] Figure 3 is a schematic diagram of an optional target generative adversarial network model according to an embodiment of the present invention;
[0013] Figure 4 is an optional feedback optimization flow chart according to an embodiment of the present invention;
[0014] Figure 5 is a schematic diagram of a charging pile vulnerability mining device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0015] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0016] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0017] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:
[0018] Generative adversarial network (GAN) is a neural network learning system composed of two deep learning models: generator and discriminator. The generator simulates the real data distribution, and the discriminator determines whether the data source is real data or the generator. The model is trained through adversarial learning, which ultimately makes it impossible for the discriminator to accurately determine the source of the data. That is, the generative model can produce real data distribution to achieve the learning purpose.
[0019] Vulnerability mining refers to the use of various technical means and system tools to find security vulnerabilities in software programs, communication protocols, etc. Unlike vulnerability detection technology, which can only detect known types of vulnerabilities, vulnerability mining targets security vulnerabilities of unknown existence, unknown type, and unknown impact. Applying vulnerability mining technology before a network attack can provide a more comprehensive understanding of existing security risks and external threats. Penetration testing is a commonly used vulnerability mining method. Testers imitate abnormal access personnel to conduct in-depth detection of the target system, using attack techniques and vulnerability exploitation techniques that abnormal access personnel may use to find weaknesses. Common penetration testing content includes authentication security testing, permission management security testing, session security testing, information leakage security testing, file system security testing, input and output legitimacy security testing, client security testing, etc. Fuzzing testing is a vulnerability mining method suitable for complex environments. It is mainly used to detect the reliability of applications in Unix systems. By sending random, unexpected, malformed inputs to the test system, program anomalies are detected to analyze the vulnerabilities and vulnerable parts. According to the different strategies used in the test phase, fuzz testing can be divided into coverage-based fuzz testing and directed grey-box fuzzing (DGF). In addition to the above two methods, commonly used vulnerability mining methods include pattern matching, reverse analysis, binary comparison, symbolic execution, etc.
[0020] Controller Area Network (CAN) is a serial communication protocol that was first used in the field of industrial control field bus control system (Field Bus Control System) to simplify the wiring of the control system. Nowadays, CAN bus technology is widely used in the automotive industry due to its ease of use, fast transmission rate, and reliable communication. CAN bus technology can achieve multiple modes of communication only through message filtering, and there is no master-slave node distinction in the CAN network. Each node can actively communicate with each other at any time, which solves the problem of a large number of car wiring and the impact of communication lines on equipment. In the environment of the Internet of Vehicles, the communication between electric vehicles and charging piles can be completed through the CAN bus system, and its high transmission rate and error detection capability also meet the real-time and security requirements of communication.
[0021] With the rapid development of intelligence, the scale of software programs and systems continues to expand, and the complexity also increases. Traditional vulnerability mining relies too much on manual operations and expert experience. When faced with highly complex and intelligent vulnerability mining scenarios, it presents disadvantages such as high investment costs, long testing time, and single test cases, making it difficult to achieve efficient and comprehensive security vulnerability exploration. Many scholars have applied machine learning and deep learning to the field of vulnerability mining, using traditional machine learning methods including support vector machines (SVM) and n-gram models, as well as reinforcement learning methods such as multilayer perceptrons (MLP), deep Q networks (DQN), and Q-learning, to solve some of the problems faced by traditional vulnerability mining technologies in terms of test case generation, mutation strategies, and response screening.
[0022] Traditional methods of learning data distribution rely only on a single generative model to learn the real data distribution, mainly including variational autoencoder (VAE), flow-based model, and probabilistic diffusion model. Variational autoencoder is a generative model for deep learning. It uses variational reasoning to map input data to a low-dimensional representation space and then restore it to learn data distribution. However, VAE takes a long time to calculate and the quality of generated images is not ideal. Flow models can generate high-dimensional image data, but are easily affected by noise and are difficult to train. Diffusion probability models produce data by learning the information attenuation caused by noise, which has a good generation effect, but it is difficult to eliminate the information of the original data during the generation process.
[0023] According to an embodiment of the present invention, a method embodiment of charging pile vulnerability mining is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0024] Figure 1 is a flow chart of a charging pile vulnerability mining method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0025] Step S102, obtaining target communication message data between the charging pile and the charging object;
[0026] Optionally, the target communication message data may be the original communication message data between the charging pile and the charging object collected during the current sampling period (or sampling time). The charging object may be a charging device or an electric vehicle. The target communication message data includes the original data during the communication process between the charging pile and the charging object, including the content in the communication message, and related information during the transmission process (such as related control information, etc.).
[0027] Step S104, based on the target communication message data, using the target generative adversarial network model to obtain a first test case.
[0028] Optionally, the target generative adversarial network model pre-learns the distribution relationship between communication message data and test cases, and the first test case generated by the target generative adversarial network model is a test case that is closest to the real test case corresponding to the target communication message data.
[0029] In an optional embodiment, based on the target communication message data, a target generative adversarial network model is used to obtain a first test case, including: based on the target communication message data, a generator in the target generative adversarial network model is used to obtain the first test case; based on the first test case, a discriminator in the target generative adversarial network model is used to obtain the credibility of the first test case.
[0030] Optionally, the target generative adversarial network model includes a generator and a discriminator, wherein the generator takes the target communication message data as input to generate a first test case; the discriminator takes the output of the generator, i.e., the first test case, as input, and the generated credibility is used to evaluate the authenticity of the first test case.
[0031] In an optional embodiment, when there are multiple target communication message data, a target generative adversarial network model is used based on the target communication message data to obtain a first test case, including: converting the multiple target communication message data into multiple first data sequences; aligning the multiple first data sequences to obtain multiple second data sequences; converting the multiple second data sequences to obtain multiple third data sequences, wherein the conversion processing at least includes base conversion and format conversion; dimensionality conversion of the multiple third data sequences to obtain a target array of predetermined dimension; generating target image data based on the target array; and obtaining the first test case based on the target image data using a target generative adversarial network model.
[0032] Optionally, the target communication message data may be multiple, and a target communication message data set is formed based on multiple target communication message data; the target communication message data set is cleaned and converted into a sequence form, that is, multiple first data sequences are obtained; in order to avoid the result deviation caused by the inconsistent lengths of the multiple first data sequences, the multiple first data sequences can be aligned by filling 0 to obtain multiple aligned second data sequences, wherein the lengths of the multiple second data sequences can be greater than or equal to the maximum length of the multiple first data sequences; the multiple second data sequences are further converted into binary system and format, and the obtained results (i.e., multiple third data sequences) are converted into a target array of a predetermined dimension, i.e., a multidimensional array, wherein the number of rows of the target array of the predetermined dimension is the number of channels that the target image data needs to display, and the number of columns represents the height and width of the channel. Through the format conversion in the above manner, the target image data represented by the image form can be obtained, which is used as the input of the target generative adversarial network model to generate the first test case.
[0033] Through the above method, the target communication message data is converted into target image data and used as the input of the target generative adversarial network model. This allows the model to utilize the rich structural information and spatial relationships of the target image data, thereby more effectively capturing the interaction patterns and potential abnormal behaviors between the charging pile and the charging object, and improving the accuracy and effectiveness of test case generation.
[0034] Step S106, performing mutation processing on the target communication message data based on the target mutation strategy to obtain a second test case;
[0035] Optionally, the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data, and a location to add the mutation operator.
[0036] Optionally, the target generative adversarial network model and the target mutation strategy are obtained by updating the initial generative adversarial network model and the initial mutation strategy based on the historical communication message data between the charging pile and the charging object, and the historical test results obtained by fuzzy testing based on the historical communication message data. That is, based on the historical communication message data and the historical test results obtained by fuzzy testing based on the historical communication message data, the initial generative adversarial network model and the initial mutation strategy are synchronously updated to obtain the target generative adversarial network model and the target mutation strategy.
[0037] Optionally, by learning the relationship between the original communication message data and the corresponding test cases, the target generative adversarial network model can learn the vulnerability characteristics that may exist in the communication, such as abnormal data packets, unauthorized access, abnormal access and other characteristics. The target generative adversarial network model can learn the distribution relationship between the original communication data and the test cases, thereby generating test cases with a similar distribution to the original data. This helps to generate more realistic and more realistic test cases. The target generative adversarial network model can also learn the association information between the original communication message data and the test cases, including the association between communication protocols, commands and responses, and the association between possible security vulnerabilities and abnormal behaviors. The target generative adversarial network model can learn abnormal patterns and abnormal behaviors in communication data, thereby helping to detect potential abnormal situations and security vulnerabilities.
[0038] In an optional embodiment, performing mutation processing on the target communication message data based on the target mutation strategy to obtain the second test case includes: performing mutation processing on the target image data based on the target mutation strategy to obtain the second test case.
[0039] It can be understood that converting the target communication message data into target image data and mutating the target image data based on the target mutation strategy to obtain the target test case can more intuitively display the structure and content of the target communication message data, facilitate the discovery of potential errors and anomalies, and at the same time, use image processing technology to more flexibly adjust and control the degree of mutation, thereby improving test coverage and the ability to discover defects.
[0040] Step S108, adding the first test case and the second test case to the fuzzy testing environment to perform fuzzy testing, and obtaining a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0041] Optionally, the first test case generated by the target generative adversarial network model is based on the real original communication message data between the charging pile and the charging object, which can improve the objectivity of the test case and reduce the time cost; the second test case generated by the target mutation strategy is more targeted at a specific vulnerability. On this basis, fuzzy testing is performed simultaneously based on the first test case and the second test case, which can not only improve the objectivity of the test and reduce the time cost, but also improve the pertinence of vulnerability mining.
[0042] Optionally, the target test result can not only indicate whether the target communication message data can trigger a vulnerability, that is, whether there is a potential vulnerability in the target message data. In the case of mining the potential vulnerability in the target communication message data, the vulnerability type triggered by the target communication message data can be further identified based on the target test result. Among them, the vulnerability type can include but is not limited to abnormal data packets, unauthorized access, abnormal access, etc.
[0043] Through the above steps S102 to S108, it is possible to generate test cases based on the generative adversarial network model and the mutation strategy respectively, and perform fuzzy testing based on the generated test cases, so as to accurately determine whether there are security vulnerabilities in the communication between the charging pile and the charging object, thereby achieving the technical effect of improving the accuracy of charging pile vulnerability mining and further improving the safety of charging pile use, thereby solving the technical problem of inaccurate vulnerability mining caused by incomplete consideration of factors when conducting charging pile vulnerability mining in related technologies.
[0044] In an optional embodiment, before obtaining a first test case based on target communication message data and using a target generative adversarial network model; and mutating the target communication message data based on a target mutation strategy to obtain a second test case, the method also includes: obtaining historical communication message data between the charging pile and the charging object; training an initial generative adversarial network model based on the historical communication message data to obtain a first generative adversarial network model and a third test case; mutating the historical communication message data based on the initial mutation strategy to obtain a fourth test case; adding the third test case and the fourth test case to a fuzzy test environment for fuzzy testing to obtain historical test results corresponding to the historical communication message data; and updating the first generative adversarial network model and the initial mutation strategy based on the historical test results to obtain a target generative adversarial network model and a target mutation strategy.
[0045] Optionally, the historical communication message data is the original communication message data between the charging pile and the charging object collected within the historical sampling moment (historical sampling period), and the historical communication message data is multiple. Before generating test cases (i.e., the first test case and the second test case) based on the target generative adversarial network model and the target mutation strategy, it is necessary to obtain the target generative adversarial network model and the target mutation strategy. Specifically, firstly, the initial generative adversarial network model is trained and the test message is generated based on the historical communication message data. Inputting the historical communication message data into the initial generative adversarial network model can not only train the initial generative adversarial network model to obtain the first generative adversarial network model, but also output the third test case for fuzzy testing; the historical communication message data can also be mutated based on the initial mutation strategy to generate a fourth test case for fuzzy testing; fuzzy testing is performed simultaneously based on the obtained third test case and the fourth test case, and feedback updates of the first generative adversarial network model and the initial mutation strategy are performed based on the obtained historical test results. Through the above methods, test cases are generated by both model training generation and mutation generation, and the generated test cases are added to the fuzzy test to verify their effectiveness. At the same time, the test results of each case are analyzed and fed back to the model training process and mutation process to enhance the model training effect and optimize the mutation strategy.
[0046] Optionally, during the model training process, the loss functions of the generator and the discriminator are used to optimize the objective function of the target generative adversarial network model, and the training is completed when the Nash equilibrium is reached; the mutation generation method is to generate test cases by mutating known vulnerabilities in the communication message data.
[0047] Optionally, in order to improve the model training efficiency and test case quality, the original communication message data (i.e., historical communication message data) between the charging piles and the charging objects (such as electric vehicles, etc.) participating in the training process collected during the preset historical sampling period is preprocessed to convert the data into corresponding historical image data. The preprocessing process includes data cleaning, alignment, base conversion, and format conversion.
[0048] Specifically, construct a historical communication message dataset Perform data cleaning operations on the historical communication message data set, and use the data set to represent the data frame sequence in the following form: in, Indicates the data sequence corresponding to the kth data in multiple historical communication message data, n k is the length of the sequence, e x is a hexadecimal number. Data 0 (which does not contain information) is used for data alignment. The aligned data sequence is S k,n =(e1,e2,e3,…,e n). Where n is the uniformly set length of the data sequence, and n≥max[n1,n2,…,n k ]. Perform base conversion and format conversion. The converted data set T is expressed as Tk=(t1, t2, …, t n ). Among them, t n is a decimal number. k Converted into a multidimensional array of r rows and s columns, r represents the number of channels that the image needs to display, and s represents the height and width of the channel. Based on the multidimensional array of r rows and s columns, the historical data image is obtained, and based on the historical data image, the corresponding initial generative adversarial network model and initial mutation strategy are used to generate the third test case and the fourth test case respectively.
[0049] In an optional embodiment, an initial generative adversarial network model is trained based on historical communication message data to obtain a first generative adversarial network model and a third test case, including: inputting random noise into the generator in the initial generative adversarial network model to obtain the third test case; inputting the third test case and the historical communication message data into the discriminator in the initial generative adversarial network model to obtain the discriminator output result; and updating the parameters of the initial generative adversarial network model based on the discriminator output result to obtain the first generative adversarial network model.
[0050] Optionally, during the model training process, the input of the generator G is random noise z, and the output is the generated result G(z); the input of the discriminator D is G(z) and real data x (i.e., historical communication message data), and the outputs are D(G(z)) and D(x), respectively, where D(G(z)) represents the discriminator's discrimination result on the false data generated by the generator G, and D(x) represents the discriminator's discrimination result on the real data x. When the input data is true, the ideal output of the discriminator is 1, and when the input data is false, the ideal output is 0. Therefore, the training goal of the discriminator is to make D(G(z)) tend to 0 and D(x) tend to 1, and the training goal of the generator is to make D(G(z)) tend to 1. The training effect is improved through continuous confrontation between the two. The loss function is used to optimize the objective function, and the training ends when the generator and the discriminator reach Nash equilibrium.
[0051] Optionally, the initial generative adversarial network model and the corresponding objective function can be constructed in the following manner, but is not limited to: construct a generator and a discriminator. Set the objective function to:
[0052]
[0053] Among them, H(G,D) represents the objective function, and x is the distribution of the real data T dataThe real data is the original communication message data between the charging pile and the charging object collected during the predetermined historical sampling period; z is the data that follows the prior distribution T z random noise; D(·) represents the discriminator’s discriminant result; G(·) represents the generator’s generation result; It represents the mathematical expectation obtained when x follows the real data distribution; It means that z is the mathematical expectation obtained when it obeys the prior distribution.
[0054] When the generator and discriminator reach the Nash equilibrium state, they reach the optimal state. The optimal discriminator is expressed as:
[0055]
[0056] Among them, p data (x) is the probability of the real data distribution; p(x) is the probability of the generator output data distribution. At this time, the objective function is:
[0057]
[0058] When p(x)=p data (x), the objective function reaches its maximum value, and the discriminator cannot distinguish between the real data and the generated results of the generator.
[0059] In an optional embodiment, the first generative adversarial network model and the initial mutation strategy are updated based on historical test results to obtain a target generative adversarial network model and a target mutation strategy, including: when the historical test results indicate that a vulnerability is triggered, based on the historical test results, updating the parameters of the first generative adversarial network model to obtain a target generative adversarial network model; or when the historical test results indicate that no vulnerability is triggered, updating the initial mutation strategy based on the historical test results to obtain a target mutation strategy.
[0060] Optionally, the test cases generated by the two methods (i.e., the third test case and the fourth test case) are added to the fuzzy test environment for testing, and the historical test results are obtained. According to the different historical test results, they are divided into normal responses and abnormal responses, wherein the normal response is used to indicate that the vulnerability cannot be triggered, and the abnormal response is used to indicate that the vulnerability can be triggered. The purpose of generative adversarial network model training is to learn the format and structure of network protocol messages, generate diversified and differentiated test data messages, and improve the generalization ability and robustness of the model. Therefore, only the analysis results of the normal response are fed back to the model training. The model training is affected by adjusting the training parameters according to the analysis results of the normal response. The normal response indicates that the test case has no vulnerability, that is, it has a complete structure and correct format. Feedback to the training process can improve the efficiency of model training; the source of the test case of the normal response may come from model generation or from mutation strategy generation. Feeding back the analysis results to the model training can improve the diversity of the training generated cases. Feedback the analysis results of the abnormal response to the mutation strategy, dynamically adjust the protocol field and mutation content to be mutated, and improve the efficiency of test case generation.
[0061] Optionally, the target generative adversarial network model includes two parts: the generator and the discriminator. The generator needs to learn the structure of the charging pile communication protocol message and generate data messages that can be used for testing as test cases. The discriminator needs to distinguish the authenticity of the generated results and the real test cases, and feed the judgment results back to the generator to optimize the generated model. The model training process also uses the generated results for fuzzy testing, analyzes the historical test results, and feeds them back to the training of the generator and discriminator to improve the learning efficiency of the generator.
[0062] Optionally, by analyzing various abnormal messages in the existing charging pile communication protocol vulnerability database, the correlation between abnormal results and abnormal fields is found, and the characters in the protocol field that can produce abnormal results are defined as mutation operators. For the historical communication test message, the corresponding test case (i.e., the fourth test case) is generated by continuously adjusting the content of the mutation operator and the protocol field where it is located, and the location, content and test results of each mutation are recorded, and new communication protocol vulnerabilities are continuously discovered. Generating test cases through mutation can strengthen the application of the existing vulnerability database and improve the efficiency of generating effective test cases.
[0063] In an optional embodiment, when historical test results indicate that a vulnerability has not been triggered, based on the historical test results, the parameters of the initial generative adversarial network model are updated to obtain a target generative adversarial network model, including: when the historical test results indicate that a vulnerability has been triggered, based on the historical test results, the parameters of the first generative adversarial network model are updated to obtain a second generative adversarial network model; determining whether the second generative adversarial network model satisfies a predetermined objective function; and if the second generative adversarial network model satisfies the predetermined objective function, using the second generative adversarial network model as the target generative adversarial network model.
[0064] Optionally, when historical test results indicate that no vulnerability has been triggered, the parameters of the generator and discriminator in the first generative adversarial network model are updated based on the historical test results, and a determination is made as to whether the updated second generative adversarial network model satisfies the objective function; if so, the training update is stopped, and the second generative adversarial network model is used as the target generative adversarial network model; otherwise, new original communication message data between the charging pile and the charging object is obtained; and the same operations as the historical communication message data are performed on the new original communication message data until the objective function is met.
[0065] In an optional embodiment, when historical test results indicate that a vulnerability has been triggered, the initial mutation strategy is trained and updated based on the historical test results to obtain a target mutation strategy, including: detecting whether the mutation operator included in the fourth test case is consistent with the abnormal protocol field included in the historical test results; when the mutation operator included in the fourth test case is inconsistent with the abnormal protocol field included in the historical test results, using the mutation operator in the historical test results that is inconsistent with the mutation operator included in the fourth test case as a new mutation operator; and updating the initial mutation strategy based on the new mutation operator to obtain the target mutation strategy.
[0066] Optionally, analyze the test cases and abnormal results that generate abnormal responses (i.e., historical test results of abnormal responses), determine the protocol field that generates the abnormality, compare it with the existing mutation operator, and check whether the mutation operator and the abnormal result correspond. After the correspondence is determined, constrain the mutation operator at that position to ensure that it can stably trigger the corresponding abnormal response. For the newly generated mutation operator, after it is determined that it can stably trigger an abnormal response, it can be included in the available mutation operators, generate the target mutation strategy, and participate in the generation of mutation test cases. The analysis results of the abnormal response are fed back to the mutation strategy, and the protocol field and mutation content to be mutated are dynamically adjusted to improve the efficiency of test case generation.
[0067] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode: Figure 2is a flow chart of an optional charging pile vulnerability mining method according to an embodiment of the present invention, such as Figure 2 As shown, the method includes:
[0068] Step S1: Data preprocessing. In order to improve the model training efficiency and test case quality, the original communication message data (i.e., historical communication message data) between the charging piles and the charging objects (such as electric vehicles, etc.) participating in the training process collected during the preset historical sampling period is preprocessed to convert the data into corresponding historical image data. The preprocessing process includes data cleaning, alignment, base conversion, and format conversion.
[0069] Step S2: Construct the target generative adversarial network (GAN) model. The GAN model consists of two parts: the generator and the discriminator. The generator needs to learn the structure of the charging pile communication protocol message and generate data messages that can be used for testing as test cases. The discriminator needs to distinguish the authenticity of the generated results and the real test cases, and feed the discrimination results back to the generator to optimize the generated model. The model training process also uses the generated results for fuzzy testing, analyzes the test results, and feeds them back to the training of the generator and discriminator to improve the learning efficiency of the generator. Figure 3 is a schematic diagram of an optional target generation adversarial network model according to an embodiment of the present invention, such as Figure 3 Step S2 specifically includes the following steps:
[0070] Step S21: Establish a generator and a discriminator according to the objective function of the GAN model.
[0071] Step S22: During the model training process, when the generator and the discriminator reach the Nash equilibrium state, it indicates that the two have reached the optimal state. Let the probability of the data distribution of the generator at this time be p(x). When p(x) is equal to the probability distribution of the real data, the objective function has a maximum value, and the discriminator cannot distinguish between the real data and the generated results of the generator.
[0072] Step S3: Generate test cases. In order to improve the effectiveness and pertinence of the final generated test cases, this embodiment uses two methods, model training generation and mutation generation, to generate test cases. During the model training process, the loss functions of the generator and the discriminator are used to optimize the objective function of the GAN model, and the training is completed when the Nash equilibrium is reached; the mutation generation method is to generate test cases by mutating the known vulnerabilities in the communication message data. Step S3 specifically includes the following steps:
[0073] Step S31: Model training generates test cases. During the model training process, the input of the generator G is random noise z, and the output is the generated result G(z); the input of the discriminator D is G(z) and real data x (i.e., historical communication message data), and the outputs are D(G(z)) and D(x), respectively, where D(G(z)) represents the discriminator's discrimination result on the false data generated by the generator G, and D(x) represents the discriminator's discrimination result on the real data x. When the input data is true, the ideal output of the discriminator is 1, and when the input data is false, the ideal output is 0. Therefore, the training goal of the discriminator is to make D(G(z)) tend to 0 and D(x) tend to 1, and the training goal of the generator is to make D(G(z)) tend to 1. The training effect is improved through continuous confrontation between the two. The loss function is used to optimize the objective function, and the training ends when the generator and the discriminator reach Nash equilibrium.
[0074] Step S32: Generate test cases through mutation. By analyzing various abnormal messages in the existing charging pile communication protocol vulnerability database, find the correlation between abnormal results and abnormal fields, and define the characters in the protocol field that can produce abnormal results as mutation operators. Generate test cases by continuously adjusting the content of the mutation operator and the protocol field where it is located, record the location, content and test results of each mutation, and continuously discover new communication protocol vulnerabilities. Generating test cases through mutation can strengthen the application of existing vulnerability databases and improve the efficiency of generating effective cases.
[0075] Step S4: Test result analysis and feedback optimization. Figure 4 is an optional feedback optimization flow chart according to an embodiment of the present invention, such as Figure 4 Step S4 specifically includes the following steps:
[0076] Step S41: Add the test cases generated by the two methods to the fuzzy test environment for testing, obtain the test results, and divide them into normal responses and abnormal responses according to the test results. The normal response is used to indicate that the vulnerability cannot be triggered, and the abnormal response is used to indicate that the vulnerability can be triggered.
[0077] Step S42: Analyze the test cases and abnormal results that generate abnormal responses (i.e., historical test results of abnormal responses), determine the protocol field that generates the abnormality, compare it with the existing mutation operator, and check whether the mutation operator and the abnormal result correspond. After the corresponding relationship is determined, constrain the mutation operator at this position to ensure that it can stably trigger the corresponding abnormal response. For the newly generated mutation operator, after it is determined that it can stably trigger an abnormal response, it can be included in the available mutation operators, generate the target mutation strategy, and participate in the generation of mutation test cases. The analysis results of the abnormal response are fed back to the mutation strategy, and the protocol fields and mutation contents to be mutated are dynamically adjusted to improve the efficiency of test case generation.
[0078] Step S43: The analysis results of the normal response are fed back to the training of the generative adversarial network model, so that the training results are more directed to the generation of test cases for charging pile vulnerability mining. After multiple test case generation and feedback optimization, the generation of effective test cases is finally completed.
[0079] This embodiment can achieve at least one of the following effects: 1) Applying the generative adversarial network to the field of charging pile vulnerability mining, the generator learns the structure of the charging pile communication protocol message and generates a data message that can be used for testing, the discriminator discriminates the authenticity of the generated results and the real use case, and feeds the discrimination result back to the generator to optimize the generated model and conduct adversarial training. 2) Make full use of the existing charging pile vulnerability database, analyze the structural characteristics of the abnormal message, explore the potential correlation between the abnormal results and special fields, formulate a suitable mutation strategy based on the correlation, and generate test cases through mutation. 3) Add the generated test case to the fuzzy test to verify its effectiveness, and analyze the test results of each use case at the same time, and feed back to the model training process and mutation process to enhance the model training effect and optimize the mutation strategy. 4) The Nash equilibrium achieved by model training is a dynamic equilibrium. Repeated testing and feedback processes can improve the effect of model training and the effectiveness of the final results.
[0080] In this embodiment, a charging pile vulnerability mining device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the terms "module" and "device" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0081] According to an embodiment of the present invention, a device embodiment for implementing the above charging pile vulnerability mining method is also provided. Figure 5 is a schematic diagram of the structure of a charging pile vulnerability mining device according to an embodiment of the present invention. Figure 5 As shown, the charging pile vulnerability mining device includes: a data acquisition module 500, a first test case generation module 502, a second test case generation module 504, and a fuzzy test module 506, wherein:
[0082] The data acquisition module 500 is used to acquire target communication message data between the charging pile and the charging object;
[0083] A first test case generation module 502, connected to the data acquisition module 500, is used to obtain a first test case based on the target communication message data by using a target generative adversarial network model, wherein the target generative adversarial network model pre-learns a distribution relationship between the communication message data and the test case;
[0084] A second test case generation module 504, connected to the first test case generation module 502, is used to perform mutation processing on the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data and a position where the mutation operator is added;
[0085] The fuzz testing module 506 is connected to the second test case generation module 504, and is used to add the first test case and the second test case to the fuzz testing environment for fuzz testing to obtain the target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0086] In an embodiment of the present invention, a data acquisition module 500 is provided to acquire target communication message data between a charging pile and a charging object; a first test case generation module 502 is connected to the data acquisition module 500 and is used to obtain a first test case based on the target communication message data by adopting a target generative adversarial network model, wherein the target generative adversarial network model has pre-learned the distribution relationship between the communication message data and the test case; a second test case generation module 504 is connected to the first test case generation module 502 and is used to perform mutation processing on the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data and the position where the mutation operator is added; fuzzy The test module 506 is connected to the second test case generation module 504, and is used to add the first test case and the second test case to the fuzzy test environment for fuzzy testing, and obtain the target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether the vulnerability is triggered, thereby achieving the purpose of generating test cases based on the generative adversarial network model and the mutation strategy respectively, and performing fuzzy testing based on the generated test cases to accurately determine whether there is a security vulnerability in the communication between the charging pile and the charging object, thereby achieving the technical effect of improving the accuracy of charging pile vulnerability mining and then improving the safety of charging pile use, thereby solving the technical problem of inaccurately determining the vulnerability mining due to incomplete consideration of factors when mining charging pile vulnerabilities in related technologies.
[0087] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0088] It should be noted that the above data acquisition module 500, the first test case generation module 502, the second test case generation module 504, and the fuzzy test module 506 correspond to steps S102 to S108 in the embodiment, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules can be run in a computer terminal as part of the device.
[0089] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.
[0090] The above-mentioned charging pile vulnerability mining device may also include a processor and a memory. The above-mentioned data acquisition module 500, the first test case generation module 502, the second test case generation module 504, the fuzzy test module 506, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize the corresponding functions.
[0091] The processor includes a kernel, which retrieves the corresponding program module from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.
[0092] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any of the charging pile vulnerability mining methods.
[0093] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.
[0094] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: obtain target communication message data between the charging pile and the charging object; based on the target communication message data, use a target generative adversarial network model to obtain a first test case, wherein the target generative adversarial network model pre-learns the distribution relationship between the communication message data and the test case; based on the target mutation strategy, the target communication message data is mutated to obtain a second test case, wherein the target mutation strategy is at least used to indicate the mutation operator added to the corresponding communication message data, and the addition position of the mutation operator; the first test case and the second test case are added to the fuzzy testing environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether the vulnerability is triggered.
[0095] According to an embodiment of the present application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein when the program is run, any one of the charging pile vulnerability mining methods is executed.
[0096] According to an embodiment of the present application, an embodiment of a computer program product is also provided. When executed on a data processing device, it is suitable for executing a program that initializes any one of the above-mentioned charging pile vulnerability mining method steps.
[0097] Optionally, the above-mentioned computer program product, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining target communication message data between the charging pile and the charging object; based on the target communication message data, using a target generative adversarial network model to obtain a first test case, wherein the target generative adversarial network model has pre-learned the distribution relationship between the communication message data and the test case; mutating the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate the mutation operator added to the corresponding communication message data, and the addition position of the mutation operator; adding the first test case and the second test case to the fuzzy testing environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0098] An embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining target communication message data between a charging pile and a charging object; based on the target communication message data, using a target generative adversarial network model to obtain a first test case, wherein the target generative adversarial network model pre-learns the distribution relationship between the communication message data and the test case; mutating the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data, and an adding position of the mutation operator; adding the first test case and the second test case to a fuzzy test environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
[0099] The above sequence of the embodiments of the present invention is for description only and does not represent the superiority or inferiority of the embodiments.
[0100] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0101] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above modules can be a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, modules or indirect coupling or communication connection of modules, which can be electrical or other forms.
[0102] The modules described above as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0103] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.
[0104] If the above-mentioned integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0105] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A charging pile vulnerability mining method, characterized in that: include: Obtain target communication message data between the charging pile and the charging object; Based on the target communication message data, a target generative adversarial network model is used to obtain a first test case, wherein the target generative adversarial network model pre-learns a distribution relationship between the communication message data and the test case; Performing mutation processing on the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data and a position where the mutation operator is added; The first test case and the second test case are added to a fuzzy testing environment for fuzzy testing to obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
2. The method according to claim 1, characterized in that The target communication message data is multiple, among which, The method of obtaining a first test case based on the target communication message data and adopting a target generative adversarial network model includes: converting multiple target communication message data into multiple first data sequences; aligning the multiple first data sequences to obtain multiple second data sequences; converting the multiple second data sequences to obtain multiple third data sequences, wherein the conversion process at least includes base conversion and format conversion; converting the multiple third data sequences to obtain a target array of a predetermined dimension; generating target image data based on the target array; and obtaining the first test case based on the target image data and adopting the target generative adversarial network model. The step of performing mutation processing on the target communication message data based on the target mutation strategy to obtain the second test case includes: performing mutation processing on the target image data based on the target mutation strategy to obtain the second test case.
3. The method according to claim 1, characterized in that In the step of obtaining a first test case based on the target communication message data, using a target generative adversarial network model; Before performing mutation processing on the target communication message data based on the target mutation strategy to obtain the second test case, the method further includes: Acquire historical communication message data between the charging pile and the charging object; Based on the historical communication message data, an initial generative adversarial network model is trained to obtain a first generative adversarial network model and a third test case; Perform mutation processing on the historical communication message data based on the initial mutation strategy to obtain a fourth test case; Adding the third test case and the fourth test case to the fuzzy test environment to perform fuzzy testing, and obtaining historical test results corresponding to the historical communication message data; The first generative adversarial network model and the initial mutation strategy are updated based on the historical test results to obtain the target generative adversarial network model and the target mutation strategy.
4. The method according to claim 3, characterized in that The initial generative adversarial network model is trained based on the historical communication message data to obtain a first generative adversarial network model and a third test case, including: Inputting random noise into the generator in the initial generative adversarial network model to obtain the third test case; Inputting the third test case and the historical communication message data into the discriminator in the initial generative adversarial network model to obtain a discriminator output result; Based on the output result of the discriminator, the parameters of the initial generative adversarial network model are updated to obtain the first generative adversarial network model.
5. The method according to claim 3, characterized in that: The updating of the first generative adversarial network model and the initial mutation strategy based on the historical test results to obtain the target generative adversarial network model and the target mutation strategy includes: When the historical test results indicate that a vulnerability has been triggered, updating the parameters of the first generative adversarial network model based on the historical test results to obtain the target generative adversarial network model; or When the historical test results indicate that no vulnerability is triggered, the initial mutation strategy is updated based on the historical test results to obtain the target mutation strategy.
6. The method according to claim 4, characterized in that When the historical test results indicate that no vulnerability has been triggered, updating the parameters of the initial generative adversarial network model based on the historical test results to obtain the target generative adversarial network model includes: When the historical test results indicate that a vulnerability has been triggered, based on the historical test results, updating the parameters of the first generative adversarial network model to obtain a second generative adversarial network model; Determining whether the second generative adversarial network model satisfies a predetermined objective function; In a case where the second generative adversarial network model satisfies the predetermined objective function, the second generative adversarial network model is used as the target generative adversarial network model.
7. The method according to claim 4, characterized in that When the historical test results indicate that a vulnerability is triggered, the initial mutation strategy is trained and updated based on the historical test results to obtain the target mutation strategy, including: Detecting whether the mutation operator included in the fourth test case is consistent with the abnormal protocol field included in the historical test result; In the case where the mutation operator included in the fourth test case is inconsistent with the abnormal protocol field included in the historical test result, the mutation operator in the historical test result that is inconsistent with the mutation operator included in the fourth test case is used as a newly added mutation operator; The initial mutation strategy is updated based on the newly added mutation operator to obtain the target mutation strategy.
8. The method according to any one of claims 1 to 7, characterized in that The step of obtaining a first test case based on the target communication message data and adopting a target generative adversarial network model comprises: Based on the target communication message data, using the generator in the target generative adversarial network model to obtain the first test case; Based on the first test case, the credibility of the first test case is obtained by using a discriminator in the target generative adversarial network model.
9. A charging pile leak excavation device, characterized in that: include: A data acquisition module is used to acquire target communication message data between the charging pile and the charging object; A first test case generation module is used to obtain a first test case based on the target communication message data using a target generative adversarial network model, wherein the target generative adversarial network model pre-learns a distribution relationship between the communication message data and the test case; A second test case generation module, configured to perform mutation processing on the target communication message data based on a target mutation strategy to obtain a second test case, wherein the target mutation strategy is at least used to indicate a mutation operator added to the corresponding communication message data and a position where the mutation operator is added; A fuzzy testing module is used to add the first test case and the second test case to a fuzzy testing environment for fuzzy testing, and obtain a target test result corresponding to the target communication message data, wherein the target test result is at least used to indicate whether a vulnerability is triggered.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the charging pile vulnerability mining method described in any one of claims 1 to 8.
Citation Information
Cited By
Vulnerability mining method and device for vehicle-mounted protocol
CN119966682A
Penetration test method and equipment for vehicle digital key system and medium
CN120857126A
