top | item 26455058

EBPFSnitch: An eBPF based Linux Application Firewall

290 points| harporoeder | 5 years ago |github.com | reply

70 comments

order
[+] aptmiguk|5 years ago|reply
If you're interested in this, you may be interested in this as well: https://github.com/evilsocket/opensnitch

It has a GUI interface as well.

[+] creamytaco|5 years ago|reply
They're both pretty bad for something so simple. Tons of dependencies, complexity that shouldn't be there and perplexing code.

evilsocket/opensnitch is worse but EBPFSnitch could also be a lot better.

[+] XorNot|5 years ago|reply
This looks spectacular! Finally! This is functionality I've desperately wanted on Linux desktop. Link that up with with some of the SELinux on-demand tools and you have a plausible way to run untrusted binaries without the overhead of completely containerizing them up front.
[+] arsome|5 years ago|reply
Be careful with that one, this isn't as capable as the HIDS solutions available on Windows - it's not going to do things like detect exfiltration using other executables or modification of other files on your system.

For example, if you allowed curl or Firefox, another executable can simply call one of them and send/receive whatever data they need to. It also can't do things like filter ptrace calls which could easily be used to modify another process to perform exfiltration or just spawn another thread and inject a whole new dynamic library to them, a common practice to bypass detection on Windows.

[+] yjftsjthsd-h|5 years ago|reply
without the overhead of completely containerizing them up front.

What overhead? `docker run --rm -it -v $PWD/untrustedprogram:/untrustedprogram:ro ubuntu:latest`, done. Use x11docker if needed.

[+] t0astbread|5 years ago|reply
What do you mean by "SELinux on-demand tools"?
[+] 29athrowaway|5 years ago|reply
I think AppArmor would be a better use-case for that.

With it you can write a security profile containing a rule like:

   network tcp src 192.168.1.1:80 dst 170.1.1.0:80
Networking access is just the start, you can restrict many other stuff, like access to dbus, files, signals, etc.
[+] the8472|5 years ago|reply
firejail?
[+] pratio|5 years ago|reply
For those who're unaware.

ebpf: extended berkeley packet filter

Unfortunately, even the website https://ebpf.io/what-is-ebpf doesn't mention this. Interestingly, I was unable to find the words packet filter used together as well or firewall. I might be wrong.

I know that if you know what it is you'd know but trying to explain that to my partner here just glancing at my screen wasn't easy.

[+] dsp|5 years ago|reply
The ebpf site doesn’t mention that because expanding the abbreviation is not helpful for understanding ebpf. The name is representative the past of ebpf, not its present use or future.
[+] ohazi|5 years ago|reply
I really like eBPF, and I even know what the acronym stands for, but I'm still completely incapable of reading it as anything other than "e band pass filter"
[+] Tcc1|5 years ago|reply
Why does this need nf_queue? Wouldn't it be sufficient to directly filter the connect syscalls using eBPF?

Dropping packets using netfilter makes many applications wait for a timeout. I prefer reject to filter unwanted outbound connections so that applications don't wait.

[+] rkeene2|5 years ago|reply
This uses NFQUEUE to get real-time userspace access to the ability to decide which connections to allow. NFQUEUE users must return a verdict on the packet (skb? I don't recall) before the packet continues to flow through the system. Using seccomp you don't get the opportunity to pass that up to a user to decide which action to take. Using other eBPF consumers are similar (since it represents a risk).
[+] egberts|5 years ago|reply
only problem is that you can’t get the process ID for inbound packets like FreeBSD can, for that still remains Linux’s weakest feature.

— The said feature is critical to proper DEFAULT-DENY firewall configuration/modeling.

[+] spyc|5 years ago|reply
Could you elaborate why that's critical to have?
[+] djeiasbsbo|5 years ago|reply
When I tested out eBPF a couple weeks ago I immediately had LittleSnitch in mind! Great to see that someone had the same idea and also the time to make it happen.

There's much more that can be done as well, I really highly recommend taking a look at eBPF!

[+] jackinloadup|5 years ago|reply
This is awesome. I can't wait to dig into it. I was contemplating creating creating the same thing roughly. Maybe I can now leverage this instead :-)
[+] spyc|5 years ago|reply
Reminds me of good old Kerio Personal Firewall on Windows back in the 90s. If the UI gets some more love, I see ebpfsnitch take off like a rocket :)
[+] EMM_386|5 years ago|reply
On Windows, Malwarebytes (now BiniSoft) still maintains a decent free product called Windows Firewall Control that works in a similar way. It augments the existing firewall.

https://www.binisoft.org/wfc

[+] squarefoot|5 years ago|reply
> Reminds me of good old Kerio Personal Firewall on Windows back in the 90s.

That was my first thought as well. Back then Kerio Personal Firewall was a godsend, and seeing live how much software (which on windows was 99.9% closed) was attempting to phone home behind the user, became an eye opener to many of us.

[+] sandGorgon|5 years ago|reply
This is very cool. Something like this can be a full blown commercial product.

>The control interface is implemented in Python 3 utilizing Qt5

I would recommend moving away from this and instead run the controls using a web interface. A small django/flask/fastapi app (maybe even running through docker).

U can see how that could run on a raspberry Pi and be accessible on the network through the browser.

[+] calvinmorrison|5 years ago|reply
Transmission the torrent daemon handles this nicely. Multiple frontends including gtk, cli and web.
[+] throwitaway12|5 years ago|reply
Thanks for this, I was using something similar called Opensnitch, which is unfortunately buggy and not as capable as Little Snitch.
[+] netsec_burn|5 years ago|reply
Hey, security guy here that has worked on something like this for about 2 years. This is cool but has some vulnerabilities upon a brief 10min code review. I'll see if I can circle back in about 2 weeks and make a list of what vulnerabilities EBPFSnitch has.
[+] cmeacham98|5 years ago|reply
When you say vulnerabilities what do you mean? RCE? Privesc? Software can bypass the firewall?

Also, based on your recent HN comments you seem to have claimed to find vulns in several projects, but to date have provided no proof of such claims, so I'll have to admit I'm a little skeptical.

[+] 0xbadcafebee|5 years ago|reply
I get the point of it, but I think it's a distraction from the solutions we really need. The whole idea of app firewalls is "do/don't let an arbitrary network communication happen unless I know about it". The problem is, what if what you allow still involves an attacker? Say you allow some network connection from application A to site Z using protocols B,C. And say that you even inspect the connection using DLP. There will come a point where the attacker will position themselves to appear exactly like legitimate traffic.

Ultimately, all firewalls are just a very poor hack around a complex problem. The best solution to the problem is to ensure the connection is genuine and that the data being passed is genuine, and you can't do that with an arbitrary monitoring program. You need strong end to end authentication, authorization, and integrity, and sometimes also privacy. But we don't have the tools to do that right now because the protocols were designed for a different time.

Take DLP for example. Almost every major company in the world is starting to implement traffic inspection, because how the hell else are you going to ensure security of your IP with 10,000 employees using TLS 1.3? The inspection you force on the users is its own security hole, to say nothing of software bugs. And you can't even just lock down the network to only protocols that use OAuth or something. None of our security solutions are holistic.

We need a revolution in network security that takes each part of a network communication and its individual security needs into account, not just what we imagine is end-to-end (but never actually is). We can't rely solely on a facile "privacy or nothing" approach to internet security that the TLS mafia has been pushing. We need more flexible methods that allow us to fine-tune security at each level of the protocol stack, across multiple organizations and use cases. Nothing like that exists currently for the web.

[+] eeZah7Ux|5 years ago|reply
Spot on. Firewall are becoming less and less useful in the time of cloud.

We need holistic solutions where we can control traffic by entity, domain, role, application, not IP address and port.

> There will come a point where the attacker will position themselves to appear exactly like legitimate traffic.

It's been happening for decades: botnet C&C servers use HTTPS and run on public clouds, mimicking legitimate websites.

[+] ghostpepper|5 years ago|reply
What would you propose instead?