How to steal $5M with a read-only bug
Devcon·Thu, Nov 5, 2026, 12:00 AM
Speaker
Transcript
[music] [music]
Hey everyone. So, let's get started. Uh yeah, as Marcin said, 2 years ago, it was 1.1 million. Since it was my first bug bounty, I got 50k from this.
Since that, my bug hunter career started. I made more than 1 million dollars from bug bounties, most of them HackenProof. So, it was a crazy time. Yeah, [snorts] let's go straight to the bug. So, I was studying how the transaction uh processing and virtual machine works on uh Move VM.
So, when you have a transaction, you can call smart contract uh basically in few different ways. And what is interesting that you can provide parameters by uh giving just a single parameter or the list. They have a different native implementation. But, uh what you can do is okay, when you have some read-only object, let's say you have some coins uh because in Move VM, everything is like an object, you can pass many of them uh as a read-only objects. But, when you want to like do something with them, and you have like multiple object, you can only pass it once.
And you cannot have a situation where you pass multiple object and just a read-only object. But, after studying this during studies, I found one exception. There is a bug which uh allows you to do something what should be illegal. You can pass uh the same arguments uh and the same like coin as multiple object and also as read-only object when you use and list for this. It was very special edge case, and only work it worked when size of the list was one.
And I've noticed it. So, yeah, I had this bug. Now, the question is uh what you can do about this bug. Okay, normally, uh you would expect that when you pass many objects to the transaction, it will be represented in memory as a single object. So, yeah, it makes sense, you know, you pass the same object many times, it should be the same object.
But, it wasn't the case. Every time you pass an object in a transaction, like okay, you pass X three times, it's in the smart contract, you get an copy of the object. So, it's copied each time. It's not the same object, it's a different one. It will be important because in practice, it makes an copy of the object, and some objects, like your coins, tokens, shouldn't be possible to be copied.
And
[snorts]
by the way, it is a bug on itself because when you have a lot of objects, let's say 10,000 of them, and each of them is 50 kilobytes, and each of them is being copied, if you create a transaction which is like call using 10,000 of read-only objects, it creates denial of service. So, I got another bounty for that. Okay. So, yeah. But, the problem with copy alone is that the read-only copies that you cannot really steal money with this because okay, when you want to send coins, when you want to like exchange them, you need this multiple object.
So, I spent like 2 weeks studying the code, searching the native contracts, and I couldn't find any way to really abuse it. So, I would get only like medium severity bug, $10,000. So, I started to dig deeper. So, I started to searching in all deployed smart contracts. Okay, is there any bug which I can abuse?
I was looking for a very specific function. One which is taking some multiple object, and another one as the read-only object, so I can somehow abuse it. And [snorts] I had to decompile smart contracts and look over them, and I created a Python script which allowed me to like find 500 [snorts] functions which had the situation where they accept mutable and non-mutable objects. And after some time, I managed to find where this attack can be executed, and the bug would be in deterministic oracles, which are the oracles which calculate the price automatically based on the liquidity pool. So, let's say you have some pool where you like trade Ethereum for USDC and some oracle is reporting the price.
So, after you do a huge swap, the price is going to change. Yeah, you spend like $2 million, the price is moving 50 50 dollars. And what you can do with this bug in practice is that okay, you can make a snapshot of this oracle before the swap and after the swap. So, you end up with two oracles giving you the same the one oracle giving you two different prices. So, yeah, the bug is there.
The question is how to use it and I spent another days to find a perfect target for this and the target was uh uh algorithmic stable coins because they were like using Ethereum price or some other token price and they were giving you stable USD. And I found and I found that, you know, by doing a loop where I first sell like Ethereum for the higher price, then I'm using different oracle price price to to to buy them cheaper. I and I repeat this, I basically I'm able to get most of the money off of the treasure. So, I started to create a contract to exploit this. It was quite complex, thousand lines of code.
I had to borrow 22 million dollars from flash loans to to make it work. Yeah, but after working few days on this and simulating in on a copy on the mainnet, I managed to do it and it was [snorts] able to extract 5 million dollar and get 5 million dollar profits on the single transaction with like no gas no no input of other coins at all. So, yeah. And the important part is here that uh without those many extra components like without the flash loan we found deterministic oracles without algorithmic stable coins I wouldn't manage to get a critical I would only get $10,000 for medium severity but by combining so many things I managed to get it to to critical. Yeah, so that's the story from from this.
Thanks.
Amazing. Thank you, Bartosz.
[applause]
Okay, we got time for maybe one maybe two questions so if you're eager please put up your hand and uh you'll get a box thrown towards you. Okay, there's one over here. One question over here. This actually there's two but we'll start over here. Make it a quick one.
Hello. Okay, how does security work now uh
Can you talk into the box?
One two three. Okay, perfect. How does security work uh works nowadays that uh you know AI is uh doing a lot of work for auditors. Uh Uh-huh. Or are you still doing security work?
All right. Yeah, so it changed a lot. It changed a lot, you know, AI changed the bug bounties a lot and like AI can find right now 80% of the bugs I was able to find. Next year it will be able to find it all. So we'll have a lot of bugs found uh during next 2 years.
It will be crazy. And I'm not doing bug bounties anymore uh to be honest. I'm started working on uh company which does formal verification to find all those bugs and fix them. So I think this is the future of cyber security.
Great. Okay. Yeah, I think we'll we'll wrap here but if you have any questions for Bartosz I'm sure you can approach afterwards.
[music]
Automatic transcript — names and jargon may be misspelled.