A Method and System for Detecting Privacy Leaks in Smart Devices Based on Multi-Dimensional Traffic Analysis
By employing a multi-dimensional traffic analysis method, the system automates the detection of privacy leaks in smart devices, solving the problems of low detection efficiency and inaccurate results in existing technologies. This achieves fully automated and quantitative detection of privacy leaks in smart devices, improving both detection efficiency and accuracy.
Patent Information
- Application Number
- CN202611251602.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-17
Smart Images

Figure CN123122893A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of Internet of Things (IoT) security and privacy protection technology, and in particular to a method and system for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis. Background Technology
[0002] This invention belongs to the field of Internet of Things security and privacy protection technology, specifically relating to an automated detection method and system for privacy leakage risks during the operation of smart devices (including AI voice interactive toys, smart speakers, child companion robots, etc.).
[0003] With the convergence of artificial intelligence and Internet of Things (IoT) technologies, smart devices have become widespread in homes. These devices typically require a persistent connection to cloud servers to transmit data such as voice commands, device status, and user behavior logs. This data may contain highly sensitive information such as the names, ages, voiceprints, home addresses, and location trajectories of minors.
[0004] Currently, the industry's methods for detecting privacy leaks in smart devices are mainly divided into three categories: (1) Static code analysis: Reverse engineer the device firmware or mobile app and check whether there are API calls for transmitting sensitive information in plaintext in the code.
[0005] (2) Access and Policy Review: Analyze the system permissions requested by the device and the terms of data collection, storage and sharing in the user agreement.
[0006] (3) Penetration testing: Simulate an attacker, intercept communication data through a man-in-the-middle attack, and manually analyze whether there is any readable sensitive information.
[0007] Deficiencies and shortcomings of existing technologies (1) Limitations of static analysis: It cannot capture the dynamic behavior of the device in the real operating environment. The communication behavior of smart devices often depends on user interaction, and static analysis cannot traverse all possible execution paths.
[0008] (2) Limitations of penetration testing: It relies on testers to manually configure the packet capture environment and check the contents of each data packet, which is labor-intensive, has poor repeatability, and is subject to subjective bias.
[0009] (3) Lack of detection of silent listening behavior: Existing technology does not pay attention to the network communication mode of the device when there is no user interaction, and cannot identify whether the device continues to upload information without the user's knowledge.
[0010] (4) Data outbound detection relies on manual labor: checking the location of IP addresses requires manual querying, which is inefficient and easy to miss overseas IPs.
[0011] (5) Lack of quantitative standards for test results: Existing methods usually output qualitative conclusions, and different testers may draw different conclusions. Summary of the Invention
[0012] The purpose of this invention is to overcome the shortcomings of the prior art and propose a method and system for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis. This method achieves fully automated detection and can effectively identify the leakage of plaintext sensitive information, silent eavesdropping behavior, and data export risks of smart devices. The detection results are objective and quantifiable and support batch parallel detection of multiple devices.
[0013] The technical problem solved by this invention is achieved through the following technical solution: A method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis includes the following steps: Step S1: Place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, start the packet capture program to continuously capture the external network traffic generated by the device, and generate a packet capture file; Step S2: Read the packet capture file, strip the data link layer frame header, extract the network layer header information, perform the stream reassembly algorithm for the TCP protocol to splice the complete application layer data, and directly extract the payload content for the UDP protocol. At the same time, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set. Step S3: Filter the plaintext data stream from the metadata generated in step S2, perform application layer protocol parsing on the plaintext data stream to extract structured key-value pairs, match the extracted field names with the preset sensitive field library, and determine that sensitive information has been hit when the field name matches and the field value conforms to the sensitive data type format, and output the plaintext leakage detection result. Step S4: Filter candidate heartbeat packets from the metadata generated in step S2. Divide the time series into interactive periods and silent periods based on user interaction behavior. Calculate the time interval between adjacent packets for the candidate heartbeat packet sequences in the two periods. Calculate the dynamic baseline using the sliding window method. Compare the heartbeat interval at the current moment with the dynamic baseline to determine abnormal heartbeat points. When the proportion of abnormal heartbeat points exceeds a preset threshold, it is determined that there is a high-frequency heartbeat abnormality. Output the heartbeat analysis results. Step S5: Extract all destination IP addresses from the metadata generated in step S2, and at the same time parse the DNS query response messages to establish a domain name-IP mapping table. After filtering private IP addresses, query the IP geolocation database for public IP addresses, mark IPs whose geolocation codes are not equal to the local code as overseas IPs, perform multi-dimensional outbound behavior analysis on overseas traffic, and output the data outbound detection results. Step S6: Using the preset full score as the initial score, weighted deductions are made based on the number of sensitive information hit types output in Step S3, the heartbeat anomaly judgment results output in Step S4, the overseas IP statistics results output in Step S5, and the total number of unique IP addresses. The final risk score is calculated and the risk level is divided according to the preset level threshold. Step S7: Summarize all output results from steps S3 to S6, load the preset report template to populate the data, and generate an inspection report that includes a comprehensive score, risk level, inspection details for each dimension, and rectification suggestions.
[0014] Furthermore, the application layer protocol parsing in step S3 includes: for the HTTP protocol, parsing the request line and request headers, extracting the URI path, query parameters, and form data and JSON data in the request body; for the MQTT protocol, parsing the fixed headers and variable headers according to the MQTT protocol specification, and extracting the topic and message payload; for the CoAP protocol, parsing the CoAP header, and extracting the structured data in the URI path, query parameters, and message payload.
[0015] Furthermore, in step S3, the sensitive field library is stored in the form of a structured configuration file, which includes a field name pattern library and a field value type library. The field name pattern library stores field name patterns that may contain sensitive information, including field name patterns for identity, attribute information, device information, and voice content. The field value type library stores regular expression patterns for sensitive data value types. During matching, the field name is first matched precisely or fuzzily. After a successful match, the field value is then verified to see if it conforms to the corresponding sensitive data type format. If both conditions are met, it is determined that sensitive information has been hit.
[0016] Furthermore, the screening conditions for candidate heartbeat packets in step S4 include: the data packet length is less than a first preset threshold, the data packet direction is from the device end to the server end, the transport layer protocol is TCP or UDP, and the time interval between adjacent packets remains relatively stable after eliminating abnormal burst packets through variance analysis.
[0017] Furthermore, in step S4, the following analysis is performed on the candidate heartbeat packet sequences during the interactive and silent periods: the basic interval analysis calculates the time interval between adjacent candidate packets, filters out interval values with intervals less than a second preset threshold to form an interval set, and calculates the arithmetic mean and standard deviation of the set; the dynamic baseline calculation uses a sliding window method, selects N heartbeat interval values before the current time window to calculate the mean and standard deviation as the dynamic baseline; the anomaly determination compares the heartbeat interval at the current moment with the dynamic baseline, and if the deviation exceeds a third preset threshold, it is marked as an abnormal heartbeat point.
[0018] Furthermore, step S4 also includes content duplication detection and destination consistency analysis: calculate the similarity of adjacent candidate heartbeat packet loads; if the load content is highly similar or completely identical and the sending frequency is abnormal, the confidence of the silent monitoring judgment is enhanced; extract the destination IP address of the candidate heartbeat packet in the silent period and compare it with the destination IP address of the communication in the interaction period; if it is sent to different servers, it is marked as a suspicious silent communication destination.
[0019] Furthermore, the multi-dimensional outbound behavior analysis in step S5 includes: protocol type analysis, which statistically analyzes the transport layer and application layer protocols of communication corresponding to overseas IPs; content type inference, which infers the content type of unencrypted outbound traffic based on port number and load characteristics; time period distribution analysis, which statistically distributes outbound traffic by time period and detects continuous outbound traffic during quiet periods; and distributed transmission mode detection, which statistically analyzes the country-specific dispersion and organization-specific dispersion of overseas IPs. If multiple different countries or multiple different cloud service providers are involved, it is marked as a highly distributed outbound mode.
[0020] Furthermore, in step S6, the deduction value for plaintext sensitive information is the number of hit sensitive information types multiplied by the single-type deduction weight, and a deduction limit is set; the heartbeat abnormality deduction deducts a preset heartbeat abnormality deduction value when there is a high frequency heartbeat abnormality; the data outbound deduction deducts a preset data outbound deduction value when the number of overseas IPs is greater than zero; and the target IP quantity deduction deducts a preset excess deduction value when the total number of unique IP addresses exceeds a preset IP quantity threshold.
[0021] Furthermore, if a high-risk item is found during the detection process in step S7, a rectification suggestion text is automatically generated based on the type of deduction item; at the same time, a structured data file is output for import into a database or secondary analysis.
[0022] A detection system for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis includes: The packet capture module is used to place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, capture the external network traffic generated by the device, and generate packet capture files. The parsing module is used to read packet capture files, strip the data link layer frame header, extract network layer header information and transport layer port information, perform a stream reassembly algorithm to assemble complete application layer data for TCP protocol, directly extract the payload content for UDP protocol, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set. The sensitive information detection module is used to filter plaintext data streams from metadata, perform application layer protocol parsing on the plaintext data streams to extract structured key-value pairs, match the extracted field names with a preset sensitive field library, and determine that sensitive information has been hit when the field name matches and the field value conforms to the sensitive data type format, and output the plaintext leakage detection result. The heartbeat analysis module is used to filter candidate heartbeat packets from metadata, divide the time series into interactive periods and silent periods based on user interaction behavior, calculate the time interval between adjacent packets for candidate heartbeat packet sequences in the two periods, calculate the dynamic baseline using the sliding window method, compare the heartbeat interval at the current moment with the dynamic baseline to determine abnormal heartbeat points, and determine the presence of high-frequency heartbeat abnormalities when the proportion of abnormal heartbeat points exceeds a preset threshold, and output the heartbeat analysis results. The IP location query module is used to extract all destination IP addresses from metadata, parse DNS query response messages to establish a domain name-IP mapping table, filter private IP addresses and query the IP geolocation database for public IP addresses, mark IPs whose geolocation codes are not equal to the local code as overseas IPs, perform multi-dimensional outbound traffic behavior analysis, and output data outbound detection results. The scoring and reporting module is used to initially score based on a preset full score. It then applies weighted deductions based on the number of sensitive information hit types output by the sensitive information detection module, the heartbeat anomaly judgment results output by the heartbeat analysis module, the overseas IP statistics output by the IP location query module, and the total number of unique IP addresses. The module calculates the final risk score and classifies the risk level, and then loads all output results into a preset report template to generate a detection report containing a comprehensive score, risk level, detection details for each dimension, and rectification suggestions.
[0023] The advantages and positive effects of this invention are: 1. Fully automated process: This invention achieves seamless connection between steps through standardized data format. The entire process requires no manual intervention, ensuring the repeatability and objectivity of the test results.
[0024] 2. Three-dimensional parallel detection efficiency: Steps 3, 4, and 5 of this invention share the same metadata output from step 2, which can be executed in parallel, avoiding repeated parsing of data packets and improving detection efficiency.
[0025] 3. Objective Quantification Advantage: This invention uses a weighted deduction method to uniformly quantify the detection results of the three dimensions into a risk score of 0-100 points, and maps it to a risk level. Compared with the qualitative conclusions of traditional methods, the quantitative results of this invention support horizontal comparisons between devices.
[0026] 4. Creative technology transfer: Step 4 of this invention transfers the network performance indicator "heartbeat interval" to the field of "privacy risk assessment" for the first time. It determines silent eavesdropping behavior by quantifying time intervals, which is a cross-border application of non-obvious technical means.
[0027] 5. Protocol-level structured data recognition capability: This invention upgrades the process from simple string matching to structured data recognition by parsing application layer protocols such as HTTP, MQTT, and CoAP. By constructing a sensitive field library that includes a field name pattern library and a field value type library, it can automatically identify sensitive information that may be contained in protocol fields, significantly reducing the false alarm rate and improving detection accuracy.
[0028] 6. Dynamic anomaly detection capability based on statistical modeling: This invention upgrades heartbeat packet detection from traditional fixed threshold judgment to a statistical modeling-based anomaly detection method by introducing multi-dimensional features such as distinguishing between interactive and silent periods, dynamic baseline calculation using a sliding window, and packet content duplication detection. This method can effectively distinguish between normal keep-alive heartbeats and abnormal silent listening behavior, significantly improving the accuracy and robustness of detection.
[0029] 7. Multi-dimensional data outbound behavior profiling capability: This invention upgrades the single IP address attribution determination to a multi-dimensional outbound behavior profiling that includes DNS resolution association, protocol type analysis, content type inference, time period distribution analysis, and distributed transmission pattern detection. By establishing a domain name-IP mapping table, it can identify the service providers actually accessed by the device; through time period distribution analysis, it can discover data outbound behavior during quiet periods; and through dispersion detection, it can identify whether data is intentionally distributed and transmitted to multiple overseas destinations. Attached Figure Description
[0030] Figure 1 This is a flowchart of the overall method of the present invention.
[0031] Figure 2 This is a flowchart of the plaintext sensitive information detection sub-process of the present invention.
[0032] Figure 3 This is a flowchart of the heartbeat packet detection and silent monitoring analysis sub-process of the present invention.
[0033] Figure 4 This is a flowchart of the data export risk detection sub-process of the present invention.
[0034] Figure 5 This is a structural diagram of the system modules of the present invention. Detailed Implementation
[0035] The present invention will be further described in detail below with reference to the accompanying drawings.
[0036] A method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis, such as Figure 1 As shown, it includes the following steps: Step S1: Place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, start the packet capture program to continuously capture the external network traffic generated by the device, and generate packet capture files.
[0037] 1.1 Place the smart device under test in a controlled network environment.
[0038] 1.2 Establish a network monitoring channel. Use one of the following two methods: 1.2.1 Port Mirroring Method: Connect the device to a switch that supports port mirroring, and copy the uplink / downlink traffic to the network card of the testing host.
[0039] 1.2.2 Wi-Fi Hotspot Mode: The host detects the creation of a Wi-Fi hotspot, the device connects to the hotspot, and the host listens to the hotspot interface.
[0040] 1.3 Start the packet capture program, call the underlying network interface functions of the operating system, set the packet capture filter, and specify the packet capture duration parameter.
[0041] 1.4 During packet capture, the program continuously reads raw Ethernet frames from the network interface, adds a timestamp to each frame read, and writes it to local storage.
[0042] 1.5 Once the packet capture time reaches the preset value, stop packet capture, write all captured data packets to a file in standard format, and generate a packet capture file.
[0043] This step enables automated, long-cycle packet capture without human intervention, covering various device states such as standby, interactive, and hibernation, providing complete runtime data samples for subsequent analysis. This differs from manual packet capture in traditional penetration testing.
[0044] Step S2: Read the packet capture file, strip the data link layer frame header, extract the network layer header information, perform a stream reassembly algorithm for the TCP protocol to splice together the complete application layer data, and directly extract the payload content for the UDP protocol. At the same time, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set.
[0045] 2.1 Read the packet capture file generated in step 1, strip the frame headers according to the data link layer type, and obtain the network layer data packets.
[0046] 2.2 Extract network layer header information. For IPv4 or IPv6 packets, obtain the following fields: 2.2.1 Source IP Address 2.2.2 Destination IP Address 2.2.3 Transport Layer Protocol Types 2.3 If the transport layer protocol is TCP or UDP, further extraction is required: 2.3.1 Source Port Number 2.3.2 Destination Port Number 2.4 Extracting Payload Data: 2.4.1 For the TCP protocol, the stream reassembly algorithm is executed: sort by sequence number, handle out-of-order and retransmitted packets, and splice the payload fragments belonging to the same quintuple into complete application layer data.
[0047] 2.4.2 For the UDP protocol, directly extract the payload content.
[0048] 2.5 Extract the timestamp of each data packet, accurate to the microsecond level.
[0049] 2.6 Calculate the length of each data packet.
[0050] 2.7 Structure all extracted information into a record set. Each record contains: index number, source IP, destination IP, protocol type, source port, destination port, packet length, timestamp, and payload.
[0051] This step ensures payload integrity through TCP stream reassembly and unifies heterogeneous data into a standard format, allowing the subsequent three detection modules to share the same data source without repeated parsing. This "parse once, reuse many times" architecture improves overall detection efficiency.
[0052] Step S3: As Figure 2 As shown, the plaintext data stream is filtered from the metadata generated in step S2. The application layer protocol is parsed on the plaintext data stream to extract structured key-value pairs. The extracted field names are matched with the preset sensitive field library. When the field name matches and the field value conforms to the sensitive data type format, it is determined that sensitive information has been hit, and the plaintext leakage detection result is output.
[0053] 3.1 Construct a regular expression library for sensitive information. This library is stored in a structured configuration file format, and each rule contains: 3.1.1 Sensitive Information Type Identifier 3.1.2 Regular Expression Patterns 3.1.3 Deduction Weighting Value 3.2 Filter the plaintext transmitted data streams from the record set generated in step 2. The filtering criteria include: 3.2.1 The destination port is the preset plaintext protocol port. 3.2.2 The source port is the preset plaintext protocol port. 3.2.3 The payload content begins with a preset protocol characteristic string. 3.2.4 For application layer traffic identified as plaintext transmission, further determine the specific application layer protocol type based on the port number and protocol characteristics, and perform structured data extraction: For the HTTP protocol: For traffic originating from port 80 or with a load order starting with an HTTP method (GET, POST, PUT, etc.), parse the request line and headers to extract the URI path, request parameters (Query String), form data (application / x-www-form-urlencoded) and JSON data (application / json) from the request body. For JSON-formatted request bodies, recursively parse key-value pairs to extract all field names and their corresponding values.
[0054] For the MQTT protocol: For traffic on port 1883 or whose load begins with the MQTT control message format, parse the fixed and variable headers according to the MQTT protocol specification to extract the topic and payload. If the payload is in JSON or key-value format, further parse to extract structured fields.
[0055] For the CoAP protocol: For traffic on port 5683 or whose load begins with a CoAP message format, parse the CoAP header and extract the URI path, query parameters, and structured data from the message payload.
[0056] 3.2.5 A sensitive field library is pre-built and stored in the form of a configuration file, containing the following two types of information: Field name pattern library: Stores field name patterns that may contain sensitive information, including but not limited to: identity identifiers (name, username, nickname, user_id, uid, device_id, serial_number), attribute information (age, gender, birthday, location, address, phone, mobile, email), device information (SSID, MAC, IMEI, WiFi_SSID), and voice content (query, text, message, content, command).
[0057] Field value type library: Stores regular expression patterns for sensitive data value types (same as the original regular expression library, but serves as a supplementary validation for field value content).
[0058] 3.2.6 Automatic Identification Based on Field Database: The structured key-value pairs extracted in step 3.2.4 are traversed, and each field name is matched against the field name pattern in the sensitive field database (supporting both exact and fuzzy matching). If a match is successful, the field value is further verified to ensure it conforms to the corresponding sensitive data type format (e.g., phone number format, age range, etc.). When both the field name and field value meet the conditions, the sensitive information is determined to have been matched.
[0059] 3.2.7 For application-layer encrypted traffic (such as TLS / SSL) that cannot be decrypted, this step only detects plaintext traffic. However, in cases where encrypted traffic cannot be decrypted, this invention provides auxiliary judgment by detecting the TLS connection status: recording the validity period of the server certificate for each TLS connection; if the certificate has expired or is about to expire, it is marked in the report as "There may be a security risk in the encrypted channel." This auxiliary detection result is included in the comprehensive report as supplementary information but does not participate in the scoring of plaintext sensitive information.
[0060] 3.3 For each filtered record, convert the payload into a printable string.
[0061] 3.4 Load the rules from the regular expression library one by one and perform pattern matching on the converted strings.
[0062] 3.5 If a match is successful, record the following information: 3.5.1 Types of Sensitive Information Hit 3.5.2 First Hit Timestamp 3.5.3 Source IP address and destination IP address 3.6 Perform deduplication for the same sensitive information type: Within a complete packet capture cycle, only the first hit record of the same type is retained.
[0063] 3.7 Output plaintext leakage detection results.
[0064] This step, through protocol-level parsing and the introduction of a sensitive field library, upgrades the detection process from "string matching" to "structured data recognition," significantly improving detection accuracy and reducing false alarm rates. Simultaneously, by clearly defining the processing boundaries of encrypted traffic, the integrity and honesty of the technical solution are enhanced.
[0065] Step S4: As Figure 3As shown, candidate heartbeat packets are filtered from the metadata generated in step S2. The time series is divided into interactive periods and silent periods based on user interaction behavior. The time interval between adjacent packets is calculated for the candidate heartbeat packet sequences in the two periods. The dynamic baseline is calculated using the sliding window method. The heartbeat interval at the current moment is compared with the dynamic baseline to determine abnormal heartbeat points. When the proportion of abnormal heartbeat points exceeds the preset threshold, it is determined that there is a high-frequency heartbeat abnormality, and the heartbeat analysis results are output.
[0066] 4.1 Filter candidate heartbeat packets from the recordset generated in step 2. Filtering criteria include: 4.1.1 The data packet length is less than the first preset threshold (this threshold is preset based on the typical heartbeat packet size of IoT devices).
[0067] 4.1.2 The data packet direction is from the device to the server (determined by the network segment to which the source IP and destination IP belong).
[0068] 4.1.3 The transport layer protocol is TCP or UDP.
[0069] 4.1.4 The time interval between adjacent packets is relatively stable (abnormal burst packets are removed through analysis of variance).
[0070] 4.2 Sort the selected candidate packets in ascending order of timestamp, and divide the time series into two time periods based on user interaction behavior logs or voice activity detection results: 4.2.1 Interaction period: The time period during which user voice commands are detected or the device responds.
[0071] 4.2.2 Silent period: The period during which there is no user interaction or device-initiated output.
[0072] 4.3 Perform the following analysis on the candidate packet sequences during the interactive and silent periods respectively: 4.3.1 Basic Interval Analysis: Calculate the time interval Δt_i between adjacent candidate packets, filter out the interval values that are less than the second preset threshold, form the interval set S, and calculate the arithmetic mean μ and standard deviation σ of the set.
[0073] 4.3.2 Dynamic baseline calculation: Using the sliding window method, select N heartbeat interval values (N is a preset value, such as 100 samples) before the current time window, calculate their mean and standard deviation, and use them as the dynamic baseline at the current time.
[0074] 4.3.3 Anomaly Detection: The current heart rate interval is compared with the dynamic baseline. If the current interval deviates from the dynamic baseline by more than a third preset threshold (e.g., 3 times the standard deviation), it is marked as an abnormal heart rate point. When the proportion of abnormal heart rate points exceeds a preset proportion threshold (e.g., 10%), it is determined that there is a high-frequency heart rate abnormality in that time period.
[0075] 4.3.4 Packet Content Repetition Detection: Analyze the payload content of candidate heartbeat packets and calculate the similarity of payloads between adjacent heartbeat packets. If the payload content is highly similar or completely identical, and the transmission frequency is abnormal, the confidence level of the silent monitoring judgment is further enhanced.
[0076] 4.3.5 Destination Consistency Analysis: Extract the destination IP address of candidate heartbeat packets during the silent period and compare it with the destination IP address of communication during the interaction period. If the heartbeat packet during the silent period is sent to the same server as the one during the interaction period, it is determined to be a normal keep-alive heartbeat; if it is sent to a different server, it is marked in the report as "There is a suspicious silent communication destination".
[0077] 4.4 Comprehensive Judgment: 4.4.1 If the average heartbeat interval during the interaction period is less than the third preset threshold (e.g., 2 seconds), the system will prompt "Heartbeats are too frequent during the interaction period, which may indicate over-reporting".
[0078] 4.4.2 If the average heartbeat interval during the silent period is significantly less than that during the interactive period (e.g., the average heartbeat interval during the silent period is less than 50% of the average heartbeat interval during the interactive period), or if there are a large number of abnormal heartbeat points during the silent period, then it is determined that there is a "silent eavesdropping risk" and it is marked as a high-risk behavior.
[0079] 4.4.3 If the average heart rate interval during the silent period is within the normal range (e.g., greater than 5 seconds), then it is determined that there is no abnormality.
[0080] 4.5 Output heart rate analysis results, including: 4.5.1 The average interval values μ_interaction and μ_silent calculated for the interaction period and the silent period, respectively.
[0081] 4.5.2 Anomaly judgment criteria (yes / no) and anomaly level (high / medium / low).
[0082] 4.5.3 Results of package content repeatability detection and destination consistency analysis (optional).
[0083] This step upgrades heartbeat anomaly detection from a simple dual-threshold judgment to a comprehensive statistical modeling method by introducing multi-dimensional features such as interactive / silent period differentiation, dynamic baseline calculation, packet content duplication detection, and destination consistency analysis. This significantly improves the accuracy and robustness of detection and can effectively distinguish between normal keep-alive heartbeats and abnormal silent listening behavior.
[0084] Step S5: As Figure 4As shown, all destination IP addresses are extracted from the metadata generated in step S2. At the same time, the DNS query response messages are parsed to establish a domain name-IP mapping table. After filtering private IP addresses, the public IP addresses are queried from the IP geolocation database. IPs whose geolocation codes are not equal to the local code are marked as overseas IPs. Multi-dimensional outbound behavior analysis is performed on overseas traffic, and the data outbound detection results are output.
[0085] 5.1 Extract all destination IP addresses from the record set generated in step 2, and at the same time parse the DNS query response messages to extract the domain names that the device attempts to access and their corresponding resolved IP addresses, and establish a domain name-IP mapping table.
[0086] 5.2 Perform deduplication on the destination IP addresses to obtain a unique set of IP addresses.
[0087] 5.3 Filter private IP addresses. The range of private IP addresses includes: 5.3.1 10.0.0.0 / 8 network segment 5.3.2 172.16.0.0 / 12 network segment 5.3.3 192.168.0.0 / 16 network segment 5.3.4 127.0.0.0 / 8 loopback address 5.3.5 169.254.0.0 / 16 Link Local Address 5.4 For each public IP address, query the IP geolocation database to find its country or region code.
[0088] 5.5 Data Outbound Determination: 5.5.1 Compare the obtained geolocation code with the preset domestic code. If the geolocation code is not equal to the domestic code, mark the IP as an overseas IP.
[0089] 5.5.2 Record the overseas IP address and its country code.
[0090] 5.5.3 Look up the domain name corresponding to the IP address (if any) through the domain name-IP mapping table and record the domain name.
[0091] 5.6 Multi-dimensional analysis of outbound behavior: 5.6.1 Protocol Type Analysis: Statistically analyze the transport layer protocols (TCP / UDP) and application layer protocols (HTTPS, MQTT, CoAP, etc.) used for communication corresponding to overseas IPs to identify any outbound traffic using unconventional or high-risk protocols.
[0092] 5.6.2 Content Type Inference: For unencrypted outbound traffic (such as HTTP plaintext), the content type (such as device status reporting, log uploads, audio data, text commands, etc.) is inferred based on the port number and load characteristics. For encrypted traffic, only the encryption status is recorded, and no content inference is performed.
[0093] 5.6.3 Time Period Distribution Analysis: Statistically distribute outbound traffic by time period (e.g., hourly) to analyze whether there are traffic peaks in specific time periods, or whether there is still continuous outbound traffic during quiet periods (e.g., when equipment is on standby at night).
[0094] 5.6.4 Distributed Transmission Mode Detection: Statistically analyze the distribution characteristics of overseas IPs, and calculate the country-specific dispersion and organization-specific dispersion of overseas IPs. If overseas IPs involve multiple different countries or multiple different cloud service providers, they are marked as "highly distributed outbound transmission mode".
[0095] 5.7 Statistics on the number of overseas IPs, the number of different countries involved by overseas IPs, the number of data packets and traffic share of each country, and the analysis results of outbound behavior from various dimensions.
[0096] 5.8 Output data: Outbound detection results, including: 5.8.1 List of Overseas IPs (each IP and its country of origin, associated domain name) 5.8.2 Total number and country distribution of overseas IP addresses 5.8.3 Protocol Type Statistics 5.8.4 Content Type Distribution (Plaintext Only) 5.8.5 Time Period Distribution Analysis 5.8.6 Determining the Distributed Transmission Mode This step upgrades from a single geographical location determination to a multi-dimensional profile of outbound behavior, encompassing DNS resolution correlation, protocol analysis, content inference, time period analysis, and dispersion detection. By establishing a domain-IP mapping table, the service providers actually accessed by the device can be identified; through time period distribution analysis, data outflow behavior during quiet periods can be discovered; and through dispersion detection, it can be identified whether data is intentionally dispersed and transmitted to multiple overseas destinations.
[0097] Step S6: Using the preset full score as the initial score, weighted deductions are made based on the number of sensitive information hit types output in Step S3, the heartbeat anomaly judgment results output in Step S4, the overseas IP statistics results output in Step S5, and the total number of unique IP addresses. The final risk score is calculated, and the risk level is divided according to the preset level threshold.
[0098] 6.1 Set the initial score (preset maximum score).
[0099] 6.2 Deduction for Plaintext Sensitive Information: 6.2.1 Count the number of sensitive information types hit in step 3. 6.2.2 Calculate the deduction value = Number of hit types × Deduction weight for a single type, and set the upper limit for deduction. 6.2.3 Deduct this score from the initial score. 6.3 Deduction for abnormal heartbeat: 6.3.1 Read the heartbeat abnormality determination result from step 4. 6.3.2 If the judgment result indicates the presence of high-frequency heartbeat abnormality, then the preset heartbeat abnormality deduction value will be deducted. 6.4 Deduction for data export: 6.4.1 Read the overseas IP statistics results from step 5 6.4.2 If the number of overseas IP addresses is greater than zero, a preset data outbound deduction value will be deducted. 6.5 Deduction for the number of target IPs: 6.5.1 Count the total number of unique IP address sets in step 5. 6.5.2 If the total number exceeds the preset IP count threshold, a preset deduction value for excess will be deducted. 6.6 Calculate the final risk score: 6.6.1 Final score = Initial score - Sum of deductions 6.6.2 If the final score is less than zero, the value will be zero. 6.7 Risk levels are determined based on the final score: 6.7.1 If the final score is greater than or equal to the first-level threshold: it is judged as low risk. 6.7.2 If the final score falls between the first-level threshold and the second-level threshold: it is classified as medium risk. 6.7.3 If the final score is less than the second-level threshold: it is judged as high risk. 6.8 Output the risk score results.
[0100] This step quantifies the heterogeneous data (discrete events, continuous numerical values, and Boolean values) generated from the three dimensions into a comparable score using a weighted scoring method. This scoring method incorporates expertise in the field of privacy risks (such as the upper limit of penalties for sensitive information leakage and the weight of data leaving the country), and is not a simple application of mathematics, thus solving the quantitative challenge of multi-dimensional risk assessment.
[0101] Step S7: Summarize all output results from steps S3 to S6, load the preset report template to populate the data, and generate an inspection report that includes a comprehensive score, risk level, inspection details for each dimension, and rectification suggestions.
[0102] 7.1 Summarize all intermediate and final results from steps 3 to 6 and integrate them into a unified data structure.
[0103] 7.2 Load the preset report template. The template contains predefined placeholders for dynamically populating data.
[0104] 7.3 Perform data population: 7.3.1 Enter the comprehensive score and risk level from step 6 into the top area of the template. 7.3.2 Fill the plaintext sensitive information hit list from step 3 into the table area. 7.3.3 Fill the analysis area with the heart rate analysis results from step 4. 7.3.4 Fill in the geographical distribution area with the data exit detection results from step 5. 7.4 Generate the final test report file.
[0105] 7.5 It also outputs structured data files, which are convenient for subsequent import into the database or for secondary analysis.
[0106] 7.6 If high-risk items are found during the inspection process, a rectification suggestion text will be automatically generated.
[0107] This step enables fully automated report generation, eliminating the need for manual writing; rectification suggestions are automatically matched based on the type of deduction, guiding users to fix the problems.
[0108] like Figure 5 As shown, a detection system for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis includes: The packet capture module is used to place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, capture the external network traffic generated by the device, and generate packet capture files. The parsing module is used to read packet capture files, strip the data link layer frame header, extract network layer header information and transport layer port information, perform a stream reassembly algorithm to assemble complete application layer data for TCP protocol, directly extract the payload content for UDP protocol, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set. The sensitive information detection module is used to filter plaintext data streams from metadata, perform application layer protocol parsing on the plaintext data streams to extract structured key-value pairs, match the extracted field names with a preset sensitive field library, and determine that sensitive information has been hit when the field name matches and the field value conforms to the sensitive data type format, and output the plaintext leakage detection result. The heartbeat analysis module is used to filter candidate heartbeat packets from metadata, divide the time series into interactive periods and silent periods based on user interaction behavior, calculate the time interval between adjacent packets for candidate heartbeat packet sequences in the two periods, calculate the dynamic baseline using the sliding window method, compare the heartbeat interval at the current moment with the dynamic baseline to determine abnormal heartbeat points, and determine the presence of high-frequency heartbeat abnormalities when the proportion of abnormal heartbeat points exceeds a preset threshold, and output the heartbeat analysis results. The IP location query module is used to extract all destination IP addresses from metadata, parse DNS query response messages to establish a domain name-IP mapping table, filter private IP addresses and query the IP geolocation database for public IP addresses, mark IPs whose geolocation codes are not equal to the local code as overseas IPs, perform multi-dimensional outbound traffic behavior analysis, and output data outbound detection results. The scoring and reporting module is used to initially score based on a preset full score. It then applies weighted deductions based on the number of sensitive information hit types output by the sensitive information detection module, the heartbeat anomaly judgment results output by the heartbeat analysis module, the overseas IP statistics output by the IP location query module, and the total number of unique IP addresses. The module calculates the final risk score and classifies the risk level, and then loads all output results into a preset report template to generate a detection report containing a comprehensive score, risk level, detection details for each dimension, and rectification suggestions.
[0109] Based on the above-described method and system for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis, the effectiveness of the present invention is illustrated through the following embodiments.
[0110] Example 1: Privacy Leakage Detection of a Brand's AI Voice Interactive Toy This embodiment uses a certain brand of AI voice interactive toy (hereinafter referred to as "Toy A") as the test object. The toy has functions such as voice dialogue, nursery rhyme playback, and story telling. It supports Wi-Fi network connection and can interact with children through voice.
[0111] 1. Testing environment configuration Toy A was placed in a controlled network environment, and the detection host (equipped with a gigabit network card) established a connection with toy A via a Wi-Fi hotspot. The detection host's operating system was Ubuntu 20.04, configured with a Python 3.9 runtime environment and the privacy leakage detection system described in this invention. Before detection, it was confirmed that toy A was connected to the Wi-Fi hotspot created by the detection host and could access the Internet normally. The detection host monitored all data traffic on the hotspot interface through its network card.
[0112] 2. Packet capture (Step 1) Start the packet capture module and set the packet capture duration to 3600 seconds (1 hour). During the packet capture process, run an automated interaction script to send preset voice commands to toy A at random intervals (20-60 seconds), including "Hello," "Tell a story," "Sing a song," etc., to simulate a normal interaction scenario between a child and a toy.
[0113] After packet capture was completed, a total of 18,247 packets were captured and saved as the file capture_toyA.pcap.
[0114] 3. Metadata Extraction (Step 2) The parsing module reads the packet capture file and extracts the source IP, destination IP, payload, timestamp, and packet length for each data packet. Toy A's local IP address is 192.168.1.100, and its cloud server IPs include 34.120.8.12, 52.45.2.100, and 18.245.46.6. A total of 18,247 structured metadata records were extracted, containing complete application-layer data after TCP stream reassembly.
[0115] 4. Plaintext Sensitive Information Detection (Step 3) The sensitive information detection module loads a pre-configured regular expression library to scan plaintext traffic in the metadata. The detection results are as follows:
[0116] The test revealed that when Toy A communicated with the cloud server, it transmitted the device ID, user age, and name in plaintext via HTTP, but no plaintext transmission of geolocation information was found.
[0117] Innovative feature: This step enables fully automated regular expression scanning of plaintext traffic, eliminating the need for manual data packet retrieval and improving detection efficiency by more than 100 times compared to traditional manual methods.
[0118] 5. Heartbeat detection and silent monitoring analysis (Step 4) The heartbeat analysis module filters data packets shorter than 200 bytes and with a direction of "toy → server" from the metadata. A total of 1,247 candidate heartbeat packets were selected. After sorting by timestamp, the time interval between adjacent packets was calculated, and intervals less than 10 seconds were selected to obtain the interval set S. The arithmetic mean μ of S was calculated to be 0.38 seconds, which is less than the preset threshold of 2 seconds, indicating the presence of a high-frequency heartbeat anomaly.
[0119] Innovative Explanation: This step is the first to apply the network performance metric of "heartbeat interval" to the field of "privacy risk assessment," using an average interval of 0.38 seconds to quantify and determine whether the toy is engaging in silent background eavesdropping.
[0120] 6. Data Outbound Risk Detection (Step 5) The IP geolocation query module extracts all destination IP addresses, and after deduplication, obtains 17 unique IPs. After filtering private IPs, the IP geolocation database is queried one by one for each of the 12 public IPs. The detection results are as follows:
[0121] Four overseas IP addresses were detected, involving the United States and Germany. DNS resolution analysis showed that three of these IPs corresponded to domains belonging to the same cloud service provider. Protocol type analysis revealed that HTTPS was the primary mode of outbound traffic, accounting for approximately 85%. Time-of-use distribution analysis showed that about 70% of outbound traffic was concentrated during quiet periods when devices were not interacting (0:00 AM to 6:00 AM). Distributed transmission pattern detection indicated that data was being transmitted to nodes in the United States and Germany belonging to the same cloud service provider, suggesting a moderate risk of distributed outbound traffic.
[0122] 7. Comprehensive Privacy Risk Score (Step 6) The scoring module calculates a risk score based on the results of each test: Initial score: 100 points Points deduction for plaintext sensitive information: Points deducted for each of the following three categories (Device ID, Age, Name) with a maximum deduction of 40 points → 40 points deducted Deduction for abnormal heartbeat: High-frequency abnormal heartbeat → Deduct 20 points Data export penalty: 20 points deducted for the presence of an overseas IP address. Deduction based on the number of target IPs: 17 IPs > 10 → Deduct 10 points. Final score: 100 - 40 - 20 - 20 - 10 = 10 points, risk level determined as high risk.
[0123] 8. Test report generation (step 7) The report generation module summarizes all test results and outputs a test report in HTML format. The report includes: Inspection Summary: Toy A, Inspection Time, Total Data Packets: 18,247, Risk Score: 10 points Details of plaintext sensitive information: Plaintext transmission records of device ID, age, and name. Heart rate analysis results: The average interval is 0.38 seconds, indicating an abnormally high heart rate. Data outbound details: 4 overseas IP addresses, involving the United States and Germany. Suggestions for rectification: Change all sensitive information transmitted in plaintext (device ID, age, name) to encrypted transmission (e.g., use HTTPS instead of HTTP); Reduce the heartbeat packet sending frequency to more than 30 seconds to avoid silent background listening. Unless absolutely necessary, migrate overseas servers to China, or inform users in advance about data export and obtain their consent.
[0124] Example 2: Privacy Leakage Detection of a Certain Brand of Smart Speaker This embodiment uses a smart speaker of a certain brand (hereinafter referred to as "Speaker B") as the test object. This speaker supports functions such as voice control, music playback, and smart home control.
[0125] 1. Testing environment configuration Connect speaker B to the controlled network created by the testing host via Wi-Fi. The testing host configuration is the same as in Example 1. Before testing, confirm that speaker B is in normal working condition, can respond to voice commands, and can access the Internet.
[0126] 2. Packet capture (Step 1) The packet capture module was activated, and the capture duration was set to 7200 seconds (2 hours). During the capture process, the tester sent voice commands (such as "play music," "what's the weather like today," and "set alarm") to speaker B every 5-10 minutes, covering various working states of speaker B. After the capture was completed, a total of 45,832 data packets were captured.
[0127] 3. Metadata extraction and plaintext sensitive information detection (steps 2-3) After the parsing module extracts the metadata, the sensitive information detection module scans the plaintext traffic. The detection reveals that when speaker B communicates with the cloud server, some requests use the HTTP protocol to transmit the following information in plaintext: Device serial number (sn=SN2024001XXXX) The text-to-text conversion result of user voice commands (e.g., query=play music) The SSID of the Wi-Fi network where the speaker is located (SSID=Home_5G) No plaintext transmission of personal identification information such as name, age, or mobile phone number was found.
[0128] 4. Heartbeat detection and silent monitoring analysis (Step 4) The heartbeat analysis module filters data packets shorter than 150 bytes with a direction of "speaker → server" from the metadata. A total of 3,456 candidate heartbeat packets were selected. Analysis during interactive and silent periods revealed that the average interval between heartbeat packets was 0.95 seconds during the silent period, significantly shorter than the 3.2 seconds during the interactive period. Dynamic baseline analysis showed that abnormal heartbeat points accounted for 23% of the total. Packet content duplication detection revealed a high degree of consistency in heartbeat packet load, and destination consistency analysis indicated that the heartbeat packets were sent to the same server as during the interactive period. Based on these findings, a high-confidence risk of silent eavesdropping was identified.
[0129] Further analysis revealed that even when speaker B was in standby mode (without any voice command input), it continued to send heartbeat packets to the server at intervals of approximately 1 second, indicating that the speaker may be continuously monitoring in the background.
[0130] Innovation: This step distinguishes the heart rate between interactive and standby periods, enabling the identification of behaviors that continue to upload data even when there is no user interaction, which is something that traditional detection methods cannot detect.
[0131] 5. Data Outbound Risk Detection (Step 5) After extracting all destination IP addresses and removing duplicates, 23 unique IPs were obtained. After filtering out private IPs, the geographic location database was queried for the 19 public IPs, and the results are as follows:
[0132] Five overseas IP addresses were identified, involving the United States, Germany, and Japan, indicating a risk of data leakage abroad.
[0133] 6. Comprehensive Privacy Risk Score (Step 6) Initial score: 100 points Points deduction for plaintext sensitive information: 40 points deducted for containing two types of sensitive information (device serial number, Wi-Fi SSID). Deduction for abnormal heartbeat: High-frequency abnormal heartbeat (μ=0.95 seconds) → Deduct 20 points. Data export penalty: 20 points deducted for the presence of an overseas IP address. Deduction for the number of target IPs: 23 IPs > 10 → Deduct 10 points Final score: 100 - 40 - 20 - 20 - 10 = 10 points, risk level determined as high risk.
[0134] 7. Test report generation (step 7) The report generation module outputs a test report, highlighting the following high-risk items: Even in standby mode, it continues to send heartbeat packets at intervals of approximately 1 second, raising suspicions of background eavesdropping. Device serial numbers and Wi-Fi SSIDs are transmitted in plaintext and may be intercepted by man-in-the-middle attacks; Data is sent to servers located in the United States, Germany, Japan, and other overseas locations, posing a risk of data leaving the country.
[0135] Example 3: Multi-device batch parallel testing (comparative example) This embodiment demonstrates the application of the present invention in a multi-device batch detection scenario. It simultaneously performs privacy leakage detection on three smart devices of different brands and models to verify the parallel processing capability of the present invention and the comparability of the detection results.
[0136] 1. Testing environment configuration Three independent network interface cards (NICs) are configured on the testing host, each connected to one of the three devices under test (Device C, Device D, and Device E). Network traffic from each device is captured in parallel by three independent packet capture processes. A multi-threaded scheduling module is configured on the testing host to manage the execution of the three packet capture processes and the aggregation of metadata.
[0137] 2. Parallel packet capture (Step 1) Three packet capture processes are launched simultaneously, with a uniform capture duration of 3600 seconds. During the capture process, each of the three devices runs its own interactive script independently. After the capture is complete, each process generates its own independent packet capture file.
[0138] 3. Parallel parsing and detection (steps 2-5) Each parsing module reads the corresponding packet capture file in parallel, extracts metadata, and then performs plaintext sensitive information detection, heartbeat analysis, and data outbound detection. The detection results are summarized below:
[0139] 4. Overall Score and Horizontal Comparison (Steps 6-7) Each scoring module calculates a risk score separately:
[0140] The report generation module outputs a comparison report, which includes a horizontal comparison table and radar chart of the three devices, intuitively showing the differences in privacy risks of each device in different dimensions.
[0141] Innovation Description: This embodiment demonstrates the application effect of the present invention in a multi-device batch detection scenario. The detection results of the three devices can be compared horizontally, facilitating users to quickly identify high-risk devices. Specifically, the analysis of device D's outbound traffic further shows that its overseas traffic involves 5 IP addresses belonging to 3 different countries, and the time-period distribution analysis indicates that approximately 60% of the outbound traffic occurs during the device's standby period. The dispersed transmission mode detection is marked as "highly dispersed," and it is comprehensively judged as high-risk. Device E's average heartbeat interval is 12.5 seconds, not triggering the abnormal heartbeat threshold (2 seconds), and there is no risk of plaintext sensitive information or data leaving the country. Its comprehensive score is 100 points, classifying it as a low-risk device, verifying that the scoring system of the present invention can effectively distinguish devices with different security levels.
[0142] Explanation of the correspondence between various embodiments
[0143] It should be emphasized that the embodiments described in this invention are illustrative rather than limiting. Therefore, this invention includes, but is not limited to, the embodiments described in the specific implementation. Any other implementations derived by those skilled in the art based on the technical solutions of this invention are also within the scope of protection of this invention.
Claims
1. A method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis, characterized in that, Includes the following steps: Step S1: Place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, start the packet capture program to continuously capture the external network traffic generated by the device, and generate a packet capture file; Step S2: Read the packet capture file, strip the data link layer frame header, extract the network layer header information, perform the stream reassembly algorithm for the TCP protocol to splice the complete application layer data, and directly extract the payload content for the UDP protocol. At the same time, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set. Step S3: Filter the plaintext data stream from the metadata generated in step S2, perform application layer protocol parsing on the plaintext data stream to extract structured key-value pairs, match the extracted field names with the preset sensitive field library, and determine that sensitive information has been hit when the field name matches and the field value conforms to the sensitive data type format, and output the plaintext leakage detection result. Step S4: Filter candidate heartbeat packets from the metadata generated in step S2. Divide the time series into interactive periods and silent periods based on user interaction behavior. Calculate the time interval between adjacent packets for the candidate heartbeat packet sequences in the two periods. Calculate the dynamic baseline using the sliding window method. Compare the heartbeat interval at the current moment with the dynamic baseline to determine abnormal heartbeat points. When the proportion of abnormal heartbeat points exceeds a preset threshold, it is determined that there is a high-frequency heartbeat abnormality. Output the heartbeat analysis results. Step S5: Extract all destination IP addresses from the metadata generated in step S2, and at the same time parse the DNS query response messages to establish a domain name-IP mapping table. After filtering private IP addresses, query the IP geolocation database for public IP addresses, mark IPs whose geolocation codes are not equal to the local code as overseas IPs, perform multi-dimensional outbound behavior analysis on overseas traffic, and output the data outbound detection results. Step S6: Using the preset full score as the initial score, weighted deductions are made based on the number of sensitive information hit types output in Step S3, the heartbeat anomaly judgment results output in Step S4, the overseas IP statistics results output in Step S5, and the total number of unique IP addresses. The final risk score is calculated and the risk level is divided according to the preset level threshold. Step S7: Summarize all output results from steps S3 to S6, load the preset report template to populate the data, and generate an inspection report that includes a comprehensive score, risk level, inspection details for each dimension, and rectification suggestions.
2. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, The application layer protocol parsing in step S3 includes: for the HTTP protocol, parsing the request line and request header, extracting the URI path, query parameters, and form data and JSON data in the request body; for the MQTT protocol, parsing the fixed header and variable header according to the MQTT protocol specification, extracting the topic and message payload; for the CoAP protocol, parsing the CoAP header, extracting the URI path, query parameters, and structured data in the message payload.
3. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, In step S3, the sensitive field library is stored in the form of a structured configuration file, which includes a field name pattern library and a field value type library. The field name pattern library stores field name patterns that may contain sensitive information, including field name patterns for identity, attribute information, device information, and voice content. The field value type library stores regular expression patterns for sensitive data value types. During matching, the field name is first matched precisely or fuzzily. After a successful match, the field value is then verified to see if it conforms to the corresponding sensitive data type format. If both conditions are met, it is determined that sensitive information has been hit.
4. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, The screening criteria for candidate heartbeat packets in step S4 include: the data packet length is less than a first preset threshold, the data packet direction is from the device end to the server end, the transport layer protocol is TCP or UDP, and the time interval between adjacent packets remains relatively stable after eliminating abnormal burst packets through variance analysis.
5. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, In step S4, the following analysis is performed on the candidate heartbeat packet sequences during the interactive period and the silent period: the basic interval analysis calculates the time interval between adjacent candidate packets, filters out the interval values with intervals less than the second preset threshold to form an interval set, and calculates the arithmetic mean and standard deviation of the set; the dynamic baseline calculation adopts the sliding window method, selects the N heartbeat interval values before the current time window to calculate the mean and standard deviation as the dynamic baseline; The anomaly detection method compares the current heartbeat interval with the dynamic baseline. If the deviation exceeds the third preset threshold, it is marked as an abnormal heartbeat point.
6. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, Step S4 also includes content duplication detection and destination consistency analysis: calculate the similarity of adjacent candidate heartbeat packet loads. If the load content is highly similar or completely identical and the sending frequency is abnormal, the confidence level of the silent listening judgment is enhanced. Extract the destination IP address of candidate heartbeat packets during the silent period and compare it with the destination IP address of communication during the interactive period. If the packets are sent to different servers, they are marked as suspicious silent communication destinations.
7. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, The multi-dimensional outbound behavior analysis in step S5 includes: protocol type analysis, which statistically analyzes the transport layer and application layer protocols of communication corresponding to overseas IPs; content type inference, which infers the content type of unencrypted outbound traffic based on port number and load characteristics; time period distribution analysis, which statistically distributes outbound traffic by time period and detects continuous outbound traffic during quiet periods; and distributed transmission mode detection, which statistically analyzes the country-specific distribution and organization-specific distribution of overseas IPs. If multiple different countries or multiple different cloud service providers are involved, it is marked as a highly distributed outbound mode.
8. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, In step S6, the deduction value for plaintext sensitive information is the number of hit sensitive information types multiplied by the single type deduction weight, and a deduction limit is set. Heartbeat abnormality deduction: A preset heartbeat abnormality deduction value is deducted when there are high-frequency heartbeat abnormalities; Data outbound deduction: A preset data outbound deduction value is deducted when the number of overseas IPs is greater than zero; The target IP count deduction is applied when the total number of unique IP addresses exceeds a preset IP count threshold.
9. The method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis according to claim 1, characterized in that, If a high-risk item is found during the detection process in step S7, a rectification suggestion text is automatically generated based on the type of deduction item; at the same time, a structured data file is output for import into a database or secondary analysis.
10. A detection system for a method for detecting privacy leaks in smart devices based on multi-dimensional traffic analysis as described in any one of claims 1 to 9, characterized in that, include: The packet capture module is used to place the smart device under test in a controlled network environment, establish a network listening channel through port mirroring or Wi-Fi hotspot, capture the external network traffic generated by the device, and generate packet capture files. The parsing module is used to read packet capture files, strip the data link layer frame header, extract network layer header information and transport layer port information, perform a stream reassembly algorithm to assemble complete application layer data for TCP protocol, directly extract the payload content for UDP protocol, extract the timestamp and packet length of each data packet, and structure all the extracted information into a unified metadata record set. The sensitive information detection module is used to filter plaintext data streams from metadata, perform application layer protocol parsing on the plaintext data streams to extract structured key-value pairs, match the extracted field names with a preset sensitive field library, and determine that sensitive information has been hit when the field name matches and the field value conforms to the sensitive data type format, and output the plaintext leakage detection result. The heartbeat analysis module is used to filter candidate heartbeat packets from metadata, divide the time series into interactive periods and silent periods based on user interaction behavior, calculate the time interval between adjacent packets for candidate heartbeat packet sequences in the two periods, calculate the dynamic baseline using the sliding window method, compare the heartbeat interval at the current moment with the dynamic baseline to determine abnormal heartbeat points, and determine the presence of high-frequency heartbeat abnormalities when the proportion of abnormal heartbeat points exceeds a preset threshold, and output the heartbeat analysis results. The IP location query module is used to extract all destination IP addresses from metadata, parse DNS query response messages to establish a domain name-IP mapping table, filter private IP addresses and query the IP geolocation database for public IP addresses, mark IPs whose geolocation codes are not equal to the local code as overseas IPs, perform multi-dimensional outbound traffic behavior analysis, and output data outbound detection results. The scoring and reporting module is used to initially score based on a preset full score. It then applies weighted deductions based on the number of sensitive information hit types output by the sensitive information detection module, the heartbeat anomaly judgment results output by the heartbeat analysis module, the overseas IP statistics output by the IP location query module, and the total number of unique IP addresses. The module calculates the final risk score and classifies the risk level, and then loads all output results into a preset report template to generate a detection report containing a comprehensive score, risk level, detection details for each dimension, and rectification suggestions.
