The Wayback Machine - https://web.archive.org/web/20240905122932/https://www.geeksforgeeks.org/challenge-handshake-authentication-protocol-chap/
Open In App

Challenge Handshake Authentication Protocol (CHAP)

Last Updated : 02 May, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Challenge Handshake Authentication Protocol (CHAP) is a Point-to-point protocol (PPP) authentication protocol developed by IETF (Internet Engineering Task Force). It is used at the initial startup of the link. Also, it performs periodic checkups to check if the router is still communicating with the same host. 

Features :  

  • It uses 3-way handshaking protocol (not like TCP). First, the authenticator sends a challenge packet to the peer then, the peer responds with a value using its one way hash function. The authenticator then matches the received value with its own calculated hash value. If the values match then the authentication is acknowledged otherwise, the connection will be terminated.
  • It uses one-way hash function called MD5.
  • It also authenticates periodically to check if the communication is taking place with the same device or not.
  • Also, it provides more security than PAP (Password Authentication Procedure) as the value used (find out by hash function) is changed variably.
  • CHAP requires to know the plaintext of the secret as it is never sent over the network.

CHAP packets : 
There are 4 types of CHAP packets – 

  1. Challenge packet : It is a packet sent, by the authenticator to peer, at the starting of the CHAP 3-way Handshake. Challenge packet is also sent periodically to check if the connection is not altered. It contains Identifier value, value field which contains random value and also contains name field which contains name of the authenticator. The name field is used for password look up. The name field is also fed to MD5 hash generator and a one-way hash value is generated.
  2. Response Packet : It is used to response to the challenge packet. It contains the Value field which contains one-way hash value generated, identifier value and the name field. The Name field of the Response packet is set to the hostname of the peer router. Now, the Name field of Challenge packet is looked up for the password. The router looks up for an entry that matches the username in the Name field of the Challenge packet and gets the password. Then, this password is hashed by feeding it to MD5 hash generator and one way hash value is generated. This value is inserted into the value field of response packet and sent to the authenticator.
  3. Success packet : Now, the authenticator also performs the same thing by looking up in name field (if it has an entry for that username) of the response packet and by using that it generates a hash value. If the value generated is same as that of peer then the success packet is send.
  4. Failure packet : If the generated value is different then the failure packet is send to the peer.

Advantages

  • Strong authentication: CHAP provides strong authentication by challenging the user with a randomly generated challenge string that changes with each session, ensuring that the user’s password or secret key is not transmitted over the network.
  • Secure: CHAP is a secure authentication protocol as it uses a one-way hash function to encrypt the challenge string and the password, making it difficult for attackers to intercept and decrypt the user’s credentials.
  • Prevents replay attacks: CHAP prevents replay attacks by including a sequence number in the challenge string, ensuring that the same challenge cannot be used twice.
  • Compatibility: CHAP is compatible with a wide range of network protocols and operating systems, making it easy to implement and use in various network environments.
  • Scalability: CHAP is a scalable authentication protocol, as it can handle a large number of users and devices in the network.

Disadvantages

  • Vulnerable to man-in-the-middle attacks: CHAP is vulnerable to man-in-the-middle attacks, where an attacker can intercept the challenge and response packets and use them to authenticate themselves to the network.
  • Requires a pre-shared key: CHAP requires a pre-shared key or password to authenticate the user, which can be difficult to manage in large-scale network environments.
  • No mutual authentication: CHAP does not provide mutual authentication, which means that the network cannot authenticate the user in the same way that the user authenticates the network. This can leave the network vulnerable to spoofing attacks.
  • Overhead: CHAP introduces additional overhead in the network, as it requires the exchange of multiple packets between the user and the network for each session.
  • Not suitable for high-security applications: CHAP is not suitable for high-security applications that require advanced authentication and encryption mechanisms, as it provides only basic authentication and encryption features.

Configuration : 
 

There is a small topology with 2-routers, namely Router1 and Router2. Router1 having IP address 10.1.1.1/30 on s0/0 and Router2 have IP address 10.1.1.2/30 on s0/0. Remember, by default HDLC is configured on Cisco routers therefore, first change the encapsulation to PPP. 

Configure R1 :  

Router1(config)# int s0/0
Router1(config-if)# encapsulation ppp

Configure R2 :  

Router2(config)# int s0/0
Router2(config-if)# encapsulation ppp

Change hostname of both routers.  

Router1(config)# hostname R1
Router2(config)# hostname R2

Provide username and password one by one. 

R1(config)# username R2 password GeeksforGeeks  
R2(config)# username R1 password GeeksforGeeks 

Notice that username and password are case-sensitive. Also, on router R1, we have to give username of other router i.e R2 and vice-versa.



Similar Reads

Difference between PAP and CHAP
Concerning communication security over the network, authentication is the initial process to make sure that only those who have rights can access the network. In Point-to-Point Protocol (PPP), there are methods of authenticating the remote devices to enhance the security between two ends. Two protocols for authentication included in the PPP are the
5 min read
Challenge Response Authentication Mechanism (CRAM)
Challenge Response Authentication Mechanism (CRAM) is the most often used way to authenticate actions. They are a group of protocols in which one side presents a challenge(to be answered) and the other side must present a correct answer(to be checked/validated) to the challenge in order to get authenticated. Figure - CRAM activity flow diagram Two
3 min read
Transport Layer Security (TLS) Handshake
TLS is a data privacy and security protocol implemented for secure communication over internet. It usually encrypts communication between server and clients. TLS is a successor to Secure Socket Layer (SSL) protocol. SSL v3.0 and TLS v1.0 were very similar but it was replaced with TLS. You can also refer to Transport Layer Security (TLS). A Transpor
2 min read
Impact of Three-way Handshake and Slow Start Algorithm
Internet became something without which our lives are incomplete. Every day each internet user makes 100s of queries on the internet, be it a simple google search or visiting any website and no one likes the delay in the response. In this article, we will discuss time delay that affects internet speed. A three-way handshake was introduced in the in
8 min read
Why TCP Connect Termination Need 4-Way-Handshake?
The modern developments in everyday life, in terms of technology and the internet, are only made possible with the help of the TCP/IP suite. TCP is been used for communication among devices on the network. It stands for Transmission Control Protocol. It can work with any type of network, whether personal networks or the internet. For instance, it c
8 min read
How to Fix the SSL/TLS Handshake Failed Error?
Secure Sockets Layer (SSL): It is an internet security protocol based on encryption. It was developed in the year 1996 by Netscape to ensure privacy, authentication, and data integrity. It is the predecessor to TLS encryption. It provides a secure channel between two devices or machines communicating over the Internet or even an internal network. S
3 min read
What is SSL/TLS Handshake?
The network is important for office, home, and business networks. The problem is at the utmost places wireless communication is used or we can say the wireless network is used which is effortlessly hackable and the router can be freely exploited if not secured rightly. So there's a need for security in the network. To fulfill this need we can use s
6 min read
TCP 3-Way Handshake Process
The TCP 3-Way Handshake is a fundamental process that establishes a reliable connection between two devices over a TCP/IP network. It involves three steps: SYN (Synchronize), SYN-ACK (Synchronize-Acknowledge), and ACK (Acknowledge). During the handshake, the client and server exchange initial sequence numbers and confirm the connection establishmen
7 min read
Difference Between Single-Factor Authentication and Multi-Factor Authentication
The process of verifying a user's identity with the help of login credentials, biometric or OTP is called Authentication. Authentication is verifying a user's identity before allowing them to access the system or resource. Authentication is important to ensure privacy and protect the system from security breaches. Authentication is a core component
4 min read
Password Authentication Protocol (PAP)
There are simply two methods to authenticate PPP links namely Password Authentication Protocol (PAP) and Challenge Handshake Authentication Protocol (CHAP). From these two authentication protocols, PAP is less secured as the password is sent in clear text and is performed only at the initial link establishment. Password Authentication Protocol (PAP
3 min read
Network Time Protocol (NTP) Security and Authentication
In the powerful scene of PC organizations, where accuracy is foremost, the Network Time Protocol (NTP) assumes an essential part in coordinating a consistent worldly dance among gadgets. As the foundation of time synchronization, NTP guarantees that divergent frameworks can walk as one, working with strong and proficient tasks across an organizatio
7 min read
Internet Protocol Authentication Header
The Internet Protocol Authentication Header (AH) is a component of the IPsec (Internet Protocol Security) suite that provides data integrity, data origin authentication, and optional anti-replay protection for IP packets. Authentication Header ensures that the data was not modified during transmission and verifies the identity of the sender. In thi
7 min read
Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol used to provide redundancy in a network. Only one router is the active router while others will be in standby state i.e the standby router will be responsible for forwarding the traffic when the active router fails. Virtual Router Redundancy Protocol (VRRP) is an open standard proto
3 min read
Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
FTP (File Transfer Protocol) It is a protocol that is used to transfer or copy the file from one host to another host. But there may be some problems like different file names and different file directories while sending and receiving a files in different hosts or systems. And in FTP, a secure channel is not provided to transfer the files between t
3 min read
Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
The main difference between the Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP) is that Serial Line Internet Protocol is the Predecessor protocol of Point-to-Point Protocol. On the other hand, Point-to-Point Protocol is the Successor protocol of Serial Line Internet Protocol. Features of SLIP: Simple: SLIP is a simple protoco
4 min read
Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
Layer 2 or the Datalink layer provides physical addressing and access to media. It defines how data is to be formatted for transmission and how access to the network is to be controlled. It also provides error detection, ensuring data on higher layers is formatted correctly for transmission. Cisco Discovery Protocol (CDP) and Link Layer Discovery P
2 min read
Difference between Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP)
1. Spanning Tree Protocol (STP) : STP is also known as spanning tree protocol is a layer 2 (Data link layer) protocol, it runs on switches and bridges. The IEEE standard of STP is 802.1D. STP is a feature used to prevent loops when using redundant switches. For example, we have three switches they are all linked together and without STP a loop coul
4 min read
Difference between Stop and Wait protocol and Sliding Window protocol
Both the Stop and Wait protocol and the Sliding Window protocol are the techniques to the solution of flow control handling. The main difference between the Stop-and-wait protocol and the Sliding window protocol is that in the Stop-and-Wait Protocol, the sender sends one frame and waits for acknowledgment from the receiver whereas in the sliding wi
5 min read
Difference between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP)
When dealing with network routing, it's crucial to understand the various protocols that help direct traffic across complex networks. Two significant protocols in this space are the Border Gateway Protocol (BGP) and the Routing Information Protocol (RIP). Each serves different purposes and operates under different principles. This article explores
5 min read
Challenge In Mobile Device
Believe it or not there are security risks when using a mobile device. We know, it is surprising right, that your phone or tablet could be a possible threat to your safety. When you consider all the potential threats that exist on the Internet and the fact that most of today’s mobile devices are connecting to and through the Internet with every fun
2 min read
Message Authentication Codes
Message Authentication Codes are the codes which plays their role in two important functions: Authentication Detection and Falsification Detection. Where do we need these codes? Suppose User A send message to user B with message - 'abc'. A encrypts the message using Shared - Key Cryptosystem for encrypting the message. A sends the key to B using a
2 min read
How message authentication code works?
Prerequisite - Message authentication codes Apart from intruders, the transfer of message between two people also faces other external problems like noise, which may alter the original message constructed by the sender. To ensure that the message is not altered there's this cool method MAC. MAC stands for Message Authentication Code. Here in MAC, s
2 min read
Domain based Message Authentication, Reporting and Conformance (DMARC)
Gestation period of "@" : In 1970’s, there weren’t more awareness about threats and malicious activities. cybersecurity which was formally known as computer security was gradually progressing. Even before that Electronic Mail (E-mail) was equivalent to sticking note on someone’s computer. Because, who wouldn’t trust any message from their colleague
4 min read
Computer Network | AAA (Authentication, Authorization and Accounting)
The administrator can take access to a router or a device through a console but it is very inconvenient if he is sitting far from the place of that device. So, eventually, he has to take remote access to that device. But as remote access will be available by using an IP address, therefore, it is possible that an unauthorized user can take access us
4 min read
AAA (Authentication, Authorization and Accounting) configuration (locally)
Prerequisite - AAA (Authentication, Authorization and Accounting) To provide security to access network resources, AAA is used. AAA is a standard based framework used to control who is permitted to use network resources (through authentication), what they are authorized to do (through authorization) and capture the actions performed while accessing
3 min read
Types of Two-factor Authentication
Two-factor Authentication refers to the use of any two self-reliant methods from the various authentication methods. Two-factor authentication is used to ensure that the user has been recognized to access secure systems and to increase the security. Two-factor authentication is first implemented for laptops because of the fundamental security liabi
4 min read
What is AAA (Authentication, Authorization, and Accounting)?
Authentication, Authorization, and Accounting (AAA) is an architectural framework to gain access to computer resources, enforcing policies, auditing usage, to provide essential information required for billing of services and other processes essential for network management and security. This process is mainly used so that network and software appl
2 min read
Authentication in Computer Network
Prerequisite - Authentication and Authorization Authentication is the process of verifying the identity of a user or information. User authentication is the process of verifying the identity of a user when that user logs in to a computer system. There are different types of authentication systems which are: - 1. Single-Factor authentication: - This
4 min read
SAML Authentication
SAML is an XML based framework that stands for Security Assertion Markup Language. Let us see how SAML is used to enable SSO (Single-Sign-On). SSO is a term used for a type of login method where a company configures all of its web apps in such a way that the user can log in to all of these apps by just signing in once. Example - When one logs in on
4 min read
Types of Authentication Protocols
User authentication is the first most priority while responding to the request made by the user to the software application. There are several mechanisms made which are required to authenticate the access while providing access to the data. In this blog, we will explore the most common authentication protocols and will try to explore their merits a
3 min read