Replay attack judgment method, Internet of Things device, electronic device and storage medium
By obtaining the time difference between the device and the server in the Internet of Things device for legality verification, the existing playback security verification methods have solved the problem of long processing time and large storage volume, and the rapid playback attack judgment is achieved.
Patent Information
- Application Number
- CN202110950587.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-08-18
AI Technical Summary
The existing replay security verification methods have a long processing time on IoT devices, a large number of server-side storage, and it is difficult to ensure the synchronization of client and server-side time in the global sweeper industry.
By obtaining the time difference between device time and server time, perform legality verification, avoid playback attacks, reduce server-side storage requirements, and use time difference verification to replace time synchronization.
It effectively shortens data processing time, reduces the dependence of hardware processing speed and memory capacity, and solves the storage problems in time areas in different regions.
Smart Images

Figure CN113612795B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of replay judgment technology, and in particular to a replay attack judgment method, an Internet of Things device, an electronic device, and a storage medium. Background Art
[0002] With the continuous development of the robot vacuum industry, sales and usage are increasing, and robot security is gaining increasing attention. While modern robot vacuums offer advanced security features for data transmission, such as traditional SSL asymmetric encryption and signature authentication to prevent data tampering, replay attacks remain a challenge.
[0003] The commonly used anti-replay attack method in the existing technology is to verify the signature of the transmitted data before transmission, and send the signature verification result identifier and the data to the server at the same time. The server identifies the requested data identifier and determines that the interval between the two requests exceeds a certain time (such as 1 minute). It considers that the subsequent data request may be a replay attack and refuses to process it.
[0004] However, this replay security verification method has the following problems in the IoT industry, especially in the global robot vacuum industry:
[0005] (1) The process of computing the requested data and generating the identification on the sweeper faces the problems of slow processing speed, long waiting time, and long time to generate the identification;
[0006] (2) The server needs to record the tag value of each request, which will result in a large amount of storage. Summary of the Invention
[0007] The present application provides a replay attack judgment method, an Internet of Things device, an electronic device, and a storage medium, which are used to solve the technical problems of the existing replay security verification method, such as long data processing time and large server-side storage volume.
[0008] This application provides a replay attack judgment method, which is applied to an Internet of Things device. The method includes the following steps:
[0009] When performing an initialization operation, obtaining a first device time and a first server time of a preset server;
[0010] Before interacting with the server, obtaining the time of the second device;
[0011] Calculating a first time difference between the first device time and the second device time;
[0012] Sending a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receiving a verification result returned by the server;
[0013] Determine whether the data request is a replay attack based on the verification result.
[0014] Optionally, the step of calculating a first time difference between the first device time and the second device time includes:
[0015] Determining whether the second device time is greater than the first device time;
[0016] When the second device time is greater than the first device time, a difference between the second device time and the first device time is calculated, and the sum of the difference and a preset value is used as a first time difference between the first device time and the second device time.
[0017] Optionally, it also includes:
[0018] When the second device time is less than or equal to the first device time, the initialization operation is triggered, and the process returns to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
[0019] Optionally, the step of performing legality verification includes:
[0020] The server obtains a second server time when the data request is received;
[0021] The server calculates a second time difference between the first server time and the second server time;
[0022] The server determines whether the second time difference is greater than the first time difference. If so, it is determined that the verification has failed; otherwise, it is determined that the verification has passed.
[0023] Optionally, the step of determining whether the data request is a replay attack according to the verification result includes:
[0024] When the verification result is a verification failure, determining that the data request is a replay attack, triggering the initialization operation, and returning to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed;
[0025] When the verification result is successful, it is determined that the data request is not a replay attack, and the processing result returned by the server in response to the data request is received.
[0026] This application also provides an Internet of Things device, including:
[0027] A first time acquisition module, configured to acquire a first device time and a first server time of a preset server when performing an initialization operation;
[0028] A second device time acquisition module, configured to acquire the second device time before interacting with the server;
[0029] A first time difference calculation module, configured to calculate a first time difference between the first device time and the second device time;
[0030] a legitimacy verification module, configured to send a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receive a verification result returned by the server;
[0031] A judgment module is used to judge whether the data request is a replay attack according to the verification result.
[0032] Optionally, the first time difference calculation module includes:
[0033] A first judgment submodule, configured to judge whether the second device time is greater than the first device time;
[0034] The first time difference calculation submodule is used to calculate the difference between the second device time and the first device time when the second device time is greater than the first device time, and use the sum of the difference and a preset value as the first time difference between the first device time and the second device time.
[0035] Optionally, it also includes:
[0036] The initialization submodule is used to trigger the initialization operation when the second device time is less than or equal to the first device time, and return to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
[0037] The present application also provides an electronic device, the device comprising a processor and a memory:
[0038] The memory is used to store program code and transmit the program code to the processor;
[0039] The processor is configured to execute any one of the above-mentioned replay attack determination methods according to the instructions in the program code.
[0040] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the replay attack determination method as described in any one of the above items.
[0041] From the above technical solutions, it can be seen that the present application has the following advantages: the replay verification of the IoT device of the present application is based on the first time difference, and the time verification of the server is based on the first server time and the first time difference of the server. There is no need to synchronize the client time with the server time by uploading the client time and comparing it with the server time, which solves the problem of large storage volume caused by the server side recording the tag value of each request in different regions and time zones. In addition, the data processed by the present application are all time data, with a small amount of data and little dependence on hardware processing speed and memory capacity, which effectively shortens the data processing time. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0043] Figure 1 A flowchart of a replay attack determination method provided in an embodiment of the present application;
[0044] Figure 2 A flowchart of a replay attack determination method provided in another embodiment of the present application;
[0045] Figure 3 A flowchart of a replay attack determination method provided in an embodiment of the present application;
[0046] Figure 4 This is a structural block diagram of an Internet of Things device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The embodiments of the present application provide a replay attack judgment method, an Internet of Things device, an electronic device, and a storage medium, which are used to solve the technical problems of the existing replay security verification method, such as the long data processing time and the need to maintain time synchronization between the server and the client.
[0048] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0049] After the protocol data on the sweeper device is intercepted, attackers often use replay to perform certain operations (i.e., replay attacks), causing losses to the device or user.
[0050] Replay attacks, also known as playback attacks or freshness attacks, occur when an attacker sends a packet that has already been received by the target server in order to deceive the system. These attacks are primarily used to compromise the authentication process and undermine its validity. Replay attacks can be carried out by the initiator or by an adversary that intercepts and retransmits the data. The basic principle of a replay attack is to retransmit previously intercepted data intact to the recipient. Often, data transmitted over networks is encrypted, making it impossible for an attacker to accurately interpret the data. However, if an attacker understands the purpose of the data, they can fool the interface by retransmitting it without knowing its content. For example, some systems may transmit authentication information with simple encryption. While an attacker cannot eavesdrop on the password, they can intercept the encrypted password and then replay it, effectively exploiting this vulnerability.
[0051] The commonly used anti-replay attack method in the existing technology is to verify the signature of the transmitted data before transmission, and send the signature verification result identifier and the data to the server at the same time. The server identifies the requested data identifier and determines that the interval between the two requests exceeds a certain time (such as 1 minute). It considers that the subsequent data request may be a replay attack and refuses to process it.
[0052] However, the inventors have found that this replay security verification method will have the following problems when applied to the Internet of Things industry, especially the global sweeper industry: (1) The hardware processor of the sweeper is often of low configuration and has a small memory (such as tens of KBit), but the amount of data to be transmitted is relatively large, such as the map data used for cleaning, which can sometimes reach hundreds of KBit or even thousands of KBit. The existing replay security verification method will face the problems of slow processing speed, long waiting time, and long time to generate identification when calculating the request data on the sweeper. (2) The server needs to record the label value of each request, which will result in a large amount of storage. For this problem, the commonly used optimization method is to keep the client time basically synchronized with the server time; then request to upload the client time at the same time; then compare the client time with the server time. If it is less than a certain set value, it is considered legal, otherwise it is considered illegal. However, although this method solves the problem of reducing the amount of data stored in the server-side identification record, it is difficult to ensure consistency in the time synchronization between the server and the client for users in different places and time zones around the world.
[0053] Therefore, a replay attack determination method, an Internet of Things device, an electronic device, and a storage medium as described in the following embodiments are proposed to solve the above-mentioned technical problems.
[0054] See also Figure 1 , Figure 1 A flowchart of the steps of a replay attack determination method provided in an embodiment of the present application.
[0055] This application provides a method for determining a replay attack, which is applied to IoT devices and may include the following steps:
[0056] Step 101, when performing an initialization operation, obtaining a first device time and a first server time of a preset server;
[0057] The Internet of Things (IoT) refers to the use of various devices and technologies, including information sensors, radio frequency identification (RFID), global positioning systems (GPS), infrared sensors, and laser scanners, to collect real-time data on any object or process that requires monitoring, connection, and interaction. This data includes acoustic, optical, thermal, electrical, mechanical, chemical, biological, and location information. Through various network connections, this allows for ubiquitous connectivity between objects and between objects and people, enabling intelligent perception, identification, and management of objects and processes. IoT devices include, but are not limited to, smart home appliances like sweepers and smart wearable devices like wristbands.
[0058] In an embodiment of the present application, when the IoT device performs an initialization operation, the current first device time of the IoT device and the first server time of the preset server can be obtained. The first device time and the first server time can be saved in the global memory for subsequent access and use.
[0059] It should be noted that, in the embodiment of the present application, the first device time of the IoT device and the second device time of the server may be different.
[0060] Step 102: Before exchanging data with the server, obtain the time of the second device;
[0061] In an embodiment of the present application, before the IoT device interacts with the server for data, it can obtain its own current second device time for subsequent determination of whether the time data of the IoT device is abnormal.
[0062] Step 103, calculating a first time difference between the first device time and the second device time;
[0063] In an embodiment of the present application, the IoT device can calculate a first time difference between two time collection behaviors based on the collected first device time and second device time, so as to verify whether its own time is disordered based on the first time difference.
[0064] Step 104: Sending a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receiving a verification result returned by the server;
[0065] After the IoT device verifies that its own time is reasonable, it can send a corresponding data request, the first time difference of the IoT device and the first server time of the server to the server when interacting with the server, so that the server can perform a legitimacy verification based on the obtained data request, first time difference and first server time, and receive the verification result of the legitimacy verification returned by the server.
[0066] Step 105: Determine whether the data request is a replay attack based on the verification result.
[0067] After obtaining the verification result returned by the server, the IoT device can determine whether the data request it issued is a replay attack based on the verification result, and adjust itself according to the verification result to avoid issuing a replay attack again.
[0068] The replay verification of the IoT device of this application is based on the first time difference, and the time verification of the server is based on the first server time and the first time difference of the server. There is no need to keep the client time synchronized with the server time by uploading the client time and comparing it with the server time, which solves the problem of large storage volume caused by the server side in different regions and time zones recording the label value of each request; in addition, the data processed by this application are all time data, with a small amount of data and little dependence on hardware processing speed and memory capacity, which effectively shortens the data processing time.
[0069] See also Figure 2 , Figure 2 This is a flowchart of a replay attack determination method provided in another embodiment of the present application. Specifically, the following steps may be included:
[0070] Step 201, when performing an initialization operation, obtaining a first device time and a first server time of a preset server;
[0071] Step 202: Before exchanging data with the server, obtain the time of the second device;
[0072] Steps 201-202 are the same as steps 101-102. For details, please refer to the description of steps 101-102, which will not be repeated here.
[0073] Step 203, determining whether the second device time is greater than the first device time;
[0074] In an embodiment of the present application, after obtaining the first device time and the second device time, the IoT device can compare the two time values to determine whether its own time is abnormal.
[0075] Step 204: When the second device time is greater than the first device time, calculate the difference between the second device time and the first device time, and add the difference and a preset value as the first time difference between the first device time and the second device time;
[0076] When the second device time is greater than the first device time, it indicates that the IoT device time is normal; at this time, the difference between the first device time and the second device time can be calculated, and then the difference is added to the preset time value to obtain the first time difference between the first device time and the second device time.
[0077] In an example, the first time difference can be calculated using the following formula:
[0078] T d =T2-T1+180;
[0079] Among them, T d is the first time difference, T2 is the second device time, and T1 is the first device time.
[0080] Furthermore, in the embodiment of the present application, it also includes:
[0081] When the second device time is less than or equal to the first device time, the initialization operation is triggered, and the process returns to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
[0082] In an embodiment of the present application, when the second device time is not greater than the first device time, it indicates that the IoT device time is abnormal, and the IoT device needs to be reinitialized.
[0083] Step 205: Sending a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receiving a verification result returned by the server;
[0084] After the IoT device verifies that its own time is reasonable, it can send a corresponding data request, the first time difference of the IoT device and the first server time of the server to the server when interacting with the server, so that the server can perform a legitimacy verification based on the obtained data request, first time difference and first server time, and receive the verification result of the legitimacy verification returned by the server.
[0085] In one example, the steps of performing the legality verification may include:
[0086] S11, the server obtains the second server time when the data request is received;
[0087] S12, the server calculates a second time difference between the first server time and the second server time;
[0088] S13, the server determines whether the second time difference is greater than the first time difference. If so, it is determined that the verification has failed; otherwise, it is determined that the verification has passed.
[0089] In an embodiment of the present application, after receiving the data request, the first time difference and the first server time, the server can obtain the second server time when the data request is received and calculate the second time difference between the first server time and the second server time.
[0090] The second time difference can be calculated using the following formula:
[0091] T s =nowTime-sysTime;
[0092] Among them, T s is the second time difference, nowTime is the second server time, and sysTime is the first server time.
[0093] After the second time difference is calculated, the legitimacy of the data request can be verified by comparing the first time difference with the second time difference.
[0094] Specifically, when T s ≤T d , the data request is considered legal and the verification is passed. s >T d , the data request is considered illegal and the verification fails.
[0095] Step 206: Determine whether the data request is a replay attack based on the verification result.
[0096] After obtaining the verification result returned by the server, the IoT device can determine whether the data request it issued is a replay attack based on the verification result, and adjust itself according to the verification result to avoid issuing a replay attack again.
[0097] In one example, the step of determining whether the data request is a replay attack based on the verification result may include:
[0098] S21, when the verification result is verification failure, determining that the data request is a replay attack, triggering the initialization operation, and returning to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed;
[0099] S22, when the verification result is successful, it is determined that the data request is not a replay attack, and the processing result returned by the server in response to the data request is received.
[0100] In the embodiment of the present application, if the verification result is a failure, the data request can be determined to be a replay attack. In this case, the IoT device receives an error code returned by the server and reinitializes. If the verification result is a success, it indicates that the data request is legitimate and there is no replay attack. In this case, the IoT device receives the processing result returned by the server in response to the data request.
[0101] The replay verification of the IoT device of this application is based on the first time difference, and the time verification of the server is based on the first server time and the first time difference of the server. There is no need to keep the client time synchronized with the server time by uploading the client time and comparing it with the server time, which solves the problem of large storage volume caused by the server side in different regions and time zones recording the label value of each request; in addition, the data processed by this application are all time data, with a small amount of data and little dependence on hardware processing speed and memory capacity, which effectively shortens the data processing time.
[0102] For ease of understanding, the embodiments of the present application are described below with specific examples:
[0103] See also Figure 3 , Figure 3 A flowchart of a replay attack determination method provided in an embodiment of the present application.
[0104] When an IoT device is initialized, it first obtains its own first device time and the first server time of the server and saves them in the global memory for subsequent access.
[0105] When the IoT device is ready to interact with the server, the IoT device obtains its current second device time, and then determines whether the second device time T2 is greater than the first device time T1. If not, it indicates that there is a problem with the current time of the IoT device and it needs to be reinitialized; if so, the first time difference between the first device time and the second device time is calculated.
[0106] When the IoT device makes a data upload request, it may upload the first time difference and the first server time to the server.
[0107] The server collects the second server time when the data request is received and calculates the second time difference between the first and second server times. It then determines whether the second time difference is less than or equal to the first time difference. If so, the request is considered legitimate. Otherwise, even if the data request passes various security authentications, it is considered invalid and a replay attack is possible. The server returns an error code to the IoT device, requiring the IoT device to initialize.
[0108] See also Figure 4 , Figure 4 This is a structural block diagram of an Internet of Things device provided in an embodiment of the present application.
[0109] The present invention provides an Internet of Things device, including:
[0110] A first time acquisition module 401 is configured to acquire a first device time and a first server time of a preset server when performing an initialization operation;
[0111] The second device time acquisition module 402 is used to acquire the second device time before interacting with the server;
[0112] A first time difference calculation module 403 is used to calculate a first time difference between the first device time and the second device time;
[0113] The validity verification module 404 is used to send a preset data request, a first time difference, and a first server time to the server for validity verification, and receive a verification result returned by the server;
[0114] The judgment module 405 is used to judge whether the data request is a replay attack according to the verification result.
[0115] In the embodiment of the present application, the first time difference calculation module 403 includes:
[0116] A first judgment submodule, configured to judge whether the second device time is greater than the first device time;
[0117] The first time difference calculation submodule is used to calculate the difference between the second device time and the first device time when the second device time is greater than the first device time, and use the sum of the difference and a preset value as the first time difference between the first device time and the second device time.
[0118] In the embodiment of the present application, it also includes:
[0119] The initialization submodule is used to trigger the initialization operation when the second device time is less than or equal to the first device time, and return to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
[0120] In this embodiment of the present application, the server includes the following modules:
[0121] A second server time acquisition module, used to acquire the second server time when the data request is received;
[0122] A second time difference calculation module, configured to calculate a second time difference between the first server time and the second server time;
[0123] The verification module is used to determine whether the second time difference is greater than the first time difference. If so, it is determined that the verification has failed; otherwise, it is determined that the verification has passed.
[0124] In the embodiment of the present application, the judgment module 405 includes:
[0125] When the verification result is a verification failure, determining that the data request is a replay attack, triggering the initialization operation, and returning to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed;
[0126] When the verification result is successful, it is determined that the data request is not a replay attack, and the processing result returned by the server in response to the data request is received.
[0127] An embodiment of the present application further provides an electronic device, the device including a processor and a memory:
[0128] The memory is used to store program codes and transmit the program codes to the processor;
[0129] The processor is used to execute the replay attack judgment method of the embodiment of the present application according to the instructions in the program code.
[0130] The embodiment of the present application further provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the replay attack determination method of the embodiment of the present application.
[0131] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0132] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0133] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0137] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0138] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0139] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A replay attack judgment method, characterized in that: Applied to IoT devices, the method comprises the following steps: When performing an initialization operation, obtaining a first device time and a first server time of a preset server; Before interacting with the server, obtaining the time of the second device; Calculating a first time difference between the first device time and the second device time; Sending a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receiving a verification result returned by the server; Determining whether the data request is a replay attack according to the verification result; The step of calculating the first time difference between the first device time and the second device time includes: Determining whether the second device time is greater than the first device time; When the second device time is greater than the first device time, calculating a difference between the second device time and the first device time, and taking the sum of the difference and a preset value as a first time difference between the first device time and the second device time; The step of performing the legality verification includes: The server obtains a second server time when the data request is received; The server calculates a second time difference between the first server time and the second server time; The server determines whether the second time difference is greater than the first time difference. If so, it is determined that the verification has failed; otherwise, it is determined that the verification has passed.
2. The method according to claim 1, characterized in that Also includes: When the second device time is less than or equal to the first device time, the initialization operation is triggered, and the process returns to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
3. The method according to claim 1, characterized in that The step of determining whether the data request is a replay attack according to the verification result includes: When the verification result is a verification failure, determining that the data request is a replay attack, triggering the initialization operation, and returning to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed; When the verification result is successful, it is determined that the data request is not a replay attack, and the processing result returned by the server in response to the data request is received.
4. An Internet of Things device, characterized in that: include: A first time acquisition module, configured to acquire a first device time and a first server time of a preset server when performing an initialization operation; A second device time acquisition module, configured to acquire the second device time before interacting with the server; A first time difference calculation module, configured to calculate a first time difference between the first device time and the second device time; a legitimacy verification module, configured to send a preset data request, the first time difference, and the first server time to the server for legitimacy verification, and receive a verification result returned by the server; A judgment module, configured to judge whether the data request is a replay attack according to the verification result; Wherein, the first time difference calculation module includes: A first judgment submodule, configured to judge whether the second device time is greater than the first device time; a first time difference calculation submodule, configured to calculate a difference between the second device time and the first device time when the second device time is greater than the first device time, and to use the sum of the difference and a preset value as a first time difference between the first device time and the second device time; The server includes the following modules: A second server time acquisition module, used to acquire the second server time when the data request is received; A second time difference calculation module, configured to calculate a second time difference between the first server time and the second server time; The verification module is used to determine whether the second time difference is greater than the first time difference. If so, it is determined that the verification has failed; otherwise, it is determined that the verification has passed.
5. The Internet of Things device according to claim 4, characterized in that Also includes: The initialization submodule is used to trigger the initialization operation when the second device time is less than or equal to the first device time, and return to the step of obtaining the first device time and the first server time of the preset server when the initialization operation is performed.
6. An electronic device, characterized in that: The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the replay attack determination method according to any one of claims 1 to 3 according to instructions in the program code.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store program code, and the program code is used to execute the replay attack determination method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Authentication method for preventing replay attack
CN102739659A
Replay attack prevention method based on function level timeout configuration
CN106713305A