1
CS 161, Summer 2026 @ UC Berkeley
Slides credit: Nick Weaver, Nicholas Ngai, Peyrin Kao, Henry Corrigan-Gibbs, Jonah Bedouch, MIT 6.1600 Staff
Access Control
Lecture 22 (Isolation 3)
Setting Security Policies
Lecture 22, CS 161, Summer 2026
Policies
Examples
Controlled Sharing
Isolation is great, but the components need to interact somehow.
Today: Building controlled sharing schemes.� Allow boxes to interact, according to some security policy we design.
When a box requests to interact with another box, the host takes three steps:
Authenticate
Learn who�is sending the request.
Authorize
Decide whether the request is allowed.�
Audit
Keep a log of all requests and decisions.
Remember to ensure complete mediation: Authenticate, authorize, audit every request!
Won't discuss auditing in detail.�Reminder: The auditing code should be in an isolated box, so attackers can't tamper with logs.
Generalizing with Principals and Objects
Informally: A box requests to interact with another box.
More formally: A principal requests to access an object.
Authenticate
Learn which principal is sending the request.
Authorize
Decide whether the request is allowed to access the object.
Audit
Keep a log of all requests and decisions.
Conceptual Security Policy: Access Control Matrix
A security policy can be modeled as a 2D matrix:
Conceptually simple, but not practical to use: the matrix gets too big.
| | The Principals | |||
| | EvanBot | CodaBot | PintoBot | BeeBot |
| pancake-recipe.txt | Read / Write | No Access | No Access | No Access |
waffle-recipe.txt | No Access | No Access | Read Only | No Access | |
scrambled-eggs-recipe.txt | No Access | Read / Write | No Access | No Access | |
hash-browns-recipe.txt | Read Only | No Access | No Access | Read / Write | |
The Objects
Practical Security Policy: Access Control List
Practical systems try to represent the matrix data in a more compact format.
Access control list (ACL): One list per object, with the permissions for that object.
pancake-recipe.txt | [ EvanBot: ReadWrite ] |
waffle-recipe.txt | [ PintoBot: ReadOnly ] |
scrambled-eggs-recipe.txt | [ CodaBot: ReadWrite ] |
hash-browns-recipe.txt | [ EvanBot: ReadOnly, BeeBot: ReadWrite ] |
Maintaining Security Policies (1/2)
Common problem: Lack of motivation to remove stale permissions.
Result: Security policies often drift to become too lenient.
Maintaining Security Policies (2/2)
ACLs can get very complicated. Real-world example:
Types of Security Policies
Lecture 22, CS 161, Summer 2026
Policies
Examples
Types of Security Policies
Discretionary Access Control (DAC)
Owner of the object sets its policy.�Owner could be creator of the object.�Other approaches exist.
Mandatory Access Control (MAC)
A security administrator sets the policy for all objects. (No relation to cryptographic MACs.)�
Types of Security Policies
Which type of policy is better? In practice, a mix is common.
More complex policies exist as well. Example: Role-Based Access Control (RBAC).
Delegation
Lecture 22, CS 161, Summer 2026
Policies
Examples
Delegation Complicates Access Control
A challenge is delegation: Requests travel multiple hops from principal to object.
By the time the request reaches the object, hard to say where the request came from.
User's web browser
User's laptop
gmail.com web server
Gmail back-end server
Database of emails
I want to delete this email.
The same request could be formatted as HTTP here...
...and later re-formatted as a SQL query here.
Who actually "sent" this request?
Authenticating/Authorizing Delegated Requests
If a request travels from A → B → C, should C authenticate/authorize A or B?
Treat the request as coming from A:
Treat the request as coming from B:
A
(Example: Employee Laptop)
B
(Example: Company Server)
C
(Example: Company Database)
Compound Principals
If a request travels from A → B → C, should C authenticate/authorize A or B?
Which approach is better? It depends.
A more sophisticated idea is compound principals: "The request is from A, via B."
A
(Example: Employee Laptop)
B
(Example: Company Server)
C
(Example: Company Database)
Scoping Delegated Permissions (1/2)
When delegating to other components, limiting the scope of delegation is important.
A
B
B can access my files.
Too broad.
A
B
B can access /users/evanbot/doodle.png for the next 3 hours.
Scoped to a specific object.
Scoped to a specific time.
Note: Picking the right time scope can be tricky, because it's not always clear how long a request will take.
Scoping Delegated Permissions (2/2)
An intermediate component must also limit scope when forwarding requests.
EvanBot
CodaBot
Mallory
Server
Sign(SKEvan, "Server can access my mail.")
Sign(SKCoda, "Server can access my mail.")
Delete Evan's emails.
Database
Sign(SKEvan, "Server can access my mail.")
Sign(SKCoda, "Server can access my mail.")
Delete Evan's emails.
Server must be careful to not attach unneeded permissions.
Capabilities
Lecture 22, CS 161, Summer 2026
Policies
Examples
Capabilities
Capabilities: If you know the name of the object, you can access the object.
Capabilities are an alternate approach to authentication and authorization.
Hybrid approach: ACLs for long-term objects, capabilities for short-term objects.
Short Examples of Access Control
Lecture 22, CS 161, Summer 2026
Policies
Examples
Access Control Example: Logging
Goal: Design an access control policy for interacting with a logging component.
Logger
delete_log_entry
edit_log_entry
read_log_entry
append_log_entry
Access Control Examples: OAuth2 Scopes (1/2)
Scenario: I write an app that wants to interact with Discord (an online messaging app).
The protocol for this is called OAuth2.
Access Control Examples: OAuth2 Scopes (2/2)
When a user clicks on the link that was generated by Discord, they see a request.
The user can approve or deny the request.
If the user approves, my app gets an OAuth Token, which acts as a capability, allowing it to access the requested resources from Discord.
The resources my app wants.
Long Example of Access Control: Firewalls
Lecture 22, CS 161, Summer 2026
Policies
Examples
Access Control Example: Firewalls
A firewall monitors incoming and outgoing network traffic,�according to some access control policy.
Firewalls enforce isolation by separating a trusted network (e.g. internal company network) from an untrusted network (e.g. the rest of the Internet).
Ensure Complete Mediation: All traffic must be checked by the firewall.
Internet
(Untrusted)
Firewall
Internal Company Network
Access Control Example: Firewalls
Example access control policy:
Internet
(Untrusted)
Firewall
Internal Company Network
Allow outbound traffic
Allow trusted inbound traffic
Deny other inbound traffic
Default-deny is better for security. (Default-allow is better for usability, but less secure.)
Enforcing Access Control: Stateless Packet Filters
A packet filter inspects a packet and decides to forward it or drop it.
Stateless packet filters have no persistent state.
Enforcing Access Control: Stateful Packet Filters
Stateful packet filters maintain state.
Example stateful policies:
Evading Packet Filters (1/3)
Running example policy: Deny all connections containing the string root.
Attack: Split the word root across TCP packets.
Attack: Send the split TCP packets out of order.
From: A | To: B |
Seq = 10 | |
Hello world | |
From: A | To: B |
Seq = 21 | |
Log in | |
✓
From: A | To: B |
Seq = 27 | |
as root | |
✗
✓
o
r
o
t
Firewall
o
r
o
t
Seq = 6
Seq = 4
Seq = 5
Seq = 7
Evading Packet Filters (2/3)
IP packets have a time-to-live (TTL).
The attacker can easily find how many hops away a given server is.
Attack: Send multiple packets with the same sequence number.
Seq = 4, TTL = 16
n
Seq = 4, TTL = 22
r
r
Seq = 5, TTL = 22
o
o
Seq = 5, TTL = 16
i
Seq = 6, TTL = 22
o
o
Seq = 6, TTL = 16
c
Seq = 7, TTL = 16
e
Seq = 7, TTL = 22
t
o
Firewall
Evading Packet Filters (3/3)
This attack is hard to stop, even for the stateful packet filter.
Seq = 4, TTL = 16
n
Seq = 4, TTL = 22
r
r
Seq = 5, TTL = 22
o
o
Seq = 5, TTL = 16
i
Seq = 6, TTL = 22
o
o
Seq = 6, TTL = 16
c
Seq = 7, TTL = 16
e
Seq = 7, TTL = 22
t
o
Firewall
Other Types of Firewalls: Proxy Firewalls
Proxy firewall: Instead of forwarding packets, form two separate connections:�One with the source, and one with the destination.
Firewall
Client (outside)
Server (inside)
TCP
TCP
From: Client | To: Server |
I like pancakes. | |
From: Client | To: Server |
I like pancakes. | |
From: Server | To: Client |
Me too! | |
From: Server | To: Client |
Me too! | |
Spoofed header field.
Spoofed header field.
Alternatives to Allowing Firewall Traffic: VPNs
A virtual private network (VPN) allows someone outside of a network to access the network, as though they were inside.
Service
Internal Company Network
Firewall
Internet (Insecure)
Encrypted Tunnel
VPN
User
Firewall Pros and Cons
Benefits:
Drawbacks: