Access Control (Authorization)

Updated 5 Oct 2026

CSS454 — Access Control (Authorization)

เป้าหมาย: เข้าใจว่าใครเข้าถึงอะไรได้บ้าง, ผ่าน Policy แบบไหน, และจัดการ Identity ยังไง


1. พื้นฐาน Access Control

1.1 Flow ของ Access Control

User ──► Authentication ──► Access Control Function ──► System Resources
                                     ▲
Security Admin ◄──► Authorization Database
                                     ▼
                               Auditing (บันทึกทุก interaction)

1.2 สี่ Policy หลัก

Policyตัดสินจากตัวอย่าง
DACIdentity ของ Requestor + Access rulesGoogle Drive owner กำหนด permission
MACSecurity labels vs Security clearancesMilitary classification
RBACRole ของ User ในระบบNurse, Doctor, Admin มี permission ต่างกัน
ABACAttributes ของ User + Resource + Environmentเข้าได้แค่จาก US location

2. Subjects, Objects, และ Access Rights

EntityคืออะไรClasses / Examples
Subjectผู้เข้าถึง ObjectOwner, Group, World
ObjectResource ที่ถูก AccessFile, Database, Process
Access Rightวิธีที่ Subject เข้าถึง ObjectRead, Write, Execute, Delete, Create, Search

3. Discretionary Access Control (DAC)

  • Owner ของ Resource กำหนดเองว่าใครเข้าถึงได้
  • Owner มักเป็น Creator ของ Resource นั้น
  • ใช้ Access Matrix เป็นโครงสร้างหลัก

อุปมา: Google Drive — คนสร้าง File เป็นคนกำหนดว่าใคร View หรือ Edit ได้

3.1 Access Matrix

SUBJECTSFile 1File 2File 3File 4
User AOwn, R, W—Own, R, W—
User BROwn, R, WWR
User CR, WR—Own, R, W

3.2 สามรูปแบบของ Access Matrix

(a) Access Control List (ACL) — มองจาก Object ว่าใครเข้าได้บ้าง

File 1 → A: Own/R/W,  B: R,  C: R/W
File 2 → B: Own/R/W,  C: R
File 3 → A: Own/R/W,  B: W
File 4 → B: R,  C: Own/R/W

(b) Capability List — มองจาก User ว่าเข้าถึง File ไหนได้บ้าง

User A → File 1: Own/R/W,  File 3: Own/R/W
User B → File 1: R,  File 2: Own/R/W,  File 3: W,  File 4: R
User C → File 1: R/W,  File 2: R,  File 4: Own/R/W

⚠️ Final Exam: อาจารย์ให้ Access Matrix มา แล้วให้วาด ACL หรือ Capability List ออกมาได้เลย

(c) Authorization Table — แสดงแบบ Row-by-row (Subject, Mode, Object)

SubjectAccess ModeObject
AOwn/Read/WriteFile 1
AOwn/Read/WriteFile 3
BReadFile 1
BOwn/Read/WriteFile 2
.........

3.3 Extended Access Matrix

  • Subjects สามารถเป็น Object ได้ด้วย (e.g., S1S_1 มี Control เหนือ S2S_2)
  • รองรับ Process operations: wakeup, stop, execute
  • รองรับ Disk operations: seek
  • Copy flag (*) — Permission ที่มี * สามารถโอนให้คนอื่นได้

3.4 Protection Domains

  • Set of objects + access rights ที่จัดกลุ่มเข้าด้วยกัน
  • แต่ละ Row ใน Access Matrix = Protection Domain หนึ่ง
  • User spawn Process ได้ด้วย Access rights subset ของตัวเอง
  • User mode — Memory บางส่วน Protected, บาง Instruction ทำไม่ได้
  • Kernel mode — ทำ Privileged instructions ได้, เข้า Protected memory ได้

อุปมา: เหมือน Security clearance ในตึก — พนักงานทั่วไปเข้าล็อบบี้ได้ แต่ Server room ต้องได้รับอนุญาตพิเศษ


4. UNIX File Access Control

4.1 Inodes (Index Nodes)

  • UNIX บริหาร File ผ่าน inode — Control structure เก็บ Key information ของ File
  • หลาย File names → inode เดียวได้
  • inode ที่ Active → ผูกกับ หนึ่ง File เท่านั้น
  • เก็บ: File attributes, permissions, control info
  • ตอน File ถูก Open → inode ถูก Load ขึ้น Main memory

4.2 UNIX File Permissions

  • User มี User ID และ Group ID
  • 12 Protection bits:
rw-   r--   ---
[Owner] [Group] [Other]
Classความหมาย
Ownerคนสร้าง File
Groupกลุ่มที่ Owner อยู่ด้วย
Otherทุกคนที่เหลือ

อุปมา: เหมือนบัตรห้องสมุด — Owner ยืม/คืนได้, Group อ่านในห้องได้, Others ไม่มีสิทธิ์


5. Mandatory Access Control (MAC)

  • ระบบ กำหนด Security level ให้ทุก Information
  • User แต่ละคนมี Security clearance
  • User เข้าถึงได้เฉพาะ Data ที่มี Clearance ถึง

Read Down: clearance≥classification ของ Object\boxed{\text{Read Down: clearance} \geq \text{classification ของ Object}} Write Up: clearance≤classification ของ Object\boxed{\text{Write Up: clearance} \leq \text{classification ของ Object}}

Ruleความหมายทำไม?
Read Downอ่านได้เฉพาะ Object ที่ Classification ≤ Clearance ตัวเองป้องกันการรั่วไหลข้อมูลชั้นสูง
Write Upเขียนได้เฉพาะ Object ที่ Classification ≥ Clearance ตัวเองป้องกัน Data leakage ลงชั้นล่าง

อุปมา: Military clearance — "Top Secret" คนอ่าน "Secret" ได้ แต่เขียนไปยัง "Classified" ไม่ได้ (ป้องกันข้อมูลรั่วลงระดับล่าง)


6. Role-Based Access Control (RBAC)

  • User เข้าถึง Object ตาม Role ที่ได้รับ
  • Role ถูกออกแบบตาม Job functions (Accountant, IT Support, CFO...)
  • ระบบสนใจ Role ของ User ไม่ใช่ตัว User โดยตรง

อุปมา: โรงพยาบาล — Nurse ฉีดยาได้, Doctor สั่งยาได้, แต่ Janitor เข้าถึงบันทึกผู้ป่วยไม่ได้ ถ้าคนออก Role → Permission หายทันที

Key Advantage: Users เปลี่ยนบ่อย แต่ Roles ไม่เปลี่ยน → ลด Admin overhead

6.1 RBAC Framework

RBAC0RBAC_0 — Core RBAC (พื้นฐานที่ทุกระบบต้องมี)

Componentความหมาย
USERSผู้ใช้งานทั้งหมด
ROLESบทบาทที่กำหนด
SESSIONSSession ที่ User ใช้งาน (1 User → หลาย Sessions)
PRMSPermissions (OPS × OBS)
UAUser Assignment — Many-to-many ระหว่าง User และ Role
PAPermission Assignment — Many-to-many ระหว่าง Role และ Permission

RBAC1RBAC_1 — Hierarchical RBAC

  • เพิ่ม Role Hierarchy (RH) — Role สูงกว่า Inherit Permission ของ Role ต่ำกว่า
  • General hierarchy — Multiple inheritance ได้
  • Limited hierarchy — มี Ascendant หลายอันได้ แต่ Descendant ทันทีได้แค่อันเดียว
Cardiologist
    ↑
Specialist ← (inherits Doctor + Intern)
    ↑           ↑
  Doctor      Intern

RBAC2RBAC_2 — Constraints (SSD + DSD)

Static Separation of Duty (SSD)

  • ป้องกัน Conflict of interest ระดับ Authorization (ถาวร)
  • User ไม่สามารถมีทั้งสอง Role ที่ Conflict กันได้
  • ตัวอย่าง: พนักงานธนาคาร ไม่สามารถเป็นทั้ง Teller และ Auditor ได้

Dynamic Separation of Duty (DSD)

  • ป้องกัน Conflict ระดับ Session (Runtime)
  • User มีทั้งสอง Role ได้ แต่ Activate พร้อมกันไม่ได้
  • ตัวอย่าง: มีทั้ง Teller และ Account Holder แต่ใช้พร้อมกันไม่ได้
AspectSSDDSD
ScopeAuthorization (ถาวร)Session (Runtime)
ตัวอย่างTeller ≠ Auditor (ห้ามมีทั้งคู่)Teller ≠ Account Holder (มีได้แต่ใช้พร้อมกันไม่ได้)
Flexibilityน้อยมาก

อุปมา: SSD = ห้ามมีทั้ง License ขับรถและ Taxi permit พร้อมกัน. DSD = มีได้ทั้งคู่ แต่ใช้พร้อมกันไม่ได้

RBAC3RBAC_3 — Consolidated Model

  • รวมทุกอย่าง: Core + Hierarchy + Constraints
RBAC₀ — Core
RBAC₁ — Core + Hierarchy
RBAC₂ — Core + SSD/DSD
RBAC₃ — Core + Hierarchy + SSD/DSD (ครบ)

6.2 Constraints ใน RBAC

ประเภทความหมายตัวอย่าง
Mutually Exclusive RolesUser มีได้แค่ Role เดียวใน Setไม่สามารถเป็นทั้ง Maker และ Approver
Cardinalityจำกัดจำนวน User สูงสุดต่อ RoleRole Approver max 3 คน
Prerequisite Rolesต้องมี Role A ก่อนถึงจะได้ Role Bต้องเป็น Grad Student ก่อนถึงจะเป็น TA ได้

7. Least Privilege & Zero-Standing Privilege

7.1 Principle of Least Privilege (PoLP)

  • User ได้รับ Permission น้อยที่สุดเท่าที่จำเป็น สำหรับงานของตัวเอง
  • ตัวอย่าง: DB Retrieval account ไม่ควรมี Admin rights
  • ตัวอย่าง: Code Developer ไม่ควรเข้าถึง Financial data

7.2 Zero-Standing Privilege (ZSP)

⚠️ Final Exam แน่นอน!

  • Core Goal: ลบ Persistent privileged access ทั้งหมดออก → ลด Attack surface
  • วิธีทำงาน: แทนที่จะมี Admin rights ตลอดเวลา → Request access สำหรับงานนั้นๆ แล้ว Revoke อัตโนมัติ หลังหมดเวลา
  • ต้องใช้: Privileged Access Management (PAM) solution
ด้านรายละเอียด
ประโยชน์ลด Cyber risk, รองรับ GDPR/HIPAA, ลด Insider threats
ความท้าทายUser productivity ลด, Implementation ซับซ้อน, ต้องมี Automated workflows

8. Attribute-Based Access Control (ABAC)

  • ตัดสินจาก Attributes ของ Subject + Object + Environment
  • Fine-grained AC (ละเอียดระดับบุคคล) ≠ RBAC ที่เป็น Coarse-grained (ระดับ Role)
  • Standard: XACML (eXtensible Access Control Markup Language)

8.1 สี่ประเภทของ Attributes

Attributeคืออะไรตัวอย่าง
Subjectตัวตนและลักษณะของ UserUsername, Department, Clearance
Objectลักษณะของ ResourceType, Owner, Classification, Date Created
EnvironmentContext สิ่งแวดล้อมLocation, Time, Device
Actionการกระทำที่ขอRead, Write, View, Transfer, Delete

8.2 Flow ของ ABAC

Subject Request ──► Access Control Mechanism
                         ├── Access Control Policy
                         ├── Subject Attributes
                         ├── Object Attributes
                         └── Environment Conditions
                              ↓
                         Decision → Enforce on Object

8.3 ABAC Policy Examples

ตัวอย่าง Policy: "US Sales data สามารถเข้าถึงได้โดย US Marketing department จาก US location"

Example 1 ✅Example 2 ❌
ObjectUS Sales dataUS Sales data
SubjectUS Marketing deptUS Marketing dept
EnvironmentLocation: New York, USLocation: London, UK
DecisionAccess GrantedAccess Denied

8.4 RBAC vs ABAC

AspectRBACABAC
GranularityCoarse-grained (Role level)Fine-grained (Individual level)
Implementationง่าย (Assign role ทีเดียว)ยากกว่า (ต้องกำหนด Attribute rules)
Policy formatRule-based, DBRule-based, XACML
Expressivenessต่ำกว่าสูงกว่า

9. ICAM — Identity, Credential, and Access Management

พัฒนาโดย U.S. Government เพื่อจัดการ Digital identities, Credentials, และ Access แบบครบวงจร

9.1 สามส่วนหลัก

1. Identity Management

  • จุดประสงค์: สร้าง Trustworthy digital identity ที่ Independent จาก Application ใดๆ
  • Lifecycle includes:
    • ปกป้อง Personal identity information
    • Control access to identity data
    • แชร์ Identity data กับ Application ที่ต้องการ
    • Revocation ของ Enterprise identity

2. Credential Management

Credential = Object ที่ Bind identity กับ Token อย่างน่าเชื่อถือ ตัวอย่าง Credential: Smart card, Cryptographic key, Digital certificate

5 Logical Components:

  1. Authorize/specify the need for a credential
  2. Credential Enrollment
  3. Generation of Credential
  4. Credential Issuance
  5. Maintenance

3. Access Management

  • จัดการว่า Entity ได้รับ Access to resources ยังไง (ทั้ง Physical และ Logical)
  • 3 Support elements:
Elementความหมาย
Resource managementกำหนด Rules สำหรับ Resource (credential requirements, conditions)
Privilege managementสร้างและดูแล Entitlement/privilege attributes ของ User
Policy managementกำหนดว่า Access transaction ไหน Allow/Deny

9.2 Identity Federation

"Trust digital identities ที่สร้างโดย Organization อื่น"

แก้ปัญหาสองข้อ:

  • เชื่อ Identity ของคนจาก Org อื่นได้ยังไง?
  • รับรอง Identity ของคนในองค์กรเราเมื่อไปทำงานกับ Org อื่น?

อุปมา: บัตรนักศึกษาที่ใช้ยืมหนังสือที่มหาวิทยาลัย Partner ได้ — เชื่อกระบวนการ Verify ของอีก Org

Flow:

User → Service Provider (SP) → Redirect Authentication → Identity Provider (IdP)
                                                               ↓
                                                     ID Token ← ─────────────
                                                         ↓
                                              Access Multiple Services

Real-world examples: AWS IAM Federation, Azure AD Federation, Google Cloud Identity

9.3 Zero Trust Identity

"Never trust, always verify!"

Access decisions ขึ้นกับ:

  • Identity — เป็นใคร?
  • Device — ใช้อุปกรณ์อะไร?
  • Location — อยู่ที่ไหน?
  • Behavior — พฤติกรรมผิดปกติไหม?

9.4 Federation Attacks & Prevention

AttackPrevention
Token replay attacksShort lifetime + Nonce
Man-in-the-middleTLS everywhere + Strict Certificate Validation
Token forgerySign token + Encrypted payload
Session hijackToken binding (to device/certificate/TLS session)

9.5 Future Directions

  • Decentralized Identity (DID)
  • Self-Sovereign Identity (SSI)
  • Blockchain-based identity systems

10. สรุปภาพรวม

TopicKey Concepts
DACAccess Matrix → ACL (มองจาก File), Capability List (มองจาก User)
MACRead Down / Write Up — ป้องกัน Data leakage
RBACRBAC₀ Core → RBAC₁ Hierarchy → RBAC₂ SSD/DSD → RBAC₃ ครบ
ABACSubject + Object + Environment + Action attributes, XACML, Fine-grained
Least Privilegeให้ Permission น้อยที่สุดเท่าที่จำเป็น
ZSPไม่มี Persistent access — Request เมื่อต้องการ, Auto-revoke
ICAMIdentity + Credential + Access management
FederationTrust identity จาก Org อื่น, Zero Trust: Never trust always verify
DAC  → Owner กำหนดเอง          → ยืดหยุ่น แต่เสี่ยง
MAC  → ระบบกำหนด Level          → Secure แต่ Rigid
RBAC → Role-based              → Balance ระหว่าง Security และ Usability
ABAC → Attribute-based         → Fine-grained สุด แต่ Complex สุด

CSS454 Computer Security — Access Control (Authorization) Cheat Sheet