CHAP Security

Challenge Handshake Authentication Protocol is the default authentication protocol used by PPP. CHAP is not vulnerable to the security attacks that threaten PAP. In fact, a PPP connection that uses CHAP is probably more secure than your local Ethernet connection. For one, CHAP does not send clear-text passwords. Instead, CHAP sends a string of characters called a challenge string. The system seeking authentication encrypts the challenge string with a secret key from the /etc/ppp/chap-secrets file, and returns the encrypted string back to the servers. The secret key never travels across the network and therefore cannot be read off the network by a snooper.

Additionally, CHAP repeatedly reauthenticates the systems. Even if a thief steals the connection through address spoofing, he cannot keep the connection for long without responding correctly to the CHAP challenge.

CHAP is configured through the chap-secrets file. Entries in the chap-secrets file contain the following fields:

respondent This is the name of the computer that will respond to the CHAP challenge. Most documentation calls this the "client" field. However, PPP clients require authentication from servers in the same way that servers require authentication from clients. The first field defines the system that must respond to the challenge in order to be authenticated.

challenger This is the name of the system that will issue the CHAP challenge. Most documentation calls this the "server" field, but as noted earlier, servers are not the only systems that issue CHAP challenges. The second field contains the name of the computer that challenges the other system to authenticate itself.

secret This is the secret key that is used to encrypt and decrypt the challenge string. The challenger sends a challenge string to the system that is being authenticated. The respondent encrypts that string using the secret key, and sends the encrypted string back to the challenger. Then, the challenger decrypts the string with the secret key. If the decrypted string matches the original challenge string, the responding system is authenticated. Using this system, the secret key never travels across the network.

address This is an address written either as a numeric IP address or as a hostname. If an address is defined, the respondent must use the specified IP address. Even if a system responds with the correct secret key, it will not be authenticated unless it is also the host at the correct IP address.

Listing 2.4 shows the entries that a chap-secrets file on robin might contain:

Listing 2.4: A Sample chap-secrets File

# cat chap-secrets

# Secrets for authentication using CHAP

# client server secret IP addresses robin wren Peopledon'tknowyou wren robin ,andtrustisajoke.

When robin is challenged by wren, it uses the secret key Peopledon'tknowyou to encrypt the challenge string. When robin challenges wren, it expects wren to use the secret key ,andtrustisajoke.. It is very common for entries to come in pairs like this. After all, there are two ends to a PPP connection, and both systems require authentication to create a secure link. wren challenges robin, and robin challenges wren. When both computers are sure they are communicating with the correct remote system, the link is established. For this to work, of course, wren needs the same entries in its chap-secrets file.

For security reasons, it is very important to protect the /etc/ppp directory. Only the root user should be able to read or write the chap-secrets file or the pap-secrets file. Otherwise, the secret keys may be compromised. Additionally, only the root user should be allowed to write the options file. Otherwise, users would be able to define system-wide PPP options.

Finally, only the root user should be able to write to the script files ip-up and ip-down. pppd runs the ip-up script as soon as it makes the PPP connection, and it runs the ip-down script after it closes the connection. These scripts can perform privileged functions relating to the network connection. Thus, allowing anyone but the root user to modify these scripts compromises the security of your system.

Was this article helpful?

0 0

Post a comment