π Lecture 44 β Overview of todayβs lecture
π Overview: This lecture provides a comprehensive overview of security mechanisms across several major operating systems, including Java, UNIX, and Windows, and introduces SELinux. It covers critical concepts like setuid programs, access control lists (ACLs), tokens, security descriptors, and the reference monitor, culminating in a summary of what constitutes a secure OS, including the distinction between Discretionary Access Control (DAC) and Mandatory Access Control (MAC) and the Orange Book criteria.
ποΈ Topics Covered
The lecture covers Java security examples, UNIX file security including permissions, setuid, setgid, and sticky bits, and process IDs (RUID, EUID, SUID). It then details Windows (NTFS) access control with tokens, SIDs, permission inheritance, security descriptors, and the reference monitor. SELinux is introduced with its security abstractions and kernelized design. Finally, the lecture summarizes features of a secure OS including DAC vs. MAC, assurance methods, and the Orange Book security evaluation criteria (Levels D through A1).
π Lecture Summary
Java Security (2)
Examples of specified protection with JDK 1.2 are an extension of previously discussed Java security concepts.
Unix file security
- Each file has an owner and a group.
- Permissions are set by the owner for read, write, and execute access, categorized by owner, group, and other.
- Permissions are represented by a vector of four octal values.
- Only the owner or root can change permissions; this privilege cannot be delegated or shared.
- Setid bits are discussed later.
π Definition β Owner privilege resolution: When an owner has fewer privileges than "other", the system uses a prioritized resolution: if the user is the owner, owner permissions apply; else if the user is in the group, group permissions apply; else, other permissions apply.
Setid bits on executable Unix file
There are three setid bits:
- Setuid: Sets the Effective User ID (EUID) of the process to the ID of the file owner.
- Setgid: Sets the Effective Group ID (EGID) of the process to the GID of the file.
- Sticky bit:
- Off: If a user has write permission on a directory, they can rename or remove files, even if they are not the owner.
- On: Only the file owner, directory owner, and root can rename or remove a file in the directory.
Effective user id (EUID)
Each process has three IDs (plus more under Linux):
- Real user ID (RUID): Same as the user ID of the parent process (unless changed); it determines which user started the process.
- Effective user ID (EUID): Comes from the set user ID bit on the file being executed or a system call; it determines the permissions for the process (file access and port binding).
- Saved user ID (SUID): Stores the previous EUID so it can be restored.
- Real group ID and effective group ID are used similarly.
Process Operations and IDs
- Root: Has an ID=0 for the superuser and can access any file.
- Fork and Exec: Inherit the three IDs, except when executing a file with the setuid bit set.
- Setuid system calls:
seteuid(newid)can set the EUID to the Real ID or Saved ID (regardless of current EUID), or to any ID if the current EUID is 0. - Details are actually more complicated, with several different calls:
setuid,seteuid,setreuid.
π Example: The lecture text implies an example exists but does not explicitly state it. The caution is that setuid programs can do anything the file owner is allowed to do, so they must ensure they do not take action for an untrusted user or return secret data to an untrusted user. Anything is possible if root; there is no middle ground between user and root.
Unix summary
- Good things: Provides some protection from most users and is flexible enough to make things possible.
- Main bad thing: It is too tempting to use root privileges, and there is no way to assume some root privileges without all root privileges.
Access control in Windows (NTFS)
- Some basic functionality is similar to Unix, specifying access for groups and users (read, modify, change owner, delete).
- Additional concepts include Tokens and Security attributes.
- Generally, it offers more flexibility than Unix, allowing the definition of new permissions and the ability to give some, but not all, administrator privileges.
Security ID (SID)
- A Security ID (SID) is an identity that replaces the UID.
- It consists of a SID revision number, a 48-bit authority value, and a variable number of Relative Identifiers (RIDs) for uniqueness.
- Users, groups, computers, domains, and domain members all have SIDs.
Permission Inheritance
- Static permission inheritance (Win NT): Subfolders initially inherit permissions of the folder. The folder and subfolder are changed independently. The "Replace Permissions on Subdirectories" command eliminates any differences.
- Dynamic permission inheritance (Win 2000): Children inherit parent permissions and remain linked. Parent changes are inherited, except for explicit settings. Inherited and explicitly-set permissions may conflict, with resolution rules that positive permissions are additive and negative permissions (deny access) take priority.
Tokens
- The Security Reference Monitor uses tokens to identify the security context of a process or thread, which consists of the privileges and groups associated with it.
- An impersonation token is used temporarily by a thread to adopt a different security context, usually of another user.
π Definition β Impersonation Tokens: A process uses the security attributes of another. The client passes an impersonation token to the server. The client specifies an impersonation level:
- Anonymous: Token has no information about the client.
- Identification: Server obtains the SIDs of the client and its privileges, but cannot impersonate.
- Impersonation: Server identifies and impersonates the client.
- Delegation: Lets server impersonate client on local and remote systems.
Security Descriptor
- Information associated with an object that defines who can perform what actions on the object.
- Fields include a Header (revision number, control flags, memory layout), the SID of the object's owner, the SID of the primary group, and two optional lists: Discretionary Access Control List (DACL) (users, groups) and System Access Control List (SACL) (system logs).
π Example access request: The lecture text mentions an example but does not provide a specific scenario in the provided text.
SELinux
- Security-enhanced Linux system (NSA) enforces separation of information based on confidentiality and integrity requirements.
- Mandatory Access Control (MAC) is incorporated into the major subsystems of the kernel to limit tampering, bypassing of application security mechanisms, and confine damage from malicious applications.
- Why Linux? It is open source, already subject to public review, and the NSA could review, modify, and extend its source code.
SELinux Security Policy Abstractions
- Type enforcement: Each process has an associated domain, and each object has an associated type. Configuration files specify how domains are allowed to access types and allowable interactions between domains.
- Role-based access control: Each process has an associated role (separating system and user processes). Configuration files specify the set of domains that may be entered by each role.
Kernelized Design
- Trusted Computing Base (TCB): The hardware and software for enforcing security rules.
- Reference monitor: Part of the TCB; all system calls go through it for security checking. Most OS are not designed this way.
What makes a βsecureβ OS?
- Extra security features: Stronger authentication (e.g., token + password), more security policy options (e.g., only let users read a file for a specific purpose), and logging.
- More secure implementation: Apply secure design and coding principles, assurance and certification (code audit or formal verification), and maintenance procedures (applying patches).
Sample Features of βTrusted OSβ
- Mandatory access control (MAC): Not under user control, with precedence over DAC.
- Object reuse protection: Write over old data when file space is allocated.
- Complete mediation: Prevent any access that circumvents the monitor.
- Audit: Log security-related events and check logs.
- Intrusion detection: Anomaly detection (learn normal activity, report abnormal actions) and attack detection (recognize patterns associated with known attacks).
DAC and MAC
- Discretionary Access Control (DAC): Restricts a subject's access to an object (e.g., limit a user's access to a file). The owner of the file controls other users' accesses.
- Mandatory Access Control (MAC): Needed when security policy dictates that protection decisions must not be left to the object owner, and the system enforces a security policy over the wishes or intentions of the object owner.
π Definition β DAC vs. MAC:
- DAC: Object owner has full power; complete trust in users; decisions are based only on user id and object ownerships; impossible to control information flow.
- MAC: Object owner CAN have some power; only trust in administrators; objects and tasks themselves can have ids; makes information flow control possible.
Audit
- Log security-related events.
- Protect audit log by writing to a write-once non-volatile medium.
- Audit logs can become huge, so manage size by following a policy (e.g., audit only first/last access by a process to a file, do not record routine, expected events). This makes storage and analysis more feasible.
Assurance methods
- Testing: Can demonstrate existence of a flaw, not absence.
- Formal verification: Time-consuming, painstaking process.
- βValidationβ: Requirements checking, design and code reviews, module and system testing.
Orange Book Criteria
- Level D: No security requirements.
- Level C: For environments with cooperating users.
- C1: Protected mode OS, authenticated login, DAC, security testing and documentation (e.g., Unix).
- C2: DAC to the level of individual user, object initialization, auditing (e.g., Windows NT 4.0).
- Level B, A: All users and objects must be assigned a security label (classified, unclassified, etc.). System must enforce the Bell-LaPadula confidentiality model.
π Definition β Levels B, A:
- Level B1: Classification and Bell-LaPadula.
- Level B2: System designed in a top-down modular way; must be possible to verify security of modules.
- Level B3: ACLs with users and groups; formal TCB must be presented; adequate security auditing; secure crash recovery.
- Level A1: Formal proof of the protection system, formal proof that the model is correct, and demonstration that the implementation conforms to the model.
β Key Takeaways
The most critical aspects of OS security from this lecture include the fundamental difference between DAC (where the object owner controls access) and MAC (where the system enforces policy independent of the owner). Understanding the setuid/setgid mechanism in Unix is crucial for recognizing a common privilege escalation vector. Windows' security model relies on tokens (especially for impersonation) and Security Descriptors (with DACL and SACL) for fine-grained access control. The Orange Book criteria provide a historic framework for evaluating system security, from Level D (no security) to Level A1 (formally proven security). Finally, a secure OS requires features like complete mediation (reference monitor), audit logs, and intrusion detection, beyond just basic access control.
π§ Quick Revision Questions
- In Unix file security, if the file owner has fewer permissions than "other", what happens when the owner tries to access the file?
- What is the purpose of the Effective User ID (EUID) in a Unix process, and how does the setuid bit affect it?
- In Windows, what is the difference between an Impersonation Level of "Identification" and one of "Impersonation"?
- What are the two main security policy abstractions used by SELinux to enforce Mandatory Access Control?
- According to the Orange Book criteria, what are the minimum requirements for a system to be classified at Level C1, and what additional requirement is added for Level C2?
π Lecture 45 β Overview of today's lectures
π Overview: This lecture surveys advanced operating system research directions and emerging technologies, with a focus on reliability challenges in commodity OSes, mobile security risks, and the Symbian OS architecture. It also introduces Virtual Machine Monitors (VMMs) and provides a comprehensive review of memory management and I/O topics covered throughout the course.
ποΈ Topics Covered
This lecture begins with OS research directions, followed by the Nooks approach to improving reliability of commodity OSes. It then covers mobile phone risks including toll fraud, theft, availability threats, and attack vectors. The Symbian OS for mobile devices is examined in detail, including its architecture, security features, and limitations. Virtual Machine Monitors are introduced with concepts of virtualization, privileged instruction handling, and virtualization conditions. The lecture concludes with a quick review of memory management topics (paging, segmentation, TLB, page replacement, thrashing), file systems (allocation methods, FFS, journaling), and I/O subsystems (DMA, interrupt handling, device drivers).
π Lecture Summary
OS research directions
The lecture outlines multiple research directions in operating systems. A major direction is improving reliability of commodity OSes like Windows and Linux. Other directions include addressing mobile phone risks and security issues, studying embedded operating systems like Symbian OS, and exploring Virtual Machine Monitors (VMMs). The lecture also covers asynchronous I/O interfaces in the Linux kernel. Finally, it provides a quick review of all memory management and I/O topics.
Reliability in commodity OSes (e.g. Nooks)
The Nooks approach addresses the problem that device drivers are a major source of OS crashes. Drivers are run in protection domains defined by hardware and software, similar to how processes are isolated. This requires kernel modification to implement the isolation mechanism. The solution is good not only for drivers but also for other kernel extensions, such as in-kernel file systems.
Mobile phone risks
Mobile phones face multiple categories of risk:
Toll fraud includes:
- Auto dialers that secretly call premium numbers
- High cost SMS/MMS messages
- Phone Proxy that uses the device for unauthorized calls
Loss or theft risks include:
- Data loss
- Data compromise
- Loss of Identity (caller ID being misused)
Availability threats include:
- SPAM messages
- Destruction of the device (flash memory)
- Destruction of data
Risks induced by usage include:
- Mobile banking vulnerabilities
- Confidential e-mail and documents
- Device present at confidential meetings enabling snooping
Attack vectors are numerous and include: Executables, Bluetooth, GPRS/GSM, OTA (Over-The-Air), IrDa (Infrared), Browser, SMS/MMS, SD card, WAP, E-mail β "too many entry points to list all."
π‘ Why this matters: The proliferation of mobile devices with multiple connectivity options creates an enormous attack surface, making mobile security a critical research area.
Symbian OS for mobile devices
Symbian Ltd. was formed in 1998 by Ericsson, Nokia, Motorola, and Psion. The EPOC operating system was renamed to Symbian OS. Currently there are approximately 30 phones with Symbian and 15 licensees.
Current ownership (at the time of this lecture):
- Nokia: 47.5%
- Panasonic: 10.5%
- Ericsson: 15.6%
- Siemens: 8.4%
- SonyEricsson: 13.1%
- Samsung: 4.5%
Architecture features:
- Multitasking, preemptive kernel
- MMU protection of kernel and process spaces
- Strong Client-Server architecture
- Plug-in patterns
- Filesystem can reside in ROM, Flash, RAM, and on SD-card
Symbian security features include:
Crypto:
- Algorithms
- Certificate framework
- Protocols: HTTPS, WTLS, etc.
Symbian signed:
- Public key signatures on applications
- Root CAs (Certificate Authorities) in ROM
Separation:
- Kernel vs. user space
- Process space
- Secured 'wallet' storage
Access controls:
- SIM PIN, device security code
- Bluetooth pairing
Artificial Limitations/patches:
- Prevent loading device drivers in the kernel (Nokia)
- Disallow overriding of ROM based plug-ins
Limitations:
- No concept of roles or users
- No access controls in the file system
- No user confirmation needed for access by applications
- User view on device is limited: partial filesystem, selected processes
- Majority of interesting applications are unsigned
Are attacks prevented?
- Fraud: user should not accept unsigned apps
- Loss/theft: In practice, little protection
- Availability: any application can render phone unusable (skulls trojan)
Virtual Machine Monitors
A Virtual Machine Monitor (VMM) exports a virtual machine to user programs that resembles real hardware. A virtual machine consists of all hardware features including user/kernel modes, I/O, interrupts, and "pretty much everything a real machine has." A virtual machine may run any OS.
Examples: JVM, VmWare, User-Mode Linux (UML).
Advantage: portability Disadvantage: slow speed
What Is It? A VMM virtualizes system resources. It runs directly on hardware and provides an interface that gives each program running on it the illusion that it is the only process on the system and is running directly on hardware. It provides the illusion of contiguous memory beginning at address 0, a CPU, and secondary storage to each program.
Privileged Instructions β The VMM handles privileged operations through a series of traps:
- VMM is running operating system
o, which is running processpptries to read β a privileged operation β this traps to hardware
- VMM is invoked, determines the trap occurred in
o- VMM updates state of
oto make it look like hardware invokedodirectly, sootries to read, causing a trap
- VMM updates state of
- VMM does the actual read
- Updates
oto make it seem likeodid the read - Transfers control to
o
- Updates
otries to switch context top, causing another trap- VMM updates virtual machine of
oto make it appearodid context switch successfully- Transfers control to
o, which (asoapparently did a context switch top) has the effect of returning control top
- Transfers control to
When Is VM Possible? An architecture can be virtualized when:
- All sensitive instructions cause traps when executed by processes at lower levels of privilege
- All references to sensitive data structures cause traps when executed by processes at lower levels of privilege
Asynchronous kernel interfaces
Asynchronous kernel interfaces and their implementation in the Linux kernel may require major changes to several parts and sub-systems of the kernel. These changes may result in enhanced kernel and application performance.
Quick review of memory management and I/O topics
Memory Management:
- Goals of OS memory management
- Questions regarding memory management
- Multiprogramming
- Virtual addresses
- Fixed partitioning and Variable partitioning
- Fragmentation
- Paging
- Address translation
- Page tables and Page table entries
- Multi-level address translation
- Page faults and their handling
- Segmentation
- Combined Segmentation and paging
- Efficient translations and caching
- Translation Lookaside Buffer (TLB)
- Set associative and fully associative caches
- Demand Paging
- Page replacement algorithms
- Thrashing
- Working set model
- Page fault frequency
- Copy on write
- Sharing
- Memory mapped files
- Allocation: Linked allocation, FAT, Indexed allocation, i-nodes
- File buffer cache
- Read ahead
- Consistency problem and its solutions
- SABRE airline example
- UNIX file system invariants
- Consistency ensuring techniques and rules: Write ordering, etc.
- Disks structure and internals: Platters, Cylinders, heads, tracks, sectors, etc.
- Fast File system (FFS): Cylinder groups, Fragments for small files
- Log structured (or journaling) file systems: Each update to the file system is recorded as a transaction. All transactions are written to a log. A transaction is considered committed once it is written to the log. The file system may not yet be updated. The transactions in the log are asynchronously written to the file system. When the file system is modified, the transaction is removed from the log. If the file system crashes, all remaining transactions in the log must still be performed.
- Uniform file system interface to user processes
- Represents any conceivable file system's general feature and behavior
- Assumes files are objects that share basic properties regardless of the target file system
I/O Topics:
- Goals of I/O software
- Layers of I/O software
- Direct Vs memory mapped I/O
- Interrupt driven I/O
- Polled I/O
- Direct Memory Access (DMA)
- Device independent I/O software layer
- Buffered and un-buffered I/O
- Block and character devices
- Network devices
- Kernel I/O subsystem and data structures
- Life cycle of a typical I/O request
- Life cycle of a typical network I/O request
- Interrupt handlers
- Interrupts and exceptions
- Linux interrupt handling
- Top halfs, bottom halfs and tasklets
- Timings and timer devices
- Linux kernel timers and interval timers
- Loadable Kernel modules and device drivers
- Linux module management
- Linux module conflict resolution
- Linux module registration
- Signals and asynchronous event notification
β Key Takeaways
The most critical concepts from this lecture are: (1) The Nooks approach improves OS reliability by running drivers in isolated protection domains requiring kernel modification. (2) Mobile phones face diverse risks including toll fraud, data loss from theft, and multiple attack vectors (Bluetooth, SMS, browser, etc.). (3) Symbian OS provides multitasking with MMU protection and client-server architecture but has significant security limitations including no user roles, no filesystem access controls, and most apps being unsigned. (4) A VMM virtualizes system resources by running directly on hardware and providing the illusion of a complete machine; virtualization is only possible when all sensitive instructions and data structure references cause traps at lower privilege levels. (5) The quick review section comprehensively lists all memory management concepts (paging, segmentation, TLB, page replacement, thrashing) and I/O topics (DMA, interrupt handling, device drivers, journaling file systems) covered in the course.
π§ Quick Revision Questions
- What are the three main categories of mobile phone risks, and give one example attack vector for each category?
- In the Nooks approach, how are device drivers isolated from the rest of the kernel, and what type of modification is required?
- What are the two conditions that must be met for an architecture to be virtualizable by a VMM?
- List three security limitations of the Symbian OS mentioned in this lecture.
- What is the key difference between how a VMM handles a privileged instruction from an operating system versus how it handles one from a user process?