Software security testing method and device, equipment and medium
By using constraint models and adversarial models in software security testing, the problem that test cases in the prior art is difficult to cover all attack situations is solved, and more comprehensive and efficient software security testing is achieved.
Patent Information
- Application Number
- CN202411773118.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The existing technology has the problem of detecting vulnerabilities in software security testing, and the test cases are difficult to cover all possible attacks, resulting in incomplete testing.
Generate more comprehensive and efficient test cases by obtaining the constraint and adversarial models of the software to be tested. The constraint model is used to determine the constraints between input and output, while the adversarial model simulates the attacker's malicious attack behavior.
It realizes comprehensive inspection of the security of the software to be tested, improves the efficiency and accuracy of software security testing, and avoids testing vulnerabilities.
Smart Images

Figure CN119783107A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software engineering, and specifically to a software security testing method, apparatus, equipment and medium. Background Art
[0002] With the rapid development of information technology, software has been widely used in various fields. However, the problem of software security has become increasingly prominent. Malicious attackers try to obtain illegal benefits or disrupt the normal operation of the system by constantly looking for loopholes and weaknesses in the software system. Therefore, ensuring the security of the software system has become a vital task.
[0003] The software security testing method provided by the prior art is mainly a dynamic testing method, which can detect security issues by simulating real operating environments and attack scenarios.
[0004] In the dynamic testing methods provided by the prior art, test cases are all generated by testers based on their testing experience, which makes it difficult to cover all possible attack scenarios, thus causing the problem of incomplete software security testing. Summary of the invention
[0005] The embodiments of the present application provide a software security testing method, apparatus, device and medium to solve the problem of detecting vulnerabilities in the process of software security testing in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a software security testing method, the method comprising:
[0007] Obtaining a constraint model and an adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker;
[0008] Generate test cases according to the constraint model and the adversarial model;
[0009] The test case is executed using the software to be tested to obtain a security test result.
[0010] In a second aspect, an embodiment of the present application provides a software security testing device, the device comprising:
[0011] A constraint adversarial model acquisition module, used to acquire a constraint model and an adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker;
[0012] A test case generation module, used to generate a test case according to the constraint model and the adversarial model;
[0013] The test module is used to execute the test case using the software to be tested to obtain the security test result.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the first aspect.
[0016] The software security testing method, device, equipment and medium provided in the embodiments of the present application can generate test cases based on the constraint model and the adversarial model, so that the test cases are more comprehensive, avoiding the test cases generated by the testers based on the test experience, and the test cases are difficult to cover all possible attack situations, resulting in incomplete testing and the problem of test loopholes. The constraint model can perform constraint analysis on the software to be tested and extract key test constraint conditions, and the adversarial model can simulate the malicious attack behavior of the attacker, so that the technical solution provided in the embodiments of the present application can perform a comprehensive detection of the security of the software to be tested, and the test cases generated by the constraint model and the adversarial model are more efficient, thereby improving the efficiency of software security testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0018] Figure 1 is a flowchart of an embodiment of the software security testing method of the present application;
[0019] Figure 2 yes Figure 1 The flowchart of the modeling method of the constraint model in the software safety testing method of the present application is shown;
[0020] Figure 3 yes Figure 1 The flowchart of the modeling method of the adversarial model in the software security testing method of the present application is shown;
[0021] Figure 4 is a flowchart of an embodiment of the software security testing method of the present application;
[0022] Figure 5 is a flowchart of an embodiment of the software security testing method of the present application;
[0023] Figure 6 It is a structural diagram of an embodiment of a software security testing device of the present application;
[0024] Figure 7 It is a schematic diagram of the structure of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION
[0025] All actions to obtain signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.
[0026] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0027] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] Please refer to Figure 1 , which shows a process 100 of an embodiment of a software security testing method according to the present application. The software security testing method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the software security testing method may be a processor in the above electronic device.
[0029] like Figure 1 As shown, the software security testing method includes the following steps:
[0030] Step 101: Obtain a constraint model and an adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker.
[0031] In this embodiment, the constraints between the input and output of the software to be tested may include mathematical constraints and logical constraints. Specifically, the input, output and the relationship between the software to be tested may be formally described using a mathematical modeling method. For example, formal tools such as mathematical equations and logical expressions may be used to represent the constraints. At the same time, the constraint information may also be extracted by analyzing existing test cases and sample data.
[0032] For example, Figure 2 As shown, the modeling method of the constraint model may include:
[0033] Step 201: Obtain security feature information of the software to be tested.
[0034] In this embodiment, step 201 can obtain security feature information by statistical methods, such as variance selection method, chi-square test, mutual information, etc.
[0035] Exemplary security feature information of network communication software may include, but is not limited to:
[0036] Packet-level features: Features can be extracted from captured network traffic packets, such as: Packet length: the number of bytes per packet, which may be related to data transmission volume, security threats, etc.
[0037] Protocol type: Common protocols include TCP, UDP, HTTP, HTTPS, DNS, etc. Different protocols have different characteristics and security risks.
[0038] Packet time interval: The time difference between consecutive packets can be used to analyze traffic patterns or detect abnormal behavior.
[0039] Source / destination IP addresses and port numbers: can help identify specific communication endpoints or attack sources.
[0040] Flags in data packets: For example, TCP flags (SYN, ACK, etc.) can be used to analyze the connection status and data flow control information.
[0041] Traffic characteristics:
[0042] 1. Traffic size: The amount of data transmitted, such as the number of bytes per second, can reflect the density of the traffic.
[0043] 2. Connection duration and number of connections: Session-related features that can help analyze the stability of the connection and whether there are abnormal connection patterns.
[0044] 3. Traffic direction: Whether the traffic is unidirectional or bidirectional may be helpful for security assessment, especially the proportion of inbound and outbound traffic.
[0045] 4. Application layer characteristics:
[0046] 4.1 URL and domain name requests: For Web communication software, the access pattern can be analyzed by extracting the requested URL or the visited domain name.
[0047] 4.2HTTP header information: such as User-Agent, Host and other information, can be used to analyze user behavior patterns.
[0048] 4.3SSL / TLS certificate information: The encryption strength and certificate validity used in the communication can be analyzed.
[0049] It should be noted that the security feature information may be different for different types of software to be tested, and each case will not be described here one by one.
[0050] Optionally, in this embodiment, step 201 may also pre-process the security feature information, including: cleaning out data packets with abnormal values and processing missing security feature information, etc., to ensure the accuracy and reliability of the input data.
[0051] Step 202: Determine the constraint conditions corresponding to the security feature information.
[0052] For example: when the security feature information is the data packet length, the constraint condition may be that the data packet length should be within a certain range; or when the security feature information is the protocol type, the constraint condition may be that the protocol type must comply with the specified standards, etc., which will not be elaborated here.
[0053] It should be noted that in order to make the constraint model more accurate and reliable, step 202 should try to exhaust the constraint conditions.
[0054] Step 203: Use the first data set to train a mathematical model of a support vector machine (SVM) to obtain a constraint model, wherein the data included in the first data set is data having security feature information and meeting constraint conditions.
[0055] Optionally, after step 203, the following steps may also be included:
[0056] Step 204: Evaluate the constraint model through a cross-validation method to obtain a constraint model evaluation result.
[0057] In this embodiment, the cross-validation method is only used as a specific example. In actual use, step 204 can also evaluate the constraint model through other algorithms, and each case will not be described here one by one.
[0058] Step 205: Optimize the constraint model according to the constraint model evaluation result.
[0059] For example, the kernel function parameters of SVM can be optimized, and each case will not be described here one by one.
[0060] Through the above steps 204 and 205, the accuracy and performance of the constraint model in describing the constraint conditions can be ensured.
[0061] In this embodiment, the construction process of the adversarial model needs to take into account different types of attack scenarios and threat patterns. The appropriate adversarial model structure can be selected in a targeted manner to meet different security testing requirements. At the same time, existing security vulnerability analysis technologies and tools can also be used to improve the efficiency and accuracy of building the adversarial model.
[0062] For example, Figure 3 As shown, the modeling methods of adversarial models may include:
[0063] Step 301: Determine the attack scenario and attack target of the software to be tested.
[0064] For example: stealing information, denial of service, etc. Step 301 needs to take into account various possible attack scenarios in the real world to ensure comprehensive testing of the software to be tested.
[0065] Step 302: Use the second data set to train a generative adversarial network (GAN) to obtain an adversarial model, wherein the data included in the second data set is obtained according to the attack scenario and the attack target.
[0066] Optionally, after step 302, the following steps may also be included:
[0067] Step 303: Generate an attack strategy for a target constraint condition, wherein the target constraint condition is one of the constraint conditions.
[0068] Step 304: Evaluate the adversarial model using an attack strategy to obtain an adversarial model evaluation result;
[0069] Step 305: Optimize the adversarial model according to the adversarial model evaluation result.
[0070] For example: adjusting the generator and discriminator structure of GAN. We will not go into details about each case here.
[0071] Through the above steps 303-305, the trained adversarial model can be evaluated to ensure its accuracy and performance in simulating attack behaviors. Based on the evaluation results, the model is optimized.
[0072] Step 102: Generate test cases based on the constraint model and the adversarial model.
[0073] In this embodiment, step 102 may specifically include:
[0074] Input constraint parsing: Use the constraint model to convert constraint conditions into specific data ranges and formats.
[0075] Adversarial model guidance: With the help of adversarial models, the attacker's behavior is simulated to guide the generation of challenging test cases.
[0076] Test case generation: Based on the processing of the first two steps, test cases are generated. These test cases will include normal data that meets the constraints and malicious data that violates the constraints.
[0077] Step 103: Use the software to be tested to execute the test case and obtain the security test result.
[0078] In this embodiment, step 103 may specifically include:
[0079] Test case execution: The generated test cases are input into the software to be tested to simulate the actual operating environment to trigger the system's response to security vulnerabilities. At the same time, the input and output information during the test process is recorded, including the response time and resource utilization of the software to be tested. This step can comprehensively evaluate the performance of the software to be tested in different test scenarios.
[0080] Result collection and analysis: Collect data generated during the test execution, including the response of the software to be tested, possible error messages, etc. Through in-depth analysis of this data, potential security vulnerabilities can be identified and the security performance of the system can be evaluated. At the same time, possible abnormal behaviors and error patterns can also be discovered, providing reference for subsequent security optimization.
[0081] The software security testing method provided in the embodiment of the present application can generate test cases based on the constraint model and the adversarial model, so that the test cases are more comprehensive, avoiding the test cases generated by the tester based on the test experience. The test cases are difficult to cover all possible attack situations, resulting in incomplete testing and the existence of test loopholes. The constraint model can perform constraint analysis on the software to be tested and extract key test constraint conditions. The adversarial model can simulate the malicious attack behavior of the attacker, so that the technical solution provided in the embodiment of the present application can perform a comprehensive detection of the security of the software to be tested, and the test cases generated by the constraint model and the adversarial model are more efficient, thereby improving the efficiency of software security testing.
[0082] Please refer to Figure 4, which shows a process 100 of another embodiment of the software security testing method according to the present application. The software security testing method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the software security testing method may be a processor in the above electronic device.
[0083] like Figure 4 As shown in the figure, the software security testing method is Figure 1 The same as shown, except that it also includes:
[0084] Step 104: Monitor the running status of the test case executed by the software to be tested in real time and obtain the real-time monitoring result.
[0085] Step 105: When the real-time monitoring result is abnormal or erroneous, an alarm message is sent.
[0086] It should be noted that this embodiment only takes steps 104 and 105 occurring after step 103 as an example for explanation. In actual use, steps 104 and 105 may also occur at other locations, which will not be described in detail here.
[0087] The software security testing method provided in this embodiment achieves Figure 1 Based on the beneficial effects brought by the technical solution shown, the running status of the test cases executed by the tested software can be monitored in real time, and an alarm signal can be sent in the event of an abnormality or error, so as to notify the system administrator and the security team to take corresponding measures, repair the discovered security vulnerabilities, and adjust the test strategy.
[0088] Please refer to Figure 5 , which shows a process 100 of another embodiment of the software security testing method according to the present application. The software security testing method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the software security testing method may be a processor in the above electronic device.
[0089] like Figure 5 As shown in the figure, the software security testing method is Figure 1 The same as shown, except that it also includes:
[0090] Step 106: Obtain execution result data of the test case executed by the software to be tested.
[0091] Step 107: Optimize the constraint model and / or adversarial model according to the execution result data.
[0092] It should be noted that this embodiment only takes steps 106 and 107 occurring after step 103 as an example for explanation. In actual use, steps 106 and 107 may also occur at other locations, which will not be described in detail here.
[0093] The software security testing method provided in this embodiment achieves Figure 1 On the basis of the beneficial effects brought by the technical solution shown, the constraint model and / or adversarial model can be optimized according to the execution result data of the test case executed by the software to be tested, thereby further ensuring the comprehensiveness and accuracy of the software security test.
[0094] Please refer to Figure 6 As an implementation of the methods shown in the figures, the present application provides an embodiment of a software security testing device. The device embodiment corresponds to the method shown in the above embodiments, and the device can be specifically applied to various electronic devices.
[0095] like Figure 6 As shown, the software security testing device 600 of this embodiment includes:
[0096] The constraint adversarial model acquisition module 601 is used to obtain the constraint model and adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker.
[0097] In this embodiment, the constraints between the input and output of the software to be tested may include mathematical constraints and logical constraints. Specifically, the input, output and the relationship between the software to be tested may be formally described using a mathematical modeling method. For example, formal tools such as mathematical equations and logical expressions may be used to represent the constraints. At the same time, the constraint information may also be extracted by analyzing existing test cases and sample data.
[0098] In this embodiment, the construction process of the adversarial model needs to take into account different types of attack scenarios and threat patterns. The appropriate adversarial model structure can be selected in a targeted manner to meet different security testing requirements. At the same time, existing security vulnerability analysis technologies and tools can also be used to improve the efficiency and accuracy of building the adversarial model.
[0099] The test case generation module 602 is used to generate a test case according to the constraint model and the adversarial model.
[0100] In this embodiment, the test case generation module 602 can be implemented by the following steps:
[0101] Input constraint parsing: Use the constraint model to convert constraint conditions into specific data ranges and formats.
[0102] Adversarial model guidance: With the help of adversarial models, the attacker's behavior is simulated to guide the generation of challenging test cases.
[0103] Test case generation: Based on the processing of the first two steps, test cases are generated. These test cases will include normal data that meets the constraints and malicious data that violates the constraints.
[0104] The testing module 603 is used to execute the test case using the software to be tested to obtain a security test result.
[0105] In this embodiment, the test module 603 can be implemented by the following steps:
[0106] Test case execution: The generated test cases are input into the software to be tested to simulate the actual operating environment to trigger the system's response to security vulnerabilities. At the same time, the input and output information during the test process is recorded, including the response time and resource utilization of the software to be tested. This step can comprehensively evaluate the performance of the software to be tested in different test scenarios.
[0107] Result collection and analysis: Collect data generated during the test execution, including the response of the software to be tested, possible error messages, etc. Through in-depth analysis of this data, potential security vulnerabilities can be identified and the security performance of the system can be evaluated. At the same time, possible abnormal behaviors and error patterns can also be discovered, providing reference for subsequent security optimization.
[0108] Optionally, the software security testing device 600 of this embodiment may further include:
[0109] A constraint model building module is used to obtain security feature information of the software to be tested; determine the constraint conditions corresponding to the security feature information; use a first data set to train a mathematical model of a support vector machine (SVM) to obtain a constraint model, wherein the data contained in the first data set is data having the security feature information and meeting the constraint conditions.
[0110] In this embodiment, the constraint model building module can obtain security feature information through statistical methods, such as variance selection method, chi-square test, mutual information, etc.
[0111] Exemplary security feature information of network communication software may include, but is not limited to:
[0112] Packet-level features: Features can be extracted from captured network traffic packets, such as: Packet length: the number of bytes per packet, which may be related to data transmission volume, security threats, etc.
[0113] Protocol type: Common protocols include TCP, UDP, HTTP, HTTPS, DNS, etc. Different protocols have different characteristics and security risks.
[0114] Packet time interval: The time difference between consecutive packets can be used to analyze traffic patterns or detect abnormal behavior.
[0115] Source / destination IP addresses and port numbers: can help identify specific communication endpoints or attack sources.
[0116] Flags in data packets: For example, TCP flags (SYN, ACK, etc.) can be used to analyze the connection status and data flow control information.
[0117] Traffic characteristics:
[0118] 1. Traffic size: The amount of data transmitted, such as the number of bytes per second, can reflect the density of the traffic.
[0119] 2. Connection duration and number of connections: Session-related features that can help analyze the stability of the connection and whether there are abnormal connection patterns.
[0120] 3. Traffic direction: Whether the traffic is unidirectional or bidirectional may be helpful for security assessment, especially the proportion of inbound and outbound traffic.
[0121] 4. Application layer characteristics:
[0122] 4.1 URL and domain name requests: For Web communication software, the access pattern can be analyzed by extracting the requested URL or the visited domain name.
[0123] 4.2HTTP header information: such as User-Agent, Host and other information, can be used to analyze user behavior patterns.
[0124] 4.3SSL / TLS certificate information: The encryption strength and certificate validity used in the communication can be analyzed.
[0125] It should be noted that the security feature information may be different for different types of software to be tested, and each case will not be described here one by one.
[0126] Optionally, the constraint model building module is also used to evaluate the constraint model through a cross-validation method to obtain a constraint model evaluation result; and optimize the constraint model according to the constraint model evaluation result.
[0127] In this embodiment, the cross-validation method is only a specific example. In actual use, the constraint model building module can also evaluate the constraint model through other algorithms, and each case will not be described here one by one.
[0128] Optionally, the software security testing device 600 of this embodiment may further include:
[0129] The adversarial model modeling module is used to determine the attack scenario and attack target of the software to be tested; use the second data set to train the generative adversarial network GAN to obtain the adversarial model, wherein the data contained in the second data set is obtained according to the attack scenario and the attack target.
[0130] Optionally, the adversarial model modeling module is also used to generate an attack strategy for a target constraint condition, wherein the target constraint condition is one of the constraints; use the attack strategy to evaluate the adversarial model to obtain an adversarial model evaluation result; and optimize the adversarial model based on the adversarial model evaluation result.
[0131] Optionally, the software security testing device 600 of this embodiment may further include:
[0132] The real-time monitoring module is used to monitor the running status of the test case executed by the software to be tested in real time and obtain the real-time monitoring result; when the real-time monitoring result is abnormal or erroneous, send an alarm message.
[0133] Optionally, the software security testing device 600 of this embodiment may further include:
[0134] The optimization module is used to obtain the execution result data of the software to be tested executing the test case; according to the execution result data, the constraint model and / or the adversarial model is optimized.
[0135] The specific implementation method of the software security testing device provided in the embodiment of the present application can be found in the software security testing method provided in the above embodiment, and will not be repeated here.
[0136] The software security testing device provided in the embodiment of the present application can generate test cases based on the constraint model and the adversarial model, so that the test cases are more comprehensive, avoiding the test cases generated by the test personnel based on the test experience. The test cases are difficult to cover all possible attack situations, resulting in incomplete testing and the existence of test loopholes. The constraint model can perform constraint analysis on the software to be tested and extract key test constraint conditions. The adversarial model can simulate the malicious attack behavior of the attacker, so that the technical solution provided in the embodiment of the present application can perform a comprehensive detection of the security of the software to be tested, and the test cases generated by the constraint model and the adversarial model are more efficient, thereby improving the efficiency of software security testing.
[0137] Reference below Figure 7 , which shows a schematic structural diagram of an electronic device for implementing some embodiments of the present application. Figure 7 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0138] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0139] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a disk, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0140] In particular, according to some embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of some embodiments of the present application are executed.
[0141] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0142] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0143] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains the constraint model and adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker; generates test cases according to the constraint model and the adversarial model; and executes the test cases using the software to be tested to obtain security test results.
[0144] Computer program code for performing the operations of some embodiments of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++; and also conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, or may be connected to an external computer (e.g., through the Internet using an Internet service provider), including a local area network (LAN) or a wide area network (WAN).
[0145] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0146] The units described in some embodiments of the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a first determination unit, a second determination unit, a selection unit, and a third determination unit. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0147] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0148] The above description is only some preferred embodiments of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with (but not limited to) the technical features with similar functions disclosed in the embodiments of the present application to form a technical solution.
Claims
1. A software security testing method, characterized in that: The method comprises: Obtaining a constraint model and an adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker; Generate test cases according to the constraint model and the adversarial model; The test case is executed using the software to be tested to obtain a security test result.
2. The method according to claim 1, characterized in that The modeling method of the constraint model includes: Obtaining security feature information of the software to be tested; Determining constraint conditions corresponding to the security feature information; The mathematical model of the support vector machine (SVM) is trained using the first data set to obtain a constraint model, wherein the data contained in the first data set is data having the security feature information and meeting the constraint conditions.
3. The method according to claim 2, characterized in that After the mathematical model of the support vector machine SVM is trained by using the first data set to obtain the constraint model, the method further includes: Evaluate the constraint model through a cross-validation method to obtain a constraint model evaluation result; The constraint model is optimized according to the constraint model evaluation result.
4. The method according to claim 1, characterized in that: The modeling method of the adversarial model includes: Determine the attack scenario and attack target of the software to be tested; A generative adversarial network (GAN) is trained using a second data set to obtain an adversarial model, wherein the data included in the second data set is obtained according to the attack scenario and the attack target.
5. The method according to claim 4, characterized in that After the second data set is used to train the generative adversarial network GAN and obtain the adversarial model, the method further includes: generating an attack strategy for a target constraint condition, wherein the target constraint condition is one of the constraint conditions; Using the attack strategy to evaluate the adversarial model, and obtaining an adversarial model evaluation result; The adversarial model is optimized according to the adversarial model evaluation result.
6. The method according to claim 1, characterized in that The method further comprises: Monitor the running status of the software to be tested executing the test case in real time and obtain real-time monitoring results; When the real-time monitoring result is abnormal or erroneous, an alarm message is sent.
7. The method according to claim 1, characterized in that The method comprises: Obtaining execution result data of the test case executed by the software to be tested; The constraint model and / or the adversarial model are optimized according to the execution result data.
8. A software security testing device, characterized in that: The device comprises: A constraint adversarial model acquisition module, used to acquire a constraint model and an adversarial model corresponding to the security test of the software to be tested, wherein the constraint model is used to determine the constraint conditions between the input and output of the software to be tested, and the adversarial model is used to simulate the malicious attack behavior of the attacker; A test case generation module, used to generate a test case according to the constraint model and the adversarial model; The test module is used to execute the test case using the software to be tested to obtain the security test result.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Artificial intelligence component-oriented test case generation method
CN115712574A
Method and device for generating and testing adversarial attack sample based on black box scene
CN117240624A
Intelligent attack vector generation method and system based on code similarity detection
CN117331839A
Model security test method, related device and storage medium
CN118484810A
Prison break attack method and device for large language model
CN118862074A