A byte array detection method, device and computer readable storage medium

Through instrumentation technology and similarity detection, the problem that data flow tracking method cannot identify changes in stain data is solved, improving the accuracy of vulnerability identification and reducing false alarms.

CN114417353BActive Publication Date: 2024-11-15SECZONE TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111602841.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-11-15
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

The existing data flow tracking method cannot identify the modification operation of the taint data itself, resulting in false positive problems and cannot effectively track the changes in the taint data during the propagation process.

Method used

Insert technology is used to insert detection logic into the application under test, and the changes in the stain data are identified by obtaining the similarity of the byte array, and the status bits are marked in the propagation result state to determine the propagation result state of the stain data.

Benefits of technology

It improves the accuracy of the data flow tracking method, reduces false positives, and can effectively identify changes and propagation results of tainted data during the propagation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114417353B_ABST
    Figure CN114417353B_ABST
Patent Text Reader

Abstract

According to a byte array detection method, device and computer-readable storage medium provided by the scheme of the present application, the detection logic is inserted into the application under test according to the plug-in technology; after detecting that the first byte array including valid tainted data is subjected to a change function to obtain a second byte array, the first similarity between the first byte array and the second byte array is obtained; if the first similarity is zero, the second byte array is marked with a status bit; when the second byte array executes a sensitive function, the state of the propagation result of the valid tainted data in the second byte array is determined according to whether the second byte array has a status bit mark. Through the implementation of the scheme of the present application, the byte array after the change function is verified for similarity, the byte array with a similarity of zero is marked with a status bit, and the state of the propagation result of the valid tainted data in the byte array is determined according to the status bit mark, thereby improving the accuracy of identifying vulnerabilities based on the data flow tracking method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to a byte array detection method, device and computer-readable storage medium. Background Art

[0002] Data flow vulnerability tracking refers to tracking the input stage, propagation stage, and execution stage of tainted data in a request, and determining whether the tainted data has gone through the complete three stages and has not passed through any security methods. In other words, the tainted data is considered to have a vulnerability, and is usually used to detect SQL injection, command line injection, etc.

[0003] Currently, common data flow tracking methods can only identify tainted data based on its memory address, but cannot identify modification operations on the tainted data itself. When the tainted data itself undergoes some changes, normal data flow tracking methods cannot track it normally, and a series of false alarm problems will occur. Summary of the invention

[0004] The embodiments of the present application provide a byte array detection method, device and computer-readable storage medium, which can at least solve the problem in the related art that when some changes occur in the tainted data itself, the normal data flow tracking method cannot be tracked normally, and a series of false alarm problems will occur at this time.

[0005] A first aspect of an embodiment of the present application provides a byte array detection method, including:

[0006] Insert detection logic into the application under test based on instrumentation technology;

[0007] After detecting that a first byte array including valid tainted data is subjected to a change function to obtain a second byte array, obtaining a first similarity between the first byte array and the second byte array;

[0008] If the first similarity value is zero, marking the status bit of the second byte array;

[0009] When the second byte array executes a sensitive function, the propagation result state of the valid tainted data in the second byte array is determined according to whether the second byte array has the status bit mark; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has the status bit mark, the propagation result state is the loss state.

[0010] A second aspect of an embodiment of the present application provides a byte array detection device, including:

[0011] An insertion module, used to insert detection logic into the application under test based on the instrumentation technology;

[0012] An acquisition module, configured to acquire a first similarity between a first byte array and a second byte array after detecting that a first byte array containing valid tainted data is obtained by a transformation function to obtain a second byte array;

[0013] a marking module, configured to mark a status bit of the second byte array if the first similarity value is zero;

[0014] A determination module is used to determine the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the second byte array executes a sensitive function; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has the status bit mark, the propagation result state is the loss state.

[0015] A third aspect of an embodiment of the present application provides an electronic device, comprising: a memory, a processor and a bus, wherein the bus is used to realize connection and communication between the memory and the processor; the processor is used to execute a computer program stored in the memory, and when the processor executes the computer program, each step in the byte array detection method provided in the first aspect of the embodiment of the present application is performed.

[0016] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, each step of the byte array detection method provided in the first aspect of the embodiment of the present application is implemented.

[0017] As can be seen from the above, according to a byte array detection method, device and computer-readable storage medium provided by the scheme of the present application, the detection logic is inserted into the application under test according to the plugging technology; after detecting that the first byte array including valid tainted data is subjected to the change function to obtain the second byte array, the first similarity between the first byte array and the second byte array is obtained; if the first similarity is zero, the second byte array is marked with a status bit; when the second byte array executes a sensitive function, the propagation result state of the valid tainted data in the second byte array is determined according to whether the second byte array has the status bit mark; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has the status bit mark, the propagation result state is the loss state. Through the implementation of the scheme of the present application, the second byte array obtained after the first byte array passes through the change function is verified for similarity, and the second byte array with zero similarity is marked with a status bit. When the second byte array passes through the sensitive function in the execution stage, the propagation result state of the valid tainted data in the second byte array is determined according to whether the second byte array has the status bit mark, which can further improve the accuracy of identifying vulnerabilities based on the data flow tracking method. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of the basic flow of the byte array detection method provided in the first embodiment of the present application;

[0019] Figure 2 A detailed flowchart of the byte array detection method provided in the second embodiment of the present application;

[0020] Figure 3 A schematic diagram of a program module of a byte array detection device provided in the third embodiment of the present application;

[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in the fourth embodiment of the present application.

[0022] Specific implementation content

[0023] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0024] In order to solve the problem in the related art that when the tainted data itself undergoes some changes, the normal data flow tracking method cannot be tracked normally, and a series of false alarms will occur at this time, the first embodiment of the present application provides a byte array detection method.

[0025] The following is the program code for the tainted data in the input stage, propagation stage, and execution stage:

[0026] ①String taintedData=request.getParameter("taintedData"); / / world

[0027] ②taintedData="hello"+taintedData; / / helloworld

[0028] ③char[]chars=taintedData.toCharArray();

[0029] ④chars[5]='g'; / / hellogorld

[0030] ⑤chars[6]='a'; / / hellogarld

[0031] ⑥chars[7]='m'; / / hellogamld

[0032] ⑦chars[8]='e'; / / hellogamed

[0033] ⑧String value=String.valueOf(chars);

[0034] ⑨Runtime.getRuntime().exec(value);

[0035] Among them, ① represents the input stage of tainted data, ②-⑧ represent the propagation stage of tainted data, and ⑨ represents the execution stage of tainted data.

[0036] like Figure 1 The basic flow chart of the byte array detection method provided in this embodiment includes the following steps:

[0037] Step 101: Insert the detection logic into the application under test according to the instrumentation technology.

[0038] Specifically, insertion refers to using Java virtual machine technology to insert the detection logic component into the application under test, where the detection logic component is an agent process in the same container as the application under test, so the component can obtain the context of each request execution process of the application. Existing data flow tracking methods only track the generated tainted data, and do not detect whether the tainted data changes during the propagation process. In this embodiment, after the application under test is started, the detection logic is inserted into the input stage, propagation stage, and execution stage of the application under test through the plug-in tool to detect the tainted data at different stages.

[0039] Step 102: After detecting that the first byte array including valid tainted data is subjected to a transformation function to obtain a second byte array, obtain a first similarity between the first byte array and the second byte array.

[0040] Specifically, in this embodiment, it should be noted that byte array similarity refers to a storage data type char[] in Java. Byte array is a native type of Java. Directly modifying a character at a certain position in a byte array will not trigger propagation phase tracking, which will also lead to false positives in the data flow vulnerability tracking phase (i.e., the original byte array may have been completely replaced, not from user input data, and has no possibility of being exploited, so there is no vulnerability in this case). After the detection logic detects that the tainted data in the input phase changes to the first byte array, it should also be noted that the tainted data is the original valid tainted data in the first byte array, and the valid tainted data is used to represent it below. The byte array similarity matching module is used to determine whether the first byte array containing valid tainted data has changed in the propagation phase, and the second byte array after the change is sent is obtained. As shown in the above code, the content in the char array at the ③ and ⑧ positions has changed, and the tainted data from the request input has only d left from world. The byte array similarity matching module determines whether there is a first similarity between the first byte array and the second byte array based on the length of the first byte array and the second byte array and the length of the largest equal byte string in the first byte array and the second byte array as algorithm input parameters.

[0041] In one implementation of this embodiment, before the step of obtaining the first similarity between the first byte array and the second byte array, it also includes: detecting in real time according to the detection logic whether there is valid tainted data in the data stream at the input stage; when there is valid tainted data, detecting whether the valid tainted data is changed into the first byte array.

[0042] Specifically, in this embodiment, after the detection logic is inserted into the application under test, the detection logic will detect in real time whether the above-mentioned valid tainted data exists in the data input by the user. When valid tainted data exists, the detection logic will track and detect the valid tainted data in the input stage to determine whether the valid tainted data changes to the above-mentioned first byte array. When there is no valid tainted data, the data is deemed to be safe data and does not participate in the subsequent detection process.

[0043] In an optional implementation of the present embodiment, after the step of detecting whether the valid taint data changes into the first byte array, the method further includes: after determining that the valid taint data changes into the first byte array, determining whether the byte at the byte coordinate position changes according to the byte coordinate position of the first byte array; when it is determined that the byte at the byte coordinate position changes, detecting that the first byte array containing the valid taint data is subjected to a change function to obtain a second byte array.

[0044] Specifically, in practical applications, the first byte array containing valid tainted data may not change during the propagation process. If all byte arrays in the propagation process are compared, the operating efficiency of the detection logic will be seriously affected. In this embodiment, before obtaining the first similarity, after determining that the valid tainted data has changed into the first byte array, the bytes at each byte coordinate position in the first byte array are detected by the detection logic. After detecting that the first byte array has changed, the second byte array obtained after the change is obtained, and then the step of obtaining the first similarity is performed. In this way, only the first similarity between the changed first byte array and the changed second byte array needs to be obtained, which can improve the operating efficiency of the detection logic.

[0045] In an optional implementation of the present embodiment, the step of obtaining the first similarity between the first byte array and the second byte array includes: performing a byte comparison between a target coordinate position of the first byte array and a corresponding coordinate position of the second byte array; and determining the first similarity between the first byte array and the second byte array based on the length of the bytes that match the comparison.

[0046] Specifically, the target coordinate position of the present embodiment is the coordinate position of the valid stain data in the first byte array. After the first byte array is determined to be changed into the second byte array according to the detection logic, the coordinate position of the valid stain data in the first byte array is compared with the bytes of the corresponding coordinate position of the second byte array. The same length of the valid stain data in the byte array is determined by comparison. It should be understood that the valid stain data in the second byte array is the valid stain data that still exists after the valid stain data in the first byte array has been changed by the function. The first similarity between the first byte array and the second byte array is determined according to the length of the same bytes. For example, at the third and eighth positions of the above code, the length of the byte array is 10, the valid stain byte data in the byte array is (5,9), and the length of the valid stain data in the two byte arrays is equal to 1.

[0047] In an optional implementation method consistent with the present embodiment, after the step of obtaining the first similarity between the first byte array and the second byte array, it also includes: if the value of the first similarity is not zero, verifying the accuracy of the first similarity; if the verification fails, marking the status bit of the second byte array, and then executing the step of determining the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the sensitive function is executed on the second byte array; if the verification passes, executing the step of determining the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the sensitive function is executed on the second byte array.

[0048] Specifically, in this embodiment, when the value of the first similarity between the first byte array and the second byte array is not zero, the first similarity is verified according to the similarity verification module to determine the accuracy of the first similarity. When the verification passes, it means that the first similarity is accurate, and it is determined that there is an association between the first byte array and the second byte array, and the valid tainted data still exists in the second byte array, and the data flow vulnerability detection logic continues to be executed. When the verification fails, it means that an error has occurred in the similarity matching module, and the second byte array will be marked with a status bit, indicating that the second byte array is safe, which can effectively improve the accuracy of whether there is valid tainted data in the second byte array.

[0049] It should be noted that, in an optional implementation of the present embodiment, before the step of verifying the accuracy of the first similarity, the step further includes: performing a byte comparison between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array; when the third similarity value between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array is not zero, executing the step of verifying the accuracy of the first similarity.

[0050] Specifically, in practical applications, for example, the hard-coded data in steps ④ to ⑦ of the above code may be consistent with part of the data of the original byte array. In this case, errors may occur. In this embodiment, by performing byte comparison between the non-target coordinate positions of the first byte array and the corresponding coordinate positions of the second byte array, it is determined whether there is a possibility of error in the obtained first similarity, thereby further improving the accuracy of the first similarity.

[0051] In an optional implementation of the present embodiment, the step of verifying the accuracy of the first similarity includes: generating a random byte array with the same length as the first byte array; obtaining a second similarity between the random byte array and a third byte array obtained by subjecting the random byte array to a variation function; and verifying the accuracy of the first similarity based on the second similarity.

[0052] Specifically, in this embodiment, after the similarity verification module receives the data for matching in the similarity matching module, it generates a byte array of random content of the same length, calls the function of changing the first byte array into the second byte array again, and performs similarity matching on the random byte data with the changed third byte array to obtain a second similarity, and verifies the accuracy of the first similarity based on the second similarity.

[0053] Step 103: If the value of the first similarity is zero, the state bit of the second byte array is marked.

[0054] Specifically, in this embodiment, the first similarity value of zero indicates that the second byte array does not contain valid tainted data contained in the first byte array, and the status bit of the second byte array is marked to determine that the second byte array is safe.

[0055] Step 104: When executing the sensitive function on the second byte array, determine the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has a status bit mark.

[0056] Specifically, the propagation result status of this embodiment includes an existence status and a loss status. In the execution stage, when the second byte array passes through a sensitive function, such as command line execution, SQL operation, etc., the detection logic will further determine the propagation result status of the valid tainted data in the second byte array according to whether there is a status bit mark in the second byte array. If there is a status bit mark, it means that the valid tainted data has been lost during the propagation process, that is, it is unlikely to be operated by malicious users. At this time, the vulnerability is not reported to improve accuracy. If there is no status bit mark, it means that there is still valid tainted data in the second byte array and the vulnerability needs to be reported.

[0057] Based on the scheme of the above-mentioned embodiment of the present application, the detection logic is inserted into the application under test according to the plugging technology; after detecting that the first byte array including valid tainted data is subjected to the change function to obtain the second byte array, the first similarity between the first byte array and the second byte array is obtained; if the first similarity is zero, the second byte array is marked with a status bit; when the second byte array executes the sensitive function, the state of the propagation result of the valid tainted data in the second byte array is determined according to whether the second byte array has a status bit mark. Through the implementation of the scheme of the present application, the similarity of the byte array after the change function is verified, the state bit of the byte array with a similarity of zero is marked, and the state of the propagation result of the valid tainted data in the byte array is determined according to the status bit mark, which can improve the accuracy of identifying vulnerabilities based on the data flow tracking method.

[0058] Figure 2 The method in is a refined byte array detection method provided in the second embodiment of the present application, and the byte array detection method includes:

[0059] Step 201: Insert the detection logic into the application program under test according to the instrumentation technology.

[0060] Step 202: After determining that the valid stain data is changed into the first byte array, determine whether the byte at the byte coordinate position is changed according to the byte coordinate position of the first byte array.

[0061] Step 203: When it is determined that the byte at the byte coordinate position changes, a second byte array is obtained by applying a change function to the first byte array.

[0062] Specifically, in this embodiment, before obtaining the first similarity, after determining that the valid taint data changes to the first byte array, the bytes at each byte coordinate position of the first byte array are detected by detection logic, and after detecting that the first byte array changes, a second byte array obtained after the change is obtained.

[0063] Step 204: Obtain a first similarity between the first byte array and the second byte array.

[0064] Step 205: If the value of the first similarity is zero, the state bit of the second byte array is marked.

[0065] Step 206: When executing the sensitive function on the second byte array, detect whether there is a status bit mark on the second byte array.

[0066] Step 207: When it is detected that the second byte array has a status bit mark, it is determined that the valid tainted data is in a lost state in the second byte array.

[0067] Step 208: When it is detected that the second byte array does not have a status bit mark, determine that the valid tainted data exists in the second byte array.

[0068] Specifically, in this embodiment, when the value of the first similarity is zero, it is determined that all the bytes in the second byte array corresponding to the coordinate positions of the valid taint data in the first byte array have changed, and there is no valid taint data in the second byte array. When the second byte array passes through the sensitive function in the execution stage, if the detection logic detects that there is a status bit mark in the second byte array, it is determined that the valid taint data of the second byte array is in a lost state. If the detection logic detects that there is no status bit mark in the second byte array, it is determined that the valid taint data of the second byte array is in an existing state.

[0069] It should be understood that the size of the serial number of each step in this embodiment does not mean the order of execution of the steps. The execution order of each step should be determined by its function and internal logic, and should not constitute a sole limitation on the implementation process of the embodiment of this application.

[0070] According to a byte array detection method provided by the present application, the detection logic is inserted into the application under test according to the plugging technology; after determining that the valid tainted data changes to the first byte array, according to the byte coordinate position of the first byte array, determine whether the byte at the byte coordinate position has changed; when it is determined that the byte at the byte coordinate position has changed, obtain the second byte array obtained by the change function of the first byte array; obtain the first similarity between the first byte array and the second byte array; if the first similarity is zero, mark the second byte array with a status bit; detect whether the second byte array has a status bit mark; when it is detected that the second byte array has a status bit mark, determine that the valid tainted data is in a lost state in the second byte array; when it is detected that the second byte array does not have a status bit mark, determine that the valid tainted data is in a state of existence in the second byte array. Through the implementation of the present application, the second byte array after the change function is verified for similarity, the second byte array with the first similarity of zero is marked with a status bit, and the propagation result state of the valid tainted data in the second byte array is determined according to the status bit mark, which can improve the accuracy of identifying vulnerabilities based on the data flow tracking method.

[0071] Figure 3 A byte array detection device is provided in the third embodiment of the present application. The byte array detection device can be used to implement the byte array detection method in the above-mentioned embodiment. Figure 3 As shown, the byte array detection device mainly includes:

[0072] Insertion module 301, used to insert detection logic into the application under test according to the instrumentation technology;

[0073] An acquisition module 302 is used to acquire a first similarity between the first byte array and the second byte array after detecting that the first byte array containing valid tainted data is subjected to a change function to obtain a second byte array;

[0074] A marking module 303, configured to mark a status bit of the second byte array if the first similarity value is zero;

[0075] The determination module 304 is used to determine the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has a status bit mark when executing the sensitive function on the second byte array; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has a status bit mark, the propagation result state is a loss state.

[0076] In an optional implementation of this embodiment, the byte array detection device further includes: a detection module. The detection module is used to: detect in real time whether there is valid tainted data in the data stream at the input stage according to the detection logic; when there is valid tainted data, detect whether the valid tainted data is changed into the first byte array.

[0077] Furthermore, in an optional implementation of this embodiment, the determination module is further used to: after determining that the valid tainted data changes to the first byte array, determine whether the byte at the byte coordinate position changes according to the byte coordinate position of the first byte array. The detection module is further used to: when determining that the byte at the byte coordinate position changes, detect that the first byte array containing the valid tainted data is subjected to a change function to obtain a second byte array.

[0078] In an optional implementation of the present embodiment, the acquisition module is specifically used to: perform a byte comparison between the target coordinate position of the first byte array and the corresponding coordinate position of the second byte array; wherein the target coordinate position is the coordinate position of the valid stain data in the first byte array; and determine the first similarity between the first byte array and the second byte array based on the length of the bytes that match the comparison.

[0079] In an optional implementation of this embodiment, the byte array detection device further includes: a verification module. The verification module is used to: if the value of the first similarity is not zero, then verify the accuracy of the first similarity; if the verification fails, then mark the state bit of the second byte array, and then perform the step of determining the state of the propagation result of the valid tainted data in the second byte array according to whether the second byte array has the state bit mark when the sensitive function is executed on the second byte array; if the verification passes, then perform the step of determining the state of the propagation result of the valid tainted data in the second byte array according to whether the second byte array has the state bit mark when the sensitive function is executed on the second byte array.

[0080] Furthermore, in an optional implementation of the present embodiment, the verification module is specifically used to: generate a random byte array with the same length as the first byte array; obtain a second similarity between the random byte array and a third byte array obtained by subjecting the random byte array to a change function; and verify the accuracy of the first similarity based on the second similarity.

[0081] Furthermore, in an optional implementation of the present embodiment, the byte array detection device further includes: a comparison module. The comparison module is used to perform a byte comparison between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array; when the third similarity value between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array is not zero, a step of verifying the accuracy of the first similarity is performed.

[0082] It should be noted that the byte array detection methods in the first and second embodiments can be implemented based on the byte array detection device provided in this embodiment. Ordinary technicians in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working process of the byte array detection device described in this embodiment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0083] According to the byte array detection device provided by the scheme of the present application, the detection logic is inserted into the application under test according to the plugging technology; after detecting that the first byte array including valid tainted data is subjected to the change function to obtain the second byte array, the first similarity between the first byte array and the second byte array is obtained; if the first similarity is zero, the second byte array is marked with a status bit; when the second byte array executes a sensitive function, the state of the propagation result of the valid tainted data in the second byte array is determined according to whether the second byte array has a status bit mark. Through the implementation of the scheme of the present application, the byte array after the change function is verified for similarity, the byte array with a similarity of zero is marked with a status bit, and the state of the propagation result of the valid tainted data in the byte array is determined according to the status bit mark, which can improve the accuracy of identifying vulnerabilities based on the data flow tracking method.

[0084] Figure 4 An electronic device is provided in the fourth embodiment of the present application. The electronic device can be used to implement the byte array detection method in the above-mentioned embodiment. Figure 4 As shown, the electronic device mainly includes:

[0085] Memory 401, processor 402, bus 403, and a computer program stored in memory 401 and executable on processor 402, memory 401 and processor 402 are connected via bus 403. When processor 402 executes the computer program, the byte array detection method in the aforementioned embodiment is implemented. The number of processors may be one or more.

[0086] The memory 401 may be a high-speed random access memory (RAM) memory, or a non-volatile memory, such as a disk memory. The memory 401 is used to store executable program codes, and the processor 402 is coupled to the memory 401 .

[0087] Furthermore, the present application also provides a computer-readable storage medium, which may be disposed in the electronic device in the above embodiments. Figure 4 Memory in the illustrated embodiment.

[0088] The computer readable storage medium stores a computer program, and when the program is executed by the processor, the byte array detection method in the aforementioned embodiment is implemented. Furthermore, the computer storable medium can also be a U disk, a mobile hard disk, a read-only memory (ROM), a RAM, a magnetic disk or an optical disk, and other media that can store program codes.

[0089] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only 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, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0090] The modules described 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 network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0091] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0092] If the 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 storage medium. Based on this understanding, the technical solution of the present application, 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, which is stored in a readable storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned readable storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0093] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0094] In the above embodiments, 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.

[0095] The above is a description of the byte array detection method, device and computer-readable storage medium provided in the present application. For those skilled in the art, according to the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. A byte array detection method, characterized in that: include: Insert detection logic into the application under test based on instrumentation technology; After detecting that a first byte array containing valid tainted data is subjected to a transformation function to obtain a second byte array, obtaining a first similarity between the first byte array and the second byte array; If the first similarity value is zero, marking the status bit of the second byte array; When the second byte array executes the sensitive function, determining the propagation result state of the valid tainted data in the second byte array according to whether the second byte array has the state bit mark; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has the state bit mark, the propagation result state is the loss state; If the first similarity value is not zero, generating a random byte array having the same length as the first byte array; Obtain a second similarity between the random byte array and a third byte array obtained by performing a change function on the random byte array; Verifying the accuracy of the first similarity based on the second similarity; If the verification fails, a status bit is marked on the second byte array, and then the step of determining the state of the propagation result of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the sensitive function is executed on the second byte array is performed; If the verification passes, the step of determining the state of the propagation result of the valid tainted data in the second byte array according to whether the second byte array has the state bit mark when the sensitive function is executed in the second byte array is executed.

2. The byte array detection method according to claim 1, characterized in that: Before the step of obtaining the first similarity between the first byte array and the second byte array, the method further includes: Detect in real time according to the detection logic whether the data stream contains the valid tainted data at the input stage; When the valid tainted data exists, it is detected whether the valid tainted data changes into the first byte array.

3. The byte array detection method according to claim 1, characterized in that: The step of obtaining a first similarity between the first byte array and the second byte array comprises: Performing a byte comparison on the target coordinate position of the first byte array and the corresponding coordinate position of the second byte array; wherein the target coordinate position is the coordinate position of the valid stain data in the first byte array; A first similarity between the first byte array and the second byte array is determined according to the lengths of the bytes that are matched.

4. The byte array detection method according to claim 1, characterized in that: Before the step of verifying the accuracy of the first similarity, the method further includes: Performing a byte comparison between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array; When the third similarity value between the non-target coordinate position of the first byte array and the corresponding coordinate position of the second byte array is not zero, the step of verifying the accuracy of the first similarity is performed.

5. The byte array detection method according to claim 2, characterized in that: After the step of detecting whether the valid tainted data changes into the first byte array, the method further includes: After determining that the valid stain data changes to the first byte array, determining whether the byte at the byte coordinate position changes according to the byte coordinate position of the first byte array; When it is determined that the byte at the byte coordinate position changes, a first byte array containing valid tainted data is detected and subjected to a change function to obtain a second byte array.

6. A byte array detection device, characterized in that: include: An insertion module, used to insert detection logic into the application under test based on the instrumentation technology; An acquisition module, configured to acquire a first similarity between a first byte array and a second byte array after detecting that a first byte array containing valid tainted data is obtained by a transformation function to obtain a second byte array; a marking module, configured to mark a status bit of the second byte array if the first similarity value is zero; a determination module, configured to determine, when the second byte array executes a sensitive function, a propagation result state of the valid tainted data in the second byte array according to whether the second byte array has the state bit mark; wherein the propagation result state includes an existence state and a loss state, and when the second byte array has the state bit mark, the propagation result state is the loss state; A verification module, configured to generate a random byte array having the same length as the first byte array if the first similarity value is not zero; obtain a second similarity between the random byte array and a third byte array obtained by applying a variation function to the random byte array; and verify the accuracy of the first similarity based on the second similarity; The determination module is also used for: if the verification fails, marking the status bit of the second byte array, and then determining the propagation result status of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the second byte array executes a sensitive function; if the verification passes, then determining the propagation result status of the valid tainted data in the second byte array according to whether the second byte array has the status bit mark when the second byte array executes a sensitive function.

7. An electronic device comprising: A memory, a processor and a bus, wherein the bus is used to realize connection and communication between the memory and the processor; the processor is used to execute a computer program stored in the memory, and when the processor executes the computer program, the steps in the method described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method for detecting program vulnerabilities during operation on the basis of dynamic binary platform

    CN107526970A

  • Data processing method and computing device

    CN110119633A

  • Management of taint information attached to strings

    CN112307474A

  • Cross-application dynamic taint tracking method

    CN113220525A

  • Detection of malicious programs

    US7870610B1