A fine-grained method for detecting firmware versions of intranet devices
By generating a fine-grained fingerprint database for intranet devices and using side channel identification methods, the problem of same-origin policy restrictions in intranet device firmware version detection is solved, fast and efficient device identification and security checks are achieved, and detection efficiency and success rate.
Patent Information
- Application Number
- CN202210706182.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-06-21
AI Technical Summary
The existing technology cannot quickly and efficiently identify the firmware version of intranet devices, and is restricted by the same-origin policy in the intranet environment and cannot obtain non-local file contents, resulting in low device detection efficiency and low success rate.
By obtaining public vulnerability information, storing it in the vulnerability feature database, obtaining and decompressing the device firmware image, extracting Web service resource files for analysis, generating a fine-grained fingerprint library for intranet devices, using side channels to identify device characteristics, and bypassing the same origin policy Limitation, combined with multi-layer device fingerprint generation method to reduce the number of detection requests.
It achieves fast and efficient firmware version identification of intranet devices, avoids same-origin policy restrictions, improves detection efficiency and success rate, and can check device security without triggering vulnerabilities.
Smart Images

Figure CN115098151B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of firmware version detection, and in particular to a fine-grained method for detecting firmware versions of intranet devices. Background Art
[0002] Device search engines can identify the manufacturers and models of devices directly connected to the World Wide Internet, such as Shodan and Censys, as well as search engines such as FOFA and ZoomEye. The above search engines all scan the common ports on the IP addresses of the entire network, analyze the return messages of the service, certificate signatures, resource files, IP addresses and other features, and can obtain device information more accurately, such as manufacturer, model, open ports, operating system type, geographical location, asset affiliation, etc. However, since the above device search engines do not have the fingerprint of the firmware version, they cannot identify the specific device firmware model.
[0003] For fine-grained fingerprint recognition of embedded devices, the natural language processing technology is currently usually used to convert the message content returned by the Web service into a vector. By comparing the similarity between the test device response data and the vector, the specific version information of the device firmware can also be determined. However, this method needs to send a large number of test requests when verifying the firmware version, which makes it difficult to quickly locate large-scale and multi-type device models, and therefore cannot solve the problem of rapid location of large-scale and multi-type device models.
[0004] In summary, the intranet device detection solution in the prior art cannot identify the specific model and firmware version of the device, and a large number of detection messages need to be sent during the detection process. The fine-grained device detection method in the prior art needs to obtain the hash value of the resource file content, but the intranet request will be restricted by the same-origin policy and the file content cannot be obtained, so it cannot be applied to intranet device detection.
[0005] Some practitioners have proposed that the local device discovery technology based on Web services can be used to identify the device model in the local area network by analyzing the error information returned by the request resource file. However, the above solution only realizes the identification of whether a certain type of device of a certain manufacturer exists in the local area network, and cannot check the security of the device without triggering the vulnerability. In addition, device detection still requires sending a large number of network requests, which may lead to failure to identify due to timeout.
[0006] Chinese patent application CN109375945A discloses a firmware version detection method and vulnerability repair rate evaluation method for IoT devices. This solution can achieve more efficient device firmware version detection, reduce the number of requests required to identify device firmware version information, and achieve rapid measurement of specific firmware version models of a large number of devices in cyberspace. However, the device fingerprint in this solution still needs to rely on the hash value calculated from the resource file content of the Web service in the device, and in the intranet detection environment, it will be affected by the homology policy, that is, it limits the acquisition of non-local file content, such as Javascript scripts cannot obtain the specific content of resource files on other websites, so the above method cannot be applied to the special environment of intranet detection to achieve intranet device identification. Summary of the invention
[0007] The technical problem to be solved by the present invention is: in view of the deficiencies in the prior art, the present invention provides a fine-grained intranet device firmware version detection method, which can quickly and efficiently detect the intranet device firmware version.
[0008] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0009] A fine-grained method for detecting the firmware version of an intranet device comprises the following steps:
[0010] S1. Obtain public vulnerability information and store the device models and firmware version ranges affected by the vulnerability in the vulnerability feature database;
[0011] S2. Obtain the device firmware image and decompress it to obtain a firmware image file database, extract the Web service resource file from the firmware image file database for analysis, and extract features for intranet device detection;
[0012] S3. Generate a firmware version fingerprint based on the features used for intranet device detection to form a fine-grained fingerprint library for intranet devices;
[0013] S4. Identify the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device, and determine whether the intranet device to be tested has a security vulnerability according to the vulnerability feature database.
[0014] Furthermore, the features used for detecting intranet devices include image size features, Javascript script features, and Cascading Style Sheet (CSS) features of the intranet devices.
[0015] Furthermore, in step S4, identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device includes: obtaining a target image file in the Web service of the intranet device to be tested, determining whether the target image file exists in the fine-grained fingerprint library of the intranet device, and obtaining the size of the target image file, and identifying the firmware version of the intranet device to be tested according to the obtained size.
[0016] Furthermore, the step S4 of identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device also includes: obtaining the variables and function summary values in the script when loading the Javascript script features, and identifying the firmware version of the intranet device to be tested from the fine-grained fingerprint library of the intranet device according to the variables and function summary values in the script obtained, wherein the function summary value includes the function name and the number of function parameters.
[0017] Furthermore, the step S4 of identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device also includes: judging the current element style after the HTML (Hypertext Markup Language) tag references the CSS (Cascading Style Sheets) file, obtaining the content in the CSS file, and identifying the firmware version of the intranet device to be tested from the fine-grained fingerprint library of the intranet device according to the content in the obtained CSS file.
[0018] Furthermore, the step of generating a firmware version fingerprint according to the feature for detecting the intranet device in step S3 includes:
[0019] S301. Summarize all features obtained from the Web service resource file and construct a feature list, where all firmware versions and all features are used as columns and rows in the feature list, respectively. Each table content in the feature list is the value of each feature in different versions;
[0020] S302. Obtain the fingerprint of the target firmware version X, which is the minimum feature set, traverse all feature values and maintain a version list L to determine whether to add the firmware version to the version list L, until the generation of all firmware version fingerprints is completed. The version list L is the value range of the target firmware version X.
[0021] Furthermore, the step S302 includes:
[0022] If the initial content of the version list L is all versions except the target version X, when all firmware versions in the version list L have the same value on a certain target feature, the target feature is not added to the firmware version fingerprint, that is, the content of the version list L remains unchanged and the traversal continues;
[0023] If the values of some versions in the version list L are the same as the value of the target firmware version X, and some are different, only the firmware versions with the same value as the target firmware version X are retained in the version list L, and the corresponding features are added to the firmware version fingerprint, and the traversal continues;
[0024] When all versions in the version list L have different values of the target feature from the target firmware version X, the target feature is added to the firmware version fingerprint, the traversal is terminated, and all firmware version fingerprints are generated.
[0025] Furthermore, the step S3 also includes a device manufacturer fingerprint generation step, including: setting the initial value of the version list to the manufacturer information of all devices in the test set, and the feature list to be a feature set common to all models of devices of the specified manufacturer.
[0026] Furthermore, the step S3 also includes a model fingerprint generation step, including: the initial value of the version list is all models of the specified manufacturer in the test set, and the feature list is a set of features common to all versions of the specified model.
[0027] A computer-readable storage medium storing a computer program, wherein the computer program implements the above method when executed.
[0028] Compared with the prior art, the advantages of the present invention are:
[0029] 1. The present invention obtains publicly disclosed vulnerability information, stores the device model and firmware version information affected by the vulnerability in a vulnerability feature database, obtains the device firmware image to obtain a firmware image file database, and then extracts the resource file of the Web service for analysis to obtain the feature value related to the intranet device detection, thereby forming a fine-grained fingerprint library of the intranet device. Based on the fine-grained fingerprint library of the intranet device, a side-channel device identification method is used to realize firmware version identification. The side-channel-based device identification method can realize multi-angle description of the intranet device characteristics, and can bypass the limitations of the homology policy in the firmware version detection of the intranet device, so as to realize fast and efficient fine-grained firmware version identification of the intranet device. At the same time, combined with the vulnerability feature database, the security of the intranet device can be checked without triggering the vulnerability.
[0030] 2. The present invention further generates device version fingerprints by combining a multi-layer device fingerprint generation method, which can reduce the number of requests required for detection, solve the problems of long detection time due to the large number of intranet devices and limited detection time window, and the possibility of identification failure due to the user closing the browser, thereby effectively improving the efficiency and success rate of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1It is a schematic diagram of the implementation process of the fine-grained intranet device firmware version detection method of this embodiment.
[0032] Figure 2 It is a schematic diagram of the principle of realizing the firmware version detection of the intranet device in this embodiment.
[0033] Figure 3 It is a schematic diagram of the principle of distinguishing devices by image size in a specific application embodiment of the present invention.
[0034] Figure 4 It is a schematic diagram of the principle of distinguishing devices by scripts in a specific application embodiment of the present invention.
[0035] Figure 5 It is a schematic diagram of the principle of distinguishing devices through cascading style sheets in a specific application embodiment of the present invention.
[0036] Figure 6 It is a schematic diagram of the recognition principle of version fingerprint in a specific application embodiment of the present invention. DETAILED DESCRIPTION
[0037] The present invention is further described below in conjunction with the accompanying drawings and specific preferred embodiments, but the protection scope of the present invention is not limited thereby.
[0038] like Figure 1 , 2 As shown, the steps of the fine-grained intranet device firmware version detection method of this embodiment include:
[0039] S1. Obtain public vulnerability information and store the device models and firmware version ranges affected by the vulnerability in the vulnerability feature database;
[0040] S2. Obtain the device firmware image and decompress it to obtain a firmware image file database, extract the Web service resource file from the firmware image file database for analysis, and extract features for intranet device detection;
[0041] S3. Generate a firmware version fingerprint based on the features used for intranet device detection. The firmware version fingerprint is the minimum feature set required to determine the firmware version information, forming a fine-grained fingerprint library for intranet devices;
[0042] S4. Identify the firmware version of the intranet device to be tested based on the fine-grained fingerprint library of the intranet device, and determine whether the intranet device to be tested has a security vulnerability based on the vulnerability feature database.
[0043] Considering (1) since intranet devices cannot be directly accessed from the World Wide Web, the detection function needs to be implemented through Javascript code rendered and executed by Web services; (2) the same-origin policy is an important browser security policy, which stipulates that resource interaction can only be carried out when the host name, network protocol and port of the requester and the responder are the same. When Javascript scripts access the device's Web service, they will be restricted by the same-origin policy and cannot directly obtain the return value of the network resource. Therefore, it is necessary to determine the device model by the difference in the resource file loading characteristics in the Web service; the device's fingerprint information is the minimum feature set required to determine the manufacturer, model, and version information of the device, which needs to be obtained by analyzing the file content in the device firmware image.
[0044] This embodiment is based on the above-mentioned characteristics of the firmware version detection of intranet devices. It first obtains publicly disclosed vulnerability information from the intelligence threat website, stores the device model and firmware version information affected by the vulnerability in the vulnerability feature database, downloads the device firmware image from the manufacturer's resource website and decompresses it to obtain the firmware image file database, and then extracts the resource file of the Web service from it for analysis, obtains the characteristic value related to the detection of intranet devices to generate the device fingerprint, and combines the device identification method based on the side channel to achieve fast and efficient fine-grained device firmware version identification. The above-mentioned device identification method based on the side channel is to detect device features through the side channel method. When the specific content of the file cannot be obtained, the content is judged by the impact on the caller, thereby bypassing the restrictions of the same-origin policy to achieve the detection of the firmware version of the intranet device.
[0045] In this embodiment, the features used for detecting intranet devices specifically include the image size features, Javascript script features, and Cascading Style Sheet (CSS) features of the intranet devices, and the detection can be performed in the order of obtaining the image size, Javascript script features, and Cascading Style Sheet (CSS) features in sequence. After obtaining the target feature value corresponding to the intranet device to be tested in the subsequent step S4, the target feature value is matched and compared with the corresponding feature value in the fine-grained fingerprint library of the intranet device, and the firmware version of the intranet device to be tested can be identified.
[0046] The method of implementing the firmware version detection of the intranet device based on the side channel in this embodiment specifically includes:
[0047] (1) Using image size feature recognition: Obtain the target image file in the Web service of the intranet device to be tested, determine whether the target image file exists in the fine-grained fingerprint library of the intranet device, and obtain the size of the target image file. Identify the firmware version of the intranet device to be tested based on the obtained size.
[0048] HTML (Hypertext Markup Language) is a common language for building website front-ends. Different display elements are introduced by parsing tags. When the img tag loads image resources, it is not restricted by the same-origin policy. Therefore, the firmware version of the intranet device can be identified by loading the image file in the intranet device Web service. Figure 3 As shown, by inputting the path of the image resource, the image file in the intranet device Web service is loaded and then it is determined whether the image exists in the fine-grained fingerprint library of the intranet device, and the two-dimensional size of the image is obtained to distinguish different devices according to the feature (the size of the image file), that is, to identify the firmware version of the device.
[0049] (2) Using Javascript script feature identification: Obtain the summary values of variables and functions in the script when loading the Javascript script feature, and identify the firmware version of the intranet device to be tested from the intranet device fine-grained fingerprint library based on the obtained summary values of variables and functions in the script.
[0050] The script tag of HTML will not be restricted by the same-origin policy when loading Javascript scripts. After the page references the script, this embodiment determines the values of variables and function summaries (including function names, number of function parameters, etc.) in the script, and distinguishes different devices based on the features (variables, function summary values), that is, identifies the firmware version of the device.
[0051] In a specific application embodiment, Figure 4 As shown, the path and logic equation of the Javascript script are input. There is a function Capture in the define.js of the Javascript script, and the number of its parameters is 1, so Capture.length is 1; there is also a variable IPSEC_ENTRY, and its value is 1, so the equation IPSEC_ENTRY==1 returns 1 (True), and the judgment result of the equation is output.
[0052] (3) Using CSS file feature recognition: After the HTML tag references the CSS file, the current element style is determined to obtain the content in the CSS file. The firmware version of the intranet device to be tested is identified from the intranet device fine-grained fingerprint library based on the content in the CSS file.
[0053] CSS files can modify the styles of elements in the front-end page, and the HTML link tag can reference external CSS files without being restricted by the same-origin policy. After reference, this embodiment determines the impact of the CSS file on the current element style and indirectly determines the content of the CSS file to distinguish different devices, that is, to identify the firmware version of the device.
[0054] In a specific application embodiment, Figure 5As shown, the CSS style login.css sets the length and width of the element with class login_username. By inputting the CSS path, the HTML tag to be tested and the element style determination equation, the style of the current element can be determined, and the content in the CSS file can be obtained, and different devices can be distinguished based on the feature.
[0055] In this embodiment, the step of generating a firmware version fingerprint according to the features used for intranet device detection in step S3 includes:
[0056] S301. Summarize all features obtained from the Web service resource file and construct a feature list. All firmware versions and all features are used as columns and rows in the feature list, respectively. Each table content in the feature list is the value of each feature in different versions;
[0057] S302. Obtain the fingerprint of the target firmware version X, which is the minimum feature set, traverse all feature values and maintain a version list L to determine whether to add the firmware version to the version list L, until the generation of all firmware version fingerprints is completed. The version list L is the value range of the target firmware version X.
[0058] The feature list constructed in the specific application embodiment is as follows Figure 6 As shown. Figure 6 For example, the traversal process of step S302 specifically includes:
[0059] (1) If the initial content of version list L is all versions except target version X, when all versions in version list L have the same value on a certain target feature (such as Figure 6 In feature 1), the target feature is not added to the version fingerprint, that is, the content of the version list L remains unchanged and the traversal continues;
[0060] (2) If some versions in L have the same value as version X, but some are different, then only the versions with the same value as version X are retained in version list L (e.g. Figure 6 Only version 2 is retained, the current target feature is added to the fingerprint, and the traversal continues;
[0061] (3) When all versions in the version list L have different values from the target version X on a certain target feature (e.g. Figure 5 When the feature M is found, the current target feature is added to the fingerprint and the traversal is terminated.
[0062] This embodiment combines a multi-layer device fingerprint generation method to reduce the number of requests required for detection, solve the problems of long detection time due to the large number of intranet devices and limited detection time window, and the possibility of identification failure due to the user closing the browser, thereby effectively improving the efficiency and success rate of detection.
[0063] In a specific application embodiment, the pseudo code for implementing firmware version fingerprint traversal generation is as follows:
[0064]
[0065]
[0066] In this embodiment, step S3 also includes a device manufacturer fingerprint generation step, including: setting the initial value of the version list to the manufacturer information of all devices in the test set, and the feature list is a set of features common to all models of devices of the specified manufacturer. The manufacturer information of the intranet device can be identified through the device manufacturer fingerprint.
[0067] In this embodiment, step S3 also includes a model fingerprint generation step, including: the initial value of the version list is all models of the specified manufacturer in the test set, and the feature list is a set of features common to all versions of the specified model. The device model of the intranet device can be identified through the model fingerprint.
[0068] In step S3 of this embodiment, by generating the firmware version fingerprint, device manufacturer fingerprint and model fingerprint respectively in the above manner, the firmware version, manufacturer and model of the intranet device can be identified according to the corresponding fingerprints. The identification principles of various fingerprints are the same and will not be repeated here.
[0069] In this embodiment, after knowing the manufacturer, model and firmware version of the device, a query is performed in the vulnerability feature database in step S4. If there is a known vulnerability and the device model and firmware version range affected by it include the detected device, it is determined that there is a security vulnerability in the intranet device.
[0070] This embodiment also provides a computer-readable storage medium storing a computer program, and when the computer program is executed, the above method is implemented.
[0071] The present invention realizes multi-angle description of intranet device characteristics through a side-channel-based device identification method, which can bypass the limitations of the same-origin policy in the detection of intranet device firmware versions. At the same time, by combining a multi-layer device fingerprint generation method, the number of requests required for detection is reduced, which can solve the problems of long detection time due to the large number of intranet devices and limited detection time window, and the possibility of identification failure due to the user closing the browser, and can effectively improve the efficiency and success rate of detection.
[0072] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment, it is not intended to limit the present invention. Therefore, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A fine-grained method for detecting the firmware version of an intranet device, characterized in that the steps include: S1. Obtain public vulnerability information and store the device models and firmware version ranges affected by the vulnerability in the vulnerability feature database; S2. Obtain the device firmware image and decompress it to obtain a firmware image file database, extract the Web service resource file from the firmware image file database for analysis, and extract features for intranet device detection; S3. Generate a firmware version fingerprint based on the features used for intranet device detection to form a fine-grained fingerprint library for intranet devices; S4. Identify the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device, and determine whether there is a security vulnerability in the intranet device to be tested according to the vulnerability feature database; The step of generating a firmware version fingerprint according to the feature for detecting an intranet device in step S3 includes: S301. Summarize all features obtained from the Web service resource file and construct a feature list, where all firmware versions and all features are used as columns and rows in the feature list, respectively. Each table content in the feature list is the value of each feature in different versions; S302. Obtain the fingerprint of the target firmware version X, which is the minimum feature set, traverse all feature values and maintain a version list L to determine whether to add the firmware version to the version list L, until all firmware version fingerprints are generated, and the version list L is the value range of the target firmware version X; The step S302 includes: If the initial content of the version list L is all versions except the target version X, when all firmware versions in the version list L have the same value on a certain target feature, the target feature is not added to the firmware version fingerprint, that is, the content of the version list L remains unchanged and the traversal continues; If the values of some versions in the version list L are the same as the value of the target firmware version X, and some are different, only the firmware versions with the same value as the target firmware version X are retained in the version list L, and the corresponding features are added to the firmware version fingerprint, and the traversal continues; When all versions in the version list L have different values of the target feature from the target firmware version X, the target feature is added to the firmware version fingerprint, the traversal is terminated, and all firmware version fingerprints are generated.
2. The fine-grained intranet device firmware version detection method according to claim 1 is characterized in that: The features used for intranet device detection include image size features, Javascript script features, and Cascading Style Sheet (CSS) features of the intranet device.
3. The fine-grained intranet device firmware version detection method according to claim 2 is characterized in that: In step S4, identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device includes: obtaining a target image file in the Web service of the intranet device to be tested, determining whether the target image file exists in the fine-grained fingerprint library of the intranet device, and obtaining the size of the target image file, and identifying the firmware version of the intranet device to be tested according to the obtained size.
4. The fine-grained intranet device firmware version detection method according to claim 3 is characterized in that: The step S4 of identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device also includes: obtaining the variables and function summary values in the script when loading the Javascript script features, and identifying the firmware version of the intranet device to be tested from the fine-grained fingerprint library of the intranet device according to the variables and function summary values in the script, wherein the function summary value includes the function name and the number of function parameters.
5. The fine-grained intranet device firmware version detection method according to claim 4 is characterized in that: The step S4 of identifying the firmware version of the intranet device to be tested according to the fine-grained fingerprint library of the intranet device also includes: judging the current element style after the HTML tag references the CSS file, obtaining the content in the CSS file, and identifying the firmware version of the intranet device to be tested from the fine-grained fingerprint library of the intranet device according to the content in the obtained CSS file.
6. The fine-grained intranet device firmware version detection method according to any one of claims 1 to 5, characterized in that: The step S3 also includes a device manufacturer fingerprint generation step, including: setting the initial value of the version list to the manufacturer information of all devices in the test set, and the feature list to be a set of features common to all models of devices of the specified manufacturer.
7. The efficient and fine-grained method for detecting the firmware version of an intranet device according to any one of claims 1 to 5, characterized in that: The step S3 also includes a model fingerprint generation step, including: the initial value of the version list is all models of the specified manufacturer in the test set, and the feature list is a set of features common to all versions of the specified model.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, the method according to any one of claims 1 to 7 is implemented.
