DSS 2026 — Detecting Unsafe ERC-20 Behavior: Deterministic Analysis and LLMs George Loukovitis Source video: https://www.youtube.com/watch?v=PBWF8hPZMwg Automatic captions — not human-reviewed. Complete spoken-audio coverage is unverified. Source language tag: en (English). Source export SHA256: 2583b05484b0b24406b503ff779a79a64f06554a845de4634fd406fc0e813021 [0:01] So, [0:03] again, am George, [0:05] and we're going to be spending the next [0:07] few minutes talking about the ERC 20 [0:08] tokens. [0:11] We're going to start with the [0:11] definition, [0:13] proceed to all the things that might go [0:14] wrong with the token, [0:16] discuss how we can check for those [0:18] things, and finally, discuss automation. [0:22] But first, [0:23] why do we care? [0:25] After all, tokens are simple, right? You [0:28] buy them, you wait for them to go to the [0:29] moon, [0:31] you buy your Lambo. Well, not these [0:33] days, but you know. [0:35] Um, [0:37] well, they're not that simple. [0:40] You see, we use them for pretty much [0:42] everything in Web 3. Your voting power [0:44] in a governance protocol, that's an ERC [0:47] 20 token. [0:48] Your position in a [0:50] liquidity pool, that's an ERC 20 token. [0:54] Your share in a liquid staking protocol, [0:57] that's also [0:58] an ERC 20 token. [1:02] So, what is an ERC 20 token? [1:05] It's just a smart contract. [1:07] Just a smart contract that implements a [1:08] set of functions. [1:10] Those that are defined by IP 20. We [1:12] expect tokens to be able to be held by [1:15] addresses and transferred between [1:17] addresses. [1:19] But again, these functions are [1:22] implemented by arbitrary code. [1:24] So, it falls on us [1:26] to verify that the behaviors we expect [1:29] to see from a tokens [1:30] from a token will be present. [1:34] So, what can go wrong? [1:37] Transfer restrictions. [1:39] Can you transfer what you own? [1:41] Are there limits, blacklists, pausing [1:44] functionality? [1:46] Is this a honey pot? [1:48] Can you only buy the token but not sell [1:50] it? [1:51] Balance manipulation. [1:53] Are you the only one who's able to [1:55] reduce your balance or is there a [1:57] special address that do so as well? [2:01] Supply manipulation. [2:03] The only reason tokens have any value is [2:05] because they're scarce. [2:08] If they're prone to infinite minting, [2:10] then they're worthless. [2:12] Taxes. [2:14] Are you able to transfer what you own [2:17] freely? [2:18] Is there a tax? [2:20] Is that tax capped [2:22] or might be [2:23] indefinitely changed? [2:26] Upgradability. [2:27] Say you check for all these things, [2:30] but then the code changes, so all the [2:32] guarantees you gathered [2:34] at the window. [2:36] Centralization. [2:38] We got to Web 3 because we wanted to get [2:40] away from [2:42] centralized authorities having power [2:43] over our assets. [2:46] But so many tokens do exactly that. [2:49] They have a special address with special [2:51] privileges. [2:52] Or even if it's not in the code, what if [2:56] certain addresses have 50% of the supply [2:58] for of the supply [3:00] or the liquidity? [3:01] Then the value of the token is held by [3:03] those addresses. [3:06] Finally, there's reputation [3:08] because all the mechanisms we discussed [3:10] so far are not inherently malicious. [3:14] Some tokens need them. USDC, for [3:16] example, cannot exist without minting [3:19] because how can it match its reserves? [3:23] But the reputation of a token and [3:25] further yet its creator is going to tell [3:28] you how this power is going to be [3:30] wielded. [3:32] So how can we check up? [3:35] How can we check for these behaviors? [3:39] We can start with on-chain data. [3:42] On-chain data providers can help us [3:44] answer questions regarding the holder [3:46] concentration, [3:47] whether the volume of this token is real [3:50] or it's artificial, was trading between [3:53] certain addresses. [3:55] And it can also help us understand how [3:58] the creator got to have the money that [4:01] was funded this project. Is this from a [4:05] hack or is it just legitimate money? [4:10] Then there is simulation. Again, using [4:13] an on-chain data provider, we can pick a [4:15] holder of a token and then use Foundry [4:17] to fork the chain [4:19] and simulate whatever action we would [4:20] like to take with regards to this token. [4:23] Then we evaluate the results and see if [4:25] they what they expect them to be. [4:28] So a transfer, for example, could let us [4:32] know that a a token has a tax. [4:37] But you're not going to sell the token [4:38] the moment you buy it. [4:40] So what if you're currently able to sell [4:42] it, but that's no longer the case in a [4:44] week from now? [4:46] That's exactly how Honey Pots work. [4:48] You can buy the token, but then there is [4:51] some logic within the token that may [4:53] disallow certain addresses or [4:55] all addresses but the creator from [4:58] selling the token. [5:00] So how do we check for behaviors that [5:02] are not currently observable, but may be [5:04] enabled in the future? [5:07] We can inspect the code. [5:09] As a matter of fact, how many of you [5:11] currently hold USDT? [5:15] Good. [5:16] So let's have a look. [5:19] We can see here that you you're only [5:21] able to transfer USDT [5:23] if you're not blacklisted. [5:25] The owner can blacklist you [5:28] and once he does, he may also wipe your [5:30] balance. [5:32] In addition to that, the owner is not a [5:35] renounced role. [5:36] It's an actual address. [5:38] So this could theoretically happen. [5:41] Now there is a whole social context [5:43] outside of code that may allow us to [5:45] trust Tether, and that's okay. But the [5:47] point I'm trying to make is that there [5:48] is more to tokens than buying and [5:50] selling them. [5:53] We were only able to discover that [5:55] because we have access to the source [5:56] code of USDT as that was provided to us [5:59] by Tether. [6:00] That is not always the case. [6:02] More often than not, when a token is [6:04] first deployed, we do not have access to [6:06] the source code. [6:07] Coincidentally, that is also when it [6:09] sees most of its price action. [6:11] So, what do we do then? [6:14] This is when we can turn to [6:15] decompilation. [6:17] You see, we might not have access to the [6:18] source code of the token, but we do have [6:20] access to the executable, as that is [6:22] stored on chain in the form of EVM [6:24] bytecode, [6:25] which looks a bit like this. [6:28] Well, make it a bit more readable, [6:31] like this. [6:32] Now, unless you're running the EVM stack [6:33] machine in your head right now, this [6:35] should not tell you a lot. But one of [6:37] the things we do at Dedaub is that we [6:39] provide a decompiler, which can take [6:42] this and turn it into this, and then [6:45] into this. [6:47] This looks a lot like the actually USD [6:51] USDT code, and it can be inspected for [6:54] all the behaviors we discussed earlier, [6:56] uh blacklisting, pausing functionality, [6:59] upgradability, everything. [7:03] The only thing is that this process is [7:05] time-consuming, and more than that, it [7:07] does require some technical skill. Mind [7:09] you, everybody in here does have that [7:12] technical skill, but that's not the case [7:14] for the people outside of this room. [7:17] So, my team has been trying to automate [7:19] this process. [7:21] The interesting thing is that I've been [7:23] giving this talk for a couple of years [7:24] now, and this has changed so much. [7:28] Not the tokens. Tokens are pretty much [7:30] the same as they have been two, three [7:32] years ago, [7:34] but the way you go about checking for [7:36] the safety of these tokens has [7:37] drastically changed. [7:39] A year ago, we would be speaking about [7:42] static analysis and simulation. [7:45] For static analysis, you would need to [7:47] collect hundreds of instances of a [7:49] specific mechanism you're checking for. [7:52] You would generalize it into a pattern [7:55] that is general enough [7:57] to catch variants, but not too general [8:01] because then you drown in false [8:03] positives. [8:04] And then you would express this [8:06] mechanism [8:07] as a pattern in Slither or Gigahorse or [8:11] whatever static analysis engine. [8:14] Then there is simulation. You would [8:16] treat the token as a black box. You [8:18] would try and guess the sequence of [8:21] calls you would need to make in order to [8:23] trigger a behavior [8:24] and then how you can actually observe it [8:27] from outside. [8:30] Both these techniques have issues. [8:33] For static analysis, [8:35] the same mechanism can be expressed in a [8:37] myriad of different ways. So a [8:39] blacklist. [8:40] It can be a mapping [8:42] or an array [8:44] or an external call or whatever else. [8:48] And then for simulation, say you want to [8:51] simulate the call to blacklist a [8:53] specific address, but what's it called? [8:55] Blacklist, deny, restrict. You have no [8:59] knowledge of the token a priori. [9:05] LLMs to the rescue. [9:07] Because the thing with LLMs is that they [9:09] do not have they do not need to be [9:11] tailored to the token [9:13] before you get to see it. [9:15] They can actually tailor the process as [9:18] they see the token. [9:19] So is this it? Are we done? Do we ask [9:22] Load is this safe? [9:24] And that's it. [9:26] Unfortunately not. [9:28] Because powerful as they are, [9:30] LLMs are not deterministic, [9:32] which means that a vague question like [9:35] is this safe is not going to yield the [9:37] same results every time. [9:39] So the first time it might see the [9:41] source code, but never see [9:45] the storage allocation. [9:46] And a mechanism that is currently [9:48] inaccessible due to the storage [9:50] allocation will be reported as active. [9:54] That's a false positive. [9:56] And then the second run might only fetch [9:58] the API, [9:59] simulate whatever call you're trying to [10:01] make, see that the results are the [10:03] expected ones, [10:05] but never see the code and as a result [10:08] miss the fact that it's a honeypot and [10:10] it's now safe, [10:12] but it's not safe in a week from now. [10:16] There is a balance to be struck. [10:18] There are things that we can do [10:20] deterministically, things that we know [10:22] how to do and things that we know how to [10:24] guide the LLM through. [10:26] And then the LLM can be used to tailor [10:28] the process to its specific token. [10:32] So how do we go about it? [10:35] We can first define the mechanisms. [10:37] The question is this safe [10:40] is vague. [10:41] It does not tell you anything. [10:44] But you can ask an LL an LLM, does this [10:46] token have a blacklist? [10:49] And then you can provide a definition of [10:50] what a blacklist is and several [10:52] examples. [10:54] And you can get a pretty good confidence [10:56] that the answer is going to be accurate. [11:00] Then you can provide the procedure [11:03] much like we do with manual audits, a [11:05] checklist. [11:07] A procedure can guide you through the [11:09] steps you need to take in order not to [11:11] omit anything that is important. [11:14] So fetch the source, fetch the API, [11:17] do the simulations, check for [11:20] for upgradability. [11:24] Then [11:25] we can provide the LLM with whatever [11:27] tool can be deterministically created. [11:30] like you should not let the LLM discover [11:33] how to fetch source or simulate or make [11:37] a read call or [11:39] override storage every time. This should [11:41] be provided to it. [11:45] Then [11:48] an a yes or no answer does not tell you [11:50] a lot. [11:52] But evidence can be audited. [11:54] So [11:55] the LLM is not going to tell you yes, [11:57] there is a blacklist. It's going to tell [11:58] you that there is a blacklist. It's that [12:00] function. It can be invoked in that way [12:03] by that address. [12:05] This is something you can actually audit [12:07] with your eyes by human [12:09] inspection. [12:13] Finally, [12:14] rounds need to be explainable. [12:17] And so, whatever run needs also [12:21] needs to come with whatever tool was [12:23] called, [12:24] whatever answer was provided by those [12:27] tools, [12:28] and finally, [12:29] how the the LLM interpreted those [12:33] answers. Then a false result can be [12:36] explained [12:37] by whatever evidence the LLM used. [12:41] Finally, there is evaluation. Whatever [12:42] pipeline we create, we evaluate, but [12:44] that you already know. [12:48] So, [12:50] in summary, [12:51] tokens are not coins to be traded [12:54] around, they're programs. [12:57] It's up to us to check their behaviors, [12:59] both present and the ones that might be [13:02] enabled in the future. [13:04] And LLMs are extremely powerful tools, [13:08] but they need to be used correctly. [13:11] Thank you very much. [13:14] >> [applause]