Potential DDoS detection #24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As has been seen all over the web (and documented in #17), recently a bunch of crawlers (suspected by many to be AI-related) have been making frequent HTTP requests that overload various websites, including many git forges (like the one you're on now).
However, this is effectively an accidental DDoS attack, and in theory said sites were always vulnerable to being taken down in such a way; this simply brought said vulnerabilities to light, at least on sites less targeted by deliberate attacks.
The de-facto workaround for this turned out to be to reverse-proxy the targeted service through a piece of software called Anubis, which filters out some requests. However, simply removing the sub-string
Mozillafrom one's User-Agent string bypasses this filter under default behavior, so Anubis is not real DDoS protection, only protection against such crawlers.It also relies on JavaScript and Cookies as its near-only means of filtering requests, and also requires support for HTTPS and modern JS APIs, which greatly harms compatibility. Again this doesn't truly prevent attacks, but merely shakes off a few specific clients. All in all, it's quite an ugly hack akin to a using a flamethrower that can only serve the purpose of a fly-swatter.
There's also Cloudflare (aka cuckflare) which is a service that acts as a reverse-proxy and intercepts all requests coming to the site behind it; since it is not ran on the site administrator's machine, it is effectively a MITM attack in my book.
It most infamously filters requests in a similar style as Anubis (granted it came first), except it's more complex and worse. However, it can protect endpoints of sites usable to non-navigator clients (like git repository contents and API endpoints). Getting hit with challenges on even some hypertext endpoints rarely to never happens. So it seems, they don't strictly need challenges to do their filtering, and this gives me inspiration...
Something I noticed after I began writing this: I read that someone had to configure CF a bunch to mitigate an attack? Perhaps it's not as powerful as I thought, though I dunno.
I'd like to note sometimes some of the "oldest tricks in the book" are still used today due to websites still being vulnerable.
These came from many IPs (in the 80.0.0.0/8 and 81.0.0.0/8 subnets), overloading nginx and even lagging my home network until I filtered it out those IPs from the VPS side
This type of attack has been around since 2009, about 10 years prior to the article being written, and even has a Wikipedia page.
I'd also like to note that while blocking these crawlers, I noticed their requests are often fingerprintable (see #17). While fingerprints can vary and sometimes be shared by legitimate clients, I still find this quite notable.
This approach alone seems to not be enough, which made me think about automatically detecting relevant fingerprints and networks. And well, perhaps we could catch other attacks this way?
So perhaps we could make our own DDoS detector for HTTP?
Considerations
Acceptwith an IE 5.0User-Agent?Perhaps a generic DDoS filter is something too ambitious or just unattainable. Still, I think it's something worth thinking about. I think we can, at the very least, kill a bunch of primitive attacks though if we try, at least maybe.
Perhaps if an attack rotates some aspects of its request fingerprints, we can detect the patterns of how it does this? Like, how frequently requests with very different headers come in?
Of course this is easier said than done and would make identification much harder. Just a thought I had.
Also there's probably something we haven't thought of. Even if we catch all potential attacks, we should do so in a modular way so we can add even more filters later.
Perhaps this filter could be written in C as a library, so it can neatly be made into modules into various web servers such as nginx. This means it would neatly fit into existing sites instead of being another reverse proxy that has to complicate things.
Other languages can probably also do the trick, but C is so standard (not that we strictly need this but literally everything has a compiler for it) and minimal (has been called portable assembly) that it's appealing, not to mention many web servers (nginx, lighttpd, apache) are written in it.
Scripting environments (njs, lua, etc) might help with testing filtering techniques early on though.
I'd also like to note that it should be plug-and-play, like Anubis. No one likes manually filtering stuff, which is probably why said program got so heavily adopted across different sites.
Also for a name, I thought of hyperwall. I got this idea when I read the definition for "Web App Firewall" which I guess this would fit but that term places emphasis on apps which...
(srsly, even technical people do, at least now in the SafetyNet era)
So I felt like looking at a lower level instead.
Back to Forgejo as an example of a service, it utilizes links heavily, in some places more obviously than others
Oh yeah, "hyperwall" just sounds cool in my mind. That could just be me though.