Preface |
|
ix | |
|
1 Container Security Threats |
|
|
1 | (12) |
|
Risks, Threats, and Mitigations |
|
|
2 | (1) |
|
|
3 | (3) |
|
|
6 | (1) |
|
|
7 | (3) |
|
|
8 | (1) |
|
|
8 | (1) |
|
|
9 | (1) |
|
|
10 | (1) |
|
|
10 | (2) |
|
|
10 | (1) |
|
|
11 | (1) |
|
Reducing the Attack Surface |
|
|
11 | (1) |
|
Limiting the Blast Radius |
|
|
11 | (1) |
|
|
11 | (1) |
|
Applying Security Principles with Containers |
|
|
11 | (1) |
|
|
12 | (1) |
|
2 Linux System Calls, Permissions, and Capabilities |
|
|
13 | (10) |
|
|
13 | (1) |
|
|
14 | (5) |
|
|
16 | (3) |
|
|
19 | (2) |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
23 | (8) |
|
|
23 | (1) |
|
|
24 | (2) |
|
|
26 | (1) |
|
Assigning a Process to a Cgroup |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
31 | (24) |
|
|
32 | (1) |
|
|
33 | (2) |
|
|
35 | (3) |
|
Changing the Root Directory |
|
|
38 | (3) |
|
Combine Namespacing and Changing the Root |
|
|
41 | (1) |
|
|
42 | (1) |
|
|
43 | (2) |
|
|
45 | (3) |
|
User Namespace Restrictions in Docker |
|
|
48 | (1) |
|
Inter-process Communications Namespace |
|
|
48 | (1) |
|
|
49 | (1) |
|
Container Processes from the Host Perspective |
|
|
50 | (2) |
|
|
52 | (1) |
|
|
53 | (2) |
|
|
55 | (10) |
|
|
55 | (2) |
|
|
57 | (2) |
|
Type 1 VMMs, or Hypervisors |
|
|
57 | (1) |
|
|
58 | (1) |
|
Kernel-Based Virtual Machines |
|
|
59 | (1) |
|
|
59 | (1) |
|
Handling Non-Virtualizable Instructions |
|
|
60 | (1) |
|
Process Isolation and Security |
|
|
61 | (1) |
|
Disadvantages of Virtual Machines |
|
|
62 | (1) |
|
Container Isolation Compared to VM Isolation |
|
|
63 | (1) |
|
|
63 | (2) |
|
|
65 | (18) |
|
Root Filesystem and Image Configuration |
|
|
65 | (1) |
|
Overriding Config at Runtime |
|
|
66 | (1) |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (3) |
|
The Dangers of docker build |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
69 | (2) |
|
|
71 | (1) |
|
|
72 | (2) |
|
|
74 | (1) |
|
|
74 | (3) |
|
Provenance of the Dockerfile |
|
|
74 | (1) |
|
Dockerfile Best Practices for Security |
|
|
75 | (2) |
|
Attacks on the Build Machine |
|
|
77 | (1) |
|
|
77 | (1) |
|
Running Your Own Registry |
|
|
78 | (1) |
|
|
78 | (1) |
|
Image Deployment Security |
|
|
78 | (2) |
|
Deploying the Right Image |
|
|
79 | (1) |
|
Malicious Deployment Definition |
|
|
79 | (1) |
|
|
79 | (1) |
|
GitOps and Deployment Security |
|
|
80 | (1) |
|
|
81 | (2) |
|
7 Software Vulnerabilities in Images |
|
|
83 | (12) |
|
|
83 | (1) |
|
Vulnerabilities, Patches, and Distributions |
|
|
84 | (1) |
|
Application-Level Vulnerabilities |
|
|
85 | (1) |
|
Vulnerability Risk Management |
|
|
85 | (1) |
|
|
85 | (1) |
|
|
86 | (1) |
|
|
87 | (2) |
|
|
87 | (1) |
|
|
88 | (1) |
|
|
89 | (2) |
|
|
89 | (1) |
|
|
89 | (1) |
|
Won't Fix Vulnerabilities |
|
|
89 | (1) |
|
Subpackage Vulnerabilities |
|
|
90 | (1) |
|
|
90 | (1) |
|
Additional Scanning Features |
|
|
90 | (1) |
|
|
90 | (1) |
|
Scanning in the CI/CD Pipeline |
|
|
91 | (2) |
|
Prevent Vulnerable Images from Running |
|
|
93 | (1) |
|
|
94 | (1) |
|
|
94 | (1) |
|
8 Strengthening Container Isolation |
|
|
95 | (10) |
|
|
95 | (2) |
|
|
97 | (1) |
|
|
98 | (2) |
|
|
100 | (2) |
|
|
102 | (1) |
|
|
103 | (1) |
|
|
103 | (1) |
|
|
104 | (1) |
|
9 Breaking Container Isolation |
|
|
105 | (12) |
|
Containers Run as Root by Default |
|
|
105 | (6) |
|
|
106 | (1) |
|
Root Requirement Inside Containers |
|
|
107 | (2) |
|
|
109 | (2) |
|
The --privileged Flag and Capabilities |
|
|
111 | (2) |
|
Mounting Sensitive Directories |
|
|
113 | (1) |
|
Mounting the Docker Socket |
|
|
114 | (1) |
|
Sharing Namespaces Between a Container and Its Host |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
116 | (1) |
|
10 Container Network Security |
|
|
117 | (14) |
|
|
117 | (2) |
|
|
119 | (1) |
|
|
120 | (1) |
|
IP Addresses for Containers |
|
|
121 | (1) |
|
|
122 | (1) |
|
Layer 3/4 Routing and Rules |
|
|
123 | (2) |
|
|
123 | (2) |
|
|
125 | (1) |
|
|
125 | (4) |
|
|
127 | (1) |
|
Network Policy Best Practices |
|
|
128 | (1) |
|
|
129 | (1) |
|
|
130 | (1) |
|
11 Securely Connecting Components with TLS |
|
|
131 | (10) |
|
|
131 | (1) |
|
|
132 | (4) |
|
|
133 | (1) |
|
|
134 | (2) |
|
Certificate Signing Requests |
|
|
136 | (1) |
|
|
136 | (2) |
|
Secure Connections Between Containers |
|
|
138 | (1) |
|
|
138 | (1) |
|
|
139 | (2) |
|
12 Passing Secrets to Containers |
|
|
141 | (8) |
|
|
141 | (1) |
|
Getting Information into a Container |
|
|
142 | (3) |
|
Storing the Secret in the Container Image |
|
|
143 | (1) |
|
Passing the Secret Over the Network |
|
|
144 | (1) |
|
Passing Secrets in Environment Variables |
|
|
144 | (1) |
|
Passing Secrets Through Files |
|
|
145 | (1) |
|
|
145 | (1) |
|
Secrets Are Accessible by Root |
|
|
146 | (2) |
|
|
148 | (1) |
|
13 Container Runtime Protection |
|
|
149 | (8) |
|
|
149 | (6) |
|
|
150 | (1) |
|
|
150 | (2) |
|
|
152 | (1) |
|
|
152 | (1) |
|
|
153 | (1) |
|
|
153 | (2) |
|
|
155 | (1) |
|
|
156 | (1) |
|
14 Containers and the OWASP Top 10 |
|
|
157 | (6) |
|
|
157 | (1) |
|
|
157 | (1) |
|
|
158 | (1) |
|
|
158 | (1) |
|
|
158 | (1) |
|
Security Misconfiguration |
|
|
159 | (1) |
|
|
159 | (1) |
|
|
159 | (1) |
|
Using Components with Known Vulnerabilities |
|
|
160 | (1) |
|
Insufficient Logging and Monitoring |
|
|
160 | (1) |
|
|
161 | (2) |
Conclusions |
|
163 | (2) |
Appendix. Security Checklist |
|
165 | (2) |
Index |
|
167 | |