Bitcoin was under attack! It’s the story the mainstream media won’t tell you! Hosts Aaron van Wirdum and Sjors Provoost finally met in Utrecht again to record Bitcoin, Explained. In this episode, they discuss a recent attack on the Bitcoin network, where some nodes were flooding peers with fake IP-addresses. As previously discussed in episode 13, Bitcoin nodes connect to peers on the network through IP-addresses, which they learn from their existing peers. Nodes on the network essentially share the IP-addresses of other nodes. Recently, however, some Bitcoin nodes shared large amounts of IP-addresses that weren’t associated with real Bitcoin nodes at all. While this attack did not do very much damage, it did waste resources from nodes on the network. On top of that, Aaron and Sjors explain, the attack could offer the attacker insight into Bitcoin’s network topology by analyzing how the fake IP-addresses spread through the network. Finally, Aaron and Sjors discuss how the attack was solved by rate limiting the amount of IP-addresses than any node will allow its peers to be shared. Further, they consider how in free and open source software development, fixing problems is not always as straightforward as it may seem… Chapters 00:00:00 The attack of the fake peers 00:02:42 How nodes discover and gossip peer addresses 00:06:27 The impact of bogus addresses on nodes 00:08:41 Mapping network topology through address gossip 00:12:41 Rate-limiting unsolicited address messages 00:14:44 A pre-existing fix and open-source disclosure Bitcoin Magazine is back in print! Get Bitcoin Magazine shipped directly to your front door! Get 21% off with promo code: MAG21 https://store.bitcoinmagazine.com/discount/MAG21?redirect=%2Fproducts%2Fbitcoin-magazine-annual-subscription “The Deep Dive” delivers the latest Bitcoin on-chain market intelligence directly to your inbox! Check it out for free here! deepdivebtc.substack.com/welcome Bitcoin 2022 will be the biggest Bitcoin conference ever! Miami, FL from April 6-9, 2022 Get 15% off tickets with promo code: MAG21 https://b.tc/conference/
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Aaron van WirdumLive from Utrecht, this is Bitcoin Explained.
Sjors ProvoostHello, and welcome back to Utrecht.
Aaron van WirdumThank you, Sjors. This is the first time in a long time that we're recording live in Utrecht, I think.
Sjors ProvoostYes. Something about El Salvador and other places.
Aaron van WirdumZurich.
Sjors ProvoostZurich, yep.
Aaron van WirdumYeah, so we're back. We're back in cloudy, rainy the Netherlands.
Aaron van WirdumNot compared to El Salvador, though, Sjors.
Sjors ProvoostI don't know. I haven't been there.
Aaron van WirdumSo today we're going to talk about... You really scraped the bottom of the barrel for this one.
Sjors ProvoostI did?
Aaron van WirdumWe're running out of the main topics and now you're looking in the [unclear] of Bitcointalk for remaining stuff that we can discuss in this podcast. Can't you?
Sjors ProvoostThat's one way to bring it. The other way would be to say, did you know that Bitcoin was attacked?
Aaron van WirdumWow, that's a much better angle.
Sjors ProvoostAnd that the media is hiding this from us because they haven't been talking about it. It's a cover-up.
Aaron van WirdumYeah, we have a...
Sjors ProvoostWe're going to bring the truth.
Aaron van WirdumWe're going to bring you the truth on this episode on the attack that was happening on Bitcoin. It was the attack of the fake peers.
Sjors ProvoostThe attack of the fake peers, yes.
Aaron van WirdumIt almost sounds like a movie title even.
Sjors ProvoostYeah, I mean, there's David Gerard's book, you know, Attack of the 50-foot Blockchain. But this is the attack of the fake peers, yep.
Aaron van WirdumAll right, so Sjors. So I think I'm just going to… give you the stage on this one. What was the attack? What is the attack of the fake peers? What happened, Sjors?
Sjors ProvoostWell, it was a cold day in July. So somewhere in July...
Aaron van WirdumSo it must have been in the Netherlands it was cold.
Sjors ProvoostExactly. Somewhere in July, what people started noticing, people who are running nodes, is that sort of random... people were connecting to them. Now, of course, this happens all the time. But these random people that were connecting to them would connect to them and then send, I think it was 500 messages. And each of those 500 messages would contain 10 addresses that were supposed to represent other nodes in the network.
Aaron van WirdumSo when you say addresses, you mean IP— IP addresses in this context?
Sjors ProvoostYes, that's right. So they would connect you and say, hey, did you know about these 10 IP addresses? And did you know about these 10 IP addresses? And they would just do that 500 times, and then they would disconnect. And that's a bit weird.
Aaron van WirdumYeah, so maybe before we move on, we should take a small step back, which is we discussed this in previous episodes: You're our library guy. So maybe you know which episodes these were, but we discussed in previous episodes, how nodes essentially bootstrap to the network. That is, how do Bitcoin nodes find other Bitcoin nodes, right?
Sjors ProvoostYeah, we discussed that in episode 13. And we talked about, yeah, so the node starts up and it usually asks, looks at a DNS seed, say, hey, tell me something. There's like five or six DNS seeds of people who are... It's not really trusted, but it is definitely not untrusted either. They get a list of nodes to connect to, and then your node will just randomly try a couple and others and others.
Aaron van WirdumYeah, and now you're using the word node, but these are also IP addresses, right?
Sjors ProvoostYes.
Aaron van WirdumYeah. So you start with a small group of IP addresses. And then from there, the nodes you connect to, they will share more IP addresses of other nodes with you. And that's how you connect to more nodes. And that's sort of how the network forms, right? So there are messages between nodes sharing IP addresses about other nodes.
Sjors ProvoostThat's right.
Aaron van WirdumRight. And it's these messages that you just explained were being... Spoofed? Is that the right way to put it?
Sjors ProvoostWell, the messages are real, but the contents was nonsense. So, indeed, a node would connect to you, and they would send you a bunch of addresses, but it turns out those addresses were just random numbers. So an IP address is just a number 1 to 255, and then another number 1 to 255, etc. Four numbers, usually with IPv4. And yeah, those numbers were just randomly generated. So if you were to map them out, you would see they were all over the spectrum. And that's not actually what
Sjors Provoostthe internet looks like because a lot of IP addresses are not used at all. And so it included IP addresses that just cannot exist. So clearly they were artificial IP addresses. And the problem with that is that then the odds of there actually being a node there is not that good. Because if you're just making up a random IP address, then there might not be a node there. The whole point of gossiping the nodes is that you get actual nodes. Because if you could just try random IP addresses yourself if you wanted to.
Aaron van WirdumRight. So there were nodes on the network that were sharing random IP addresses with other nodes on the network. And that's what we're defining as an attack here because the IP addresses that they were sharing were just random numbers and they didn't actually point you to a real Bitcoin node, right?
Sjors ProvoostYeah. And apparently, according to the people who did some research on it, it happened on a fairly large scale. So these people were connecting to lots and lots and lots of nodes in the network, at least to the nodes that are listening. Because one of the things is if you're starting a node, you might not be listening to the outside world. It depends, especially if you're behind a router. It's not always the case. But if your node is listening to the outside world, then what it does is it actually tells its peers its own IP address. So the first time you connect to another node, you're saying, hey, by the way,
Sjors Provoostthis is my IP address. Please spread the word.
Aaron van WirdumDo you say it's yours or do you just give an IP address?
Sjors ProvoostI think you just give one.
Aaron van WirdumRight.
Sjors ProvoostAnd, you know, the other node doesn't really know. But you can give up to 10. And that's kind of the mechanism that this attack is exploiting is kind of saying, hello, here's 10 IP addresses. And the usual assumption is if that's a new node, then, you know, the first one is probably that node. So they're kind of abusing the way that nodes used to introduce themselves to the network. Because once your address has been gossiped around, then people can connect to you and give you good stuff.
Aaron van WirdumAll right, so I'm running a listening node. I don't think I actually am, but for the... As a matter of examples, Sjors, I'm running a listening node.
Sjors ProvoostYeah.
Aaron van WirdumNow, there is this other node that we just explained that is sharing random IP addresses. So it's sharing that with my node, and we just define this as an attack. Why are we defining this as an attack? What's the problem for me or for my node? How am I... you know, how am I a victim of what's going on?
Sjors ProvoostWell, it's not a big problem for your node in reality, so it's kind of a mild attack, you could say, at least in terms of it's not an attack that would kill your node in any way. It would just get these IP addresses, and then, you know, we talked about it in earlier episodes, I think. Anyway, when a node gets a list of IP addresses, it puts them in a bunch of buckets and shuffles them around and makes sure that it doesn't listen too much to, like, the same source. And so, you know, you already have lots of IP addresses from earlier, from honest nodes. So
Sjors Provoostmost likely it won't bother you too much. You might connect to a few nodes that don't exist. You know, you're just wasting some of your time, but not a huge amount.
Aaron van WirdumBut I would connect to these IP addresses or would I just notice, would my node just notice that these aren't nodes and just disconnect immediately?
Sjors ProvoostWell, that's, that's, but that process takes time, right?
Aaron van WirdumOkay, yeah, that's what I'm asking.
Sjors ProvoostYour node is keeping a list of nodes, of IP addresses that it could potentially connect to if it needs more connections.
Aaron van WirdumGot it.
Sjors ProvoostAnd then it'll go through that list that is a useless list, basically.
Aaron van WirdumRight, so it's wasting some of my resources. It's wasting some of my resources because my node is storing IP addresses that aren't real Bitcoin node IP addresses. So I guess that's a little bit of waste there. And then once in a while, I'll try to connect with the node and there's a little bit of bandwidth waste. Yeah. And that's sort of it.
Sjors ProvoostYeah. So at the individual level, this is not really, you know, you could call it an attack. It's like a kid throwing a little pebble at you. You could tell the kid, hey, you're attacking me and you could shoot the kid. But usually we just, you know, keep walking.
Aaron van WirdumGot it.
Sjors ProvoostAnd nobody noticed it, right? Most people who are not actively looking at their node would have not even know this attack happened. So that's good.
Aaron van WirdumSo then why would an attacker, I think that's the next question, why would an attacker even bother then? Because clearly someone was bothering to do that. So what is the potential benefit of this type of attack?
Sjors ProvoostSo there's two people who wrote a paper, Matthias Grundmann and Max Baumstark, and we'll link to it in the show notes from, I believe, the Karlsruhe Institute of Technology. And the department is the Institute of Information Security and Dependability. And I guess that might give a little hint. So what they're guessing is that this attacker was not so much trying to destroy the network as they were trying to map the network to get a sense of how well nodes are connected to each other. And the
Sjors Provoostreason they can do that is because when you receive these 10 IP addresses, you will forward some of them to some of your peers, but not all of them. So you get some exponential decay where you send them to your neighbors and their neighbors send some of them to their neighbors. And so if you're the attacker and you're also just running regular nodes, then eventually you'll hear some of the echo of your own attack, basically, because your peers will eventually relay it back to you. And by looking at this sort of this echo, you can determine a little bit of
Sjors Provoostwhat the network looks like, the shape of it, how well connected it is, how robust it is.
Aaron van WirdumRight. So in the same way that individual transactions, for example, make their way through the network by nodes forwarding the transaction to other nodes, they are also forwarding these IP addresses to other nodes. So if you keep track of how the IP addresses are shared over the network, you learn something about how nodes connect to each other, which nodes connect to each other, in what order they connect to each other, that kind of stuff.
Sjors ProvoostRoughly, though not precisely.
Aaron van WirdumYeah, and you can potentially use that to analyze the actual transactions as well. So if you want to learn something about where transactions originate, for example.
Sjors ProvoostI don't think you can with this type of attack. That's at least what I've been told. But you can get a general sense. At least you can get a general sense of the shape or maybe the robustness of the network. So that's useful information then if you want to attack in the future, perhaps. Or more likely, my guess would be maybe it was just people doing research, some academic research, trying to find out what the network looks like.
Aaron van WirdumRight.
Sjors ProvoostAnd maybe they'll publish a paper next year.
Aaron van WirdumRight. So what it does is it helps you map the network. And for whatever reason you want to do that, we don't know that, but it helps you map the network. It helps you figure out who's connecting to who.
Sjors ProvoostYeah, but there are some defense mechanisms in nodes already to make it not too easy to use this information. So for example, one thing is if you're telling a node a bunch of IP addresses, it's not immediately going to connect to all of them because that would be kind of obvious. And it doesn't relay all of them. And there's some time delay in when it relays some of them. So it makes it very difficult to say specifically which node connects to which node connects to which node.
Aaron van WirdumAnd these are these defense… mechanisms specifically for this type of attack then or…
Sjors ProvoostThat's my guess but I'm not sure.
Aaron van WirdumAnd have they been in Bitcoin Core for a long time or are they new?
Sjors ProvoostI think they get incrementally added, I guess, when people do these types of attacks then, then people like Greg Maxwell and Pieter Wuille will look at it and like maybe we can add this little defense.
Aaron van WirdumI see. So these are attacks that have been happening more often over the past couple of years?
Sjors ProvoostI think so. Not the specific type of attack.
Aaron van WirdumBut these general types of IP sharing attacks?
Sjors ProvoostI think just probing the network in weird ways.
Aaron van WirdumRight.
Sjors ProvoostBut it's not really my area of expertise, so I can't really tell much more about that than this vague answer that I just gave you that it does seem that people are probing the Bitcoin network.
Aaron van WirdumFair enough.
Sjors ProvoostOften probably just for research, but who knows? There might be some evil army out there.
Aaron van WirdumSo is there a solution? Is there a definitive solution? Is this even a concern that developers feel like deserves a solution?
Sjors ProvoostSo there is indeed a countermeasure that's been added. Like we said, it wasn't a... Yeah, so that's kind of the cliffhanger we can end on. But first, let me explain what the countermeasure is. The countermeasure basically says that… And normally, when people are acting nice, they will connect to you and they'll send you one IP address, namely their own. And then occasionally they'll send you some other IP addresses, but not very frequently. And people have measured the average speed. I think it's like 20 times— No, once
Sjors Provoostevery 20 seconds on average or something like that. And so this defense mechanism...
Aaron van WirdumOnce in every 20 seconds, an average node will share an IP address with a peer.
Sjors ProvoostYeah, it might be a different number, but anyway, there's some average number.
Aaron van WirdumSomething in that ballpark.
Sjors ProvoostYeah. And so you can use that by introducing a sort of a rate limiter. So a rate limiter basically says, okay, when a new node connects to me, I'll allow it to send me one address immediately. And then I'm going to allow it every 20 seconds up to one address. So it just tracks how many seconds have gone by, and if it's sending too many addresses, it'll just ignore the new ones that go over this rate limit. So you don't get punished for it. But this way, when somebody connects to you and sends a firehose of addresses to you, you just
Sjors Provoostignore all of them.
Aaron van WirdumRight.
Sjors ProvoostExcept the first one. Now, there are cases when nodes actually want to receive addresses from their peer, and there's a special message from that. So if somebody connects to you and you say, please tell me addresses, like give me up to 1,000, then, of course, you will not rate limit the response. You'll make sure that they can actually give you those addresses. But if it's unsolicited, then you rate limit it.
Aaron van WirdumSure. So it's rate limited unless you overwrite that limit.
Sjors ProvoostYeah, and that pretty much gets rid of this attack. Now, the interesting part is that apparently...
Aaron van WirdumIs this the cliffhanger?
Sjors ProvoostThis is the cliffhanger.
Aaron van WirdumNice.
Sjors ProvoostThis fix was added before the attack happened. A few weeks before. Or even just one week before.
Aaron van WirdumSo the fix was added in Bitcoin Core.
Sjors ProvoostYeah, so not released. It was just in the... No, it wasn't even merged. So it was an open pull request.
Aaron van WirdumRight.
Sjors ProvoostSo that means it proposed change to Bitcoin Core. And it was open. And then I think a week later or so that attack happened. And it was then merged like a couple of weeks later, but it's been released now in version 22.0.
Aaron van WirdumRight. So the problem was anticipated. A solution was developed. And before the solution was actually deployed, the problem was abused.
Sjors ProvoostYeah. So it almost sounds like somebody saw the solution and thought, huh, maybe I can do this attack. Or perhaps somebody was already planning this attack and then thought, oh shit, I'd better do it now because it won't be possible anymore soon.
Aaron van WirdumYeah, that's an interesting point about open source development in general. Now, this is a very innocent example, but we've seen other examples of this. I remember back in the Bitcoin Unlimited days, if you remember that, where they had this alternative implementation that had a bug in it; then it was basically the bug was fixed but before the fix was deployed, the bug was exploited and it brought down
Aaron van Wirdumall the Bitcoin Unlimited nodes at that time.
Sjors ProvoostYeah, so around 2013 on Bitcoin, something similar didn't happen, but could have happened, where I think the OpenSSL library was made, so basically it was made stricter in a soft fork by saying, okay, the signatures have to be— I don't know, some positive number or not a negative number, some some constraints on the signatures— was made because otherwise OpenSSL would be unpredictable or something like that. And it was presented as just a nice cleanup soft fork, but it was actually also a patch for a security vulnerability where somebody could
Sjors Provoosthave posted a slightly different kind of signature and caused a fork because some nodes would accept it and other nodes would not accept it.
Aaron van WirdumYeah, this is a very interesting problem. I think it has happened a few times before and it seems like the overall solution from Bitcoin Core developers is to sort of pretend that it's not a big deal until people have actually downloaded and used the software and then later they'll reveal that it was actually a much bigger problem.
Sjors ProvoostAt least in those examples that that seems to have happened. Yeah, and that's of course not ideal because in open source development you want to be very transparent about things you're changing, because you know, if you're being not transparent about fixing a critical bug, then maybe you're also not transparent about adding inflation, right? So, so it's, it's delicate balance.
Aaron van WirdumWell, that's another example, actually. That was also the inflation bug a couple of years ago. And that was another example where the fix was presented as something very unimportant.
Sjors ProvoostWell, no, it wasn't presented as something. It was presented as important, but it was not the full truth. It was presented as this will crash your node, this bug. And we fixed a bug that can crash your node. And that was true. It could crash your node. But it could also create inflation, which is a bit more important. And that was, of course, not announced.
Aaron van WirdumYeah.
Sjors ProvoostBecause somebody could have done that in that window of opportunity.
Aaron van WirdumIt's an interesting problem. Anyways, back to the fake peers attack. The fake peers attack happened, as we discussed, after a fix was actually written but not deployed yet. But now the fix is deployed. It was deployed in Bitcoin Core 22.
Sjors ProvoostYeah, so anybody who's running Bitcoin Core 22 won't have this problem and anybody who doesn't still doesn't really have the problem.
Aaron van WirdumGot it. I think that that covers it all. Sure, sure.
Sjors ProvoostNo, I think so too. So in that case, thank you for listening to Bitcoin Explained.
Aaron and Sjors discuss Bitcoin Core 32.1 and its updated security disclosure policy in this live conference recording, followed by audience questions. Links Bitcoin Core 32.1 release announcement and release notes...
Aaron and Sjors discuss the COLDCARD hack: the bug itself, how it could have happened, and some reflections on having had Coinkite as a sponsor. Note: If you’re using a COLDCARD and still haven’t moved your funds to a...
The COLDCARD hardware wallet has a critical vulnerability. If you are using the COLDCARD to store bitcoin, move them to a secure location as soon as you can. More information:...
Aaron and Sjors discuss what’s new in Bitcoin Core 31. Chapters 00:00:00 Episode 100 and Core 31 00:02:41 Cluster Mempool 00:10:45 Package Relay and Fee Selection 00:18:59 Private Broadcast over Tor 00:24:03 ASMAP and...