DSS 2026 — Automated Flashloan Attack Discovery Speaker credit under review Source video: https://www.youtube.com/watch?v=rtPGleXFIA4 Automatic captions — not human-reviewed. Complete spoken-audio coverage is unverified. Source language tag: en (English). Source export SHA256: 2440394d8d08efd8bf3480d0edba73c853792a0f25aea29335e839ef7b04eee9 [0:00] Um if you can hear me the first thing [0:01] you'll notice is that my name is Martin [0:03] Ion Martin and I go back a long way. Um [0:06] we both did our PhD at the University of [0:08] Wateroo. We are both auditors at [0:09] Quonstant and then we both co-ounded [0:10] Zirket. So I know Martin very well and [0:12] this content very well. But due to some [0:14] travel disruptions, he's not here. So [0:16] I'm presenting on his behalf. If you [0:17] have any questions, I'm happy to take [0:19] them and refer them to Martin or answer [0:21] them directly. Uh but without further [0:23] ado, let's get into it. Um so I'm going [0:25] to talk to you about automated flash [0:27] flow and attack discovery. This is [0:28] something that we've been very [0:29] interested as auditors for years. Um, [0:32] and we're going to give some updates on [0:34] some tooling that we have developed. So, [0:37] we'll go through the background. We'll [0:38] give some updates on what we did, why [0:39] we're giving this talk today, and then [0:42] what we would like to see next in this [0:44] particular area of um security. So, [0:47] first, what is a flash loan? Probably [0:50] everyone in this room does know what it [0:51] is, but I do have to go through and tell [0:53] you what it is. Essentially, they are [0:55] unc uncolateralized loans that you can [0:57] um take out over the duration of a [0:59] single block. Usually a lot of liquidity [1:02] uh usually you can get as much as you [1:04] want. It's only bounded by what's [1:05] available and as long as you pay it back [1:07] within the same block, everything looks [1:09] really good from the contract you're [1:10] borrowing it from and you don't have to [1:12] pay a lot of interest. In fact, pretty [1:14] much none because it's the same time. [1:16] So, uh these have been really [1:17] problematic in this space. In 2023, [1:20] um when this particular tooling was [1:22] started, there were over $300 million [1:25] lost um to attacks of this type. And [1:27] this is a particularly challenging uh [1:29] class of bugs to find because really [1:31] it's not always a bug. A flash zone is [1:33] not necessarily a bug on its own. Some [1:34] people argue there are positive use [1:36] cases. I've yet to find a lot that I [1:38] love. Um but the challenge of finding [1:40] them is that they're actually between [1:41] protocols. So typically one protocol [1:43] lends and then that excessive amount of [1:46] um length of asset negatively affects um [1:49] assets in another protocol that protocol [1:52] you know does something with its own [1:53] pricing uh and then gives the attacker [1:56] some upside and then the original [1:58] capital is returned and everything works [2:00] out. But because of this difficulty, [2:02] auditing any single protocol or [2:05] reviewing any single protocol is very [2:07] very um unlikely to find that bug or at [2:10] least um you have to know what to look [2:12] for and you have to be very familiar [2:13] with flash loss. So because you're [2:15] looking at multiple protocols, these [2:16] things are particularly challenging and [2:17] so we think it's something we need to [2:18] actually care about a lot. To do that um [2:21] some tooling was built. So in 2023 um [2:24] Jeff and others at the University of [2:25] Toronto, Jeff worked at Quan for a while [2:27] uh built a tool called Flash and Flash [2:29] was actually pretty effective at finding [2:32] these types of attacks on deployed uh D5 [2:35] protocols in the Ethereum ecosystem. So [2:37] what we wanted to do is actually see if [2:39] we can update this because some reasons [2:40] I'll get to in a second. But first, how [2:43] does it work? Very quickly, um this is, [2:45] you know, a long paper published at [2:47] Dixie. So I can't present it all in 15 [2:48] minutes, let alone as part of the [2:50] background work. But essentially what [2:51] you're going to do is you're going to [2:52] treat the flash loan as a optimization [2:55] problem and then you're going to use um [2:57] counter examples to refine the system. [2:58] So you're going to sample things that [3:00] you can do on various D5 protocols on a [3:02] real fork of D5 protocols. You're going [3:04] to try to like you know mock the VM so [3:06] that you can make calls from that as [3:07] appropriate or just actually get the um [3:09] flash loan itself working. And then [3:11] you're going to approximate some profit [3:14] measure. You're going to search for an [3:15] action sequence that let lets you get to [3:18] that approximate value. So, you know, [3:19] various loans, various deposits, various [3:21] withdrawals, depends on the assets [3:23] involved, depends on the um supporting [3:25] infrastructure you can do. And then if [3:27] you can do that and you verify that [3:28] you've made some money, then you sort of [3:29] report, hey, I may have found a flash [3:31] loan. This is a real problem. Let's go [3:33] take a look. Um, but basically what [3:36] we're looking for in these types of [3:37] sequences are things that are price [3:38] manipulation or oracle manipulations and [3:40] exchange rate manipulations. So, we're [3:42] not necessarily um looking for other [3:44] things. Now, if we find something else, [3:46] that's cool. But typically out of out of [3:48] scope are things where you have only a [3:50] limited number of uh actions you can [3:52] take. Uh logic bugs like re-entry. This [3:54] is not the type of bug we're finding. [3:56] And some very weird singularities like [3:58] when things go to zero. So this is sort [3:59] of looking for the average case in the [4:01] real world um after an audit. So you [4:04] don't expect really bad code, you just [4:06] expect weird interactions between pieces [4:08] of code. And the idea is to find [4:10] something where you get profit. And it [4:11] does this. It does this reasonably well. [4:14] And over the last 3 years, 2023 was was [4:17] 3 years ago, um, Quamp and Martin and [4:21] others have started looking at this tool [4:23] and using it in some various places. We [4:25] want to use it more. We think it's [4:26] actually underutilized. We think flash [4:27] one tooling is still something that's [4:29] not particularly um, up to date and we [4:32] wanted to change that. So, what Martin [4:33] did uh, was actually take this to the [4:35] first DAO security funding round, which [4:37] happened over the summer and said, "Hey, [4:39] you know, can we raise some money to [4:40] modernize this tool?" because prior to [4:42] this um update, which is why I'm giving [4:44] this talk on's behalf, it would be very [4:47] cumbersome to use this tool. It's not [4:49] quite as bad as full formal [4:50] verification. So, you don't need a whole [4:52] bunch of, you know, very specific domain [4:54] specific languages to learn, but you do [4:55] need to go into the tool and figure out [4:57] how it works. But over the last 3 years, [4:59] in addition to um hacks being obviously [5:01] still problematic, uh we've seen LLMs [5:03] become very very popular and doing a [5:05] bunch of really cool stuff. And so if [5:06] the LLM can do all that stuff for you, [5:09] we should make it so that the LM can do [5:11] that for you. And so that's what we [5:13] wanted to do over the last 3 years. Um [5:15] what we wanted to do is basically make [5:17] it very very simple to take this tool, [5:19] download it from the GitHub repo, and [5:20] then make minimal set of configuration [5:22] changes to say, hey, I want to look at [5:24] this protocol on chain and see if it's [5:27] vulnerable to flash context. And so now [5:29] all you need to do is define two files, [5:30] um this attack.est.sol file and this [5:33] manifest manifest.l [5:35] and set it up in all the right right [5:36] ways and you say, "Okay, I want to [5:37] deposit certain assets. I'm looking for [5:39] these parameters." And if you tune all [5:40] of that, right, the engine's going to do [5:42] the work without you having to go edit [5:43] that. So, this is actually a bit of a [5:45] cleanup and an update from the original [5:48] version of the software that probably [5:50] would require an auditor or at least a [5:52] couple of hours of work to fix. So, now [5:54] um as you'll see later, what we can do [5:56] is actually get LLM to this very [5:58] quickly. More concretely, over the [6:00] summer after the funds were raised, what [6:02] uh was done was to first make things [6:03] reproducible. So, we dockerize things. [6:05] We've made Python work a lot better with [6:07] up to- date dependencies. Obviously, [6:09] software supply chains are still a [6:10] concern, but like um you know, things [6:12] that were currently state-of-the-art in [6:14] 2023 are no longer the case now. So, [6:16] even that would have been a problem for [6:17] you. Now, we fixed that. Second, uh we [6:20] wanted to be able to use these manifests [6:22] and test files rather than uh going into [6:25] the engine and making changes very [6:27] hands-on in a very messy way. We also [6:30] made some bug bug fixes like changing [6:31] how decimals are handles. So we can do [6:33] this um you know in a better way and as [6:36] a result we get better results. Actually [6:37] the tool became more accurate. And then [6:40] finally um three things that are really [6:41] cool. Uh a CLI that's actually really [6:43] compatible with LM. I'll still get to [6:45] exactly how that works, but essentially [6:47] we have some new commands that basically [6:49] say, you know, to the LM, if you just [6:51] want to collect data, do this. If you [6:52] just want to validate something, do [6:53] this. It's very simple. Now, um I don't [6:56] have time to give you an example over [6:57] the next 7 minutes. Anyways, uh but do [6:59] take a look. There's a link at the end. [7:01] And we can also define a grammar for [7:03] what it means to actually have a flash [7:05] on borrows and deposits be inverted and [7:07] things like this. And if you donate and [7:09] burn, there's different. And finally, [7:11] there's performance updates. Um, as [7:13] software developers, we're also uh [7:16] always excited to get performance [7:17] improvements and so we're able to make [7:18] it almost two times faster. Um, using [7:21] more modern versions of standard [7:23] blockchain testing tools, which is also [7:25] really cool. So, the work's been update [7:27] or yeah, the work's been completed and [7:29] the software has been updated to test [7:31] that. And maybe this is the impact that [7:33] maybe I should have led the slides with, [7:34] but um, essentially we were able to run [7:37] it against common hacks that we found [7:39] and it still performs very well. it [7:41] still finds things that um were [7:43] problematic. So if we pointed back at [7:45] Oiler or Harvest or a damn vulnerable [7:48] DeFi uh example or Lazy Summer, the ones [7:50] shown on the screen, it will actually [7:52] find flash loans that would have uh [7:54] resulted in this problem. So these are [7:56] all um exploits that have been fixed or [7:58] been exploited in the real past or that [8:00] you know not something you want to [8:01] target now. These are not new exploit [8:03] vectors. Um we also created some new [8:05] examples for you to see how it works. in [8:07] particular, we came up with this fluid [8:09] Q1 where you can sort of say that [8:11] actually sometimes not all um situations [8:14] are going to be flash loans and so it [8:16] serves as a way to calibrate your own [8:18] testing. But essentially um this slide [8:21] shows that the tooling will find flash [8:23] loans in real world situations and it'll [8:25] come up with the exact sequence of [8:27] events that you need to have executed [8:28] that attack. Now obviously the tool is [8:30] not meant for exploiters, it's meant for [8:32] people to guard these systems. So you [8:33] see this and you figure out what is need [8:34] to change and you go home and change it. [8:36] straightforward. Um, as a more concrete [8:39] example, we'll take a look at the lazy [8:41] summer example. Uh, the exploit that [8:43] happened in the real world was 6 [8:45] something million. It's a lot of money. [8:48] Our tool found a flash loan only of 1.4, [8:50] but that's still enough for you to say, [8:52] "Hey, wait a minute. Maybe someone else [8:53] could have had a better flash loan or [8:55] there's still a flash loan possibility." [8:57] So, while the tool is not absolutely [8:59] perfect, obviously didn't match what the [9:00] exploiter did, showing a flash loan [9:02] vulnerability of 1.4 4 million is still [9:04] probably going to be enough for everyone [9:05] in this room to to take a look at their [9:06] code and say, "Hey, wait a minute. I [9:08] should do something about this and maybe [9:10] there's something we can do." And so the [9:11] way it did it is found a sequence of [9:13] deposits and donates and redeems in such [9:14] a way that this happened. This is really [9:16] cool because it used multiple um vaults [9:19] and other systems in in order to do this [9:21] and it did it all automatically. So [9:23] that's really really cool. Um this is [9:25] also the same type of attack that uh [9:27] harvest suffered as well. In other [9:30] cases, we don't want to show you that it [9:31] only works in good ways. if you want to [9:33] make sure that it doesn't give you false [9:34] positives uh in some settings at least [9:36] and so we came up with other work [9:38] examples with all this one through a T1 [9:40] and essentially we came up with some way [9:41] that you get an NFT issuance token and [9:44] you get some position and then the tool [9:46] will basically report that in this case [9:47] actually it's not that problematic um [9:49] and because this is a very worked [9:51] example within the code I'm not going to [9:52] go into it it's not something that's [9:53] very general most people will understand [9:55] but um it does not report many false [9:57] positives but in short um of many of the [10:00] old of the hacks that have happened [10:02] recently [10:02] It still actually does a pretty good job [10:04] at about half of them, which is great. I [10:06] don't think any one tool is going to [10:07] solve every single hack. But if we build [10:10] a set of tools to put in our toolbox, [10:12] one tool will hopefully find the problem [10:13] in every protocol if there is one. [10:17] And now, um, the idea was basically to [10:20] make it very easy to run for LLM so that [10:21] you yourself don't need to run this. Um, [10:23] here's an exact prompt you can use. It's [10:25] going to be on the slides, a link to it [10:27] later. Um, but essentially instead of [10:28] having to do any manual work with uh the [10:31] Smashson codebase, you can now just [10:34] import it, have your, you know, catch or [10:36] cla or copilot or wherever you say, [10:38] "Hey, I want to do this. Find me hacks." [10:40] And then it's it's good. The downside is [10:43] um because you found profit doesn't mean [10:45] it's necessarily a hack, but it should [10:46] be taken as a good warning sign that you [10:48] need to go look at your codebase and the [10:50] interactions that Flashton said you had [10:52] and say, "Can you explain what [10:55] happened?" And if it's a real problem, [10:56] go take some steps to fix it before you [10:58] deploy your code. Please find something [11:00] live, please report it in a whitehead [11:02] manner. Okay, almost out of time, almost [11:05] out of slides. What's next? Um, so that [11:08] was really good. I think actually [11:09] updating the tooling so that anyone can [11:12] use it is really nice cuz we actually [11:14] want to be accessible. We want security [11:15] to be accessible. We think everyone's [11:18] responsibility is security in this [11:19] ecosystem. And at this conference in [11:21] particular, I don't think that's a a [11:23] controversial thing to say. U but what's [11:26] next? Well, actually, we'd love to test [11:28] this more. And we had a bit of a problem [11:30] with that. We had the tool. We didn't [11:31] know exactly what to find. Um you could [11:34] point it at every single DeFi Lama [11:35] contract out there and it doesn't it [11:37] doesn't find a lot. That's great cuz [11:39] actually we didn't want to find anything [11:40] on a live DeFi Lama project because then [11:42] we'd have to go, you know, talk to them [11:44] and secure it and obviously that's [11:45] something we do, but uh we didn't want [11:47] any of the contracts to be vulnerable. [11:49] So, uh, everything worked out really [11:50] well, but it was still very difficult to [11:53] find, um, things that you should test [11:55] pooling. And so, one thing that we want [11:57] to talk about for the last few minutes [11:58] of this talk is essentially, can we come [12:01] up with a directory of value, a system [12:03] or an onchain registry that says these [12:05] are contracts that are really valuable, [12:06] so you can test to link against it. And [12:08] actually, what Martin did was put [12:10] together an RFP for exactly this on the [12:12] next DAW funding round. So if you have [12:14] money to burn and you think security is [12:16] a an important thing, security [12:18] researchers always need a good corpus of [12:19] valuable contracts because otherwise [12:21] they will cherrypick the ones that they [12:22] need to get their paper published, but [12:24] that's only going to save those [12:26] contracts. We need all of them to be [12:27] saved. Um, and so the idea was to put [12:29] out an RFP where anyone can submit a [12:32] contract saying this is something that's [12:33] really valuable to the community. It [12:35] should not get hacked. Test your tools [12:36] against it. If you find something, go [12:38] please, you know, report get a bug [12:40] bounty for it if that's possible. So, [12:42] this is an active DAO uh funding [12:43] proposal that's open right now. Um, if [12:45] you're interested, take a look. There's [12:46] a link at the end. Come talk to me or [12:48] I'm sure there's some people from the [12:49] DAO here. There were yesterday, so I'm [12:51] sure they're still here. Please, you [12:52] know, talk to them. And why we want that [12:55] is again because um the tooling we found [12:59] on previous exploits worked. We were [13:02] able to find them. Maybe not the same [13:04] magnitude, but we were able to say flash [13:05] loans existed on the previously hacked [13:07] versions of code. That was good. also [13:10] good, but not necessarily good from a [13:12] tooling point of view or tooling [13:14] research point of view is that when we [13:15] point it on live contracts, it also [13:16] reported no bugs. That's good in the [13:18] sense that nothing's vulnerable, but [13:20] it's bad in the sense we don't know what [13:21] to test. We don't know where else is [13:23] going to be vulnerable, right? What we [13:25] want to be able to do is point at new [13:26] contracts that you're currently using [13:28] that you think is important and say, [13:29] "Hey, is this currently vulnerable? If [13:31] so, let's go fix it." So we have a a [13:33] good, you know, set of of back testing [13:36] that works and we know that the things [13:38] that are really really popular are [13:40] secure, but there's a middle ground that [13:41] surely holds millions of dollars that a [13:43] lot of people are going to use and we [13:44] need to be able to secure those as well. [13:46] So we don't know if our tool is more in [13:48] the it's definitely not going to find [13:50] something on deployed code or it only [13:51] works on back testing because we've [13:52] overengineered it in that way which I [13:54] don't think is the case. So we need more [13:56] data. The one way we can do this is to [13:59] get that RFP settled to get a nice [14:01] directory of value and then [14:04] throw a bunch of LLMs with this tool on [14:06] it and say, "Hey, what what actually [14:07] went wrong?" You know, what needs to be [14:09] changed and is that our tooling that [14:10] needs to be changed? Is there types of [14:12] um flash that we're not capturing or are [14:14] there vulnerable contracts out there [14:15] that need to be secured today because [14:17] otherwise something will happen. So, [14:18] what would settle it is if we get some [14:20] exploits that do it and they don't [14:22] necessarily come with explanations of [14:24] the mechanisms, right? that would make [14:26] sure that the tool is finding a general [14:28] case and we haven't overengineered for [14:30] specific flash loan cases. To do that, [14:31] we do need that RFP. Please talk to me [14:34] about funding it. With that, I'm out of [14:36] time. Anyways, these are the links. [14:37] Flash is available in the quant GitHub [14:39] and the directory of value is um open [14:42] for funding on the Dow right now. So, [14:44] thank you very much. Any questions, find [14:45] me or email Martin. Thank you.