Introduction To Information Security: Process Confinement (1/2)
Introduction To Information Security: Process Confinement (1/2)
Lecture 4:
Process confinement (1/2)
Eran Tromer
Slides credit:
Dan Boneh and John Mitchell, Stanford
1
Process confinement
2
Running untrusted code
5
Simple process confinement
6
A simple example: chroot
Problem: all utility programs (ls, ps, vi) must live inside jail
• jailkit project: auto builds files, libs, and dirs needed in jail
environment
• jk_init: creates jail environment
• jk_check: checks jail env for security problems
• checks for any modified programs,
• checks for world writable directories, etc.
• jk_lsh: restricted shell to be used inside jail
• Restricts only filesystem access. Unaffected:
• Network access
• Inter-process communication
• Devices, users, … (see later)
8
Escaping from jails
9
Many ways to escape chroot jail as root
10
FreeBSD jail
• To run:
jail jail-path hostname IP-addr cmd
• calls hardened chroot (no “../../” escape)
• can only bind to sockets with specified IP address
and authorized ports
• can only communicate with process inside jail
• root is limited, e.g. cannot load kernel modules
11
Problems with chroot and jail
• Coarse policies:
• All-or-nothing access to file system
• Inappropriate for apps like web browser
• Needs read access to files outside jail
(e.g. for sending attachments in gmail)
12
System call interposition
for process-level confinement
13
System call interposition
14
Initial implementation (Janus)
open(“/etc/passwd”, “r”)
OS Kernel
15
Complications
16
Problems with ptrace
17
Improved system call interposition: Systrace
user space
monitored
application monitor policy file
(outlook) for app
open(“etc/passwd”, “r”)
sys-call
systrace
gateway
permit/deny
OS Kernel
• Systrace only forwards monitored sys-calls to monitor (saves context switches)
• Systrace resolves sym-links and replaces sys-call path arguments by full path to
target
• When app calls execve, monitor loads new policy file
• Fast path in kernel for common/easy cases, ask userspace for complicated/rare
cases
18
Systrace policy
19