CN106230587B - 一种长连接防重放攻击的方法 - Google Patents

一种长连接防重放攻击的方法 Download PDF

Info

Publication number
CN106230587B
CN106230587B CN201610635733.1A CN201610635733A CN106230587B CN 106230587 B CN106230587 B CN 106230587B CN 201610635733 A CN201610635733 A CN 201610635733A CN 106230587 B CN106230587 B CN 106230587B
Authority
CN
China
Prior art keywords
client
server end
hmac
replay
attack
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201610635733.1A
Other languages
English (en)
Other versions
CN106230587A (zh
Inventor
李朝铭
李炫均
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Software Co Ltd
Original Assignee
Inspur Software Co Ltd
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 Inspur Software Co Ltd filed Critical Inspur Software Co Ltd
Priority to CN201610635733.1A priority Critical patent/CN106230587B/zh
Publication of CN106230587A publication Critical patent/CN106230587A/zh
Application granted granted Critical
Publication of CN106230587B publication Critical patent/CN106230587B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • 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/1441Countermeasures against malicious 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/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
    • H04L9/3242Cryptographic 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 involving keyed hash functions, e.g. message authentication codes [MACs], CBC-MAC or HMAC

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)
  • Power Engineering (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明特别涉及一种长连接防重放攻击的方法。该长连接防重放攻击的方法,客户端连接服务器端,服务器端返回客户端一个随机数;客户端利用复合密钥,对客户端用户所使用的密码进行HMAC计算,并将用户名明文和客户端HMAC计算结果发送到服务器端;服务器端收到客户端HMAC计算结果后,查询对应的客户端用户所使用的密码,并在服务器端同样以复合密钥对与之对应的客户端用户所使用的密码进行HMAC计算;将服务器端和客户端得到的HMAC计算结果进行比对,如对比结果一致则连接保持,否则断开连接。该长连接防重放攻击的方法,克服了常用防重放攻击方式的不足,实现了对长连接的防重放攻击,效果良好,适用范围广。

Description

一种长连接防重放攻击的方法
技术领域
本发明涉及信息安全技术领域,特别涉及一种长连接防重放攻击的方法。
背景技术
重放攻击(Replay Attacks)又称重播攻击、回放攻击或新鲜性攻击(FreshnessAttacks),是指攻击者发送一个目的主机已接收过的包,特别是在认证的过程中,用于认证用户身份所接收的包,来达到欺骗系统的目的,主要用于身份认证过程,破坏认证的安全性。
重放攻击是一种攻击类型,这种攻击会不断恶意或欺诈性地重复一个有效的数据传输,重放攻击可以由发起者拦截并重复发该数据到目的主机进行。攻击者利用网络监听或者其他方式盗取认证凭据,一般是cookies或者一些的认证session会话,进行一定的处理后,再把它重新发给认证服务器。从原理上可以理解,加密可以有效防止明文数据被监听,但是却防止不了重放攻击。重放攻击任何网络通讯过程中都可能发生。重放攻击是计算机世界黑客常用的攻击方式之一。
防止重放攻击通常三种方式:
一种是时间戳方式,“时间戳”代表当前时刻的数,其基本思想是A接收一个消息当且仅当其包含一个对A而言足够接近当前时刻的时间戳,而重放的时间戳将相对远离当前时刻而不被接受。时间戳方式要求通信各方的计算机时钟保持同步,如果双方时钟若偶然出现不同步,则正确的信息可能会被误判为重放信息而丢弃,而错误的重放信息可能会当作最新信息而接收。
第二种是重放攻击序号,通信双方通过消息中的序列号来判断消息的新鲜性,要求通信双方必须事先协商一个初始序列号,并协商递增方法。此种方法的弊端是序列号递增方法的规律有可能被猜到,从而防重放失败。
第三种是重放攻击挑战与应答,其基本做法是期望从B获得消息的A 事先发给B一个挑战值, B计算并发送应答值,A通过判断应答值是否正确来判定本次消息是不是重放的。此种方法的弊端是挑战值和应答值的范围要足够宽,否则攻击者只需截获足够的挑战应答关系,就可以进行重放攻击了。
针对上述问题,本发明设计了一种长连接防重放攻击的方法,对常用防重放攻击方式进行了改进,适用范围更广。
发明内容
本发明为了弥补现有技术的缺陷,提供了一种简单高效的长连接防重放攻击的方法。
本发明是通过如下技术方案实现的:
一种长连接防重放攻击的方法,其特征在于包括以下步骤:
(1)客户端向服务器端发起连接,服务器端返回客户端一个随机数;
(2)客户端利用复合密钥,对客户端用户所使用的密码进行HMAC计算,得到客户端HMAC计算结果,并将用户名明文和客户端HMAC计算结果发送到服务器端;
(3)服务器端收到客户端HMAC计算结果后,查询对应的客户端用户所使用的密码,并在服务器端同样以复合密钥对与之对应的客户端用户所使用的密码进行HMAC计算,得到服务器端HMAC计算结果;
(4)将服务器端HMAC计算结果与客户端HMAC计算结果进行比对,如对比结果一致则连接保持,否则断开连接。
所述步骤(2)中,客户端利用自身的IP值,客户端本次连接分配的端口号值和收到的服务器端发送的随机数作为复合密钥。
所述步骤(3)中,服务器端以连接的客户端IP,该连接的外部端口号及之前发送给客户端的随机数构成复合密钥。
本发明的有益效果是:该长连接防重放攻击的方法,利用客户端IP及端口号的唯一性,加上随机数生成唯一的复合密钥,克服了常用防重放攻击方式的不足,实现了对长连接的防重放攻击,防重放攻击效果更好,适用范围更广。
附图说明
附图1为本发明长连接防重放攻击的方法示意图。
具体实施方式
为了使本发明所要解决的技术问题、技术方案及有益效果更加清楚明白,以下结合附图和实施例,对本发明进行详细的说明。应当说明的是,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。
该长连接防重放攻击的方法,包括以下步骤:
(1)客户端(1010)向服务器端(2010)发起连接,服务器端返回客户端一个随机数(2020);
(2)客户端利用复合密钥,对客户端用户所使用的密码进行HMAC计算,得到客户端HMAC计算结果(1030),并将用户名明文和客户端HMAC计算结果发送到服务器端(1040);
(3)服务器端收到客户端HMAC计算结果后,查询对应的客户端用户所使用的密码,并在服务器端同样以复合密钥对与之对应的客户端用户所使用的密码进行HMAC计算,得到服务器端HMAC计算结果(2030);
(4)将服务器端HMAC计算结果与客户端HMAC计算结果进行比对,如对比结果一致则连接保持,否则断开连接(2040)。
所述步骤(2)中,客户端利用自身的IP值,客户端本次连接分配的端口号值和收到的服务器端发送的随机数作为复合密钥。
所述步骤(3)中,服务器端以连接的客户端IP,该连接的外部端口号及之前发送给客户端的随机数构成复合密钥。
由于每个客户端的IP及该连接分配的端口号组合上是唯一的,再加上随机数,因而用于每个客户端的复合密钥也是唯一的。因此,相对于传统的三种防重放攻击方式,其防重放攻击效果更好,适用范围更广。

Claims (1)

1.一种长连接防重放攻击的方法,其特征在于包括以下步骤:
(1)客户端向服务器端发起连接,服务器端返回客户端一个随机数;
(2)客户端利用复合密钥,对客户端用户所使用的密码进行HMAC计算,得到客户端HMAC计算结果,并将用户名明文和客户端HMAC计算结果发送到服务器端;
所述步骤(2)中,客户端利用自身的IP值,客户端本次连接分配的端口号值和收到的服务器端发送的随机数作为复合密钥;
(3)服务器端收到客户端HMAC计算结果后,查询对应的客户端用户所使用的密码,并在服务器端同样以复合密钥对与之对应的客户端用户所使用的密码进行HMAC计算,得到服务器端HMAC计算结果;
所述步骤(3)中,服务器端以连接的客户端IP,该连接的外部端口号及之前发送给客户端的随机数构成复合密钥;
(4)将服务器端HMAC计算结果与客户端HMAC计算结果进行比对,如对比结果一致则连接保持,否则断开连接。
CN201610635733.1A 2016-08-05 2016-08-05 一种长连接防重放攻击的方法 Active CN106230587B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610635733.1A CN106230587B (zh) 2016-08-05 2016-08-05 一种长连接防重放攻击的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610635733.1A CN106230587B (zh) 2016-08-05 2016-08-05 一种长连接防重放攻击的方法

Publications (2)

Publication Number Publication Date
CN106230587A CN106230587A (zh) 2016-12-14
CN106230587B true CN106230587B (zh) 2019-01-22

Family

ID=57546975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610635733.1A Active CN106230587B (zh) 2016-08-05 2016-08-05 一种长连接防重放攻击的方法

Country Status (1)

Country Link
CN (1) CN106230587B (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107483459A (zh) * 2017-08-29 2017-12-15 四川长虹电器股份有限公司 防重放攻击的接口保护方法
US11716774B2 (en) 2018-03-02 2023-08-01 Nitto Denko Corporation Device pairing system and method, and device communication control system and method
CN109409143B (zh) * 2018-12-21 2022-05-17 北京思源理想控股集团有限公司 一种安全键盘系统及其方法
CN109412799B (zh) * 2018-12-21 2021-07-16 北京思源理想控股集团有限公司 一种生成本地密钥的系统及其方法
CN110213247B (zh) * 2019-05-16 2021-10-01 福建天泉教育科技有限公司 一种提高推送信息安全性的方法及系统
CN110602055A (zh) * 2019-08-21 2019-12-20 厦门网宿有限公司 长连接鉴权方法、装置、服务器及存储介质
CN113395247B (zh) * 2020-03-11 2023-01-13 华为技术有限公司 一种防止对SRv6 HMAC校验进行重放攻击的方法和设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272251B (zh) * 2007-03-22 2012-04-18 华为技术有限公司 鉴权和密钥协商方法、认证方法、系统及设备
EP2558990A4 (en) * 2010-04-14 2016-09-21 Nokia Technologies Oy METHOD AND DEVICE FOR AUTOMATIC PAYMENTS
CN103916363B (zh) * 2012-12-30 2018-04-27 航天信息股份有限公司 加密机的通讯安全管理方法和系统
CN104917765A (zh) * 2015-06-10 2015-09-16 杭州华三通信技术有限公司 一种防范攻击的方法和设备
CN105376216B (zh) * 2015-10-12 2019-04-26 华为技术有限公司 一种远程访问方法、代理服务器及客户端

Also Published As

Publication number Publication date
CN106230587A (zh) 2016-12-14

Similar Documents

Publication Publication Date Title
CN106230587B (zh) 一种长连接防重放攻击的方法
Li et al. Group-based authentication and key agreement with dynamic policy updating for MTC in LTE-A networks
KR102068367B1 (ko) 사물인터넷을 위한 데이터그램 전송에서 경량 인증을 위한 컴퓨터 구현 시스템 및 방법
CN107360571B (zh) 在移动网络中的匿名相互认证和密钥协商协议的方法
US20160365982A1 (en) System and method for secure end-to-end messaging system
CN109167802B (zh) 防止会话劫持的方法、服务器以及终端
CN104158653A (zh) 一种基于商密算法的安全通信方法
CN101442411A (zh) 一种p2p网络中对等用户结点间的身份认证方法
CN102111411A (zh) P2p网络中对等用户结点间的加密安全数据交换方法
CN110999223A (zh) 安全加密的心跳协议
CN112235235A (zh) 一种基于国密算法的sdp认证协议实现方法
CN112637136A (zh) 加密通信方法及系统
CN102638468A (zh) 保护信息传输安全的方法、发送端、接收端及系统
Chen et al. Security analysis and improvement of user authentication framework for cloud computing
CN104901940A (zh) 一种基于cpk标识认证的802.1x网络接入方法
JP2016522637A (ja) 共有秘密を含意するセキュア化されたデータチャネル認証
CN116388995A (zh) 一种基于puf的轻量级智能电网认证方法
KR102219086B1 (ko) 드론(Unnamed Aerial vehicle)시스템을 위한 HMAC기반의 송신원 인증 및 비밀키 공유 방법 및 시스템
CN113645115B (zh) 虚拟专用网络接入方法和系统
CN103973438B (zh) 通信信道动态加密方法
Bonaventura et al. Smart Bulbs can be Hacked to Hack into your Household
CN105790932B (zh) 一种通过使用机器码为基础的加密方法
CN107979466B (zh) 基于Diffie-Hellman协议的iSCSI协议安全增强方法
CN108282456A (zh) 网络摄像机授权访问的方法
Chuang et al. Cryptanalysis of four biometric based authentication schemes with privacy-preserving for multi-server environment and design guidelines

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant