eBPF Offensive Capabilities – Get Ready for Next-Gen Malware (2023)
sysdig.com
sysdig.com
Netlink is pretty awesome, you can sort of think of it like ioctl on steroids. As a result it's proliferated around the kernel as much nicer replacement for ioctls or implementing a custom character device or something for userspace/kernel communication.
Knowledge of this isn't widespread however, even security experts I have spoken to that don't have deep kernel development background aren't really aware of how widespread Netlink is in generic non-network related subsystems.
Depends on the scene. This is why my portfolio companies as well as my previous employer when I was a PM and SWE began moving engineering (and even PM) hiring to Israel, CEE, and India.
I've noticed a severe degradation in OS, Systems, and Networking knowledge in the US market over the past 15 years.
Everyone went gungho into "fullstack" or "backend" and significantly deskilled.
> Netlink is pretty awesome
It really is. Most security products will use a mix of Netlink and eBPF to gain observability and enforcement capabilities on Linux workloads.
> if you have to say run a daemon that manages network device state that now becomes attack surface for other juicy things you can do with Netlink (because once you have CAP_NET_ADMIN everything is up for grabs)
Big reason most companies I know of would prevent third party software from being granted CAP_NET_ADMIN
I think awesome in kernel terms is always relative. It's awesome compared to ioctl or custom character devices (or the very dirty option of custom syscalls). I suspect io_uring would be a much much nicer alternative but it's also much more modern and not something I have worked with yet.
For the latter case, there are now mechanisms that aim to prevent root from modifying the kernel or otherwise getting ring 0 access, see eg https://www.man7.org/linux/man-pages/man7/kernel_lockdown.7....
But even in a non locked down mode, there are practical advantages for the adversary in using officially supported interfaces vs their own kernel module or leveraging some i/o path to access kernel memory.
To me It feels more like a reverse proxy for intercepting traffic going between user land and kernel space.
As we move to k8s and classic EDR isn’t feasible i 100% understand the need. It still feels like a dumb thing humanity has done and will blow up in our face after having the kernel / user space security boundary beat into our heads for so long.
Though it's still not exactly clear to me what the verifier intends to prevent. I can understand that it limits how far you can look up into the stack and what memory your eBPF program can read. But can we otherwise just run any random code in eBPF? The register value tracking and DAG stuff kind of goes over my head.
In short, could I write a Scheme in eBPF and pass it a program at runtime, through a map?