WO2022116883A1 - 重放攻击检测方法、装置、设备和存储介质 - Google Patents

重放攻击检测方法、装置、设备和存储介质 Download PDF

Info

Publication number
WO2022116883A1
WO2022116883A1 PCT/CN2021/132904 CN2021132904W WO2022116883A1 WO 2022116883 A1 WO2022116883 A1 WO 2022116883A1 CN 2021132904 W CN2021132904 W CN 2021132904W WO 2022116883 A1 WO2022116883 A1 WO 2022116883A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
verification code
data
replay attack
shared key
Prior art date
Application number
PCT/CN2021/132904
Other languages
English (en)
French (fr)
Inventor
李岩
苏航
Original Assignee
百果园技术(新加坡)有限公司
李岩
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百果园技术(新加坡)有限公司, 李岩 filed Critical 百果园技术(新加坡)有限公司
Publication of WO2022116883A1 publication Critical patent/WO2022116883A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • H04L63/1416Event detection, e.g. attack signature detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0838Key agreement, i.e. key establishment technique in which a shared key is derived by parties as a function of information contributed by, or associated with, each of these
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps

Definitions

  • the embodiments of the present application relate to the computer field, and in particular, to a replay attack detection method, apparatus, device, and storage medium.
  • Replay attack is an attack behavior that communication entities in the network often face.
  • the attacker first conducts an eavesdropping attack on a target host, grabs the network data packets received by the target host, and then sends a historical data packet that has been received to the target host, trying to deceive the target host system and destroy the target.
  • Host security The attack often threatens some security-related protocol data of the target host, such as user login protocol, key exchange protocol, etc.
  • Existing methods for detecting replay attacks mainly include system time synchronization, digital signatures, and blockchain internal clocks.
  • the first detection method is based on the time synchronization of both parties in the communication, that is, the system time of the sender and the receiver is kept synchronized. If the time interval between two data packets exceeds a certain threshold, it is determined as a replay attack.
  • This kind of method has the risk that the attacker modifies the timestamp of the data packet and bypasses the replay detection mechanism; moreover, it is difficult to strictly synchronize the system time of the two communication parties in the network, and the time overhead of network time synchronization is large, which is difficult to achieve in reality. .
  • the second detection method is based on digital signatures, that is, the sender adds a digital signature to the data packet sent by the sender.
  • the digital signature of the packet is verified, and if the verification fails, it is considered a replay attack.
  • This type of method can effectively detect whether the data packet has been tampered with, but cannot directly detect whether the data packet has been replayed. In practice, the replay attack is likely to simply re-send the historical data packet without modifying the content of the data packet.
  • the signature of the historical data packet It can still be verified successfully.
  • the third detection method is based on the internal clock of the blockchain.
  • On a blockchain according to the internal clock of the block node, verify whether the candidate transaction timestamp in the recent time period is within the verification range compared with the internal clock. And whether the candidate transaction identifier is in the identifier database synchronized by the blockchain nodes, so as to achieve the goal of detecting and replaying transactions.
  • This type of method is mainly applied to the blockchain, relying on the internal time and node synchronization identification database of the block node of the blockchain, and is used in limited and specific scenarios.
  • the embodiments of the present invention provide a replay attack detection method, apparatus, device and storage medium, which can quickly and efficiently detect replay attacks and tampering attacks of network data packets with low system overhead.
  • an embodiment of the present invention provides a replay attack detection method, which includes:
  • Receive message data sent by the data sender where the message data includes a message body and an associated message verification code, and the message verification code is calculated by a secure message verification code function;
  • the comparison verification code of the message body is obtained by calculating the shared key through the secure message verification code function
  • comparison verification code is consistent with the message verification code, query whether there is a data record corresponding to the message verification code to determine whether the message data is a replay attack message.
  • an embodiment of the present invention also provides another method for detecting a replay attack, including:
  • the message data and the message verification code are assembled and sent to the data receiving end.
  • an embodiment of the present invention further provides a replay attack detection device, the device comprising:
  • a message receiving module configured to receive message data sent by the data sender, where the message data includes a message body and an associated message verification code, and the message verification code is calculated by a secure message verification code function;
  • a verification code calculation module configured to obtain the comparison verification code of the message body through the secure message verification code function using the shared key to calculate;
  • a query and determination module is configured to query whether there is a data record corresponding to the message verification code if the comparison verification code is consistent with the message verification code, so as to determine whether the message data is a replay attack message.
  • an embodiment of the present invention further provides another apparatus for detecting a replay attack, which includes:
  • the message acquisition module is used to acquire the message data to be sent and the stored shared key
  • a message processing module configured to calculate the hash value of the message data through a one-way hash function, and obtain a message verification code by calculating the shared key and the hash value through a secure message verification code function;
  • a message sending module configured to assemble the message data and the message verification code and send them to the data receiving end.
  • an embodiment of the present invention further provides a replay attack detection device, the device includes:
  • processors one or more processors
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the replay attack detection method according to the embodiment of the present invention.
  • embodiments of the present invention further provide a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute the replay attack detection method described in the embodiments of the present invention when executed by a computer processor .
  • the message data sent by the data sending end is received, and the message data includes a message body and an associated message verification code.
  • the function uses the shared key to calculate and obtains the comparison verification code of the message body. If the comparison verification code and the message verification code are consistent, query whether there is a data record corresponding to the message verification code to determine the Whether the message data is a replay attack message.
  • FIG. 1 is a flowchart of a method for detecting a replay attack according to an embodiment of the present invention
  • FIG. 2 is a flowchart of another replay attack detection method provided by an embodiment of the present invention.
  • FIG. 3 is a flowchart of another replay attack detection method provided by an embodiment of the present invention.
  • FIG. 4 is a flowchart of another replay attack detection method provided by an embodiment of the present invention.
  • 4a is a schematic diagram of deleting a timeout record in a data queue according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of another replay attack detection method provided by an embodiment of the present invention.
  • FIG. 6 is a structural block diagram of a replay attack detection device provided by an embodiment of the present invention.
  • FIG. 7 is a structural block diagram of another replay attack detection apparatus provided by an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a device according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for detecting a replay attack provided by an embodiment of the present invention. This embodiment is applicable to detecting a replay attack, and the method can be executed by a data receiving end computing device, and specifically includes the following steps:
  • Step S101 Receive message data sent by a data sending end, where the message data includes a message body and an associated message verification code.
  • the data sending end When sending the message data, the data sending end performs data processing on the message data to generate a message verification code associated with the message data, and sends the message after combining the message data and the corresponding message verification code.
  • the calculation method of the message verification code tag is as follows:
  • MAC is the function of the security message verification code
  • K MAC is the shared key stored at the data sending end
  • H(M) is the hash value obtained by calculating the message data M through a one-way hash function.
  • the one-way hash function can calculate the data of any length to generate L-byte fixed-length digest information B 0 B 1 B 2 ...B L-2 B L-1 , including MD5 output 16B digest, SHA1 output 20B digest, SHA256 output 32B digest, SHA512 output 64B digest, etc.
  • the data sender After generating the message verification code tag, the data sender assembles the tag and message data M to obtain message data ⁇ M, tag ⁇ for sending.
  • the data receiving end receives the message data ⁇ M, tag ⁇ .
  • Step S102 calculating the comparison verification code of the message body by using the security message verification code function with the shared key.
  • the shared key is stored at both the data sending end and the data receiving end.
  • it also includes the step of transmitting the shared key at the data sending end and the data receiving end. Specifically, a secure network transmission channel is established between the data sending end and the data receiving end, the data sending end sends a shared key, and the data receiving end receives and saves the shared key.
  • MAC secure message authentication code
  • the message verification code function is in the form of MAC(K,H(M)), which can calculate the input message data M of any length and the key K (usually 128/256/512 bits in length) to generate L-byte fixed-length integrity Label B 0 B 1 B 2 ...B L-2 B L-1
  • commonly used MAC algorithms include HMAC-MD5 output 16B label, HMAC-SHA1 output 20B label, HMAC-SHA256 output 32B label, HMAC-SHA512 output 64B label, etc. .
  • Step S103 If the comparison verification code is consistent with the message verification code, query whether there is a data record corresponding to the message verification code to determine whether the message data is a replay attack message.
  • the comparison verification code tag' After the comparison verification code tag' is calculated, it is determined whether the tag' and the tag are consistent. If the comparison is found to be inconsistent, the message data will be discarded and not processed. If the comparison finds that the two are consistent, check whether there is a record of the message verification code in the locally stored data. If it already exists, it is determined as a replay attack, otherwise it is determined as a normal data packet. Correspondingly, after it is determined to be a normal data packet, the message verification code is stored and recorded.
  • the transmitted message data includes the message body and the associated message verification code
  • the comparison verification code is calculated by using the shared key to perform tamper-proof verification of the message data.
  • the data record of the message verification code is used to determine whether the message data is a replay attack message.
  • This replay attack detection method does not depend on time synchronization, ensures data to prevent tampering, and can efficiently carry out replay attacks. This method is also limited to the blockchain scenario and has a higher degree of applicability.
  • FIG. 2 is a flowchart of another method for detecting a replay attack according to an embodiment of the present invention, and a time stamp mechanism is introduced and combined in the process of detecting a replay attack.
  • the technical solution is as follows:
  • Step S201 Receive message data sent by a data sending end, where the message data includes a message body and an associated message verification code.
  • Step S202 Determine the time stamp difference between receiving the message data and sending the message data.
  • Step S203 judging whether the time stamp difference is less than the preset time value, if so, go to step S204, otherwise go to step S205.
  • the preset time value is counted as T, and if ⁇ T>T, it is determined that the transmission is overtime, and step S205 is performed to discard the message data. If the time stamp difference is smaller than the preset time value, step S204 is performed.
  • Step S204 calculating the comparison verification code of the message body by using the security message verification code function with the shared key.
  • Step S205 discarding the message data.
  • Step S206 judging whether the message verification code and the comparison verification code are consistent, if so, go to step S207, otherwise go to step S205.
  • Step S207 query whether there is a data record corresponding to the message verification code, if yes, execute step S208 , otherwise execute step S205 .
  • Step S208 Store the message verification code.
  • the difference between the time stamps of receiving the message data and the time stamp of sending the message data is determined, and it is determined whether the time stamp difference is less than a preset time value, and if the time stamp difference is not less than the preset time value If the time value is set, the message data is discarded to eliminate abnormal data packets, which further improves and improves the replay attack detection mechanism.
  • FIG. 3 is a flowchart of another replay attack detection method provided by an embodiment of the present invention, in which a hash table storage structure is introduced. As shown in Figure 3, the technical solution is as follows:
  • Step S301 Receive message data sent by a data sending end, where the message data includes a message body and an associated message verification code.
  • Step S302 calculating the comparison verification code of the message body by using the security message verification code function with the shared key.
  • Step S303 if the comparison verification code is consistent with the message verification code, search the stored hash table to see if there is a key value corresponding to the message verification code, and if so, determine that it is a replay attack message .
  • the hash table is a data structure that directly accesses and stores the data value (Value) according to the key value (Key value). It maps the Keyvalue to a location in the table, and records the access to the stored data value Value to speed up the search.
  • FIG. 4 is a flowchart of another method for detecting a replay attack provided by an embodiment of the present invention, and a method for detecting a replay attack that reduces system overhead is provided.
  • the message verification code and the data of the message data are received
  • the timestamps are stored in the hash table in association with each other, and at the same time, the message verification code and the receiving timestamp are inserted into the cache queue, and the queue head of the cache queue is scanned every preset time.
  • the data elements corresponding to the tuples to be deleted are deleted from the hash table, and the tuples to be deleted are deleted from the cache queue at the same time.
  • the technical solution is as follows:
  • Step S401 Receive message data sent by a data sending end, where the message data includes a message body and an associated message verification code.
  • Step S402 Determine the time stamp difference between receiving the message data and sending the message data.
  • Step S403 judging whether the time stamp difference is less than the preset time value, if so, go to step S404 , otherwise go to step S405 .
  • Step S404 calculating the comparison verification code of the message body by using the security message verification code function with the shared key.
  • Step S405 discarding the message data.
  • Step S406 determine whether the message verification code and the comparison verification code are consistent, if so, go to step S407, otherwise go to step S405.
  • Step S407 query whether there is a data record corresponding to the message verification code, if yes, execute step S408, otherwise execute step S405.
  • Step S408 storing the message verification code and the data receiving timestamp of the message data in the hash table in association with each other.
  • Step S409 insert the message verification code and the receiving time stamp into the cache queue, scan the queue head of the cache queue every preset time, take out the tuples to be deleted that exceed the preset difference time, and The data elements corresponding to the to-be-deleted tuple are deleted from the hash table, and the to-be-deleted tuple is also deleted from the cache queue.
  • FIG. 4a is a schematic diagram of deleting a timeout record in a data queue according to an embodiment of the present invention.
  • the data receiving end sets a cache time window w and a deletion operation time interval N as the preset time.
  • a data cleaning operation is performed every N minutes. Specifically, scanning is performed from the head of the cache queue, and the to-be-deleted tuples e 1 , e 2 , . . According to e 1 .tag, e 2 .tag,..., delete the elements of the corresponding key from the hash table HashTable, and delete these tuples from the cache queue Queue.
  • the cache time window is determined according to the maximum time difference value set by the system, and the preset time is set according to the maximum tolerated system overhead.
  • FIG. 5 is a flowchart of another replay attack detection method provided by an embodiment of the present invention. This embodiment is applicable to the detection of replay attacks, and the method can be executed by a data sending end computing device, and specifically includes the following steps :
  • Step S501 Acquire the message data to be sent and the stored shared key.
  • the shared key is also stored correspondingly at the data receiving end.
  • Step S502 Calculate the hash value of the message data through a one-way hash function, and obtain a message verification code by calculating the shared key and the hash value through a secure message verification code function.
  • the standard secure one-way hash function can calculate any length of data to generate L-byte fixed-length digest information B 0 B 1 B 2 ... B L-2 B L-1 , including MD5 output 16B digest, SHA1 output 20B digest , SHA256 output 32B digest, SHA512 output 64B digest, etc.
  • the data sender when sending message data, the data sender performs data processing on the message data to generate a message verification code associated with the message data, and sends the message data and the corresponding message verification code after combining the message data.
  • the calculation method of the message verification code tag is as follows:
  • Step S503 Assemble the message data and the message verification code and send them to the data receiving end.
  • the tag is assembled with the message data M to obtain message data ⁇ M, tag ⁇ for sending.
  • the data receiving end When the data receiving end receives the message data ⁇ M, tag ⁇ , it calculates the comparison verification code of the message body through the secure message verification code function using the shared key; if the comparison verification code and the message If the verification codes are consistent, query whether there is a data record corresponding to the message verification code to determine whether the message data is a replay attack message.
  • the hash value of the message data is calculated by a one-way hash function, and the shared key, the The hash value is calculated to obtain a message verification code, the message data and the message verification code are assembled and sent to the data receiving end, and the retransmission detection mechanism is constructed by using the irreversibility of the calculation of the one-way hash function.
  • the transmission of data security and anti-replay attack is not limited to:
  • FIG. 6 is a structural block diagram of a replay attack detection apparatus provided by an embodiment of the present invention.
  • the apparatus is configured to execute the replay attack detection method provided by the data receiving end embodiment, and has corresponding functional modules and beneficial effects of the execution method.
  • the device specifically includes: a message receiving module 101, a verification code calculation module 102, and a query determination module 103, wherein,
  • a message receiving module 101 configured to receive message data sent by a data sending end, where the message data includes a message body and an associated message verification code, and the message verification code is calculated by a secure message verification code function;
  • the verification code calculation module 102 is used to obtain the comparison verification code of the message body by using the shared key calculation through the security message verification code function;
  • the query determination module 103 is configured to query whether there is a data record corresponding to the message verification code if the comparison verification code is consistent with the message verification code, so as to determine whether the message data is a replay attack message.
  • the message data sent by the data sending end is received, and the message data includes a message body and an associated message verification code.
  • the comparison verification code of the message body is calculated by using the shared key. If the comparison verification code and the message verification code are consistent, query whether there is a data record corresponding to the message verification code to determine the Whether the message data is a replay attack message.
  • it also includes a timestamp processing module 104, configured to obtain the comparison verification code of the message body through the secure message verification code function using the shared key to calculate:
  • the verification code calculation module 102 is specifically used for:
  • the comparison verification code of the message body is obtained by calculating the shared key through the secure message verification code function.
  • the timestamp processing module 104 is further configured to:
  • the message data is discarded.
  • the verification code calculation module 102 is further configured to:
  • the message data is discarded.
  • the query determination module 103 is specifically configured to:
  • a data storage module 105 which is specifically used for:
  • the message data is determined to be a normal data packet, and the message verification code and the data receiving timestamp of the message data are associated and stored into the hash table.
  • a queue processing module 106 is further included, configured to associate and store the message verification code and the data receiving timestamp of the message data in the hash table:
  • Every preset time is scanned from the head of the cache queue, and the tuples to be deleted that exceed the preset difference time are taken out, and the data elements corresponding to the tuples to be deleted are deleted in the hash table.
  • the to-be-deleted tuple is deleted from the cache queue.
  • the cache time window is determined according to a maximum time difference value set by the system, and the preset time is set according to a maximum tolerated system overhead.
  • a key transmission module 107 is further included, configured to establish a secure network transmission channel with the data end before receiving the message data sent by the data sending end, and transmit the shared key through the secure network transmission to the data sender.
  • FIG. 7 is a structural block diagram of another replay attack detection apparatus provided by an embodiment of the present invention.
  • the apparatus is used to execute the replay attack detection method provided by the above data sending end embodiment, and has corresponding functional modules and beneficial effects of the execution method.
  • the device specifically includes: a message acquisition module 301, a message processing module 302 and a message sending module 303, wherein,
  • a message acquisition module 301 configured to acquire the message data to be sent and the stored shared key
  • a message processing module 302 configured to calculate the hash value of the message data through a one-way hash function, and obtain a message verification code by calculating the shared key and the hash value through a secure message verification code function;
  • the message sending module 303 is configured to assemble the message data and the message verification code and send them to the data receiving end.
  • the hash value of the message data is calculated by a one-way hash function, and the shared key and all the shared keys are verified by a secure message verification code function.
  • the hash value is calculated to obtain a message verification code, the message data and the message verification code are assembled and sent to the data receiving end, and the retransmission detection mechanism is constructed by using the irreversibility of the calculation of the one-way hash function, It realizes the transmission of data security and anti-replay attack.
  • FIG. 8 is a schematic structural diagram of a replay attack detection device provided by an embodiment of the present invention.
  • the device includes a processor 201, a memory 202, an input device 203, and an output device 204;
  • the number can be one or more.
  • a processor 201 is used as an example; the processor 201, the memory 202, the input device 203 and the output device 204 in the device can be connected by a bus or in other ways. Connect as an example.
  • the memory 202 may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the replay attack detection method in the embodiment of the present invention.
  • the processor 201 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 202, that is, the above-mentioned replay attack detection method is implemented.
  • the input device 203 may be used to receive input numerical or character information, and to generate key signal input related to user settings and function control of the device.
  • the output device 204 may include a display device such as a display screen.
  • Embodiments of the present invention further provide a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute a replay attack detection method when executed by a computer processor, and the method includes:
  • Receive message data sent by the data sender where the message data includes a message body and an associated message verification code, and the message verification code is calculated by a secure message verification code function;
  • the comparison verification code of the message body is obtained by calculating the shared key through the secure message verification code function
  • comparison verification code is consistent with the message verification code, query whether there is a data record corresponding to the message verification code to determine whether the message data is a replay attack message.
  • Embodiments of the present invention further provide another storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute a replay attack detection method when executed by a computer processor, and the method includes:
  • the message data and the message verification code are assembled and sent to the data receiving end.
  • the embodiments of the present invention can be implemented by software and necessary general-purpose hardware, and of course can also be implemented by hardware, but in many cases the former is better implementation.
  • the technical solutions of the embodiments of the present invention may be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products may be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including several instructions to make a computer device (which can be A personal computer, a service, or a network device, etc.) executes the methods described in the various embodiments of the embodiments of the present invention.
  • the units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; , the specific names of the functional units are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明实施例公开了一种重放攻击检测方法、装置、设备和存储介质,该方法包括:接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。本方案,能够以较低的系统开销,快速高效的检测网络数据包的重放攻击和篡改攻击行为。

Description

重放攻击检测方法、装置、设备和存储介质
本申请要求在2020年12月05日提交中国专利局,申请号为202011404609.7的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及计算机领域,尤其涉及一种重放攻击检测方法、装置、设备和存储介质。
背景技术
重放攻击是网络中通信实体常常面临的一种攻击行为。在重放攻击中,攻击者首先针对一个目标主机进行窃听攻击,并抓取目标主机接收的网络数据包,然后向目标主机发送一个已经接收过的历史数据包,试图欺骗目标主机系统,破坏目标主机安全。该攻击往往威胁目标主机的一些安全相关协议数据,例如用户登录协议、密钥交换协议等。
现有检测重放攻击的方法,主要包括基于系统时间同步、基于数字签名、基于区块链内部时钟。
第一种检测方法是基于通信双方时间同步,即发送方和接收方系统时间保持同步一致,如果发送方数据包中的时间戳与接收方的系统时间差别超过一定阈值,或者接收方先后收到两个数据包的时间间隔超过一定阈值,则判定为重放攻击。该类方法存在被攻击者修改数据包时间戳,绕过重放检测机制的风险;而且,网络中通信双方的系统时间严格同步比较困难,且网络时间同步的时间开销较大,现实中难以实现。
第二种检测方法是基于数字签名,即发送方在发送的数据包中,加入对数据包的数字签名,接收方在收到数据包时,使用发送方预先共享的验签密钥,对数据包的数字签名进行校验,如果校验失败,则认为是重放攻击。该类方法可以有效检测数据包是否被篡改,而无法直接检测数据包是否被重放,实际中重放攻击很可能不修改数据包内容而直接简单重发历史数据包,该历史数据包的签名仍然可以验证成功。
第三种检测方法是基于区块链内部时钟,在一个区块链上,根据区块节点的内部时钟,验证最近时间段内的候选交易时间戳与内部时钟相比,是否在验证范围内,且候选交易标识是否在区块链节点同步的标识数据库中,以达到检测重放交易的目标。该类方法主要应用于区块链,依赖于区块链的区块节点内部时和节点同步标识数据库,使用于有限的、特定的场景。
发明内容
本发明实施例提供了一种重放攻击检测方法、装置、设备和存储介质,能够以较低的系统开销,快速高效的检测网络数据包的重放攻击和篡改攻击行为。
第一方面,本发明实施例提供了一种重放攻击检测方法,该方法包括:
接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;
如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
第二方面,本发明实施例还提供了另一种重放攻击检测方法,包括:
获取待发送的消息数据,以及存储的共享密钥;
通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
第三方面,本发明实施例还提供了一种重放攻击检测装置,该装置包括:
消息接收模块,用以接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
验证码计算模块,用于通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;
查询确定模块,用于如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放 攻击消息。
第四方面,本发明实施例还提供了另一种重放攻击检测装置,该装置包括:
消息获取模块,用于获取待发送的消息数据,以及存储的共享密钥;
消息处理模块,用于通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
消息发送模块,用于将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
第五方面,本发明实施例还提供了一种重放攻击检测设备,该设备包括:
一个或多个处理器;
存储装置,用于存储一个或多个程序,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明实施例所述的重放攻击检测方法。
第六方面,本发明实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行本发明实施例所述的重放攻击检测方法。
本发明实施例中,接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到,通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码,如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
附图说明
图1为本发明实施例提供的一种重放攻击检测方法的流程图;
图2为本发明实施例提供的另一种重放攻击检测方法的流程图;
图3为本发明实施例提供的另一种重放攻击检测方法的流程图;
图4为本发明实施例提供的另一种重放攻击检测方法的流程图;
图4a为本发明实施例提供的在数据队列中删除超时记录的示意图;
图5为本发明实施例提供的另一种重放攻击检测方法的流程图;
图6为本发明实施例提供的一种重放攻击检测装置的结构框图;
图7为本发明实施例提供的另一种重放攻击检测装置的结构框图;
图8为本发明实施例提供的一种设备的结构示意图。
具体实施方式
下面结合附图和实施例对本发明实施例作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明实施例,而非对本发明实施例的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明实施例相关的部分而非全部结构。
图1为本发明实施例提供的一种重放攻击检测方法的流程图,本实施例可适用于对重放攻击进行检测,该方法可以由数据接收端计算设备来执行,具体包括如下步骤:
步骤S101、接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码。
数据发送端在发送消息数据时,对该消息数据进行数据处理以生成和该消息数据关联的消息验证码,将消息数据以及对应的消息验证码组合后进行发出。示例性的,以消息主体M为例,消息验证码tag的计算方式如下:
tag=MAC(K MAC,H(M))
其中,MAC为安全消息验证码函数,K MAC为在数据发送端存储的共享密钥,H(M)为通过单向散列函数对消息数据M进行计算得到的散列值。其中,单向散列函数可将任意长度数据计算生成L字节固定长度摘要信息B 0B 1B 2…B L-2B L-1,包括MD5输出16B摘要、SHA1输出20B摘要、SHA256输出32B摘要、SHA512输出64B摘要等。数据发送端在生成消息验证码tag后,将该tag与消息数据M进行组装后得到消息数据{M,tag}进行发送。相应的,数据接收端即接收到消息数据{M,tag}。
步骤S102、通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
其中,共享密钥在数据发送端和数据接收端均进行存储。
在一个实施例中,还包括在数据发送端和数据接收端进行共享密钥传输的步骤。具体的,在数据发送端和数据接收端建立安全网络传输通道,数据发送 端发送共享密钥,数据接收端接收并保存该共享密钥。
在接收到消息数据后,通过安全消息验证码函数利用存储的共享密钥对消息数据中的消息主体进行计算,得到比对验证码:
tag'=MAC(K MAC,H(M))
在密码学中,安全消息验证码(MAC)为通讯双方使用的完整性校验工具,是基于密钥和单向散列函数所获得的一个固定长度值。消息验证码函数形式为MAC(K,H(M)),即可将输入的任意长度消息数据M和密钥K(长度通常为128/256/512比特)计算生成L字节固定长度完整性标签B 0B 1B 2…B L-2B L-1,常用的MAC算法包括HMAC-MD5输出16B标签、HMAC-SHA1输出20B标签、HMAC-SHA256输出32B标签、HMAC-SHA512输出64B标签等。
步骤S103、如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
在计算出比对验证码tag’后,确定tag’和tag是否一致,如果比对发现二者不一致,则将该消息数据丢弃,不做处理。如果比对发现二者一致,则在本地存储的数据中查询是否有该消息验证码的记录,如果已经存在,则判定为重放攻击,否则判定为正常数据包。相应的,在确定为正常数据包后,对该消息验证码进行存储记录。
由上述方案可知,数据传输过程中,传输的消息数据包含有消息主体以及关联的消息验证码,利用共享密钥计算得到比对验证码以进行消息数据的防篡改验证,同时通过查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息,该种重放攻击检测方法不依赖于时间同步,保证数据以防止篡改,同时可高效的进行重放攻击的确定,该种方式也局限于区块链场景,适用程度更高。
图2为本发明实施例提供的另一种重放攻击检测方法的流程图,在重放攻击检测过程中引入结合了时间戳机制。如图2所示,技术方案具体如下:
步骤S201、接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码。
步骤S202、确定接收所述消息数据以及发送所述消息数据的时间戳差值。
在一个实施例中,消息主体M包含数据内容部分以及相应的数据发送端发送该数据内容时的数据发送时间戳,即M={Data,sTimestamp},当数据接收端接收到该消息数据时相应的确定数据接收时间戳rTimestamp,计算数据接收时间戳与数据发送时间戳二者之间的差值ΔT=|rTimestamp-sTimestamp|。
步骤S203、判断所述时间戳差值是否小于预设时间值,如果是,则执行步骤S204,否则执行步骤S205。
示例性的,该预设时间值计为T,如果ΔT>T,则判定为传输超时,执行步骤S205丢弃该消息数据。如果时间戳差值小于预设时间值,则执行步骤S204。
步骤S204、通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
步骤S205、丢弃所述消息数据。
步骤S206、判断消息验证码和比对验证码是否一致,如果是,则执行步骤S207,否则执行步骤S205。
步骤S207、查询是否存在对应于所述消息验证码的数据记录,如果是,则执行步骤S208,否则执行步骤S205。
步骤S208、存储所述消息验证码。
由上述方案可知,确定接收所述消息数据以及发送所述消息数据的时间戳差值,判断所述时间戳差值是否小于预设时间值,如果所述时间戳差值不小于所述预设时间值,则丢弃消息数据,以剔除异常数据包,进一步完善、提升了重放攻击检测机制。
图3为本发明实施例提供的另一种重放攻击检测方法的流程图,引入了哈希表存储结构。如图3所示,技术方案具体如下:
步骤S301、接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码。
步骤S302、通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
步骤S303、如果所述比对验证码和所述消息验证码一致,则在存储的哈希表中检索是否存在和所述消息验证码对应的键值,如果存在,则确定为重放攻 击消息。
其中,哈希表是根据键值(Key value)直接访问存储数据值(Value)的数据结构。其把Keyvalue映射到表中的一个位置,对存储数据值Value进行访问记录,以加快查找速度。
具体的,在比对验证码和消息验证码一致的情况下,在哈希表HashTable中检索是否有键Key=tag的记录,如果该键记录在表中已存在,则判定为重放攻击,将该异常数据包抛弃不处理,如果该键记录在哈希表HashTable中没有找到,则判定为正常数据包。
由上述方案可知,通过使用哈希表数据结构,显著提高了数据查找速度,进一步优化重放检测机制。
图4为本发明实施例提供的另一种重放攻击检测方法的流程图,给出了一种降低系统开销的重放攻击检测方法,将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中,同时,将所述消息验证码和所述接收时间戳插入至缓存队列中,每隔预设时间从所述缓存队列的队首进行扫描,取出超过预设差异时间的待删除元组,在所述哈希表中删除和所述待删除元组对应的数据元素,同时在所述缓存队列中删除所述待删除元组。如图4所示,技术方案具体如下:
步骤S401、接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码。
步骤S402、确定接收所述消息数据以及发送所述消息数据的时间戳差值。
步骤S403、判断所述时间戳差值是否小于预设时间值,如果是,则执行步骤S404,否则执行步骤S405。
步骤S404、通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
步骤S405、丢弃所述消息数据。
步骤S406、判断消息验证码和比对验证码是否一致,如果是,则执行步骤S407,否则执行步骤S405。
步骤S407、查询是否存在对应于所述消息验证码的数据记录,如果是,则 执行步骤S408,否则执行步骤S405。
步骤S408、将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中。
具体的,将{tag,rTimestamp}插入哈希表HashTable中。
步骤S409、将所述消息验证码和所述接收时间戳插入至缓存队列中,每隔预设时间从所述缓存队列的队首进行扫描,取出超过预设差异时间的待删除元组,在所述哈希表中删除和所述待删除元组对应的数据元素,同时在所述缓存队列中删除所述待删除元组。
图4a为本发明实施例提供的在数据队列中删除超时记录的示意图。在一个实施例中,数据接收端设置一缓存时间窗口w以及删除操作时间间隔N作为预设时间,如图4a所示,每个N分钟进行一次数据清理的处理操作。具体的,从缓存队列的队首进行扫描,取出超过预设差异时间T的待删除元组e 1,e 2,…,该预设差异时间T和缓存窗口w的关系可以是:w=2T。根据e 1.tag,e 2.tag,…,从哈希表HashTable中删除对应键的元素,同时从缓存队列Queue中删除这些元组。
由上述方案可知,通过将所述消息验证码和所述接收时间戳插入至缓存队列中,每隔预设时间从所述缓存队列的队首进行扫描,取出超过预设差异时间的待删除元组,在所述哈希表中删除和所述待删除元组对应的数据元素,同时在所述缓存队列中删除所述待删除元组,以此主动进行哈希表数据的删除,显著降低了数据接收端的系统内存开销。
在上述技术方案的基础上,所述缓存时间窗口依据系统设置的最大时间差异值确定,所述预设时间根据最大容忍系统开销进行设置。
图5为本发明实施例提供的另一种重放攻击检测方法的流程图,本实施例可适用于对重放攻击进行检测,该方法可以由数据发送端计算设备来执行,具体包括如下步骤:
步骤S501、获取待发送的消息数据,以及存储的共享密钥。
其中,该共享密钥在数据接收端也进行相应存储。
步骤S502、通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码。
其中,标准安全单向散列函数,可将任意长度数据计算生成L字节固定长度摘要信息B 0B 1B 2…B L-2B L-1,包括MD5输出16B摘要、SHA1输出20B摘要、SHA256输出32B摘要、SHA512输出64B摘要等。本方案中,数据发送端在发送消息数据时,对该消息数据进行数据处理以生成和该消息数据关联的消息验证码,将消息数据以及对应的消息验证码组合后进行发出。示例性的,以消息主体M为例,消息验证码tag的计算方式如下:
tag=MAC(K MAC,H(M))
步骤S503、将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
示例性的,在生成消息验证码tag后,将该tag与消息数据M进行组装后得到消息数据{M,tag}进行发送。
当数据接收端接收到消息数据{M,tag}后,通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
由上述可知,通过获取待发送的消息数据,以及存储的共享密钥,通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码,将所述消息数据以及所述消息验证码组装后发送至所述数据接收端,利用单向散列函数的计算不可逆性进行重传检测机制的构建,实现了数据的安全、防重放攻击的传输。
图6为本发明实施例提供的一种重放攻击检测装置的结构框图,该装置用于执行上述数据接收端实施例提供的重放攻击检测方法,具备执行方法相应的功能模块和有益效果。如图6所示,该装置具体包括:消息接收模块101、验证码计算模块102和查询确定模块103,其中,
消息接收模块101,用以接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
验证码计算模块102,用于通过所述安全消息验证码函数利用共享密钥计算 得到所述消息主体的比对验证码;
查询确定模块103,用于如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
由上述方案可知,接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到,通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码,如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
在一个可能的实施例中,还包括时间戳处理模块104,用于在通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码之前:
确定接收所述消息数据以及发送所述消息数据的时间戳差值;
确定所述时间戳差值是否小于预设时间值;
所述验证码计算模块102具体用于:
如果所述时间戳差值小于所述预设时间值,则通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
在一个可能的实施例中,所述时间戳处理模块104还用于:
如果所述时间戳差值大于或等于所述预设时间值,则丢弃所述消息数据。
在一个可能的实施例中,所述验证码计算模块102还用于:
如果所述比对验证码和所述消息验证码不一致,则丢弃所述消息数据。
在一个可能的实施例中,所述查询确定模块103具体用于:
在存储的哈希表中检索是否存在和所述消息验证码对应的键值,如果存在,则确定为重放攻击消息。
在一个可能的实施例中,还包括数据存储模块105,具体用于:
如果在存储的哈希表中不存在和所述消息验证码对应的键值,则确定所述消息数据为正常数据包,将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中。
在一个可能的实施例中,还包括队列处理模块106,用于在将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中之后:
将所述消息验证码和所述接收时间戳插入至缓存队列中;
每隔预设时间从所述缓存队列的队首进行扫描,取出超过预设差异时间的待删除元组,在所述哈希表中删除和所述待删除元组对应的数据元素,同时在所述缓存队列中删除所述待删除元组。
在一个可能的实施例中,所述缓存时间窗口依据系统设置的最大时间差异值确定,所述预设时间根据最大容忍系统开销进行设置。
在一个可能的实施例中,还包括密钥传输模块107,用于在接收数据发送端发送的消息数据之前,建立和所述数据端的安全网络传输通道,通过所述安全网络传输发送共享密钥至所述数据发送端。
图7为本发明实施例提供的另一种重放攻击检测装置的结构框图,该装置用于执行上述数据发送端实施例提供的重放攻击检测方法,具备执行方法相应的功能模块和有益效果。如图7所示,该装置具体包括:消息获取模块301、消息处理模块302和消息发送模块303,其中,
消息获取模块301,用于获取待发送的消息数据,以及存储的共享密钥;
消息处理模块302,用于通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
消息发送模块303,用于将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
由上述方案可知,通过获取待发送的消息数据,以及存储的共享密钥,通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码,将所述消息数据以及所述消息验证码组装后发送至所述数据接收端,利用单向散列函数的计算不可逆性进行重传检测机制的构建,实现了数据的安全、防重放攻击的传输。
图8为本发明实施例提供的一种重放攻击检测设备的结构示意图,如图8所示,该设备包括处理器201、存储器202、输入装置203和输出装置204;设备中处理器201的数量可以是一个或多个,图8中以一个处理器201为例;设备中的处理器201、存储器202、输入装置203和输出装置204可以通过总线或 其他方式连接,图8中以通过总线连接为例。存储器202作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本发明实施例中的重放攻击检测方法对应的程序指令/模块。处理器201通过运行存储在存储器202中的软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述的重放攻击检测方法。输入装置203可用于接收输入的数字或字符信息,以及产生与设备的用户设置以及功能控制有关的键信号输入。输出装置204可包括显示屏等显示设备。
本发明实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种重放攻击检测方法,该方法包括:
接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;
如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
本发明实施例还提供另一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种重放攻击检测方法,该方法包括:
获取待发送的消息数据,以及存储的共享密钥;
通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明实施例可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access  Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务,或者网络设备等)执行本发明实施例各个实施例所述的方法。
值得注意的是,上述重放攻击检测装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明实施例的保护范围。
注意,上述仅为本发明实施例的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明实施例不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明实施例的保护范围。因此,虽然通过以上实施例对本发明实施例进行了较为详细的说明,但是本发明实施例不仅仅限于以上实施例,在不脱离本发明实施例构思的情况下,还可以包括更多其他等效实施例,而本发明实施例的范围由所附的权利要求范围决定。

Claims (14)

  1. 重放攻击检测方法,其特征在于,包括:
    接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
    通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;
    如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
  2. 根据权利要求1所述的方法,其特征在于,在通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码之前,还包括:
    确定接收所述消息数据以及发送所述消息数据的时间戳差值;
    确定所述时间戳差值是否小于预设时间值;
    相应的,所述通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码,包括:
    如果所述时间戳差值小于所述预设时间值,则通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码。
  3. 根据权利要求2所述的方法,其特征在于,如果所述时间戳差值大于或等于所述预设时间值,则丢弃所述消息数据。
  4. 根据权利要求1所述的方法,其特征在于,如果所述比对验证码和所述消息验证码不一致,则丢弃所述消息数据。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息,包括:
    在存储的哈希表中检索是否存在和所述消息验证码对应的键值,如果存在,则确定为重放攻击消息。
  6. 根据权利要求5所述的方法,其特征在于,如果在存储的哈希表中不存在和所述消息验证码对应的键值,则确定所述消息数据为正常数据包,将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中。
  7. 根据权利要求6所述的方法,其特征在于,在将所述消息验证码以及所述消息数据的数据接收时间戳关联存储至所述哈希表中之后,还包括:
    将所述消息验证码和所述接收时间戳插入至缓存队列中;
    每隔预设时间从所述缓存队列的队首进行扫描,取出超过预设差异时间的待删除元组,在所述哈希表中删除和所述待删除元组对应的数据元素,同时在所述缓存队列中删除所述待删除元组。
  8. 根据权利要求7所述的方法,其特征在于,所述缓存时间窗口依据系统设置的最大时间差异值确定,所述预设时间根据最大容忍系统开销进行设置。
  9. 根据权利要求1所述的方法,其特征在于,在接收数据发送端发送的消息数据之前,还包括:
    建立和所述数据端的安全网络传输通道,通过所述安全网络传输发送共享密钥至所述数据发送端。
  10. 重放攻击检测方法,其特征在于,包括:
    获取待发送的消息数据,以及存储的共享密钥;
    通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
    将所述消息数据以及所述消息验证码组装后发送至所述数据接收端。
  11. 重放攻击检测装置,其特征在于,包括:
    消息接收模块,用以接收数据发送端发送的消息数据,所述消息数据包括消息主体以及关联的消息验证码,所述消息验证码通过安全消息验证码函数计算得到;
    验证码计算模块,用于通过所述安全消息验证码函数利用共享密钥计算得到所述消息主体的比对验证码;
    查询确定模块,用于如果所述比对验证码和所述消息验证码一致,则查询是否存在对应于所述消息验证码的数据记录,以确定所述消息数据是否为重放攻击消息。
  12. 重放攻击检测装置,其特征在于,包括:
    消息获取模块,用于获取待发送的消息数据,以及存储的共享密钥;
    消息处理模块,用于通过单向散列函数计算所述消息数据的散列值,通过安全消息验证码函数对所述共享密钥、所述散列值进行计算得到消息验证码;
    消息发送模块,用于将所述消息数据以及所述消息验证码组装后发送至所 述数据接收端。
  13. 一种重放攻击检测设备,所述设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-10中任一项或权利要求11所述的重放攻击检测方法。
  14. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-10中任一项或权利要求11所述的重放攻击检测方法。
PCT/CN2021/132904 2020-12-05 2021-11-24 重放攻击检测方法、装置、设备和存储介质 WO2022116883A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011404609.7A CN112615820A (zh) 2020-12-05 2020-12-05 重放攻击检测方法、装置、设备和存储介质
CN202011404609.7 2020-12-05

Publications (1)

Publication Number Publication Date
WO2022116883A1 true WO2022116883A1 (zh) 2022-06-09

Family

ID=75229039

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132904 WO2022116883A1 (zh) 2020-12-05 2021-11-24 重放攻击检测方法、装置、设备和存储介质

Country Status (2)

Country Link
CN (1) CN112615820A (zh)
WO (1) WO2022116883A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615820A (zh) * 2020-12-05 2021-04-06 百果园技术(新加坡)有限公司 重放攻击检测方法、装置、设备和存储介质
CN114500328A (zh) * 2022-01-20 2022-05-13 深圳市迈睿迈特环境科技有限公司 数据通讯方法、设备及计算机可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2407236A (en) * 2003-10-17 2005-04-20 Toshiba Res Europ Ltd Diffie-Hellman exchange of a session key
CN1980124A (zh) * 2005-12-05 2007-06-13 刘任 使用一次性变量的密钥数字认证方法
US20110066856A1 (en) * 2009-09-17 2011-03-17 Oki Electric Industry Co., Ltd. Communication data freshness confirmation system
CN107979466A (zh) * 2016-07-27 2018-05-01 北京计算机技术及应用研究所 基于Diffie-Hellman协议的iSCSI协议安全增强方法
CN111385258A (zh) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 一种数据通信的方法、装置、客户端、服务器和存储介质
CN112615820A (zh) * 2020-12-05 2021-04-06 百果园技术(新加坡)有限公司 重放攻击检测方法、装置、设备和存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101800989B (zh) * 2010-01-19 2013-07-10 重庆邮电大学 用于工业无线网络的防重放攻击系统
CN108833346A (zh) * 2018-05-04 2018-11-16 北京天元创新科技有限公司 一种工业控制系统安全通信方法和装置
CN109145593A (zh) * 2018-07-04 2019-01-04 杭州涂鸦信息技术有限公司 一种物联网过滤非法数据的方法、装置及计算机设备
CN110896390B (zh) * 2018-09-12 2021-05-11 华为技术有限公司 一种发送消息的方法、验证消息的方法、装置及通信系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2407236A (en) * 2003-10-17 2005-04-20 Toshiba Res Europ Ltd Diffie-Hellman exchange of a session key
CN1980124A (zh) * 2005-12-05 2007-06-13 刘任 使用一次性变量的密钥数字认证方法
US20110066856A1 (en) * 2009-09-17 2011-03-17 Oki Electric Industry Co., Ltd. Communication data freshness confirmation system
CN107979466A (zh) * 2016-07-27 2018-05-01 北京计算机技术及应用研究所 基于Diffie-Hellman协议的iSCSI协议安全增强方法
CN111385258A (zh) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 一种数据通信的方法、装置、客户端、服务器和存储介质
CN112615820A (zh) * 2020-12-05 2021-04-06 百果园技术(新加坡)有限公司 重放攻击检测方法、装置、设备和存储介质

Also Published As

Publication number Publication date
CN112615820A (zh) 2021-04-06

Similar Documents

Publication Publication Date Title
WO2022116883A1 (zh) 重放攻击检测方法、装置、设备和存储介质
WO2021047012A1 (zh) 基于token令牌的身份校验方法及相关设备
JP4608000B2 (ja) セキュアで帯域効率の良い暗号化同期方法
WO2022022009A1 (zh) 消息处理方法、装置、设备及存储介质
US11265339B1 (en) Network traffic monitoring
US20180278678A1 (en) System and method for limiting access request
US9973499B2 (en) Method for statistical object indentification
CN111988289B (zh) Epa工业控制网络安全测试系统及方法
US7139679B1 (en) Method and apparatus for cryptographic protection from denial of service attacks
EP3535951B1 (en) Password based key derivation function for ntp
US10122755B2 (en) Method and apparatus for detecting that an attacker has sent one or more messages to a receiver node
CN112968910B (zh) 一种防重放攻击方法和装置
WO2014147934A1 (ja) 通信装置、通信システム及び通信方法
EP4099657A1 (en) Method and device for preventing replay attack on srv6 hmac check
Othman et al. Secure data aggregation with MAC authentication in wireless sensor networks
WO2022042198A1 (zh) 身份验证方法、装置、计算机设备和存储介质
US10091249B2 (en) Method and system for synchronization of two databases in a lawful interception network by comparing checksum values
Annessi et al. SecureTime: Secure multicast time synchronization
CN111901116B (zh) 一种基于eap-md5改进协议的身份认证方法及系统
CN111756698A (zh) 一种消息传递方法、装置、设备和计算机可读存储介质
Treytl et al. Practical application of 1588 security
Bäumer et al. Terrapin Attack: Breaking SSH Channel Integrity By Sequence Number Manipulation
CN111565178B (zh) 业务信息下发方法、装置、服务器、客户端及存储介质
CN112889239A (zh) 用于证实物理攻击的方法和装置
Migault et al. RFC 9333: Minimal IP Encapsulating Security Payload (ESP)

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21899916

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21899916

Country of ref document: EP

Kind code of ref document: A1