Attack Protection
These rules are used to counter penetration tactics in the container environment, such as mitigating container information leakage and prohibiting execution of sensitive actions.
You can refer to the following format to define policies:
policy:
enforcer: AppArmorBPF
mode: EnhanceProtect
enhanceProtect:
attackProtectionRules:
- rules:
- mitigate-sa-leak
- rules:
- disable-write-etc
targets:
- "/bin/bash"
- "/usr/bin/bash"
Mitigating Information Leakage
mitigate-sa-leak
Mitigating ServiceAccount token leakage.
This rule prohibits container processes from reading sensitive Service Account-related information, including tokens, namespaces, and CA certificates. It helps prevent security risks arising from the leakage of Default ServiceAccount or misconfigured ServiceAccount. In the event that attackers gain access to a container through an RCE vulnerability, they often seek to further infiltrate by leaking ServiceAccount information.
In most user scenarios, there is no need for Pods to communicate with the API Server using ServiceAccounts. However, by default, Kubernetes still sets up default ServiceAccounts for Pods that do not require communication with the API Server.
Disallow reading ServiceAccount-related files.
- AppArmor
- BPF
mitigate-disk-device-number-leak
Mitigating host disk device number leakage.
Attackers may attempt to obtain host disk device numbers for subsequent container escape by reading the container process's mount information.
Disallow reading /proc/[PID]/mountinfo and /proc/partitions files.
- AppArmor
- BPF