kubearmor / KubeArmor

Runtime Security Enforcement System. Workload hardening/sandboxing and implementing least-permissive policies made easy leveraging LSMs (BPF-LSM, AppArmor).
https://kubearmor.io/
Apache License 2.0
1.48k stars 340 forks source link

Security Enforcement Considerations #988

Open daemon1024 opened 1 year ago

daemon1024 commented 1 year ago

KubeArmor segregates entities into process,file and networks. But each of these entities can be accessed in different ways as well.

Like for file, Let's consider hardlinks. each file path is just an hardlink to an inode. I block access to /var/secrets.txt ( which points to xyz inode ) What if the attacker somehow creates an hardlink in an accessible directory. /home/notsosecret.txt ( pointing to same xyz inode ) Attacker can access it and do anything with it now. So ig this is what means to assign attr to objects not pathnames.

This point spawned from https://lkml.iu.edu/hypermail/linux/kernel/0409.0/1062.html which bases the design principles of SELinux. But KubeArmor is largely based around on Path names so what should be the approach, are we vulnerable to something?

Similarly for executions, it may be a file path is not directly executed but loaded into memory and then accessed from there. Once we enforce Zero Trust posture it may be eliminated, but it may not be as well. We should go through these scenarios and take considerations into the rules and Hooks we leverage here and update them if needed to enforce more comprehensive security.

Creating this issue for feedback and discussion since there are a still a lot of unknowns.

wdsun1008 commented 1 year ago

Just like Apparmor, file path based solutions can't handle attacks like CVE-2021-30465. However inode/xattr based solutions (SELinux) are not scalable (relabel, global policy store), especially in cloud native scenario. It's more like a kernel design problem, we just discuss it again on ebpf.