Potential Sidecar Injection Into Running Deployment

Detects attempts to inject a sidecar container into a running deployment. A sidecar container is an additional container within a pod, that resides alongside the main container. One way to add containers to running resources like Deployments/DeamonSets/StatefulSets, is via a "kubectl patch" operation. By injecting a new container within a legitimate pod, an attacker can run their code and hide their activity, instead of running their own separated pod in the cluster.

Sigma rule (View on GitHub)

 1title: Potential Sidecar Injection Into Running Deployment
 2id: ad9012a6-e518-4432-9890-f3b82b8fc71f
 3status: experimental
 4description: |
 5    Detects attempts to inject a sidecar container into a running deployment.
 6    A sidecar container is an additional container within a pod, that resides alongside the main container.
 7    One way to add containers to running resources like Deployments/DeamonSets/StatefulSets, is via a "kubectl patch" operation.
 8    By injecting a new container within a legitimate pod, an attacker can run their code and hide their activity, instead of running their own separated pod in the cluster.    
 9references:
10    - https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch
11    - https://microsoft.github.io/Threat-Matrix-for-Kubernetes/techniques/Sidecar%20Injection/
12author: Leo Tsaousis (@laripping)
13date: 2024/03/26
14tags:
15    - attack.t1609
16logsource:
17    category: application
18    product: kubernetes
19    service: audit
20detection:
21    selection:
22        verb: 'patch'
23        apiGroup: 'apps'
24        objectRef.resource: 'deployments'
25    condition: selection
26falsepositives:
27    - Unknown
28level: medium

References

Related rules

to-top