8 ms·
Mitigating a DDoS on Mastodon
- qxnqd 7y agoon my own instance of Mastodon
- wlkr 7y agoGreat write-up. As someone unfamiliar with the legal side of this, would it be worth the author contacting law enforcement of some kind?
- rehasu 7y agoIf you want to just have a piece of official documentation, why not. And if you know Putin and Xi personally maybe you even have a chance to get the DDOSer.
- philpem 7y agoUnlikely. From past experience (a 4-year-long online harassment and dirty-tricks campaign!) the police are generally clueless to online matters. The most common responses I've had were "we don't police the Internet", "there's no evidence" or "there's nothing we can do". Unless you're, yanno, EMI Records, Sky TV or someone with political sway. The most productive (best outcome) way of handling it tends to be to turn your OPSEC up to eleven and put all your XP into defence. Again, based on experience.
- wlkr 7y agoThank you for your insight. As you point out, it's no alternative to a robust defence, I was just curious as to whether it would ever actually be investigated. I would probably report it still just for accountability (e.g. insurance). Especially now you can report online.
- ekimekim 7y agoOn the subject of the IP leaking: Note that IPv4 only has 2^32 addresses, and people can and do mass scan all of them (see here shodan.io). If your service is exposing any identifiable information (ie. if it's not completely blocking all non-cloudflare IPs) then it's fairly easy to find even if it's "unguessable".
- tyingq 7y agoThat's an interesting side topic. What do services like Shodan do in an ipv6 world? Dumb brute force scanning seems unlikely.
- Nextgrid 7y agoThey run NTP servers that are (were?) included in the NTP pool to fish for clients’ IPv6 addresses.
- tyingq 7y agoInteresting. I also found this post about using UpnP on ipv4 addresses to unmask ipv6. https://blog.talosintelligence.com/2019/03/ipv6-unmasking-via-upnp.html https://blog.talosintelligence.com/2019/03/ipv6-unmasking-vi...
- koroshitekure 7y agoyep, i had the same thought which is what led me to block all other IPs - it's not the hardest thing to just make an openssl req and get the common names of the certificate returned especially if you know the hosting provider, which narrows down the ip space significantly
- zaarn 7y agoWell, that would only work if the other end responds to a request to the IP address with a cert that includes the proper domain. If you setup Cloudflare properly, then you only see a CF-based certificate, not that actual hostnames. Since you didn't send a proper hostname (unless you use PTR, which isn't reliable either) it'll use whatever default hostname it has configured (or just close the connection). Or in a case like my setup, you'll get an empty 0-byte response if no Host: header is present. The certificate is a wildcard for the primary domain the server runs, not even related to the mastodon service. And of course, this post contains enough information to probably nail it down but on the other hand, mass scanning the internet is a lot of trouble.
- 7y ago
- tyingq 7y agoAlso a good idea to have more than one DNS server, from separate providers denoted as authoritative for your domain. Assuming your CDN will let you.
- judge2020 7y agoCloudflare I believe will remove the site if other nameservers are added. Simply using a non-CF registrar and having a backup authoritative nameserver will suffice.
- rehasu 7y agoIs a federated system like Mastodon not setup in a way that users have access lists and if one server is down they simply connect to the next? I would expect to just limit the access to my server in a way that no illegal content is added to its storage and I don't have to pay horrendous fees for the network traffic and then just let the DDOS happen. At some point it needs to stop since the DDOSer will find nicer targets and the source of your problem will not have enough funds left. And then your service simply continues. That's at least how I think a federated system should work. Not sure if reality matches that.
- jboynyc 7y agoNo, accounts are instance-bound, you can't just log into another instance in the federation.
- bluehatbrit 7y agoFrom my understanding of Mastodon, you register an account with an instance and that's where your account and data are stored. You then get an address which is something like me@instance.tld. Federated instances can then connect together to read and exchange information, but for the most part your data doesn't leave your instance. I imagine the idea behind this is you can choose (or host) where your data sits, but still interact with a large network of individuals. That said, my understanding of Mastodon is limited.
- dredmorbius 7y agoAs others have noted: accounts are instance-bound. Other Fediverse protocols -- I believe either Friendica or ... I think Hubzilla? -- have some level of account portability. There's a fairly long-standing request for Mastodon to support this. For now, you can have accounts on other instances forwarded to your primary. While you can export and import your own follows, followers of your account won't automatically redirect to the new home. Masodon content however will syndicate across the Fediverse, and even some of my posts from a now-dead instance can (occasionally) be found.
- gargron 7y ago
- koroshitekure 7y agohey, i'm the author of the article really... surprised it got submitted here incidentally i'm running pleroma, not mastodon. minor detail but you know
- iampims 7y agoTo avoid leaking IPs, you can use cloudflared tunnel. It might get pricy if you move a lot of bytes, but it’ll isolate you from IP leaking issues.
- koroshitekure 7y agooh, i found out where the leak was it's right at the end of the article - the attacker was abusing the "create a preview card of any posted URL" feature - he'd post a link, wait for pleroma to go and grab the url to preview it, then narrow down which one was mine based on user agent i added an upstream proxy and anonymised the user agent, so even if he were to do that, the most he'd find was my proxy box
- chvanikoff 7y agoThat might be what you are talking about, but just to confirm: Pleroma has an ability to proxy outbound requests via `pleroma.http` config out of the box
- koroshitekure 7y agoyeah that's what I'm using I also pull-requested a user agent anonymisation setting (pleroma.http.user_agent) to make this better
- TrueDuality 7y agoDid you consider using Tor to make those kind of outbound requests? I've done that in that past for a similar situation to avoid leaking IPs, there is a latency overhead but it solved my issue pretty quickly. There were some sites that were blocking Tor exits but the vast majority were successful (enough that when the feature failed it didn't really matter).
- pferde 7y agoIt just boggles my mind how petty and vindictive people can be.
- dredmorbius 7y agoAlso: how much just one asshole can screw things up for everyone. Unfortunately, this is probabalistically likely as any community grows. Equivalent raging occured fairly early in the life of other social networks such as Usenet and The WELL.
- deleted 7y ago[deleted]
- ryencoke 7y agoAnother option since you already have OSSEC running.. Create a script for OSSEC that interacts with the cloudflare api to block the flooding IPs. This way the flood doesn't get to your server.
- aeyes 7y ago> Cloudflare logs really suck for non-enterprise customers. Clouflare logs also suck for enterprise customers
- jgrahamc 7y agoIn what way do they suck? We have incredibly detailed logs available to our customers. https://developers.cloudflare.com/logs/about/ https://developers.cloudflare.com/logs/about/
- bananocurrency 7y agoI want to write a bunch of code just to see decent logs. Thanks for passing the work to me.
- pjc50 7y agoDecentralisation fans take note: despite wanting to remain independent, the only effective solution was in this case to re-insert a giant global intermediary (Cloudflare) and block all the anonymous unaccountable Tor users. If a decentralised system is to stay decentralised, it needs to consider spammy bad actors.
- lifty 7y agoThat's true, Cloudflare has mastered the art of DDoS mitigation and they have developed some amazing tools [1] to achieve that, and fortunately they are sharing some of this knowledge. With the advent of eBPF, I reckon that this kind of tooling will become more accessible and easy to deploy for people that do self-hosting. I also hope that DDoS mitigations based on web of trust or other type of cryptographic identity [2] will come about in the future, although I wouldn't hold my breath for that. [1] https://blog.cloudflare.com/l4drop-xdp-ebpf-based-ddos-mitigations/ https://blog.cloudflare.com/l4drop-xdp-ebpf-based-ddos-mitig... [2] https://identity.foundation https://identity.foundation
- pjc50 7y agoTheir main form of mitigation is sheer size. On a smaller ISP you can just get your entire uplink saturated by the attack. Even if you correctly drop 100% of the attack packets that reach you, your system is still unusable.
- generalpass 7y agoHow come private contract clauses can't be initiated to protect from malicious actors? What if I own a server and connect it to an ISP under an agreement where the ISP is accountable for clearly malicious behavior coming from its connection (regardless of origin)? Then, that ISP requires the same agreement from me, and everyone connecting to that ISP, and on down the chain. Wouldn't we all be very active in policing bad actors in the networks we manage?
- pjc50 7y agoProbably worth thinking through why this isn't done already: firstly it's a lot of work, and secondly the cross-network accountability is very short on choices. After a certain point you have to decide whether you want to cut off a majority of the internet or put up with it. It also requires de-anonymisation (so you can identify who the bad actor actually is!) - you wouldn't be allowed a Tor exit node on this network, for example.
- adventskalender 7y agoEver since they injected 70kb of JavaScript into my site, I don't trust Cloudflare anymore. I just checked, and other CDNs seem to be very expensive. I wonder if there are any other ways to defend against DDoS? Maybe looking for a host that helps with such matters? But then they will probably be more expensive, too?