Post Page Advertisement [Top]



Click here to send WhatsApp On Unsaved Mobile Numbers For Free

 

Ethical Hacking Access Control & Broken Access Control | Day 29
Ethical Hacking

🛡️ Ethical Hacking — Day 29

Access Control & Broken Access Control

⚠️ LEARNING PURPOSE ONLY: This tutorial is strictly for educational and defensive cybersecurity learning. Perform all practical exercises only on systems you own, intentionally vulnerable training applications, or environments where you have explicit authorization. Never attempt to access another user's data or bypass permissions on a real system without authorization.

Welcome to Day 29 of the Ethical Hacking learning series.

Today, we will learn about:

🔐 Access Control & Broken Access Control

A user may successfully log in to an application but still should not be allowed to access everything.

For example:

USER LOGS IN
     │
     ▼
AUTHENTICATION SUCCESSFUL
     │
     ▼
ACCESS CONTROL CHECK
     │
 ┌───┴────┐
 ▼        ▼
ALLOW     DENY

This is where authorization and access control become extremely important.


🎯 Day 29 Learning Objectives

By the end of this tutorial, you will understand:

  • What access control is

  • Authentication vs authorization

  • Broken access control

  • Horizontal access control

  • Vertical access control

  • IDOR concepts

  • Role-Based Access Control (RBAC)

  • Attribute-Based Access Control (ABAC)

  • Least privilege

  • Server-side authorization

  • Client-side vs server-side security

  • Access control testing methodology

  • Safe local lab exercises

  • Linux practical session

  • Windows practical session

  • macOS practical session

  • Burp Suite testing in an authorized lab

  • Laravel authorization

  • Spring Boot authorization


1. What Is Access Control?

Access control determines:

Who is allowed to access which resource or perform which action?

For example:

USER
 │
 ▼
REQUEST RESOURCE
 │
 ▼
ACCESS CONTROL CHECK
 │
 ├── Authorized → ALLOW
 │
 └── Unauthorized → DENY

2. Authentication vs Authorization

These concepts are related but different.

Authentication

Authentication asks:

WHO ARE YOU?

Example:

Username + Password

Authorization

Authorization asks:

WHAT ARE YOU ALLOWED TO DO?

Example:

Can this user:
- View this record?
- Edit this record?
- Delete this record?
- Access the admin panel?

Remember:

AUTHENTICATION = IDENTITY

AUTHORIZATION = PERMISSIONS

3. What Is Broken Access Control?

Broken access control occurs when an application does not correctly enforce permissions.

Conceptually:

USER
 │
 ▼
REQUESTS RESTRICTED RESOURCE
 │
 ▼
APPLICATION FAILS TO CHECK PERMISSION
 │
 ▼
UNAUTHORIZED ACCESS

The key problem is:

The application trusts the user when it should verify permissions.


4. Why Access Control Matters

Imagine an ERP application with different users:

ADMIN
MANAGER
EMPLOYEE
CUSTOMER

Each role should have appropriate permissions.

For example:

ActionAdminManagerEmployeeCustomer
Manage Users✔Limited✖✖
View Reports✔✔Limited✖
Edit Own Profile✔✔✔✔
Manage System Settings✔✖✖✖

A secure system should enforce these permissions on the server.


5. The Principle of Least Privilege

The principle of least privilege means:

Give users only the permissions they need.

Conceptually:

USER
 │
 ▼
ONLY REQUIRED ACCESS
 │
 ▼
REDUCED SECURITY RISK

Avoid:

EVERY USER
    │
    ▼
ADMIN ACCESS

6. Horizontal Access Control

Horizontal access control separates users with similar privilege levels.

Example:

User A → Own Profile
User B → Own Profile
User C → Own Profile

A problem occurs if:

User A
  │
  ▼
Accesses User B's private data

without permission.

Conceptually:

USER A  ──────X──────> USER B DATA

7. Vertical Access Control

Vertical access control separates users with different privilege levels.

Example:

ADMIN
  │
MANAGER
  │
EMPLOYEE
  │
CUSTOMER

A problem occurs when a lower-privileged user can perform an action intended only for a higher-privileged role.

Conceptually:

EMPLOYEE
   │
   X
   ▼
ADMIN FUNCTION

8. Horizontal vs Vertical Access Control

HORIZONTAL ACCESS CONTROL
─────────────────────────

User A ──X──> User B Data


VERTICAL ACCESS CONTROL
───────────────────────

Employee ──X──> Admin Function

Both require proper server-side authorization checks.


9. What Is IDOR?

IDOR stands for:

Insecure Direct Object Reference

An IDOR-type issue can occur when an application exposes a direct reference to an object but does not properly verify whether the requesting user is authorized to access it.

Example concept:

/profile/1001

The server should verify:

Who is requesting this?

Are they authorized to access profile 1001?

The object identifier alone should never be treated as authorization.


10. Object Reference vs Authorization

Consider:

GET /orders/123

The application should not simply assume:

User knows 123
       │
       ▼
Therefore allow access

Instead:

REQUEST
   │
   ▼
IDENTIFY USER
   │
   ▼
IDENTIFY RESOURCE
   │
   ▼
CHECK PERMISSION
   │
 ┌─┴─┐
 ▼   ▼
ALLOW DENY

11. Important IDOR Defense

The main defense principle is:

Verify authorization for every sensitive object request.

For example:

User requests Order #123
          │
          ▼
Does this user own the order?
          │
      ┌───┴───┐
      ▼       ▼
     YES      NO
      │       │
      ▼       ▼
    ALLOW    DENY

12. Role-Based Access Control (RBAC)

RBAC stands for:

Role-Based Access Control

Permissions are assigned based on roles.

Example:

ROLE
 │
 ├── ADMIN
 │      ├── Manage Users
 │      ├── View Reports
 │      └── Configure System
 │
 ├── MANAGER
 │      ├── View Team
 │      └── View Reports
 │
 └── EMPLOYEE
        ├── View Own Data
        └── Update Own Profile

13. RBAC Example

USERS
  │
  ▼
ASSIGNED ROLE
  │
  ▼
ROLE PERMISSIONS
  │
  ▼
ALLOW / DENY

Example:

Rohit
   │
   ▼
Manager
   │
   ▼
View Team Reports
Approve Leave Requests

14. Attribute-Based Access Control (ABAC)

ABAC makes authorization decisions using attributes.

Examples may include:

User Role
Department
Location
Time
Resource Owner
Employment Status

Conceptually:

USER ATTRIBUTES
       +
RESOURCE ATTRIBUTES
       +
ENVIRONMENT CONDITIONS
       │
       ▼
AUTHORIZATION DECISION

15. RBAC vs ABAC

RBACABAC
Based mainly on rolesBased on attributes and policies
Easier for many systemsMore flexible
Example: AdminExample: Department = HR
Common in business appsUseful for complex rules

Many applications combine multiple authorization approaches.


16. Access Control Should Be Server-Side

One major security principle is:

Never rely only on the user interface to enforce security.

For example:

HIDE ADMIN BUTTON

does not automatically mean:

USER CANNOT ACCESS ADMIN FUNCTION

The server must verify permissions.


17. Client-Side vs Server-Side Security

Client-Side

Browser
JavaScript
HTML
CSS

Client-side controls can improve usability.

But users control their own browsers.


Server-Side

REQUEST
   │
   ▼
SERVER
   │
   ▼
AUTHORIZATION CHECK

Sensitive access decisions should be enforced server-side.


18. Deny by Default

A secure authorization model often follows:

NO EXPLICIT PERMISSION
        │
        ▼
       DENY

Instead of:

ALLOW EVERYTHING
        │
        ▼
BLOCK SOME THINGS

The first approach is generally easier to reason about securely.


19. Access Control Matrix

Create an access matrix before developing a system.

Example:

ResourceAdminManagerEmployee
UsersCreate/Edit/DeleteView✖
ReportsFullTeam OnlyOwn Only
ProfileFullOwnOwn
SettingsFull✖✖

This helps developers clearly define expected permissions.


20. Access Control Testing Methodology

For an authorized application:

1. Define test users
        ↓
2. Identify roles
        ↓
3. Identify protected resources
        ↓
4. Define expected permissions
        ↓
5. Test authorized actions
        ↓
6. Test unauthorized access safely
        ↓
7. Verify server response
        ↓
8. Document findings

🧪 Practical Lab Setup

For today's exercises, use:

  • Your own application

  • A local application

  • An intentionally vulnerable training application

  • A dedicated test environment

Create two test users:

User A
User B

Optionally create:

Admin User
Regular User

Never use another person's account.


21. Safe Object Authorization Exercise

Suppose your local application has:

/orders/100
/orders/101

Your goal is not to access unauthorized production data.

Instead, create test records owned by your own test accounts.

Example:

Test User A owns Order A
Test User B owns Order B

Now document the expected behavior:

User A requests Order A → ALLOW

User A requests Order B → DENY

This is how authorization testing should be performed in a safe lab.


22. Expected Secure Response

When access is not permitted, an application may respond with an appropriate error.

Common HTTP responses include:

401 Unauthorized
403 Forbidden
404 Not Found

The appropriate response depends on the application's design and security requirements.

Do not assume that every situation requires the same response.


23. Linux Practical Session

Today, we will review users, groups, and file permissions on your own Linux system.

Check Current User

whoami

Check User Identity

id

Example information may include:

User ID
Group ID
Groups

View Your Groups

groups

This helps you understand group-based access.


24. Linux File Permissions

Create a safe practice directory:

mkdir -p ~/access-control-lab
cd ~/access-control-lab

Create a file:

touch test.txt

Check permissions:

ls -l

You may see something similar to:

-rw-r--r--  test.txt

25. Understanding Linux Permissions

Example:

-rw-r--r--

Can be understood as:

OWNER  → rw-
GROUP  → r--
OTHERS → r--

Where:

r = Read
w = Write
x = Execute

26. Safe Linux Permission Exercise

Create a private test file:

echo "Private lab data" > private.txt

Restrict it to the current user:

chmod 600 private.txt

Check:

ls -l private.txt

The purpose is to understand:

Who can read?
Who can write?
Who can execute?

⚠️ Practice only inside your own lab directory. Do not randomly change permissions on important system files.


27. Linux Access Control Concepts

Important commands for learning include:

whoami
id
groups
ls -l
chmod

Use:

man chmod

to learn more about permission management.


28. Windows Practical Session

Open PowerShell.

Check your current identity:

whoami

View detailed identity information:

whoami /all

29. View Local Groups

On systems where appropriate permissions are available:

Get-LocalGroup

View local users:

Get-LocalUser

These commands help you understand local account structures.


30. Windows File Permissions

Create a safe test directory:

mkdir "$HOME\access-control-lab"

Create a test file:

"Private lab data" | Out-File "$HOME\access-control-lab\private.txt"

View permissions:

Get-Acl "$HOME\access-control-lab\private.txt" | Format-List

31. Understanding Windows ACLs

Windows commonly uses:

Access Control Lists (ACLs)

Conceptually:

FILE
 │
 ▼
ACCESS CONTROL LIST
 │
 ├── User A → Read
 ├── User B → Read + Write
 └── Administrator → Full Control

The goal is to understand:

WHO
CAN DO WHAT
ON WHICH RESOURCE

32. Windows Practical Exercise

Inspect the ACL of a file you created yourself.

Ask:

Who owns the file?

Which users have access?

Which permissions are granted?

Are unnecessary permissions present?

Do not modify system ACLs without understanding their purpose.


33. macOS Practical Session

Open Terminal.

Check the current user:

whoami

Check identity:

id

View groups:

groups

34. macOS File Permission Lab

Create a safe directory:

mkdir -p ~/access-control-lab
cd ~/access-control-lab

Create a test file:

echo "Private lab data" > private.txt

Check permissions:

ls -l private.txt

35. macOS Permission Exercise

Restrict your test file:

chmod 600 private.txt

Verify:

ls -l private.txt

Use:

stat private.txt

for additional information.


36. Compare Linux and macOS Permissions

Both systems use familiar Unix-style permission concepts:

READ
WRITE
EXECUTE

Common commands include:

whoami
id
groups
ls -l
chmod

However, system administration details may differ.


37. Burp Suite Access Control Testing

Use only an authorized application.

Create at least two test users that you control:

TEST USER A
TEST USER B

Then:

1. Log in as User A
2. Access User A's own test resource
3. Capture the request
4. Record the expected authorization behavior
5. Verify that server-side controls enforce ownership

Do not test real third-party accounts.


38. Safe Burp Suite Baseline

Document requests such as:

GET /profile/me HTTP/1.1

Observe:

Request method
Response status
Session behavior
Authorization controls
Returned data

The goal is to understand how your application enforces permissions.


39. Role-Based Testing Matrix

Create a table for your own application:

FeatureAdminUser AUser B
View Own Profile✔✔✔
Edit Own Profile✔✔✔
View Other User's ProfileControlled✖✖
Manage Users✔✖✖
System Settings✔✖✖

Then verify your application behaves according to the intended design.


40. Testing Authorization Safely

Use this methodology:

EXPECTED ACCESS
       │
       ▼
TEST USER REQUEST
       │
       ▼
SERVER AUTHORIZATION CHECK
       │
 ┌─────┴─────┐
 ▼           ▼
EXPECTED    UNEXPECTED
RESULT       RESULT
 │             │
 ▼             ▼
DOCUMENT    INVESTIGATE

Always test with accounts and data created for the lab.


41. Common Broken Access Control Mistakes

❌ Mistake 1 — Trusting the URL

Example:

/orders/123

Knowing an identifier must not automatically grant permission.


❌ Mistake 2 — Hiding Buttons Only

Hide Admin Button

is not the same as:

Block Admin Action

The server must enforce the restriction.


❌ Mistake 3 — Checking Permissions Only Once

Permissions should be evaluated where needed.

Sensitive actions and resources require appropriate checks.


❌ Mistake 4 — Giving Too Many Permissions

Avoid:

EVERYONE = ADMIN

Follow least privilege.


❌ Mistake 5 — Trusting Client-Supplied Roles

Do not blindly trust:

role=admin

if it comes directly from an untrusted client request.

Authorization information must be securely managed and verified.


42. Laravel Authorization Security

Laravel provides multiple tools for authorization.

Important concepts include:

Middleware
Gates
Policies
User permissions
Role management

The goal is to ensure the application verifies permissions before sensitive actions occur.


43. Laravel Middleware Concept

Conceptually:

REQUEST
   │
   ▼
AUTHENTICATION
   │
   ▼
AUTHORIZATION MIDDLEWARE
   │
 ┌─┴─┐
 ▼   ▼
ALLOW DENY

Example routes should use appropriate middleware and authorization checks based on the application's design.


44. Laravel Policies

Policies help organize authorization logic around models or resources.

Conceptually:

USER
 │
 ▼
POLICY CHECK
 │
 ▼
RESOURCE

Example question:

Can this user update this specific record?

The application should verify ownership or other relevant permissions.


45. Laravel Security Principles

☐ Authenticate users
☐ Authorize sensitive actions
☐ Use middleware appropriately
☐ Use policies for resource access
☐ Validate ownership
☐ Apply least privilege
☐ Do not trust client-side role values
☐ Log important authorization events
☐ Keep dependencies updated

46. Spring Boot Access Control

Spring applications can use security frameworks to manage:

Authentication
Authorization
Roles
Authorities
Method security
Endpoint security

Conceptually:

REQUEST
   │
   ▼
SPRING SECURITY
   │
   ▼
AUTHENTICATION
   │
   ▼
AUTHORIZATION
   │
 ┌─┴─┐
 ▼   ▼
ALLOW DENY

47. Spring Boot Authorization Principles

Review:

Roles
Authorities
Endpoint restrictions
Method-level authorization
Resource ownership
Session or token validation

Important rule:

Do not assume authentication automatically provides permission for every action.


48. Secure Access Control Architecture

                  USER
                    │
                    ▼
             AUTHENTICATION
                    │
                    ▼
             IDENTIFY ROLE
                    │
                    ▼
          CHECK PERMISSIONS
                    │
                    ▼
          CHECK RESOURCE ACCESS
                    │
              ┌─────┴─────┐
              ▼           ▼
            ALLOW        DENY
              │
              ▼
          AUDIT LOG

49. Day 29 Main Practical Challenge

Perform this exercise only in your own lab.

Step 1 — Create Two Test Users

In your local application:

Test User A
Test User B

Step 2 — Create Separate Test Data

User A → Test Record A

User B → Test Record B

Step 3 — Define Expected Permissions

User A → Can access Record A

User A → Cannot access Record B

Step 4 — Verify the Application

Test the intended access controls.

Document:

REQUEST:
________________

EXPECTED RESULT:
________________

ACTUAL RESULT:
________________

AUTHORIZATION VERIFIED?
YES / NO

50. Professional Access Control Finding Template

For an authorized assessment:

Title:
Broken Access Control

Affected Component:
________________

Affected Role:
________________

Description:
________________

Expected Behavior:
________________

Actual Behavior:
________________

Evidence:
________________

Verified Impact:
________________

Recommendation:
________________

Severity:
Based on demonstrated impact

Do not exaggerate findings.


📝 Day 29 Assignment

Answer the following questions:

  1. What is access control?

  2. What is the difference between authentication and authorization?

  3. What is broken access control?

  4. What is horizontal access control?

  5. What is vertical access control?

  6. What does IDOR mean?

  7. Why should object ownership be verified?

  8. What is RBAC?

  9. What is ABAC?

  10. What is the principle of least privilege?

  11. Why should authorization be enforced server-side?

  12. Why is hiding a button not enough for security?

  13. What does deny by default mean?

  14. What is an access control matrix?

  15. Why should permissions be documented?

  16. What is a Windows ACL?

  17. What do Linux file permissions control?

  18. What does chmod 600 mean conceptually?

  19. Why should test users be used during security testing?

  20. How can Burp Suite help analyze authorization?

  21. What are Laravel policies used for?

  22. What authorization features can Spring Security provide?

  23. Why should client-supplied roles not be blindly trusted?

  24. What is resource ownership validation?

  25. Why should access control findings be based on verified impact?


🏆 Day 29 Challenge

Create an access control design for a simple ERP system.

Use these roles:

ADMIN
HR
SALES
EMPLOYEE
CUSTOMER

Create a permissions table for:

Manage Users
View Employee Data
Manage Leads
View Reports
Edit Own Profile
Manage Settings

Then answer:

Which role truly needs each permission?

Apply:

LEAST PRIVILEGE
        +
SERVER-SIDE AUTHORIZATION
        +
RESOURCE OWNERSHIP CHECKS

🔐 Day 29 Golden Rules

Rule 1

Authentication identifies the user. Authorization determines what the user can do.

Rule 2

Never rely only on hidden buttons or client-side controls.

Rule 3

Verify authorization on the server.

Rule 4

Verify ownership before allowing access to sensitive resources.

Rule 5

Follow the principle of least privilege.

Rule 6

Use deny-by-default where appropriate.

Rule 7

Do not blindly trust client-supplied role information.

Rule 8

Practice access control testing only in authorized environments.


📚 Day 29 Summary

Today you learned:

  • Access control fundamentals

  • Authentication vs authorization

  • Broken access control

  • Horizontal access control

  • Vertical access control

  • IDOR concepts

  • Resource ownership validation

  • RBAC

  • ABAC

  • Least privilege

  • Server-side authorization

  • Client-side limitations

  • Deny-by-default concepts

  • Access control matrices

  • Linux users and file permissions

  • Windows ACL concepts

  • macOS permission concepts

  • Safe Burp Suite authorization testing

  • Laravel authorization

  • Spring Boot authorization

  • Professional security reporting


🔑 Most Important Lesson

A user being logged in does not mean the user should have access to everything.

Think:

AUTHENTICATION
      +
AUTHORIZATION
      +
RESOURCE OWNERSHIP
      +
LEAST PRIVILEGE
      =
STRONGER ACCESS CONTROL

🛡️ LEARN → PRACTICE SAFELY → VERIFY → DOCUMENT → SECURE


🔜 Day 30 — Security Monitoring, Logging & Incident Response Basics

Next, we will learn about:

  • Why security logging matters

  • Important security events

  • Log analysis fundamentals

  • Windows Event Viewer

  • Linux logs

  • macOS unified logs

  • Detecting suspicious activity

  • SIEM concepts

  • Incident response lifecycle

  • Evidence preservation

  • Safe log analysis labs

  • Linux practical session

  • Windows practical session

  • macOS practical session

  • Application logging with Laravel

  • Logging and monitoring with Spring Boot

  • Professional incident documentation

⚠️ LEARNING PURPOSE ONLY: All practical exercises must be performed only on systems you own or are explicitly authorized to administer and analyze.

No comments:

Post a Comment

Bottom Ad [Post Page]

rrkksinha.