DSS

DSS 2026 / Day 2 / Pearl Hall

Detecting Unsafe ERC-20 Behavior: Deterministic Analysis and LLMs

George Loukovitis

13:17 · Recording

Watch on YouTube ↗Open recording viewerOriginal programme entry
Download plain textDownload timestamped JSON

Source: YouTube automatic caption track · Exported 2026-11-16. Timestamps link to the source video. Cue end times were not supplied.

Transcript

0:01So,

0:03again, am George,

0:05and we're going to be spending the next

0:07few minutes talking about the ERC 20

0:08tokens.

0:11We're going to start with the

0:11definition,

0:13proceed to all the things that might go

0:14wrong with the token,

0:16discuss how we can check for those

0:18things, and finally, discuss automation.

0:22But first,

0:23why do we care?

0:25After all, tokens are simple, right? You

0:28buy them, you wait for them to go to the

0:29moon,

0:31you buy your Lambo. Well, not these

0:33days, but you know.

0:35Um,

0:37well, they're not that simple.

0:40You see, we use them for pretty much

0:42everything in Web 3. Your voting power

0:44in a governance protocol, that's an ERC

0:4720 token.

0:48Your position in a

0:50liquidity pool, that's an ERC 20 token.

0:54Your share in a liquid staking protocol,

0:57that's also

0:58an ERC 20 token.

1:02So, what is an ERC 20 token?

1:05It's just a smart contract.

1:07Just a smart contract that implements a

1:08set of functions.

1:10Those that are defined by IP 20. We

1:12expect tokens to be able to be held by

1:15addresses and transferred between

1:17addresses.

1:19But again, these functions are

1:22implemented by arbitrary code.

1:24So, it falls on us

1:26to verify that the behaviors we expect

1:29to see from a tokens

1:30from a token will be present.

1:34So, what can go wrong?

1:37Transfer restrictions.

1:39Can you transfer what you own?

1:41Are there limits, blacklists, pausing

1:44functionality?

1:46Is this a honey pot?

1:48Can you only buy the token but not sell

1:50it?

1:51Balance manipulation.

1:53Are you the only one who's able to

1:55reduce your balance or is there a

1:57special address that do so as well?

2:01Supply manipulation.

2:03The only reason tokens have any value is

2:05because they're scarce.

2:08If they're prone to infinite minting,

2:10then they're worthless.

2:12Taxes.

2:14Are you able to transfer what you own

2:17freely?

2:18Is there a tax?

2:20Is that tax capped

2:22or might be

2:23indefinitely changed?

2:26Upgradability.

2:27Say you check for all these things,

2:30but then the code changes, so all the

2:32guarantees you gathered

2:34at the window.

2:36Centralization.

2:38We got to Web 3 because we wanted to get

2:40away from

2:42centralized authorities having power

2:43over our assets.

2:46But so many tokens do exactly that.

2:49They have a special address with special

2:51privileges.

2:52Or even if it's not in the code, what if

2:56certain addresses have 50% of the supply

2:58for of the supply

3:00or the liquidity?

3:01Then the value of the token is held by

3:03those addresses.

3:06Finally, there's reputation

3:08because all the mechanisms we discussed

3:10so far are not inherently malicious.

3:14Some tokens need them. USDC, for

3:16example, cannot exist without minting

3:19because how can it match its reserves?

3:23But the reputation of a token and

3:25further yet its creator is going to tell

3:28you how this power is going to be

3:30wielded.

3:32So how can we check up?

3:35How can we check for these behaviors?

3:39We can start with on-chain data.

3:42On-chain data providers can help us

3:44answer questions regarding the holder

3:46concentration,

3:47whether the volume of this token is real

3:50or it's artificial, was trading between

3:53certain addresses.

3:55And it can also help us understand how

3:58the creator got to have the money that

4:01was funded this project. Is this from a

4:05hack or is it just legitimate money?

4:10Then there is simulation. Again, using

4:13an on-chain data provider, we can pick a

4:15holder of a token and then use Foundry

4:17to fork the chain

4:19and simulate whatever action we would

4:20like to take with regards to this token.

4:23Then we evaluate the results and see if

4:25they what they expect them to be.

4:28So a transfer, for example, could let us

4:32know that a a token has a tax.

4:37But you're not going to sell the token

4:38the moment you buy it.

4:40So what if you're currently able to sell

4:42it, but that's no longer the case in a

4:44week from now?

4:46That's exactly how Honey Pots work.

4:48You can buy the token, but then there is

4:51some logic within the token that may

4:53disallow certain addresses or

4:55all addresses but the creator from

4:58selling the token.

5:00So how do we check for behaviors that

5:02are not currently observable, but may be

5:04enabled in the future?

5:07We can inspect the code.

5:09As a matter of fact, how many of you

5:11currently hold USDT?

5:15Good.

5:16So let's have a look.

5:19We can see here that you you're only

5:21able to transfer USDT

5:23if you're not blacklisted.

5:25The owner can blacklist you

5:28and once he does, he may also wipe your

5:30balance.

5:32In addition to that, the owner is not a

5:35renounced role.

5:36It's an actual address.

5:38So this could theoretically happen.

5:41Now there is a whole social context

5:43outside of code that may allow us to

5:45trust Tether, and that's okay. But the

5:47point I'm trying to make is that there

5:48is more to tokens than buying and

5:50selling them.

5:53We were only able to discover that

5:55because we have access to the source

5:56code of USDT as that was provided to us

5:59by Tether.

6:00That is not always the case.

6:02More often than not, when a token is

6:04first deployed, we do not have access to

6:06the source code.

6:07Coincidentally, that is also when it

6:09sees most of its price action.

6:11So, what do we do then?

6:14This is when we can turn to

6:15decompilation.

6:17You see, we might not have access to the

6:18source code of the token, but we do have

6:20access to the executable, as that is

6:22stored on chain in the form of EVM

6:24bytecode,

6:25which looks a bit like this.

6:28Well, make it a bit more readable,

6:31like this.

6:32Now, unless you're running the EVM stack

6:33machine in your head right now, this

6:35should not tell you a lot. But one of

6:37the things we do at Dedaub is that we

6:39provide a decompiler, which can take

6:42this and turn it into this, and then

6:45into this.

6:47This looks a lot like the actually USD

6:51USDT code, and it can be inspected for

6:54all the behaviors we discussed earlier,

6:56uh blacklisting, pausing functionality,

6:59upgradability, everything.

7:03The only thing is that this process is

7:05time-consuming, and more than that, it

7:07does require some technical skill. Mind

7:09you, everybody in here does have that

7:12technical skill, but that's not the case

7:14for the people outside of this room.

7:17So, my team has been trying to automate

7:19this process.

7:21The interesting thing is that I've been

7:23giving this talk for a couple of years

7:24now, and this has changed so much.

7:28Not the tokens. Tokens are pretty much

7:30the same as they have been two, three

7:32years ago,

7:34but the way you go about checking for

7:36the safety of these tokens has

7:37drastically changed.

7:39A year ago, we would be speaking about

7:42static analysis and simulation.

7:45For static analysis, you would need to

7:47collect hundreds of instances of a

7:49specific mechanism you're checking for.

7:52You would generalize it into a pattern

7:55that is general enough

7:57to catch variants, but not too general

8:01because then you drown in false

8:03positives.

8:04And then you would express this

8:06mechanism

8:07as a pattern in Slither or Gigahorse or

8:11whatever static analysis engine.

8:14Then there is simulation. You would

8:16treat the token as a black box. You

8:18would try and guess the sequence of

8:21calls you would need to make in order to

8:23trigger a behavior

8:24and then how you can actually observe it

8:27from outside.

8:30Both these techniques have issues.

8:33For static analysis,

8:35the same mechanism can be expressed in a

8:37myriad of different ways. So a

8:39blacklist.

8:40It can be a mapping

8:42or an array

8:44or an external call or whatever else.

8:48And then for simulation, say you want to

8:51simulate the call to blacklist a

8:53specific address, but what's it called?

8:55Blacklist, deny, restrict. You have no

8:59knowledge of the token a priori.

9:05LLMs to the rescue.

9:07Because the thing with LLMs is that they

9:09do not have they do not need to be

9:11tailored to the token

9:13before you get to see it.

9:15They can actually tailor the process as

9:18they see the token.

9:19So is this it? Are we done? Do we ask

9:22Load is this safe?

9:24And that's it.

9:26Unfortunately not.

9:28Because powerful as they are,

9:30LLMs are not deterministic,

9:32which means that a vague question like

9:35is this safe is not going to yield the

9:37same results every time.

9:39So the first time it might see the

9:41source code, but never see

9:45the storage allocation.

9:46And a mechanism that is currently

9:48inaccessible due to the storage

9:50allocation will be reported as active.

9:54That's a false positive.

9:56And then the second run might only fetch

9:58the API,

9:59simulate whatever call you're trying to

10:01make, see that the results are the

10:03expected ones,

10:05but never see the code and as a result

10:08miss the fact that it's a honeypot and

10:10it's now safe,

10:12but it's not safe in a week from now.

10:16There is a balance to be struck.

10:18There are things that we can do

10:20deterministically, things that we know

10:22how to do and things that we know how to

10:24guide the LLM through.

10:26And then the LLM can be used to tailor

10:28the process to its specific token.

10:32So how do we go about it?

10:35We can first define the mechanisms.

10:37The question is this safe

10:40is vague.

10:41It does not tell you anything.

10:44But you can ask an LL an LLM, does this

10:46token have a blacklist?

10:49And then you can provide a definition of

10:50what a blacklist is and several

10:52examples.

10:54And you can get a pretty good confidence

10:56that the answer is going to be accurate.

11:00Then you can provide the procedure

11:03much like we do with manual audits, a

11:05checklist.

11:07A procedure can guide you through the

11:09steps you need to take in order not to

11:11omit anything that is important.

11:14So fetch the source, fetch the API,

11:17do the simulations, check for

11:20for upgradability.

11:24Then

11:25we can provide the LLM with whatever

11:27tool can be deterministically created.

11:30like you should not let the LLM discover

11:33how to fetch source or simulate or make

11:37a read call or

11:39override storage every time. This should

11:41be provided to it.

11:45Then

11:48an a yes or no answer does not tell you

11:50a lot.

11:52But evidence can be audited.

11:54So

11:55the LLM is not going to tell you yes,

11:57there is a blacklist. It's going to tell

11:58you that there is a blacklist. It's that

12:00function. It can be invoked in that way

12:03by that address.

12:05This is something you can actually audit

12:07with your eyes by human

12:09inspection.

12:13Finally,

12:14rounds need to be explainable.

12:17And so, whatever run needs also

12:21needs to come with whatever tool was

12:23called,

12:24whatever answer was provided by those

12:27tools,

12:28and finally,

12:29how the the LLM interpreted those

12:33answers. Then a false result can be

12:36explained

12:37by whatever evidence the LLM used.

12:41Finally, there is evaluation. Whatever

12:42pipeline we create, we evaluate, but

12:44that you already know.

12:48So,

12:50in summary,

12:51tokens are not coins to be traded

12:54around, they're programs.

12:57It's up to us to check their behaviors,

12:59both present and the ones that might be

13:02enabled in the future.

13:04And LLMs are extremely powerful tools,

13:08but they need to be used correctly.

13:11Thank you very much.

13:14>> [applause]

Source and accuracy details

Source export SHA256: 2583b05484b0b24406b503ff779a79a64f06554a845de4634fd406fc0e813021