sandboxing€¦ · sandboxing methods vm-based §run entire os in isolation os-based §process-wide...

60
Sandboxing CS-576 Systems Security Instructor: Georgios Portokalidis Spring 2018

Upload: others

Post on 03-Aug-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

SandboxingCS-576 Systems Security

Instructor: Georgios PortokalidisSpring 2018

Page 2: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Why?Software has bugsDefenses slipUntrusted code

Compartmentalization limits interference and damage!

Spring 2018 Stevens Institute of Technology

Sandboxing Means Isolation

“a sandbox is a security mechanism for separating running programs” -- wikipedia

Page 3: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Opportunities for Sandboxing: Browsers

Spring 2018 Stevens Institute of Technology

Flash plugin

Browser

JS engine

Internet

.swf

.js

Untrusted inputs

Page 4: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Opportunities for Sandboxing: Browsers

Flash plugin

Browser

JS engine

Internet

.swf

.js

Sandboxes

Page 5: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Untrusted Code in Browsers

Flash plugin

Browser

JS engine

Internet

.html

.cssRendering

engine

Untrusted inputs

Page 6: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Untrusted Code in Browsers

Flash plugin

Browser

JS engine

Internet

.html

.cssRendering

engine

Untrusted inputs

Sandbox?

Page 7: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing MethodsVM-based

§ Run entire OS in isolation

OS-based§ Process-wide§ Available system calls and capabilities are restricted

Language-based§ Language isolates components

Inline reference monitor§ Integrated into untrusted code during compilation, code

generation, or through emulation§ Security checks injected to enforce policy

Spring 2018 Stevens Institute of Technology

Page 8: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing MethodsVM-based

§ Run entire OS in isolation

OS-based§ Process-wide§ Available system calls and capabilities are restricted

Language-based§ Language isolates components

Inline reference monitor§ Integrated into untrusted code during compilation, code

generation, or through emulation§ Security checks injected to enforce policy

Spring 2018 Stevens Institute of Technology

Page 9: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Lets Refresh What We Know About OSes

Page 10: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018

OS Access Control of HW

User land

Kernel

Application Application Application

Trusted Kernel

CPU MEMORY HW DEVICESHardware

Stevens Institute of Technology

Page 11: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018

OS Access Control of HW

User land

Kernel

Application Application Application

Trusted Kernel

CPU MEMORY HW DEVICESHardware

Stevens Institute of Technology

Page 12: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018

OS Access Control of HW

User land

Kernel

Application Application Application

Trusted Kernel

CPU MEMORY HW DEVICESHardware

Stevens Institute of Technology

User space has restricted access to CPU and memory

User space cannot access HW devices

Page 13: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018

OS Access Control of HW

User land

Kernel

Application Application Application

Trusted Kernel

CPU MEMORY HW DEVICESHardware

Stevens Institute of Technology

Page 14: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018

OS Access Control of HW

User land

Kernel

Application Application Application

Trusted Kernel

CPU MEMORY HW DEVICESHardware

Stevens Institute of Technology

Privileged

Unprivileged

Page 15: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Example of OS-Level Access Control to HW

Page 16: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process-level IsolationProcesses cannot directly access each other’s state

Spring 2018

User land

Kernel

USER1 Application

USER1 Application

USER1 Application

Trusted Kernel

Stevens Institute of Technology

Page 17: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process-level IsolationThe kernel can setup inter-process communication

Spring 2018

User land

Kernel

USER1 Application

USER1 Application

USER1 Application

Trusted Kernel

IPCsetup

Stevens Institute of Technology

Page 18: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process-level IsolationThe kernel can setup inter-process communication

Spring 2018

User land

Kernel

USER1 Application

USER1 Application

USER1 Application

Trusted Kernel

IPCsetup

IPCchannel

Stevens Institute of Technology

Page 19: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process-level IsolationSame for processes owned by different users

Spring 2018

User land

Kernel

USER1Application

USER2Application

USER3Application

Trusted Kernel

IPCsetup

IPCchannel

Stevens Institute of Technology

Page 20: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

The memory-management unit (MMU) provides virtual memory

Execution rings separate user and kernel space

§ Indicated by bits in CPU status register

Processes are isolated into different virtual memory address spaces

Spring 2018 Stevens Institute of Technology

Hardware-based Enforcement

USER1 Application

USER2 Application

Trusted Kernel

Ring 3

Ring 0VMEM VMEM

Page 21: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Back to Sandboxing

Spring 2018 Stevens Institute of Technology

Page 22: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing MethodsVM-based

§ Run entire OS in isolation

OS-based§ Process-wide§ Available system calls and capabilities are restricted

Language-based§ Language isolates components

Inline reference monitor§ Integrated into untrusted code during compilation, code

generation, or through emulation§ Security checks injected to enforce policy

Spring 2018 Stevens Institute of Technology

Page 23: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Building on Process IsolationRun code in its own process space to isolate it from browser processCongratulations you have just executed untrusted code from the Internet!

Spring 2018

Browser

Flash plugin

Browser

Flash plugin

Plugin container

IPC

Stevens Institute of Technology

Page 24: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Container must have limited privileges

Spring 2018

Building on Process Isolation

Browser

Flash plugin

Plugin container

IPC

Stevens Institute of Technology

Page 25: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Chromium Sandboxing in LinuxChromium runs plugins and the rendering engine for each tab in a separate processRendering processes are sandboxedSandboxed processes are managed by a broker process over IPC

Spring 2018 Stevens Institute of Technology

https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandboxing.md

Page 26: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Page 27: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process Sandbox: SUIDA helper binary with the setuid bit set is used

The SUID bit causes the execution of the process as root§ Enables access to privileged kernel APIs

chroot() is used to change the process’ root directory§ Take away file system access from the process

Process is placed in new PID namespace§ Process cannot terminate or signal processes outside the namespace

Process is placed in new network namespace§ Restrict network access of process

Finally drop super-user privileges

Spring 2018 Stevens Institute of Technology

Page 28: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process Sandbox: User NamespacesUser namespaces are an unprivileged API

Used as an alternative to SUID sandbox

A process is placed a new namespace

Isolates:§ Filesystem§ Network§ PID§ IPC

Spring 2018 Stevens Institute of Technology

Page 29: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

User NamespacesA newly launched process can be put in a new namespace

§ Through the clone() system call

Spring 2018 Stevens Institute of Technology

Reading material: https://lwn.net/Articles/531114/

Namespace Constant IsolatesCgroup CLONE_NEWCGROUP Cgroup root directoryIPC CLONE_NEWIPC System V IPC, POSIX message queuesNetwork CLONE_NEWNET Network devices, stacks, ports, etc.Mount CLONE_NEWNS Mount pointsPID CLONE_NEWPID Process IDsUser CLONE_NEWUSER User and group IDsUTS CLONE_NEWUTS Hostname and NIS domain name

Available namespaces

Page 30: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Process Sandbox: SECCOMP BPFFilters the kernel APIs available to a process

Used together with previous sandboxes

Aims to protect the kernel from a malicious process

Available system calls are defined using Berkeley packet filters

§ Filters are compiled to a program that enforces policy

Spring 2018 Stevens Institute of Technology

Page 31: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

static int install_syscall_filter(void)

{

struct sock_filter filter[] = {

/* Validate architecture. */

VALIDATE_ARCHITECTURE,

/* Grab the system call number. */

EXAMINE_SYSCALL,

/* List allowed syscalls. */

ALLOW_SYSCALL(rt_sigreturn),

#ifdef __NR_sigreturn

ALLOW_SYSCALL(sigreturn),

#endif

ALLOW_SYSCALL(exit_group),

ALLOW_SYSCALL(exit),

ALLOW_SYSCALL(read),

ALLOW_SYSCALL(write),

KILL_PROCESS,

};

struct sock_fprog prog = {

.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),

.filter = filter,

};

Page 32: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {perror("prctl(NO_NEW_PRIVS)");goto failed;

}if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) {

perror("prctl(SECCOMP)");goto failed;

}return 0;

failed:if (errno == EINVAL)

fprintf(stderr, "SECCOMP_FILTER is not available. :(\n");return 1;

}

Page 33: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Limitations of OS and VM-based SandboxingContext switches between broker and sandboxed processes can be expensive

Spring 2018 Stevens Institute of Technology

Page 34: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing MethodsVM-based

§ Run entire OS in isolation

OS-based§ Process-wide§ Available system calls and capabilities are restricted

Language-based§ Language isolates components

Inline reference monitor§ Integrated into untrusted code during compilation, code

generation, or through emulation§ Security checks injected to enforce policy

Spring 2018 Stevens Institute of Technology

Page 35: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Example: JS/JavaThe language and the runtime environment/VM is enforcing security

§ Memory safe languages§ Memory corruption or leakage is not possible (at least in

theory)

Access control done at the API level, for example:§ Which files can be loaded§ Which frames are accessible through the DOM§ Where can code be loaded from § The VM acts as a reference monitor

Spring 2018 Stevens Institute of Technology

Page 36: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing MethodsVM-based

§ Run entire OS in isolation

OS-based§ Process-wide§ Available system calls and capabilities are restricted

Language-based§ Language isolates components

Inline reference monitor§ Integrated into untrusted code during compilation, code

generation, or through emulation§ Security checks injected to enforce policy

Spring 2018 Stevens Institute of Technology

Page 37: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Sandboxing Unsafe LanguagesPointers can be used to potential read/write arbitrary memory

Memory accesses need to be isolated first§ Can rarely rely on HW to contain memory operations§ Software checks are introduced in application code

Spring 2018 Stevens Institute of Technology

Page 38: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Software-fault IsolationRun multiple programs in the same address space that run in isolation

Each program runs in a different logical fault domain

Programs can access memory within their domain§ Ensures memory secrecy and integrity

Code within a domain cannot call/jump to code in other domains

§ Unless through secure interfaces

Spring 2018 Stevens Institute of Technology

Page 39: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Software-fault IsolationPrograms can only access memory within their domain

§ Ensures memory secrecy and integrity

Spring 2018 Stevens Institute of Technology

Write OK Write OK

Domain-1 Domain-2Writedisallowed

Page 40: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Software-fault IsolationPrograms can only access memory within their domain

§ Ensures memory secrecy and integrity

Code within a domain cannot call/jump to code in other domains

§ Unless through secure interfaces

Spring 2018 Stevens Institute of Technology

Function call

Domain-1 Domain-2Transferdisallowed

Function call

Page 41: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Software-fault IsolationPrograms can only access memory within their domain

§ Ensures memory secrecy and integrity

Code within a domain cannot call/jump to code in other domains

§ Unless through secure interfaces

Modify programs during compilation or by rewriting to enforce these properties

Spring 2018 Stevens Institute of Technology

Page 42: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesThrough boundary checking

Spring 2018 Stevens Institute of Technology

cmp 0x0300if less Errorcmp 0x04AAif greater Errorwrite x

0x0300

0x04AA

Page 43: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesWe can improve the boundary checks

§ By allocating domains in aligned memory ranges§ Using bit masking to help with checking

Spring 2018 Stevens Institute of Technology

tmp := x & FF00cmp tmp 0300if not equal Errorwrite x

0x0300

0x03FF

Page 44: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesFurther improvements

§ Do not detect error§ Constrain memory access to domain

Spring 2018 Stevens Institute of Technology

tmp : = x & 00FFtmp : = tmp | 0300write tmp

0x0300

0x03FF

Page 45: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesEliminating temporary registers is not always a good idea

Spring 2018 Stevens Institute of Technology

0x0300

0x03FF

…x : = x & 00FFx : = x | 0300write x

Malicious code could bypass masking

operations

Time Of CheckTime Of Use

(TOCTOU)

Page 46: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesCan malicious code bypass checks with temporary registers?

Spring 2018 Stevens Institute of Technology

tmp : = x & 00FFtmp : = tmp | 0300write tmp

0x0300

0x03FF

Page 47: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesCan malicious code bypass checks with temporary registers?

Spring 2018 Stevens Institute of Technology

tmp : = x & 00FFtmp : = tmp | 0300write tmp

0x0300

0x03FF

?• tmp has not been initialized

and will probably cause the program to crash.

• Can be forced to crash by setting tmp to bad address (e.g., 0xffffffff) after write

Page 48: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Memory AccessesCan malicious code bypass checks with temporary registers?

Spring 2018 Stevens Institute of Technology

tmp : = x & 00FFtmp : = tmp | 0300write tmp

0x0300

0x03FF

?This will also not work

Page 49: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Control FlowSandboxes are mainly to used to constrain untrusted code so obviously this is a general problem

Spring 2018 Stevens Institute of Technology

…jmp ptr

?

Page 50: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Control FlowSimilar tricks can be applied

Spring 2018 Stevens Institute of Technology

…jmp ptr

…tptr : = ptr & 00FFtptr : = tptr | 0300jmp tptr

…call ptr

…tptr : = ptr & 00FFtptr : = tptr | 0300call tptr

…ret ?

Page 51: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Constraining Control FlowNaive approach

Spring 2018 Stevens Institute of Technology

ret

pop tptrtptr : = tptr & 00FFtptr : = tptr | 0300jmp ptr

Page 52: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

CISC TroubleConstraining within the domain is not enough

§ Instructions may be hidden within instructions in CISC programs

Spring 2018 Stevens Institute of Technology

ins ins ins ins ins ins

ins ins ins ins ins ins

ins ins ins ins ins ins

Page 53: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Pseudo Fixed-size InstructionsAlign every “pseudo” instruction on a 32-byte boundary

§ 0x1F bits are always zeroForce pointer so it can only point to a pseudo instruction

Spring 2018 Stevens Institute of Technology

pop tptrtptr : = tptr & 00E0tptr : = tptr | 0300jmp ptr

Page 54: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Benefits of SFINo context switches

Faster if run-time checks are faster than context switching

Spring 2018 Stevens Institute of Technology

Page 55: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Google Native Client (NaCL)A sandboxing technology for running a subset of Intel x86, ARM, or MIPS native code in a sandbox

https://developer.chrome.com/native-client

NaCL programs are compiled with modified compiler

Supports subset of language

Produces sandboxed programsSpring 2018 Stevens Institute of Technology

Page 56: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Escaping SandboxesExploitation of a sandboxed component grants limited control

But sandboxes may have bugs

Multiple exploits in different components are usually required

In 2012’s pwnium competition 14 bugs where needed to take down chrome

§ http://blog.chromium.org/2012/05/tale-of-two-pwnies-part-1.html

Spring 2018 Stevens Institute of Technology

Page 57: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

Multiple Layers of Sandboxes

Sandboxed process

Sandboxedcomponent

Original process

Page 58: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Other Use Cases for IsolationProcess-level Isolation from the OS is frequently used to realize the principle of least privilege in servers

Examples: SSH, Web servers

Spring 2018 Stevens Institute of Technology

Page 59: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

SSH

SSH listening process

SSH request serving process

Connections

AuthenticateSSH request

serving process

SSH request serving process

fork()Runs as root

How is access control done here?

Page 60: Sandboxing€¦ · Sandboxing Methods VM-based §Run entire OS in isolation OS-based §Process-wide §Available system calls and capabilities are restricted Language-based §Language

Spring 2018 Stevens Institute of Technology

SSH

SSH listening process

SSH request serving process

Connections

AuthenticateSSH request

serving process

SSH request serving process

fork()Runs as root

setuid()/seteuid()

Process drop privileges and run as the authenticated user