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.
Two types of questions (Challenge) –
- Static questions, as the name suggests, involve a static approach to the challenge selection. The user can select his challenge and authenticate himself. For example, take the use case of FORGET PASSWORD in email services. A static challenge is the ‘security question’ that you have saved as part of your account setup. The correct answer to those questions are not expected to change over time.
- Dynamic questions involve a dynamic approach to the Challenge selection and authentication. The challenges are selected randomly presuming that the user will know the valid answer to the challenge considering the user is the real one.
Ways CRAM is executed –
The Completely Automated Public Turing Test to Tell Computers and Humans Apart. CAPTCHA is used to prevent spam and auto-registration of new accounts for email or websites.
- SSH (Secure SHell):
SSH is a cryptographic network protocol for operating network services securely over an unsecured network.
The password is sent to the server for validation by matching with the correct password.
- Salted Challenge Response Authentication Mechanism (SCRAM, a variant of CRAM):
The challenge is salted with a hash to make sure the password is used for only one time. The hash is sent to the server for matching with the hash of the correct password for match and not the match of the plain text password itself. So, the password is not revealed preventing the Man-in-the-Middle attack and replay attacks because the password can be used only once.
The biometric details(retina scan, fingerprint scan) that are unique are recorded and everytime a user wants to authenticate himself, he has to present his biometric credentials to the authenticating system for validation.
Use cases –
- To differentiate between a computer and a human:
An image (usually difficult to read in plain glance) is presented to the user and the user would be asked to input by reading the characters from the image. The input is then matched with the actual characters to prevent bots from entering the system.
- In training Machine Learning models:
An image is pieced and jumbled up and presented to the user for some kind of verification that a real human user can do. The input is used for user validation. The answer given by the user is matched with the answer given by the ML model. The jumbled up image is the ‘challenge’ and selecting the right pieces is the example. Commonly seen in Google CAPTCHA authentication.
- For login (authentication) purposes:
The password input is matched(directly or indirectly) with the correct password(already stored in the server that you are trying to access) for matching.
Common attacks on CRAMs –
- Phishing Attacks
- Pharming Attacks
- Man-In-The-Middle Attacks
- DNS Cache Poisoning Attacks
- Trojans Attacks
- Man-In-The-Phone Attacks
- Browser Poisoning Attacks
- Dictionary Attacks
- Brute-Force Attacks
- zero-knowledge password proof
- Reusable password attacks
A fundamental problem with passwords is that passwords are used repeatedly. When a password is received by the server, the server cannot determine if the real user is entering the password or not.
Newer CRAMs also employ cryptography so that the hash of the passwords are matched and not the plain passwords.
Some examples of cryptographic CRAMs –
- SCRAM – Salted Challenge Response Authentication Mechanism
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Challenge Handshake Authentication Protocol (CHAP)
- Core Defences Mechanism in Web Applications
- Mobile Crowd Sensing along with Incentive Mechanism
- Types of Security Mechanism
- hmac - Keyed-Hashing for Message Authentication
- Message Authentication Codes
- How message authentication code works?
- Computer Network | AAA (Authentication, Authorization and Accounting)
- AAA (Authentication, Authorization and Accounting) configuration (locally)
- Password Authentication Protocol (PAP)
- Difference between Authentication and Authorization
- PGP - Authentication and Confidentiality
- Implement Token Authentication using Django REST Framework
- Broken Authentication Vulnerability
- 3D passwords-Advanced Authentication Systems
- Types of Two-factor Authentication
- JWT Authentication with Django REST Framework
- What is AAA (Authentication, Authorization, and Accounting)?
- What is HMAC(Hash based Message Authentication Code)?
- Internet Protocol Authentication Header
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.