Is CH4
Is CH4
User authentication
Main Points:
User authentication: Overview, Passwords
Challenge response, Zero knowledge proof,
Password cracking, Biometrics.
User Authentication
Authentication is the process of verifying the identity of a user. It’s
essential in information security to ensure that only authorized users can
access a system or resource.
Three Types of User Authentication
1. Something You Know:
o Examples: Passwords, PINs, security questions (e.g., mother’s
maiden name, date of birth).
o Example with Alice and Bob:
Alice wants to access Bob's server. Bob asks her for her
password. If Alice provides the correct password, she's
authenticated.
2. Something You Have:
o Examples: Smartcards, ATM cards, hardware tokens, or devices
that generate one-time passwords.
o Example:
Alice uses a hardware token provided by Bob's system.
The token generates a one-time password that Alice
enters to log in.
3. Something You Are:
o Examples: Biometric traits like fingerprints, voice recognition,
facial scans, or even gait analysis.
o Example:
Bob's system authenticates Alice by scanning her
fingerprint before granting her access.
Access Control
Access control is a fundamental concept in information security, designed
to regulate access to resources in a computing environment. It answers
two crucial questions:
1. Authentication: Who are you?
This confirms a user's identity using methods like passwords,
biometrics, or tokens.
2. Authorization: What are you allowed to do?
This ensures that authenticated users can only access resources and
perform actions they are permitted to.
Components of Access Control
1. Authentication
Authentication verifies the identity of a user or system.
Human to Machine Authentication: Example: Alice logs into Bob's
server by providing her username and password.
Machine to Machine Authentication: Example: A database
authenticates an application server using API keys.
Methods of Authentication:
Single-Factor Authentication: A single layer of security (e.g., just a
password).
Multi-Factor Authentication (MFA): Combines two or more factors
(e.g., password + fingerprint).
Certificate-Based Authentication: Machines or users are
authenticated using digital certificates.
2. Authorization
Authorization determines the actions or resources a user is allowed to
access after authentication.
Key Principles:
Principle of Least Privilege (PoLP): Users should only be granted
permissions they need to perform their job and no more.
o Example: Alice, a data analyst, only has read access to financial
records, not write access.
Separation of Duties (SoD): Responsibilities should be divided among
multiple users to reduce the risk of fraud or error.
o Example: Alice approves a transaction, and Bob processes it.
Access Control Models
Several models are used to implement access control. Here’s a deeper
explanation of each:
1. Discretionary Access Control (DAC)
Definition: Access is determined by the owner of the resource.
Example: Alice owns a file on Bob's server and can decide who else
can read, write, or execute it.
Pros: Flexible and easy to implement.
Cons: Susceptible to insider threats and accidental
misconfigurations.
2. Mandatory Access Control (MAC)
Definition: Access is determined by a central authority based on
classifications.
Example: Bob’s organization implements a system where files are
classified as "Top Secret" or "Confidential." Alice can only access files
for which she has clearance.
Pros: Highly secure and prevents unauthorized access.
Cons: Inflexible and harder to manage.
3. Role-Based Access Control (RBAC)
Definition: Access is assigned based on a user's role in the
organization.
Example: Alice, as a "Manager," has access to performance reports,
while Bob, as an "Analyst," has access to raw data but not the
reports.
Pros: Simplifies management as roles are easier to assign than
individual permissions.
Cons: Roles need to be carefully defined and maintained.
4. Attribute-Based Access Control (ABAC)
Definition: Access is based on attributes (e.g., user attributes,
resource attributes, environment conditions).
Example: Alice can access a file if she is in the "Finance" department
and accessing the system from the office network.
Pros: Highly granular and flexible.
Cons: Complex to implement and manage.
Passwords
Passwords are the most common method for "something you know."
However, they come with challenges:
Problems with Passwords
Humans are bad at creating and remembering secure passwords.
Weak passwords (e.g., "123456" or "password") are easy to guess.
Users often reuse passwords across multiple accounts.
Best Practices for Passwords
Use passphrases or random characters.
Include a mix of letters, numbers, and symbols (e.g.,
"0nceuP0nAt1m8").
Require periodic password changes and enforce complexity rules.
Experiment Results
Passwords based on passphrases are easier to remember and harder
to crack than random passwords.
Password Attacks
Password attacks aim to guess, steal, or recover passwords to gain
unauthorized access. They exploit weaknesses in user behavior, system
design, or cryptographic protections.
Types of Attacks
1. Brute Force Attack
Definition: Systematically attempts every possible combination of
characters until the correct password is found.
Characteristics:
o Time-consuming but guaranteed to succeed eventually.
o Computationally expensive, depending on password complexity
and length.
Example:
o Alice's password is "aBc123". A brute-force attacker tries all
combinations:
"aaa...", "aab...", ..., "aBc123".
Challenges for Attackers:
o Long passwords with high entropy (randomness) significantly
increase the time required.
2. Dictionary Attack
Definition: Uses a precompiled list of commonly used passwords
(e.g., "password123", "qwerty") to match against stored hashes.
Process:
1. The attacker creates a "dictionary" of possible passwords.
2. Hashes each password in the dictionary using the same
algorithm as the target system.
3. Compares the resulting hashes with those in the password
database.
Example:
o Alice’s password is "P@ssw0rd". The attacker uses a dictionary
containing "password", "123456", and "P@ssw0rd". Once the
hash matches, the password is cracked.
Why It’s Effective:
o Many users choose predictable, common passwords, making
this attack faster than brute force.
3. Social Engineering
Definition: Manipulates human behavior to obtain passwords or
sensitive information.
Techniques:
o Phishing: Fake emails or websites trick users into entering their
credentials.
Example: Alice receives an email mimicking Bob’s IT
department asking her to "reset her password" by clicking
a link.
o Pretexting: The attacker pretends to be someone trustworthy
(e.g., IT admin).
Example: An attacker calls Alice pretending to be Bob's
system admin and asks for her password to "fix an issue."
o Baiting: Offers a lure (e.g., a USB drive labeled "Company
Secrets") to trick users into compromising their systems.
4. Rainbow Table Attack
Definition: Utilizes precomputed tables of hashes for all possible
passwords.
Process:
o The attacker compares hashes in the table to those in the
password database.
Why It’s Dangerous:
o It eliminates the need to compute hashes during the attack,
making it faster than brute force.
Defense: Salting passwords (see below).
5. Credential Stuffing
Definition: Reuses stolen credentials from one site to access other
sites where users may have reused passwords.
Example:
o An attacker obtains Alice’s password from a data breach of a
shopping site and uses it to log into her email or banking
accounts.
6. Keylogging and Spyware
Definition: Malware records keystrokes or captures screens to steal
credentials.
Example:
o A keylogger records every key Alice types, capturing her
username and password as she logs in to Bob's server.
7. Shoulder Surfing
Definition: Observing someone directly to steal credentials.
Example:
o An attacker watches Alice type her password at a café.
Defense Mechanisms
1. Salting
Definition: Adds a unique, random value (salt) to each password
before hashing.
How It Works:
o The password is hashed as y=h(password,salt)y = h(\
text{password}, \text{salt})y=h(password,salt).
o Even if two users have the same password, their hashes differ
because their salts are unique.
Benefits:
o Prevents precomputed attacks (e.g., rainbow tables).
o Forces attackers to recompute hashes for every salt, increasing
the computational cost.
Example:
o Without salting:
Password "Alice123" always hashes to the same value,
h("Alice123")=abc123h(\text{"Alice123"}) =
abc123h("Alice123")=abc123.
o With salting:
Salt = "xyz".
h("Alice123","xyz")=def456h(\text{"Alice123"}, \
text{"xyz"}) = def456h("Alice123","xyz")=def456.
Same password with a different salt yields a different
hash.
2. Iterative Hashing
Definition: Hashes a password multiple times to slow down attacks.
Algorithms:
o PBKDF2, bcrypt, Argon2.
Effect:
o Increases the computational cost for each hash attempt,
slowing down brute force and dictionary attacks.
3. Password Retry Limit
Definition: Limits the number of incorrect login attempts before
locking the account temporarily or permanently.
Options:
o Lock for a specific time (e.g., 5 minutes).
o Require administrator intervention to unlock.
Trade-offs:
o Too short a lockout (e.g., 5 seconds) may still allow slow brute-
force attacks.
o Too long a lockout (e.g., until admin resets) could enable denial-
of-service (DoS) attacks.
4. Multi-Factor Authentication (MFA)
Definition: Requires multiple factors (e.g., password + phone-based
OTP) to authenticate.
Example:
o Even if Alice’s password is compromised, the attacker cannot
log in without her smartphone-generated OTP.
5. User Education
Teach users to:
o Recognize phishing attempts.
o Avoid using predictable passwords.
o Not reuse passwords across sites.
6. Secure Password Storage
Hash Algorithms:
o Use strong hash algorithms like bcrypt, PBKDF2, or Argon2 to
secure stored passwords.
Do Not Store Plaintext Passwords:
o Only store the hashed and salted versions.
7. CAPTCHA
Definition: Prevents automated bots from attempting brute force or
dictionary attacks.
Example:
o Bob’s login system requires Alice to solve a CAPTCHA after 3
failed login attempts.
Combining Defenses: Layered Security
To mitigate password attacks effectively:
1. Strong Password Policies:
o Enforce minimum length, complexity, and periodic changes.
2. Implement MFA:
o Adds an extra layer of protection beyond passwords.
3. Monitor and Log:
o Continuously monitor login attempts for anomalies (e.g., rapid
retries).
4. Educate Users:
o Make users aware of risks like phishing and credential reuse.
5. Regular Audits:
o Use tools to identify weak passwords or breaches.
Password Generators
Password generators are a type of token-based authentication system.
They are used to dynamically generate secure, temporary passwords that
are valid for a single session or transaction.
How Password Generators Work
1. Challenge-Response Mechanism:
o Bob’s system (server) sends a random challenge RRR (e.g., a
random number or a timestamp) to Alice.
o Alice inputs the challenge RRR along with her PIN (something
she knows) into her password generator device.
o The password generator uses a cryptographic function
h(K,R)h(K, R)h(K,R), where:
KKK: A secret key shared between Alice’s device and Bob’s
server.
hhh: A cryptographic hash function or algorithm.
o The device computes the result and displays it to Alice.
2. Response:
o Alice sends the computed result h(K,R)h(K, R)h(K,R) to Bob as
her one-time password (OTP).
3. Verification:
o Bob, who also knows KKK, independently computes h(K,R)h(K,
R)h(K,R) using the same RRR he sent to Alice.
o If Alice's response matches Bob's computation, authentication
is successful.
Key Features of Password Generators
1. One-Time Use:
o The generated password is valid for only one session or
transaction, reducing the risk of replay attacks.
2. Shared Secret Key:
o Both Alice’s device and Bob’s system share the same secret
key KKK, which is crucial for generating consistent OTPs.
3. Dynamic Challenges:
o The challenge RRR ensures that each generated password is
unique, even if Alice’s PIN remains the same.
Benefits of Password Generators
1. Enhanced Security:
o Dynamic, session-specific passwords are much harder to crack
compared to static passwords.
2. Resistant to Replay Attacks:
o Since the password is valid only for a specific challenge, it
cannot be reused even if intercepted.
3. Reduced Human Error:
o Users don’t have to remember complex, static passwords.
Web Cookies
Web cookies are small text files stored on a user’s device by websites.
They enable websites to "remember" users across sessions, maintaining a
state in the inherently stateless HTTP protocol.
How Web Cookies Work
1. Storing Information:
o When Alice visits Bob’s website, the server sends a cookie to
her browser with a unique identifier.
2. Session Continuity:
o On subsequent requests, Alice’s browser sends the cookie back
to Bob’s server, allowing the server to recognize her.
3. Authentication Cookies:
o After Alice logs in, Bob’s server creates an authentication
cookie to track her session.
Benefits of Cookies
Session Management:
Cookies maintain state across multiple page visits or interactions.
Example:
o Alice adds items to her shopping cart, and cookies ensure her
cart persists as she navigates Bob’s e-commerce site.
Convenience:
Users don’t need to log in repeatedly during a session.
Example:
o Alice logs into her online banking app, and cookies keep her
authenticated until she logs out.
Concerns with Cookies
1. Theft or Hijacking
Cross-Site Scripting (XSS):
o Attackers inject malicious scripts into trusted websites to steal
cookies.
o Example:
An attacker steals Alice’s authentication cookie via an XSS
vulnerability, gaining unauthorized access to Bob’s
website.
Mitigation:
o Implement HTTP-only cookies (inaccessible to JavaScript).
o Use secure cookies transmitted over HTTPS.
2. Privacy Concerns
Cookies can track user behavior across websites for targeted
advertising or analytics.
Example:
o Alice visits a news website, which sets a third-party tracking
cookie. Advertisers later target her with ads based on her
reading habits.
Mitigation:
o Use browser settings or extensions to block third-party cookies.
o Provide clear privacy policies to users.
3. Weak Authentication
Cookies can be stolen or manipulated, allowing attackers to
impersonate users.
Example:
o An attacker copies Alice’s session cookie to impersonate her on
Bob’s website.
Enhancing Cookie Security
1. Use Secure Flags:
o Ensure cookies are transmitted only over HTTPS by setting the
Secure flag.
2. HTTP-Only Cookies:
o Prevent access to cookies from client-side scripts.
3. Session Expiration:
o Implement time limits for session cookies to reduce the impact
of theft.
4. SameSite Attribute:
o Restricts cookies from being sent with cross-site requests,
mitigating CSRF attacks.