![]() |
| Ethical Hacking |
🛡️ Ethical Hacking — Day 28
Authentication Security & Password Attack Defense
⚠️ LEARNING PURPOSE ONLY: This tutorial is strictly for educational and defensive cybersecurity learning. Perform practical exercises only on systems, accounts, and applications you own or are explicitly authorized to test. Do not attempt password attacks against third-party accounts or systems.
Welcome to Day 28 of the Ethical Hacking learning series.
Today, we will learn about:
🔐 Authentication Security & Password Attack Defense
Authentication is one of the most important security layers in any application.
If authentication is weak:
ATTACKER
│
▼
WEAK AUTHENTICATION
│
▼
UNAUTHORIZED ACCESSA strong authentication system helps ensure:
The person or system requesting access is genuinely authorized.
🎯 Day 28 Learning Objectives
By the end of today's tutorial, you will understand:
What authentication is
Authentication vs authorization
Password security fundamentals
Weak password risks
Password hashing
Salting concepts
Multi-factor authentication (MFA)
Rate limiting
Account lockout concepts
Credential stuffing
Password spraying concepts
Brute-force protection
Secure session management
Login error handling
Logging and monitoring authentication events
Linux practical session
Windows practical session
macOS practical session
Burp Suite authentication analysis in a safe lab
Laravel authentication security
Spring Boot authentication security
1. What Is Authentication?
Authentication answers the question:
Who are you?
Examples include:
Username + Password
Passkey
One-Time Code
Security Key
Biometric AuthenticationConceptually:
USER
│
▼
LOGIN
│
▼
VERIFY IDENTITY
│
┌┴┐
▼ ▼
YES NO
│ │
▼ ▼
ACCESS DENY2. Authentication vs Authorization
These terms are often confused.
Authentication
WHO ARE YOU?Example:
User logs in successfully.Authorization
WHAT ARE YOU ALLOWED TO DO?Example:
Can this user access the admin dashboard?Remember:
Authentication = Identity
Authorization = Permission3. Why Password Security Matters
Passwords protect many important systems:
Email
Web Applications
Cloud Accounts
Databases
Business Systems
Financial ServicesWeak passwords increase the risk of unauthorized access.
4. Common Weak Password Problems
Examples of poor password practices include:
Short passwords
Common passwords
Reused passwords
Predictable passwords
Sharing passwords
Storing passwords in plain textFor example:
password123
admin123
company2026These types of passwords are predictable and should not be used.
5. Strong Password Principles
A stronger password should generally be:
LONG
UNIQUE
UNPREDICTABLEA passphrase can be easier to remember while still providing strong length.
Example concept:
Correct-Random-Words-ExampleDo not reuse example passwords from tutorials for real accounts.
A password manager can help generate and store unique passwords.
6. Password Reuse
Imagine one password is used everywhere:
EMAIL ─────┐
BANK ─────┤
WORK ─────┼── SAME PASSWORD
SOCIAL ────┤
APP ─────┘If one service is compromised, password reuse can increase risk elsewhere.
The better approach:
EVERY IMPORTANT ACCOUNT
│
▼
UNIQUE PASSWORD7. What Is Password Hashing?
Applications should not normally store passwords as readable plain text.
Instead:
PASSWORD
│
▼
HASH FUNCTION
│
▼
PASSWORD HASHConceptually:
Password:
MyPasswordExample
Stored:
$hashed-value...The application verifies passwords by using an appropriate password hashing mechanism.
8. Password Hashing Is Not Encryption
These are different concepts.
Encryption
DATA
│
▼
ENCRYPT
│
▼
ENCRYPTED DATA
│
▼
DECRYPT WITH KEY
│
▼
ORIGINAL DATAPassword Hashing
PASSWORD
│
▼
PASSWORD HASHThe original password should not simply be recoverable from the stored hash.
9. Modern Password Hashing
For password storage, use well-established password hashing functions designed for passwords.
Examples include:
Argon2
bcrypt
PBKDF2The correct choice depends on your platform and requirements.
Avoid creating your own password hashing system.
10. What Is a Salt?
A salt is additional random data used as part of secure password hashing.
Conceptually:
PASSWORD
+
RANDOM SALT
│
▼
PASSWORD HASHThis helps ensure that identical passwords do not automatically result in identical stored password hashes.
Modern password libraries typically manage salting appropriately.
11. Why Plain-Text Password Storage Is Dangerous
Never design a production application like this:
users
-----------------
username
passwordwhere the password column contains readable passwords.
A compromise could expose users immediately.
Instead:
users
-----------------
username
password_hashUse trusted framework features for password hashing.
12. Multi-Factor Authentication (MFA)
MFA requires more than one type of verification.
Examples:
Something You Know
+
Something You HaveFor example:
PASSWORD
+
AUTHENTICATOR CODEOr:
PASSKEYMFA can provide an important additional security layer.
13. Authentication Factors
Authentication factors are commonly grouped as:
Something You Know
Password
PINSomething You Have
Security Key
Authenticator DeviceSomething You Are
Fingerprint
Face RecognitionCombining appropriate factors can improve account protection.
14. Brute-Force Attacks — Concept
A brute-force attack involves repeated attempts to guess authentication credentials.
Conceptually:
LOGIN ATTEMPT
│
▼
FAIL
│
▼
REPEATDefensive controls should prevent unlimited authentication attempts.
⚠️ Do not perform credential-guessing attacks against accounts or systems without explicit authorization.
15. Rate Limiting
Rate limiting restricts how frequently an action can occur.
Example:
LOGIN REQUESTS
│
▼
RATE LIMIT CHECK
│
┌────┴────┐
▼ ▼
ALLOW LIMITFor example, an application might temporarily restrict excessive repeated requests.
The correct threshold depends on the application's risk and usability requirements.
16. Account Lockout Concepts
Some systems temporarily restrict login attempts after repeated failures.
Conceptually:
FAILED ATTEMPTS
│
▼
THRESHOLD REACHED
│
▼
TEMPORARY PROTECTIONHowever, poorly designed lockouts can create denial-of-service problems.
A good design balances:
SECURITY
+
USABILITY
+
AVAILABILITY17. Credential Stuffing
Credential stuffing involves attempting credentials obtained from one breach against another service.
The main defense for users is:
UNIQUE PASSWORDS
+
MFAFor applications:
Rate Limiting
Anomaly Detection
Credential Breach Monitoring
MFA18. Password Spraying — Concept
Password spraying generally refers to attempting a small number of common passwords across many accounts rather than repeatedly targeting one account.
The defensive lesson is:
Monitoring should consider suspicious patterns across multiple accounts, not only repeated failures for a single account.
19. Secure Login Error Messages
Avoid unnecessarily revealing whether a username exists.
Less secure:
User does not exist.or:
Incorrect password.A more controlled approach may use:
Invalid username or password.The right design depends on the application's usability and security requirements.
20. Secure Login Flow
A secure login process may look like:
USER
│
▼
LOGIN REQUEST
│
▼
INPUT VALIDATION
│
▼
RATE LIMIT CHECK
│
▼
USER VERIFICATION
│
▼
PASSWORD HASH VERIFICATION
│
▼
MFA CHECK
│
▼
SESSION CREATION
│
▼
AUTHENTICATED USER21. Session Management
After successful authentication, applications often create a session.
Conceptually:
LOGIN
│
▼
SESSION CREATED
│
▼
SESSION IDENTIFIER
│
▼
SUBSEQUENT REQUESTSSession security is extremely important.
22. Session Security Principles
Consider:
Secure Cookies
HttpOnly
SameSite
HTTPS
Session Expiration
Session Rotation
Logout
Idle TimeoutA session should not remain valid forever without an appropriate business reason.
23. Session Fixation — Concept
Session fixation is a risk where an attacker attempts to influence or predict a session identifier before authentication.
A common defense principle is:
Regenerate or rotate session identifiers at important authentication events.
Modern frameworks often provide mechanisms to support this.
24. Secure Logout
A proper logout process should invalidate or appropriately terminate the user's authenticated session.
Conceptually:
USER
│
▼
LOGOUT
│
▼
SESSION INVALIDATED
│
▼
LOGIN REQUIRED AGAINDo not assume simply hiding a button provides security.
25. Password Reset Security
Password reset features are high-value targets.
A secure process should consider:
Strong reset tokens
Short expiration
Single use
Secure delivery
Rate limiting
Identity verification
LoggingNever expose reset tokens in logs.
26. Authentication Logging
Useful events to monitor may include:
Successful login
Failed login
MFA failure
Password reset request
Password changed
Account recovery
Suspicious loginLogs should be protected because they may contain sensitive information.
Do not log:
Passwords
Authentication secrets
Full session tokens
MFA secrets27. Linux Practical Session
Today we will safely inspect authentication-related activity on your own machine.
Check Current User
whoamiView Logged-In Users
whoView User Identity Information
idView Recent Login Records
Depending on your Linux distribution:
lastThese commands are for understanding your own local system.
28. Linux — Check SSH Configuration Safely
If you use SSH on your own machine or server, inspect its configuration.
For example:
sudo sshd -TThis displays effective SSH daemon configuration on systems where the command is available.
You can review settings related to:
Password authentication
Root login
Authentication methodsDo not change production authentication settings without understanding the impact and ensuring you have a safe recovery method.
29. Linux — Check Failed Authentication Logs
Log locations vary by distribution.
Examples may include:
sudo journalctl -u sshor other system authentication logs depending on your Linux distribution.
The goal is to learn:
What authentication events are logged?
What does a failed login look like?
What information is recorded?30. Windows Practical Session
Open PowerShell.
Check Current User
whoamiView Current Identity
whoami /allView Local Users
Get-LocalUserView Recent Security Events
On systems where you have appropriate permissions, you can inspect Windows Event Logs using Event Viewer.
PowerShell example:
Get-WinEvent -LogName Security -MaxEvents 10Some security events require administrative permissions.
31. Windows — Password Policy
On your own Windows machine, review the password policy:
net accountsObserve settings such as:
Minimum password length
Password age
Lockout policyDo not weaken security settings for testing.
32. macOS Practical Session
Open Terminal.
Check Current User
whoamiView User Identity
idView Logged-In Users
whoReview Account Information
dscl . list /UsersThis command may list local user accounts.
Focus on understanding which accounts exist on your own machine.
33. macOS — Authentication Logs
macOS logging can be inspected with:
log show --predicate 'process == "loginwindow"' --last 1hLog availability varies depending on the macOS version and privacy settings.
Use logs only for systems you own or administer.
34. Practical Exercise — Authentication Inventory
Create this table in your notes:
SYSTEM:
________________________
AUTHENTICATION METHOD:
________________________
MFA ENABLED?
YES / NO
SESSION TIMEOUT:
________________________
RATE LIMITING:
YES / NO / UNKNOWN
PASSWORD POLICY:
________________________
PASSWORD STORAGE:
HASHED / UNKNOWN
SECURITY IMPROVEMENT:
________________________35. Burp Suite Authentication Analysis
Use only:
Your own application
A deliberately vulnerable training application
A local test environment
A system where you have written authorization
Start Burp Suite and inspect your application's login request.
Example structure:
POST /login HTTP/1.1
username=test-user
password=test-passwordDo not use real production passwords in shared screenshots or documentation.
36. Establish a Baseline
Record:
Login endpoint:
________________
Authentication method:
________________
HTTPS enabled?
YES / NO
Cookies set?
YES / NO
Secure attribute?
YES / NO
HttpOnly attribute?
YES / NO
SameSite attribute?
YES / NO37. Safe Burp Suite Exercise
Use a test account you created yourself.
Observe:
Request method
Response status
Session cookie behavior
Redirect after login
Logout behavior
Error messagesYour goal is to understand the authentication flow—not to attack other users' accounts.
38. Authentication Testing Checklist
For an authorized application, review:
☐ HTTPS enforced
☐ Passwords transmitted securely
☐ Passwords stored using secure hashing
☐ MFA available where appropriate
☐ Rate limiting implemented
☐ Excessive failures monitored
☐ Error messages reviewed
☐ Sessions rotated after login
☐ Secure cookie attributes configured
☐ Logout invalidates sessions
☐ Password reset tokens expire
☐ Reset tokens are single-use
☐ Sensitive secrets are not logged39. Laravel Authentication Security
Laravel provides authentication tools and integrations.
Important security practices include:
Use Laravel's built-in password hashing
Use authentication middleware
Enable HTTPS
Configure secure session cookies
Use rate limiting
Regenerate sessions after authentication
Protect password reset functionality
Keep Laravel updatedAvoid creating your own password hashing logic.
40. Laravel Password Hashing
Laravel provides secure hashing facilities.
Conceptually:
use Illuminate\Support\Facades\Hash;
$hash = Hash::make($password);Verification should use the framework's supported functionality.
Example concept:
Hash::check($password, $storedHash);Do not compare plain-text passwords with stored values.
41. Laravel Rate Limiting
Authentication endpoints should be protected against excessive requests.
Conceptually:
LOGIN
│
▼
RATE LIMITER
│
├── Normal → Continue
│
└── Excessive → Temporarily LimitUse Laravel's supported rate-limiting features and configure limits based on your application's needs.
42. Spring Boot Authentication Security
Spring applications can use security frameworks to manage:
Authentication
Authorization
Password hashing
Session management
CSRF protection
Rate limiting integrationsKey principles include:
Use strong password encoders
Protect authentication endpoints
Secure sessions
Use HTTPS
Review error responses
Secure management endpoints
Keep dependencies updated43. Spring Password Encoding
Spring Security provides password encoders designed for password storage.
Conceptually:
PASSWORD
│
▼
PASSWORD ENCODER
│
▼
STORED HASHUse supported framework mechanisms rather than implementing custom cryptographic code.
44. Authentication Defense Architecture
A stronger design looks like:
USER
│
▼
HTTPS
│
▼
LOGIN FORM
│
▼
INPUT VALIDATION
│
▼
RATE LIMITING
│
▼
PASSWORD VERIFICATION
│
▼
MFA
│
▼
SESSION ROTATION
│
▼
SECURE SESSION COOKIE
│
▼
AUTHORIZED ACCESS45. Common Authentication Mistakes
❌ Mistake 1 — Plain-Text Password Storage
Never store production passwords as readable text.
❌ Mistake 2 — Weak Password Policies
Security should encourage:
Length
Uniqueness
Unpredictability❌ Mistake 3 — Unlimited Login Attempts
Repeated authentication attempts should be controlled and monitored.
❌ Mistake 4 — Revealing Too Much in Errors
Avoid unnecessarily confirming:
This username exists.when it is not needed.
❌ Mistake 5 — Weak Password Reset Tokens
Reset tokens should be:
Random
Short-lived
Single-use
Protected❌ Mistake 6 — Insecure Sessions
Review:
Secure
HttpOnly
SameSite
Expiration
Rotation
Invalidation❌ Mistake 7 — Logging Secrets
Never intentionally log:
Passwords
Full session tokens
MFA secrets
Reset tokens46. Day 28 Main Practical Challenge
Perform this exercise on your own machine.
Step 1 — Identify Your Current User
Linux
whoami
idWindows
whoami
whoami /allmacOS
whoami
idStep 2 — Review Authentication Policy
Linux
Review your local authentication configuration according to your distribution.
Windows
net accountsmacOS
Review the local user accounts:
dscl . list /UsersStep 3 — Inspect an Authorized Login Application
Using your own local application, check:
HTTPS
Login response
Session cookie
Logout behavior
Error messages
Rate limitingStep 4 — Document Your Findings
APPLICATION:
________________
LOGIN METHOD:
________________
MFA:
YES / NO
SESSION COOKIE:
________________
RATE LIMITING:
________________
PASSWORD HASHING:
________________
LOGGING:
________________
SECURITY IMPROVEMENT:
________________47. Professional Authentication Finding Template
For an authorized security assessment:
Title:
Authentication Security Issue
Affected Component:
________________
Description:
________________
Evidence:
________________
Verified Impact:
________________
Recommended Fix:
________________
Severity:
Based on actual demonstrated impactNever exaggerate the impact.
📝 Day 28 Assignment
Answer the following questions:
What is authentication?
What is authorization?
What is the difference between authentication and authorization?
Why are weak passwords dangerous?
Why should passwords be unique?
What is password hashing?
How is hashing different from encryption?
What is a salt?
Name three modern password hashing approaches.
Why should passwords never be stored as plain text?
What is MFA?
Name three types of authentication factors.
What is brute-force protection?
What is rate limiting?
What is credential stuffing?
What is password spraying?
Why should login errors be carefully designed?
What is session management?
Why should session identifiers be rotated?
What makes a password reset token secure?
What authentication events should be logged?
What secrets should never be logged?
How can Laravel help secure authentication?
What should Spring applications use for password storage?
Why should authentication findings be based on verified impact?
🏆 Day 28 Challenge
Create this secure authentication architecture in your notes:
┌─────────────┐
│ USER │
└──────┬──────┘
│
▼
┌─────────────┐
│ HTTPS │
└──────┬──────┘
│
▼
┌─────────────┐
│ LOGIN INPUT │
└──────┬──────┘
│
▼
┌─────────────┐
│ RATE LIMIT │
└──────┬──────┘
│
▼
┌─────────────┐
│ VERIFY HASH │
└──────┬──────┘
│
▼
┌─────────────┐
│ MFA │
└──────┬──────┘
│
▼
┌─────────────┐
│ ROTATE ID │
└──────┬──────┘
│
▼
┌─────────────┐
│SECURE SESSION│
└─────────────┘Add:
Logging
Monitoring
Alerts
Session Timeout
Secure Logout
Password Reset Protection🔐 Day 28 Golden Rules
Rule 1
Authentication proves identity. Authorization controls permissions.
Rule 2
Passwords must be stored using secure password hashing—not plain text.
Rule 3
Use unique, long, and unpredictable passwords.
Rule 4
MFA provides an important additional layer of protection.
Rule 5
Protect login endpoints with appropriate rate limiting and monitoring.
Rule 6
Secure session creation, rotation, expiration, and logout.
Rule 7
Never log passwords, reset tokens, or authentication secrets.
Rule 8
Practice authentication testing only in authorized environments.
📚 Day 28 Summary
Today you learned:
Authentication fundamentals
Authentication vs authorization
Password security
Password reuse risks
Password hashing
Salting concepts
MFA
Authentication factors
Brute-force defense concepts
Rate limiting
Account protection
Credential stuffing concepts
Password spraying concepts
Secure login messages
Session management
Session rotation
Secure logout
Password reset security
Authentication logging
Linux practical commands
Windows practical commands
macOS practical commands
Burp Suite authentication analysis
Laravel authentication security
Spring Boot authentication security
Professional security reporting
🔑 Most Important Lesson
A secure login system is not just:
USERNAME + PASSWORDIt is:
STRONG IDENTITY VERIFICATION
+
SECURE PASSWORD STORAGE
+
RATE LIMITING
+
MFA
+
SECURE SESSION MANAGEMENT
+
LOGGING & MONITORING🛡️ LEARN → PRACTICE IN YOUR OWN LAB → UNDERSTAND → DEFEND
🔜 Day 29 — Access Control & Broken Access Control
Next, we will learn about:
What access control is
Authentication vs authorization
Horizontal access control
Vertical access control
IDOR concepts
Role-Based Access Control (RBAC)
Least privilege
Access control testing methodology
Safe local lab exercises
Linux, Windows, and macOS practical sessions
Burp Suite access control testing in an authorized lab
Laravel authorization
Spring Boot authorization
⚠️ LEARNING PURPOSE ONLY: All practical exercises must remain limited to systems you own, intentionally vulnerable labs, and environments where you have explicit authorization to test.

No comments:
Post a Comment