EBAF – eBPF Based Ad Firewall
43 comments
·July 3, 2025mfro
pogue
Can you share a pre made hosts blocklist that is regularly updated & works on Spotify? The ones I've come across are all dated or still let ads through.
null
add-sub-mul-div
The great thing about AI coding is that you never have to learn enough judgment or context to know if something should be written a certain way or not!
therein
The whole thing is AI generated and you can tell from subpar decisions made at every turn.
Retr0id
I got AI-generated vibes from the banner image, which surprised me because I wouldn't expect someone to generate something so trivial.
So I investigated, lining up the real Spotify logo in GIMP - it doesn't match up, the details are different!
But then I checked the image metadata:
`Actions Software Agent Name : GPT-4o, OpenAI API`
Doh, I should've saved time and checked that first. TIL OpenAI explicitly watermarks their output images via metadata. It even has c2pa signatures (which I didn't bother trying to verify)
Retr0id
After that hint, I thought I'd give the code a quick audit. The install script adds sudoers rules to allow ebaf executable to be run with no password[0] (and also to `pkill -P` any PPID).
The ebaf executable checks the current directory by default, to look for the ebpf code to load[1].
So, running the install script this allows any ebpf code to be loaded into the kernel without a sudo password. You probably don't want this! (I'm pretty sure that'd be enough for a root LPE)
Further, the ebaf executable writes logs to a file named `/tmp/ebaf-stats.dat` [2]. An unprivileged user could put a symlink here, causing the destination file to get clobbered.
It also re-resolves all domain names every 600 seconds. Given that there are over a thousand domains listed, that's quite a lot of DNS traffic! [3]
Also, the "web dashboard" claims to listen on localhost, but it actually listens on INADDR_ANY [4]
[0] https://github.com/Kazedaa/eBAF/blob/8f88cefe0b5a837aa99f454...
[1] https://github.com/Kazedaa/eBAF/blob/8f88cefe0b5a837aa99f454...
[2] https://github.com/Kazedaa/eBAF/blob/8f88cefe0b5a837aa99f454...
[3] https://github.com/Kazedaa/eBAF/blob/8f88cefe0b5a837aa99f454...
[4] https://github.com/Kazedaa/eBAF/blob/8f88cefe0b5a837aa99f454...
bobbyraduloff
The README itself is also very much in the style of ChatGPT. It loves the to overuse rhetorical questions.
What I find most interesting is that it apparently didn’t trigger their content filters which, at least previously, were also blocking piracy stuff.
_benj
How is this different than other ip or dns ad blockers?
I see that it all comes down to a blacklist of urls. Wouldn’t eBPF just make things more complicated?
jeroenhd
Effectively, not a lot. eBPF does have the capabilities to do more than a regular firewall, but this just seems to do an IP lookup in a blacklist file.
If you buy a fancy network card from a company like Nvidia, you could run the eBPF program on the card itself and the kernel wouldn't even see the packet come in. This use case doesn't seem like it'd need that kind of performance tweak, though.
It's useful as a fun project to experiment with eBPF, though!
blipvert
Do you have a model number for an Nvidia offload card? I thought that only Netronome did them and that they were kinda long in the tooth now. I’d love to get my hands on one.
ranger_danger
It's one program that blocks everything everywhere, and doesn't rely on specific firewall configurations or DNS resolvers to be able to block requests.
And because it uses eBPF, technically (it probably doesn't support this yet but it could) you could block requests at the application level, even if it uses TLS, before it ever even gets to a resolver or firewall.
Taking that fact even further, this means that not only well-behaved resolv.conf-reading applications are blocked, but programs that use their own DoH/DoT could be as well. Your browser wouldn't even need an ad-blocker extension. Your local resolver and your VPN-specific resolver both continue to work normally while also blocking what you want.
benreesman
This is the killer eBPF usecase for the non-engineer user: getting underneath TLS and DoH (which have both been effectively weaponized at this point).
No means no, my computer my choice. sudo build a real product.
JoshTriplett
> getting underneath TLS and DoH (which have both been effectively weaponized at this point).
Only to the extent you are running software you don't trust. If you're running a user agent (e.g. a browser), rather than an app, you can easily do full ad-blocking much more effectively.
Calling TLS and DoH a weapon because apps you don't trust can use them to maintain integrity of their connections is like calling secure coding practices a weapon because they make jailbreaking harder.
null
sbarre
> We’re not here to pirate. We’re here to opt out.
Then "opt out" by not using the product? No one has a right to use Spotify. If you don't like the terms, don't use the service.
I'll never get why people smart enough to build something technically impressive like this feel the need to throw these completely childish pseudo-rationalizations out there. Yeah, you are stealing actually.. Is it that big of a deal? Nope. But it still is what it is.
Do they think this kind of false-moralizing will protect them from DMCA takedowns or something?
breppp
Artists are earning pennies of what subscribers are paying? then let's not pay, that will show them artists
immibis
Some people choose to pirate media and then pay the full price to the artists directly.
toomuchtodo
You're "stealing" (if you can even call it that) from Spotify, not artists. As of July 2025, Spotify has a market cap of $145.48B USD. This makes Spotify the world's 118th most valuable company by market cap. They'll be fine. No one has a right to revenue or profit.
Mental models differ, it is what it is. Stealing from artists is of course always poor form, don't do that.
sbarre
Curious where exactly do you draw your line when it comes to who it's ok to steal from and who it's not? Do you have a formula or something?
Or is just an arbitrary bar of convenience that you set case-by-case depending on how you want to feel about it?
> No one has a right to revenue or profit.
I certainly didn't imply anything this universal. But as a society we do have laws, and if you engage with Spotify's product, you agree to their terms, and in that very specific context they do have a legal right to see their terms held up.
Now.. will they go after you for bypassing their ads? Probably not. Will your actions have a negative impact on them? Again, nope.. I definitely agree with you that they'll be fine..
But then the people who make these products that facilitate this kind of activity should just have the conviction to stand by their actions and say "yep we're helping you steal from Spotify".
Just own it, especially if your justification is "it doesn't matter anyways".
toomuchtodo
"Can this multinational company afford it?" and "Will this incur a felony or similar judicial record?" is my bar, broadly speaking. Never take from someone who cannot afford it, or where it would be material to them. Bits, never fiat. Laws are just words, how you decide which to ignore is a function of potential legal exposure and your belief system.
I pay for Spotify because I’m lazy and can afford it, but rip whatever I want from YouTube, for example. I own it, I do not care. Why would one care what random strangers think of them?
immibis
Spotify also doesn't have a right to unmodified client systems.
If their server sends you bits, why should you delete the bits? If you accidentally sent them the wrong bits, do you think they'd be nice enough to delete them? Pre-emptively before receiving any notification from you?
Terms are irrelevant and in most cases have no legal power at all. Fighting back with technical power (as YouTube has done) is fair game though.
The golden rule of capitalism is to do everything in your physical ability to improve your individual situation at the expense of others. Feel free to come to an agreement with Spotify, that neither of you will do capitalism against the other. Until then, you should probably play the game or you will lose by default. Spotify isn't that important but you should definitely get into the mindset of playing the hand you're dealt.
sciencesama
extend this like pihole so we can use it for reddit and facebook and instagram ad blocking using proxy !
null
null
bobbyraduloff
Kernel level packet filtering to avoid Spotify ads is about the same level of mental gymnastics as the GPT-generated “we’re not pirates” argument in their README.
While Spotify is obviously an immoral company, you, the person reading this, are not entitled to free 24/7 cloud-streamed music on demand. They are a business and they don’t owe that service to you on principle.
If you don’t like them as a company, there’s way to purchase the music directly (remember how we all used the iTunes Store back in the day) and there are other streaming services whose morals you might find more acceptable.
To be clear, I’m not making some grand “piracy is evil” argument, but I’m saying that to publish software enabling piracy with the justification that a business’ free service is not good enough value for you is a bit out there.
antif
I’m confused.. effective ad blocking is now “piracy?”
I thought TiVo settled that argument long ago.
Edit; maybe not TiVo leading the disruption here: https://modern-counsel.com/2016/tivo/
NoMoreNicksLeft
>you, the person reading this, are not entitled to free 24/7 cloud-streamed music on demand.
I took it anyway. I have a few terabytes of flac that I stream through Plex when I feel like it. I dare anyone to stop me. Pay hard drive manufacturers, not IP companies.
Marsymars
> Kernel level packet filtering to avoid Spotify ads is about the same level of mental gymnastics as the GPT-generated “we’re not pirates” argument in their README.
This jumble of sentences stuck out to me as logically incoherent, but not necessarily LLM-generated. I guess I need to update my mental model a bit to account for more things being being LLM-generated.
immibis
Neither is Spotify owed anything from you. They aren't owed money, unless you agreed to pay them money (actually agreed, not clickwrap). They aren't owed ad views, because clickwrap agreements to watch ads generally don't actually have any legal force. And if they think they do, let them sue you and find out. You don't owe them advance compliance according to what would benefit them the most, but they benefit greatly from you thinking you do.
This applies to a lot of things, not Spotify in particular.
alephnerd
I'm curious about it's eBPF coexistence capabilities. If you are running an XDR like Crowdstrike, this might interfere with their eBPF sensors for Linux desktops.
jekwoooooe
Not proposing a moral opinion but this is still piracy no matter how much they deny it. The contract with free Spotify is you receive ads.
GuinansEyebrows
no advertiser has the right to tell me how to process their advertising data. hypothetically, once it's in my network, i can do whatever i please with it.
jekwoooooe
That doesn’t make any sense that’s like saying you should be allowed to trick your bank into giving you free money because you processed their website “in your network”
GuinansEyebrows
what? not at all. nobody thinks its bad that you're allowed to skip ads on podcasts by fast-forwarding (outside of advertisers). the ad has been delivered to my device by the advertiser. it's my choice to ingest it into my physical/mental body, or not.
therein
>once it's in my network, i can do whatever i please with it.
But that literally applies to any online licensing check flow.
And extends to binaries that are on your disk. I can patch that conditional jump, it is on my hard drive.
Absolutely no need to do kernel level packet filtering for this. You can use the absurdly easy hostfile approach, or a simple self-hosted DNS server. This looks entirely LLM generated as well.
Also... who the hell tries to make changes to a user's sudoers file from their install script? This is an awful project.