OWasp Docker Security Cheat Sheet Flashcards

Real time AJAX security evaluation for learners based on content at https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet

1
Q

RULE #0: Keep Host and Docker Up to Date

Why is keeping the host and Docker updated important?

A

Containers share the host’s kernel, so vulnerabilities like Dirty COW in the host kernel can result in root access on the host.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

RULE #0: Keep Host and Docker Up to Date

What components should be regularly updated?

A

The host kernel and the Docker Engine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

RULE #1: Do Not Expose the Docker Daemon Socket

Why should the Docker daemon socket not be exposed?

A

The socket, /var/run/docker.sock, grants unrestricted root access to the host.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

RULE #1: Do Not Expose the Docker Daemon Socket

What should you avoid enabling for Docker daemon socket?

A

Avoid enabling unencrypted and unauthenticated TCP access (-H tcp://0.0.0.0:XXX).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

RULE #2: Set a User

How can privilege escalation attacks be prevented?

A

Configure containers to use unprivileged users during runtime or build time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

RULE #2: Set a User

What Kubernetes field is used to set a user for a Pod?

A

The runAsUser field in the SecurityContext.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

RULE #3: Limit Capabilities

What is the safest way to configure Linux kernel capabilities for containers?

A

Drop all capabilities (–cap-drop all) and add only the required ones (–cap-add).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RULE #3: Limit Capabilities

Why should you not use the –privileged flag?

A

It adds all Linux kernel capabilities to the container, creating security risks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ULE #4: Prevent In-Container Privilege Escalation

How can privilege escalation within a container be disabled?

A

Use the –security-opt=no-new-privileges option during runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ULE #4: Prevent In-Container Privilege Escalation

What Kubernetes field prevents privilege escalation?

A

allowPrivilegeEscalation: false in the SecurityContext.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

RULE #5: Be Mindful of Inter-Container Connectivity

How can inter-container communication be restricted in Docker?

A

Use custom Docker networks instead of relying on the default docker0 bridged network.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

RULE #5: Be Mindful of Inter-Container Connectivity

What Kubernetes feature helps regulate pod interactions?

A

Network Policies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

RULE #6: Use Linux Security Modules

What security profiles should be considered for Docker containers?

A

Use Linux Security Modules such as seccomp, AppArmor, or SELinux.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

RULE #6: Use Linux Security Modules

What Kubernetes resource configures security profiles?

A

Security Context in Pods or Containers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

RULE #9: Integrate Container Scanning Tools into Your CI/CD Pipeline

Why is integrating container scanning tools into a CI/CD pipeline important?

A

It ensures security checks, such as linting, static code analysis, and container scanning, are part of the software development lifecycle to prevent vulnerabilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Best Practices

What are some best practices for writing a secure Dockerfile?

A

Specify a USER directive.
Pin the base image version.
Pin OS package versions.
Use COPY instead of ADD.
Avoid curl bashing in RUN directives.