Software Security
Memory corruption
public enemy number 1
Erik Poll
Digital Security Radboud University Nijmegen
1
Memory corruption public enemy number 1 Erik Poll Digital Security - - PowerPoint PPT Presentation
Software Security Memory corruption public enemy number 1 Erik Poll Digital Security Radboud University Nijmegen 1 Security in the development lifecycle 2.1 week 3: exercise week4: group project Security in the development lifecycle
1
2.1
2.2
2.3
3
4
5.1
5.2
6
7
8
9
10.1
10.2
10.3
10.4
10.5
[C.A.R. Hoare, The Emperor’s Old Clothes, Communications of the ACM, 1980]
11
12
13.1
13.2
13.3
13.4
13.5
(see lecture notes, §3.1-3.2)
13.6
14
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.1
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.2
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.3
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.4
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.5
1000
1001 void f (){ 1002
1003
1004
...
2001
2002
3001
3002
3003
3004
3005 } 15.6
16
17
18.1
18.2
18.3
18.4
18.5
19.1
19.2
20
21
[Smashing the stack for fun and profit, Aleph One, 1996]
22
23.1
23.2
24.1
24.2
26
27
28.1
28.2
29
30.1
30.2
31
32
33
34
35
36
37
38.1
38.2
39
40
41
42.1
42.2
42.3
42.4
See https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=integer+overflow
42.5
43.1
43.2
43.3
44
45.1
45.2
45.3
45.4
45.5
45.6
45.7
45.8
46.1
46.2
46.3
46.4
46.5
// TCHAR is 1 byte ASCII or multiple byte UNICODE #ifdef UNICODE # define TCHAR wchar_t # define _sntprintf _snwprintf #else # define TCHAR char # define _sntprintf _snprintf #endif TCHAR buf[MAX_SIZE]; _sntprintf(buf, sizeof(buf), input);
47.1 [slide from presentation by Jon Pincus]
// TCHAR is 1 byte ASCII or multiple byte UNICODE #ifdef UNICODE # define TCHAR wchar_t # define _sntprintf _snwprintf #else # define TCHAR char # define _sntprintf _snprintf #endif TCHAR buf[MAX_SIZE]; _sntprintf(buf, sizeof(buf), input);
47.2
[slide from presentation by Jon Pincus]
48.1
48.2
49
50.1
50.2
50.3
50.4
Check https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=format+string to see how depressingly common format strings still are
51.1
Check https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=format+string to see how depressingly common format strings still are
51.2
52
54
55
56
57
58.1
58.2
60
61.1
61.2
61.3
61.4
61.5
61.6
62.1
62.2
62.3
62.4
62.5
62.6
63.1
63.2
64
65
66
67
68.1
68.2
68.3
69
70.1
70.2
70
70
71
ptr
72
73
ptr
74
s
e d a t a
d j u n k X Y Z h e l l
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
75
76
void f() { ... ; g(); ... ; g(); ... ; h(); ... } void g(){ ..h();} void h(){ ... }
77
call g call h return call g call h g() h() f() return
78
https://techcommunity.microsoft.com/t5/windows-kernel-internals/understanding- hardware-enforced-stack-protection/ba-p/1247815
https://www.youtube.com/watch?v=oOqpl-2rMTw
The Evolution of CFI Attacks and Defenses @ OffensiveCON 18 79