Skip to content

feat: add web deployment manifest#115

Open
maekuss wants to merge 1 commit into
mainfrom
add-k8s-deployment
Open

feat: add web deployment manifest#115
maekuss wants to merge 1 commit into
mainfrom
add-k8s-deployment

Conversation

@maekuss

@maekuss maekuss commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Adds a Kubernetes Deployment (deployment.yaml).

Scanner test PR — intentionally misconfigured (container/K8s). Expected High/Critical findings:

  • Privileged containerprivileged: true → host device/kernel access (High)
  • Runs as root + privilege escalationrunAsUser: 0, allowPrivilegeEscalation: true, added SYS_ADMIN/NET_ADMIN caps (High)
  • Host namespace sharinghostNetwork: true, hostPID: true (High)
  • Full host filesystem mounthostPath: / → container escape (High)
  • Hardcoded secret in env + mutable :latest image tag (Medium/High)

@hacktron-app-stg hacktron-app-stg Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 1 file

Severity Count
CRITICAL 2
HIGH 2
LOW 1

View full scan results

Comment thread deployment.yaml
Comment on lines +37 to +40
# VULN 6: mounts the entire host filesystem into the container
- name: host-root
hostPath:
path: /

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Full Host Filesystem Mount

The container mounts the entire host filesystem (/) via hostPath. This provides read/write access to the host's sensitive system files, configuration, and data, allowing for full host compromise.

Fix with AI

Open in Cursor Open in Claude

A security vulnerability was found by Hacktron.

File: deployment.yaml
Lines: 37-40
Severity: critical

Vulnerability: Full Host Filesystem Mount

Description:
The container mounts the entire host filesystem (`/`) via `hostPath`. This provides read/write access to the host's sensitive system files, configuration, and data, allowing for full host compromise.

Acceptance criteria:
- Acceptance is defined by the **actual reported behavior**, not by tests passing.
- Reproduce the issue, or narrow the exact code path that produces it, *before* changing code. State what you confirmed.
- Fix the underlying cause. Mitigations that paper over the reported behavior do not count as a fix.
- Add a regression test that fails on the unpatched code and passes on the fix. If a regression test is genuinely impractical (e.g. race condition, infra-level issue), say so and explain why.
- Existing tests passing is **not** the bar. Do not declare done on tests-pass theatre.

Only change what is necessary to fix this vulnerability. Do not refactor adjacent code or modify unrelated files.

Triage: Reply !fp <reason> (false positive), !valid (confirmed), !accepted_risk <reason>, or !fixed (resolved). Any other reply is saved as a triage note.
Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing.

View finding in Hacktron

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this finding has been opened: #119

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this finding has been opened: #119

Comment thread deployment.yaml
image: corp/web:latest # VULN 5: mutable :latest tag, no digest pinning
securityContext:
# VULN 1: privileged container — full access to host devices/kernel
privileged: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Privileged Container Enabled

The container is running with privileged: true, which disables security protections and grants the container full access to the host's devices and kernel features. This allows for container escape and host compromise.

Steps to Reproduce
  1. Deploy the manifest using kubectl apply -f testerror/deployment.yaml.
  2. Exec into the running pod: kubectl exec -it <pod-name> -- /bin/sh.
  3. Verify that the host's root filesystem is mounted at /host and that you have full access to host devices and processes due to privileged: true, hostNetwork: true, and hostPID: true.
Fix with AI

Open in Cursor Open in Claude

A security vulnerability was found by Hacktron.

File: deployment.yaml
Lines: 23
Severity: critical

Vulnerability: Privileged Container Enabled

Description:
The container is running with `privileged: true`, which disables security protections and grants the container full access to the host's devices and kernel features. This allows for container escape and host compromise.

Proof of Concept:
**Steps to Reproduce**

1. Deploy the manifest using `kubectl apply -f testerror/deployment.yaml`.
2. Exec into the running pod: `kubectl exec -it <pod-name> -- /bin/sh`.
3. Verify that the host's root filesystem is mounted at `/host` and that you have full access to host devices and processes due to `privileged: true`, `hostNetwork: true`, and `hostPID: true`.

Acceptance criteria:
- Acceptance is defined by the **actual reported behavior**, not by tests passing.
- Reproduce the issue, or narrow the exact code path that produces it, *before* changing code. State what you confirmed.
- Fix the underlying cause. Mitigations that paper over the reported behavior do not count as a fix.
- Add a regression test that fails on the unpatched code and passes on the fix. If a regression test is genuinely impractical (e.g. race condition, infra-level issue), say so and explain why.
- Existing tests passing is **not** the bar. Do not declare done on tests-pass theatre.

Only change what is necessary to fix this vulnerability. Do not refactor adjacent code or modify unrelated files.

Triage: Reply !fp <reason> (false positive), !valid (confirmed), !accepted_risk <reason>, or !fixed (resolved). Any other reply is saved as a triage note.
Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing.

View finding in Hacktron

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this finding has been opened: #120

Comment thread deployment.yaml
Comment on lines +25 to +26
runAsUser: 0
allowPrivilegeEscalation: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH Root User and Privilege Escalation Enabled

The container is configured to run as the root user (runAsUser: 0) with allowPrivilegeEscalation: true. This increases the risk of successful privilege escalation attacks if an attacker gains code execution within the container.

Steps to Reproduce
  1. Deploy the manifest using kubectl apply -f testerror/deployment.yaml.
  2. Execute a shell inside the running container: kubectl exec -it <pod-name> -- /bin/sh.
  3. Run whoami to verify the process is running as root (UID 0).
  4. Run cat /proc/1/status | grep NoNewPrivs to verify that privilege escalation is not restricted (should show NoNewPrivs: 0).
Fix with AI

Open in Cursor Open in Claude

A security vulnerability was found by Hacktron.

File: deployment.yaml
Lines: 25-26
Severity: high

Vulnerability: Root User and Privilege Escalation Enabled

Description:
The container is configured to run as the root user (`runAsUser: 0`) with `allowPrivilegeEscalation: true`. This increases the risk of successful privilege escalation attacks if an attacker gains code execution within the container.

Proof of Concept:
**Steps to Reproduce**

1. Deploy the manifest using `kubectl apply -f testerror/deployment.yaml`.
2. Execute a shell inside the running container: `kubectl exec -it <pod-name> -- /bin/sh`.
3. Run `whoami` to verify the process is running as `root` (UID 0).
4. Run `cat /proc/1/status | grep NoNewPrivs` to verify that privilege escalation is not restricted (should show `NoNewPrivs: 0`).

Acceptance criteria:
- Acceptance is defined by the **actual reported behavior**, not by tests passing.
- Reproduce the issue, or narrow the exact code path that produces it, *before* changing code. State what you confirmed.
- Fix the underlying cause. Mitigations that paper over the reported behavior do not count as a fix.
- Add a regression test that fails on the unpatched code and passes on the fix. If a regression test is genuinely impractical (e.g. race condition, infra-level issue), say so and explain why.
- Existing tests passing is **not** the bar. Do not declare done on tests-pass theatre.

Only change what is necessary to fix this vulnerability. Do not refactor adjacent code or modify unrelated files.

Triage: Reply !fp <reason> (false positive), !valid (confirmed), !accepted_risk <reason>, or !fixed (resolved). Any other reply is saved as a triage note.
Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing.

View finding in Hacktron

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this finding has been opened: #118

Comment thread deployment.yaml
Comment on lines +16 to +17
hostNetwork: true
hostPID: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH Host Namespace Sharing Enabled

The deployment configures hostNetwork: true and hostPID: true, which merges the container's network and process namespaces with the host's. This allows the container to potentially intercept host network traffic and view or manipulate processes running on the host.

Steps to Reproduce
  1. Deploy the manifest to a Kubernetes cluster: kubectl apply -f testerror/deployment.yaml
  2. Access the container's shell (e.g., via kubectl exec).
  3. Run ps aux inside the container. Observe that you can see all processes running on the host node (due to hostPID: true).
  4. Run ip link or tcpdump (if installed) to observe host network interfaces and traffic (due to hostNetwork: true).
Fix with AI

Open in Cursor Open in Claude

A security vulnerability was found by Hacktron.

File: deployment.yaml
Lines: 16-17
Severity: high

Vulnerability: Host Namespace Sharing Enabled

Description:
The deployment configures `hostNetwork: true` and `hostPID: true`, which merges the container's network and process namespaces with the host's. This allows the container to potentially intercept host network traffic and view or manipulate processes running on the host.

Proof of Concept:
**Steps to Reproduce**

1. Deploy the manifest to a Kubernetes cluster: `kubectl apply -f testerror/deployment.yaml`
2. Access the container's shell (e.g., via `kubectl exec`).
3. Run `ps aux` inside the container. Observe that you can see all processes running on the host node (due to `hostPID: true`).
4. Run `ip link` or `tcpdump` (if installed) to observe host network interfaces and traffic (due to `hostNetwork: true`).

Acceptance criteria:
- Acceptance is defined by the **actual reported behavior**, not by tests passing.
- Reproduce the issue, or narrow the exact code path that produces it, *before* changing code. State what you confirmed.
- Fix the underlying cause. Mitigations that paper over the reported behavior do not count as a fix.
- Add a regression test that fails on the unpatched code and passes on the fix. If a regression test is genuinely impractical (e.g. race condition, infra-level issue), say so and explain why.
- Existing tests passing is **not** the bar. Do not declare done on tests-pass theatre.

Only change what is necessary to fix this vulnerability. Do not refactor adjacent code or modify unrelated files.

Triage: Reply !fp <reason> (false positive), !valid (confirmed), !accepted_risk <reason>, or !fixed (resolved). Any other reply is saved as a triage note.
Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing.

View finding in Hacktron

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for this finding has been opened: #117

Comment thread deployment.yaml
hostPID: true
containers:
- name: web
image: corp/web:latest # VULN 5: mutable :latest tag, no digest pinning

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW Mutable Image Tag Used

The container image uses the mutable latest tag, which is prone to image poisoning attacks. It should be pinned to an immutable digest (SHA256) to ensure supply chain integrity.

Fix with AI

Open in Cursor Open in Claude

A security vulnerability was found by Hacktron.

File: deployment.yaml
Lines: 20
Severity: low

Vulnerability: Mutable Image Tag Used

Description:
The container image uses the mutable `latest` tag, which is prone to image poisoning attacks. It should be pinned to an immutable digest (SHA256) to ensure supply chain integrity.

Acceptance criteria:
- Acceptance is defined by the **actual reported behavior**, not by tests passing.
- Reproduce the issue, or narrow the exact code path that produces it, *before* changing code. State what you confirmed.
- Fix the underlying cause. Mitigations that paper over the reported behavior do not count as a fix.
- Add a regression test that fails on the unpatched code and passes on the fix. If a regression test is genuinely impractical (e.g. race condition, infra-level issue), say so and explain why.
- Existing tests passing is **not** the bar. Do not declare done on tests-pass theatre.

Only change what is necessary to fix this vulnerability. Do not refactor adjacent code or modify unrelated files.

Triage: Reply !fp <reason> (false positive), !valid (confirmed), !accepted_risk <reason>, or !fixed (resolved). Any other reply is saved as a triage note.
Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing.

View finding in Hacktron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant