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