mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-01-31 15:53:33 +08:00
47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
id: k8s-containers-share-host-ipc
|
|
|
|
info:
|
|
name: Containers sharing host IPC namespace
|
|
author: princechaddha
|
|
severity: critical
|
|
description: Checks if any containers in Kubernetes Pods are configured to share the host's IPC namespace, which can lead to security risks.
|
|
impact: |
|
|
Sharing the host's IPC namespace allows containers to access data across all containers on the same host, posing potential security risks.
|
|
remediation: Ensure that no container in Kubernetes Pods is set to share the host IPC namespace. Configure 'spec.hostIPC' to 'false' for all pods to isolate IPC namespaces.
|
|
reference:
|
|
- https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
|
tags: cloud,devops,kubernetes,k8s,devsecops,pods,k8s-cluster-security
|
|
|
|
flow: |
|
|
code(1);
|
|
for (let pod of template.items) {
|
|
set("pod",pod)
|
|
javascript(1);
|
|
}
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: kubectl get pods --all-namespaces --output=json
|
|
extractors:
|
|
- type: json
|
|
name: items
|
|
internal: true
|
|
json:
|
|
- '.items[]'
|
|
|
|
javascript:
|
|
- code: |
|
|
pod = JSON.parse(template.pod);
|
|
if (pod.spec.hostIPC) {
|
|
let result = (`Pod '${pod.metadata.name}' in namespace '${pod.metadata.namespace}' is configured to share the host IPC namespace.`);
|
|
Export(result);
|
|
}
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- response
|
|
# digest: 4b0a00483046022100cc2146147ae70fb4bfc9d107d68d692ac4a287dfdaebfb356b425af0761eda00022100a8262c6003997d011ca625ceb8c1f8cc5e245c64c7306870001756811b39889b:366f2a24c8eb519f6968bd8801c08ebe |