Is This Token Safe? Detecting Unsafe ERC-20 Behavior
This is my second year speaking about token safety, and the tokens themselves have barely changed. What has changed drastically is how we answer the question behind every trade: is this token safe? A year ago, the answer would have been built from static analysis rules and simulation scripts. Today, the natural question is whether an LLM can simply answer it for us.
At DeFi Security Summit 2026 in Mumbai, I argued that neither is enough on its own. Predefined rules have to account for a myriad of ways to implement the same mechanism, and an unconstrained model may not follow the same analysis twice. What follows is how we got from one to the other, and what it takes to build an LLM-based token check we can rely on.
A token is a program, not a coin
Tokens are simple, right? You buy them, wait for them to go to the moon, sell them, and buy your Lamborghini. Well, not exactly. An ERC-20 token is a smart contract. The standard defines an interface, with functions such as transfer, approve, and balanceOf, while the implementation of that interface is left to the developer. The functions we interact with are arbitrary code, and that code sits behind our voting rights in governance protocols, our liquidity positions, and our shares in liquid staking protocols, far beyond speculative trading.
Given that flexibility, it falls on us to determine whether a token has characteristics that may be detrimental to us. Broadly, they come in three kinds.
The first concerns whether we can move what we own. A token may restrict transfers through caps, trading pauses, or blacklists, and the extreme case is a honeypot, where holders are maliciously prevented from selling a token after buying it. A transfer may also carry a tax, and a tax that is reasonable today could become prohibitive tomorrow if a privileged address can raise it without meaningful restrictions.
The second concerns whether what we hold stays ours and stays scarce. Some implementations allow a privileged address to manipulate the balances of other holders, and an address with unrestricted minting rights may be able to increase the supply substantially, diluting everyone else.
The third concerns who can change the rules. Many tokens keep a privileged address that can modify their behavior, some can be upgraded so that the guarantees we gathered no longer hold, and in others a small number of holders controls enough of the supply to exert considerable influence over the token’s market value.
None of these capabilities is inherently malicious. They can be used legitimately or abused, and some tokens need them: a stablecoin such as USDC requires a mechanism to adjust its supply as assets enter and leave circulation. Clues as to how they are likely to be used often lie outside the contract, in the reputation of the team and the onchain history of the token’s creator.
Is this token safe today, or safe tomorrow?
The intuitive way to evaluate a token is to observe it. Using an onchain data provider, we can examine holder concentration, try to distinguish organic trading volume from artificially generated activity, and trace where the creator’s funds came from. We can also simulate what we intend to do: identify an existing holder, fork the chain with a tool like Foundry, simulate a transfer or a sale, and inspect the outcome. By doing so, we can identify taxes, transfer caps, and honeypot behavior that are currently enforced.
The limitation lies in the word “currently.” We are observing the token under one particular blockchain state, and there is no guarantee that a transaction which succeeds today will continue to succeed tomorrow. That is exactly how honeypots work: we can buy the token today, and logic inside it can later prevent certain addresses, or every address except the creator’s, from selling. To identify mechanisms that are not currently observable but can be enabled in the future, we need to examine the implementation itself.
Consider Tether’s USDT contract on Ethereum. Its source code reveals that transfers are subject to blacklist checks, and it exposes a function called destroyBlackFunds, which allows the owner to destroy the balance of a blacklisted address. Identifying such a function is not enough, however. We also need to establish whether it remains accessible, because ownership may have been renounced, or the values of certain storage variables may make the code path unreachable. In USDT’s case, the owner is an actual address, so in theory this could happen.
Granted, there is an entire social and institutional context outside the code that may lead us to trust Tether. The point is not that USDT is necessarily unsafe, but rather that such capabilities should be taken into consideration when deciding whether to interact with an asset.
We can only read USDT’s source code because Tether published it. For newly launched tokens, where some of the most speculative trading takes place, that is often not the case. What we do have is the EVM bytecode stored onchain, and unless you happen to be running an EVM stack machine in your head, it is unlikely to tell you much. At Dedaub, we provide a decompiler that transforms that bytecode into a more readable representation, which can be inspected for many of the same mechanisms we would look for in verified source code, including blacklists, taxes, and balance manipulation.
All of this takes time and a considerable amount of technical expertise, which is why my team works on automating it.
A semantic problem, approached with syntactic tools
Traditionally, automating a check started with one mechanism and approached it from two sides. On the static analysis side, we would examine hundreds of contracts to understand how the mechanism tends to appear in code, generalize those instances into a pattern, and express the pattern in a static analysis engine such as Gigahorse. The pattern had to strike a balance between being too specific and missing variations of the mechanism, or being too generic and drowning in false positives. On the simulation side, we would determine how the mechanism shows up in the observable behavior of a token, establish a sequence of actions that triggers it, and script those actions against a node.
Take blacklists. In many cases, a blacklist is a mapping lookup involving msg.sender, whose result controls the execution of the transfer function:
mapping(address => bool) blacklisted;
function transfer(address to, uint256 amount) public {
require(!blacklisted[msg.sender]);
// Transfer logic
}
This is something static analysis can detect. But what if the blacklist is implemented as an array of addresses? What if the contract makes an external call to an access control contract to decide whether the sender may transfer? These are all implementations of the same mechanism, yet they may require different detection patterns. Simulation has the same difficulty, because the function that blacklists an address may not be called blacklist. It may be called deny, restrict, or something completely unrelated, and outside the standard ERC-20 interface we cannot reliably assume which functions exist or what they are called.
In essence, we were trying to solve a semantic problem through predefined syntactic and behavioral patterns.
What an LLM changes, and what it does not
LLMs offer a fundamentally different approach. Instead of designing checks that are generic enough to be token-agnostic, we can tailor the analysis to the specific token under examination. An LLM can inspect the implementation of a contract, reason about the purpose of its functions, identify the relevant state variables, and determine which interactions should be simulated.
Does this mean we should scrap our existing tooling and simply ask Claude whether a token is safe to trade? Unfortunately, not. Powerful as they are, LLMs are nondeterministic. Given the same token across multiple runs, an unconstrained agent may follow substantially different analysis procedures and arrive at very different conclusions. Consider two hypothetical runs:
- In the first, the agent fetches the verified source code and identifies a privileged mechanism, but never examines the relevant storage variables. It reports the mechanism as active, even though it is no longer accessible given the current state of the contract.
- In the second, the agent fetches the contract’s ABI but not its source code, successfully simulates a swap, and reports that the token is safe to trade. It misses a mechanism that will prevent holders from selling a week later.
In both cases, the agent performs actions that are relevant to the task. The problem is not necessarily a lack of reasoning capabilities, but rather that nothing ensures the agent takes all the relevant information into consideration before reaching a conclusion.
There is, therefore, a balance to be struck. We want the LLM to have the flexibility to tailor the analysis to each token, while we retain control over what constitutes a comprehensive and reliable analysis.
How to make an LLM token check reliable
In my view, there are five responsibilities that should remain in the hands of the developer.
1. Define the mechanisms being detected
The question “is this token safe?” is inherently ambiguous, as it provides no concrete definition of what is considered safe. Across different runs, safety could be interpreted as anything from whether a swap will execute successfully to whether holders retain exclusive control over their balances. We can obtain more consistent results by giving the agent explicit definitions of the mechanisms it is expected to detect, accompanied by representative examples. A blacklist, for instance, can be defined as “functionality through which a privileged address may prevent another address from interacting with a token,” and illustrated with a line such as require(!blacklisted[msg.sender]);.
Unlike a static analysis rule, the example is not an exhaustive detection pattern. It illustrates the concept the agent should look for, regardless of how it is implemented, so we can use the semantic reasoning of the model without leaving the definition of safety open to interpretation.
2. Define the analysis procedure
A checklist serves the same purpose here as it does in a manual audit: it prevents avoidable omissions. Rather than letting the agent decide what constitutes sufficient investigation, we can establish a set of steps it must follow, for example:
- Examine the verified source code, or fall back to bytecode decompilation if it is unavailable.
- Identify potentially problematic mechanisms.
- Inspect storage variables to determine whether the relevant code paths remain accessible.
- Identify privileged addresses and determine whether their privileges remain active.
- Simulate relevant transactions where appropriate.
The actions needed to complete each step can vary with the token, but the steps themselves should not be optional. We want the agent to have flexibility in how it performs the analysis, not in whether it performs it.
3. Package deterministic operations as tools
There is little reason for an agent to work out, on every run, how to perform operations that we already know how to implement reliably. Common functionality should instead be packaged as well-defined tools that the agent can invoke when needed. Such tools might look like this:
get_source_code(address, network)
decompile_bytecode(bytecode)
call_read_function(args)
simulate_write_function(args)
get_past_transactions(start_block, end_block)
The LLM can decide which functions to inspect, which transactions to simulate, and how the results relate to the mechanism under examination, while the tools handle execution. Traditional software stays in charge of well-defined operations, the LLM handles context-dependent reasoning, and we avoid introducing nondeterminism into parts of the process that can already be handled programmatically.
4. Make every answer and every run explainable
A yes or no answer does not tell us much, but evidence can be audited. The agent should not only report that a blacklist exists. It should report which function implements it, how it can be invoked, and by which address, so that a person can verify the answer by reading the code.
The same applies to the run itself. When an agent works through our own tools, we can instrument them to record the actions performed, the information retrieved, and the results of simulated transactions. When a mechanism is reported incorrectly, we can trace the steps that led to that conclusion. Did the agent inspect the relevant code? Did it query the appropriate storage variables? Did it simulate the right sequence of transactions, or did it simply misinterpret the results? Without this level of observability, it becomes difficult to tell whether an issue originates from the agent’s reasoning, the information it was given, or the implementation of the tools. Explainability is therefore not just a feature for the end user, but an essential part of the development process.
5. Establish an evaluation pipeline
Building a security tool around a nondeterministic component without being able to evaluate its performance is a recipe for disaster. We need a systematic way of determining whether the agent correctly identifies the mechanisms we are interested in, how often it produces false positives and false negatives, and how consistent its results are across multiple runs. An evaluation pipeline also helps us assess whether a change to our prompts, tools, or procedures has genuinely improved the system, or has simply produced better results on a handful of examples. The more autonomy we give an agent, the more important systematic evaluation becomes.
Closing thoughts
LLMs do not make static analysis, decompilation, or transaction simulation obsolete. Rather, these techniques are the foundations on which a security agent can operate, and what LLMs change is how we combine and apply them. The goal is not to replace traditional security tooling with LLMs, but to use them where their ability to reason and adapt provides the most value, while retaining deterministic approaches wherever possible.
Watch the talk
My full talk from DeFi Security Summit 2026 is on our YouTube channel: Is This Token Safe? Detecting Honeypots and Unsafe ERC-20 Code.





