Protection
1
Disclaimer: some slides are adopted from book authors’ slides with permission
Protection Disclaimer: some slides are adopted from book authors - - PowerPoint PPT Presentation
Protection Disclaimer: some slides are adopted from book authors slides with permission 1 Examples of OS Protection Memory protection Between user processes Between user and kernel File protection Prevent unauthorized
1
Disclaimer: some slides are adopted from book authors’ slides with permission
2
3
4
5
E.g., User D1 can read F1 or F3
6
group world
7
8
9
10
11
12
13
14
15
– Physical
– Human
– Operating System
– Network
16
17
18
Stack pointer
19
#define BUFFER_SIZE 256 int process_args(char *arg1) { char buffer[BUFFER SIZE]; strcpy(buffer,arg1); ... } int main(int argc, char *argv[]) { process_args(argv[1]); ... }
20
#define BUFFER_SIZE 256 int process_args(char *arg1) { char buffer[BUFFER SIZE]; strcpy(buffer,arg1); ... } int main(int argc, char *argv[]) { process_args(argv[1]); ... }
arg1
21
#define BUFFER_SIZE 256 int process_args(char *arg1) { char buffer[BUFFER SIZE]; strcpy(buffer,arg1); ... } int main(int argc, char *argv[]) { process_args(argv[1]); ... }
arg1
22
#include <stdio.h> int main(int argc, char *argv[]) { execvp(‘‘/bin/sh’’,‘‘/bin/sh’’, NULL); return 0; }
23
Before After executing strcpy(buffer, arg1) the crafted string containing the illegitimate code
24
Source: http://www.cvedetails.com/vulnerability-list/vendor_id-33/product_id- 47/cvssscoremin-9/cvssscoremax-/Linux-Linux-Kernel.html
212 reported buffer overflow bugs in Linux
25
Sub AutoOpen() Dim oFS Set oFS = CreateObject(’’Scripting.FileSystemObject’’) vs = Shell(’’c:command.com /k format c:’’,vbHide) End Sub
26
27
28
iOS 7.0.6 Data Security Available for: iPhone 4 and later, iPod touch (5th generation), iPad 2 and later Impact: An attacker with a privileged network position may capture or modify data in sessions protected by SSL/TLS Description: Secure Transport failed to validate the authenticity of the connection. This issue was addressed by restoring missing validation steps.
29
err = 0 . . . hashOut.data = hashes + SSL_MD5_DIGEST_LEN; hashOut.length = SSL_SHA1_DIGEST_LEN; if ((err = SSLFreeBuffer(&hashCtx)) != 0) goto fail; if ((err = ReadyHash(&SSLHashSHA1, &hashCtx)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) goto fail; err = sslRawVerify(...); // This code must be executed . . . fail: SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); Return err;
MISTAKE! THIS LINE SHOULD NOT BE HERE
30
really popular?
31
32
33
Image source: xkcd.com
34
Image source: xkcd.com
35
struct { HeartbeatMessageType type; uint16 payload_length;
} HeartbeatMessage int tls1_process_heartbeat(SSL *s) { ... /* Read type and payload length first */ hbtype = *p++; n2s(p, payload); // payload = recv_packet.payload_length pl = p; ... if (hbtype == TLS1_HB_REQUEST) { ... buffer = OPENSSL_malloc(1 + 2 + payload + padding); bp = buffer; memcpy(bp, pl, payload); r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); ...
Heartbeat
Heartbeat Response function
36
curl -H "User-Agent: () { :; }; /bin/eject" http://example.com/
For detailed explanation: security.stackexchange.com
security policy
– Signature-based detection spots known bad patterns – Anomaly detection spots differences from normal behavior
– False-positives and false-negatives a problem
– Searching all programs or programs at execution for known virus patterns – Or run in sandbox so can’t damage system
sites, etc
37
– The firewall limits network access between these two security domains
– Tunneling allows disallowed protocol to travel within allowed protocol (i.e., telnet inside of HTTP) – Firewall rules typically based on host name or IP address which can be spoofed
– Can monitor / limit traffic to and from the host
38
– Each user has unique security ID – Login to ID creates security access token
– A subject tracks and manages permissions for each program that a user runs
– For example, a file has a security descriptor that indicates the access permissions for all users
– Owner ID, group security ID, discretionary access-control list, system access- control list
39