en

Why AI Tokens Introduce a New Class of Smart Contract Risks

Why AI Tokens Introduce a New Class of Smart Contract Risks
Oleksandr Filipov
Oleksandr Filipov CTO (Chief Technology Officer)
Upd: 04.08.2026 4 min

AI tokens introduce a new class of risk because part of the decision-making now sits with a model, not with code. An attacker can influence the data that model reads - proposal metadata, an oracle response - and change what the contract does. That's prompt injection, and a Solidity audit doesn't see it: the AI logic needs checking too.

To clear up a likely misreading: an AI token isn't "less secure" than a plain ERC-20. What changes is the architecture around it, not the quality of the code.

A few years ago, "AI in blockchain" mostly meant a marketing tag in a token's name. Today:

  • AI agents control wallets and execute transactions with no human involved;
  • models pre-screen governance proposals;
  • scoring modules assess the risk of an operation before it's confirmed;
  • part of the business logic effectively lives in prompts rather than in Solidity.

The moment a model's output shapes what the contract does, the old security model stops covering the actual risks.

Why AI Tokens Create Different Security Challenges Than Traditional Tokens

A plain ERC-20 is boring, and that's its greatest virtue. A handful of functions (transfer, approve, mint, burn), predictable state transitions, a clearly drawn perimeter.

The auditor works in a closed space: inputs are bounded, logic is linear, and while there are plenty of scenarios to test, you can enumerate them.

AI products work differently. The token is increasingly part of a system where AI participates in decisions: analyzing governance proposals, weighing transaction risk, classifying participants. It stops being a bolt-on feature and becomes a component the contract's behavior depends on.

 

Plain ERC-20

Token with AI logic

Inputs

User transactions

Plus metadata, prompts, model outputs, oracle data

Behaviour

Deterministic

Depends on how the model interprets the data

Audit perimeter

Solidity code

Code + AI module + integration layer

Typical attack vector

A flaw in the code

Influence over the data the model reads

How it's found

Static analysis, fuzzing

Manual business-logic review

Every new component is a new entry point

The AI module takes in data from outside - proposal metadata, user queries, oracle feeds - and returns a result that shapes what the contract does next. An attacker who once needed a flaw in the code now has a second route: influence that data, and change the contract's behavior indirectly.

Picture an AI module in a DAO protocol that assigns priority to proposals ahead of a vote. The contract may be flawless and clear a Solidity audit without comment. Then someone words a proposal description so the model scores it differently - and the system does exactly what it was asked to do.

So when a team says "we have an AI token, we audited the smart contract thoroughly," ask what exactly they audited. The contract alone - or the whole logic of how AI and contract interact?

Why Traditional Smart Contract Security Is No Longer Enough

 AI smart contract security audit

Most teams treat an audit as a check for the familiar mistakes:

  • reentrancy;
  • access control and role errors;
  • mishandled approve and allowances;
  • proxy and upgradeable pattern issues;
  • arithmetic overflows - these days mostly in unchecked blocks, assembly, or on older compiler versions, since Solidity 0.8 reverts on overflow by default.

The work is necessary. But it examines only one layer of the system.

The risks live at the seams

In AI products, the most exposed spots aren't the contracts themselves but the seams between parts of the system:

  • the link between the smart contract and an external AI service;
  • how the model interprets proposal metadata;
  • the chain running from an external oracle to the final business logic.

This is a scoping problem, not a competence problem

There's a further reason, purely organizational, and it works against security no less than the technical ones. By commissioning "a smart contract audit," a team unwittingly narrows the perimeter to the Solidity repository.

The AI module, its system prompt, the rules validating the model's response, the integration layer - formally none of these "is a contract," so none makes it into scope.

The result: the part of the system an attacker finds most interesting goes unwatched. The auditor honestly checked everything they were given. They just weren't given everything.

Why automated tests don't catch this

No matter how thorough automated testing is, it can't cover every unusual interaction between AI and contract. Those scenarios depend not only on the code but on how the module interprets each input.

Oracles are a good illustration. In a classic DeFi product, the oracle supplies an asset price, and the auditor checks that the contract handles it correctly and is protected against price manipulation.

In an AI product, oracle data first passes through a module that interprets it, weighs it, and only then hands the result on. Between the raw numbers and the contract's decision sits an intermediary a classic audit never sees.

If nobody examined that intermediary separately, the team will wrongly assume the oracle is secure - while the vulnerability sits in how the AI processes its data.

Inside a Real AI/Web3 Security Audit

Smart contract audit process

The difference between "we checked the code" and "we checked the system" shows up best in a specific case. Consider the White-box audit of a Web3 company's smart contracts with integrated AI that the Datami team ran ahead of an AI token launch.

The client was an international Web3 company that had built its own AI-enabled smart contract on the ERC-20 standard. The product handled confidential payment data and had to interact with exchanges, so the cost of a mistake was high: anything from asset loss to a complete business shutdown.

How the audit ran:

  • Approach: White-box, with full access to the source code of two contracts.
  • Step 1 - manual analysis: several auditors reviewing the logic independently.
  • Step 2 - automated scanning: static analyzers (Slither and Mythril among them) plus call graph mapping.
  • Step 3 - fuzzing: custom Echidna tests targeting atypical scenarios.
  • Step 4 - reporting: two interim reports and a final document with recommendations.
  • Duration: one month.

Across the two contracts, 40 vulnerabilities were found:

  • 2 critical;
  • 5 medium;
  • 8 low;
  • 25 informational.

The spread of findings is telling: from reentrancy and the possibility of influencing the AI through metadata down to overly detailed error messages and outdated library versions.

The product's risk level dropped from high to minimal before the token ever reached an exchange. For a team already preparing to list, that's the line between "seems to work" and "verified to work."

The Most Valuable Finding Wasn't Reentrancy

Reentrancy is a textbook vulnerability. The audit found one too.

But for AI/Web3 security, the telling discovery was different: AI query injection through proposal metadata. In formal severity terms it wasn't the highest-rated item in the report. Its value lies elsewhere: it demonstrates a whole class of problem that didn't exist in smart contract audits a few years ago.

What proposal metadata actually is

In products with governance logic, participants create proposals - to change contract parameters, say, or to allocate funds. Every proposal comes with metadata: a text description, additional fields, context.

If AI analyzes those proposals - to judge legitimacy, classify risk, or produce a recommendation - that metadata becomes input for the model.

And that's where the risk appears. If the metadata isn't validated and isolated, an attacker could in principle craft a proposal that shapes how the AI interprets it - slipping hidden instructions to the model inside what looks like an ordinary description.

In AI security this class of attack is known as indirect prompt injection: the malicious instruction reaches the model not from the user directly but alongside data the model is obliged to read. In the OWASP Top 10 for LLM Applications (2025 edition), prompt injection is LLM01 - first on the list.

How this differs from classic vulnerabilities

 

Reentrancy

Indirect prompt injection

Target

The contract's code

The decision-making logic

Where it lives

In Solidity

In data and prompts

How it's found

Slither, Mythril, fuzzing

Manual review, model behavior testing

Tooling maturity

High, decades of practice

Only just forming

Consequence

Direct extraction of funds

A distorted decision the contract then executes

The trend has stopped being hypothetical. August 2025 brought ERC-8004 (Trustless Agents), a standard for on-chain identity and reputation for AI agents, authored by engineers from MetaMask, the Ethereum Foundation, Google and Coinbase.

Reference deployments reached mainnet in early 2026, and by mid-February thousands of agents were registered. In parallel, x402 is developing as a machine-to-machine payment protocol, and in June 2026 MetaMask opened early access to Agent Wallet, which lets an agent execute swaps and trades on its own.

There aren't many public prompt injection incidents in smart contracts yet - but that says more about how young this attack surface is than about how safe it is.

What to do about it architecturally

Defence against this class of attack is built mostly around the model rather than inside it.

The model advises, the contract decides. An AI response shouldn't be a direct execution command. Between it and the transaction sits a layer that checks the result against rules written in code.

Limits live in the contract, not in the prompt. MetaMask Agent Wallet illustrates this: the user sets spending limits and a list of permitted protocols up front, and the agent operates only within those bounds, whatever the model concludes. A prompt instruction can be rewritten from outside; an on-chain allowance cannot.

Data stays separate from instructions. Proposal metadata is passed to the model as explicitly untrusted data, not as part of the system prompt. Add limits on length, format, and permitted characters at the input.

Model output is structured and narrowed. Instead of free text - an enum, a score within a set range, a fixed schema. Anything that doesn't fit the schema is rejected.

Fail closed by default. If the model returns garbage, an empty answer, or a contradictory one, the system halts rather than substituting a default value.

A human or a multisig at the final step - for actions that can't be rolled back.

Why Modern Audits Need to Go Beyond Code

There's no universal tool here. There's a set, and each method in it sees what the others miss.

A White-box audit gives full access to the code and shows not just individual functions but the connections between components - including where the AI gets its data and how it reaches the contract.

Manual analysis is irreplaceable wherever logical errors are involved. Automated tools are good at spotting familiar vulnerability patterns and poor at recognizing business-logic problems specific to a product.

Static analysis (tools like Slither) covers a large volume of code quickly and surfaces the standard vulnerability classes. A basic but necessary level of checking.

Fuzzing and invariant testing - Echidna, Medusa, Foundry invariant tests, and symbolic execution for the critical spots. This is where you find the scenarios in which the AI component behaves unexpectedly.

Reviewing business logic and component interaction answers what happens when these parts interact in an atypical way. This is where you verify that the defensive patterns above are genuinely implemented - and can't be bypassed.

No single method covers the full range of risks. Together they show the whole picture: the errors in the code, and the problems at the seam between AI and contract.

Security Checklist Before Launching an AI Token

AI token security checklist before launch

Seven questions worth having answers to before listing rather than after.

Has the business logic between AI and smart contract been reviewed? It isn't enough that the AI module and the contract each work on their own. What matters is how they exchange data and whether it can be substituted anywhere along the way.

Have atypical scenarios been tested? Standard test cases cover expected behavior. Real attacks often start where someone did something the developers never anticipated.

Has metadata been analyzed, along with every external data source? Anything arriving from outside - oracles, user proposals, third-party AI services - should be treated as untrusted until proven otherwise.

Have edge cases been checked? Particularly at the seams between components: what happens if the AI returns an unexpected result, empty data, or a contradictory answer.

Was the AI component inside the audit scope? Prompts, response validation rules, and the integration layer are part of the product even if they aren't written in Solidity. If the engagement never mentioned them, assume nobody checked them.

Was an audit run after the most recent code changes? Even a small change in logic after the main audit concluded can create a fresh vulnerability.

Is the product ready to list from a security standpoint? Worth asking well before the launch deadline, not at the end of development.

The list doesn't replace a full audit, but it shows where to look while preparing an AI token for market.

Conclusion

AI opens genuine possibilities for Web3: more flexible governance, automated decisions, data analysis at a scale that used to demand manual work. But alongside them comes a new class of risk - one that arises not in the code itself but at the seam between AI logic, metadata, and business processes.

Fixing mistakes after deployment in Web3 is extraordinarily expensive: for non-upgradeable contracts there's no way back, and for upgradeable systems every update carries serious risk.

So the question isn't whether vulnerabilities will be found in your product. It's who finds them first - your auditor, or somebody else.

If you're preparing a product with an AI component, start with a simple exercise: list every point where external data influences the model's decision, and where the model's decision influences the contract's state. 

If that list runs longer than expected, or your last audit's scope didn't cover it, consider a smart contract audit with a clearly agreed scope that includes the AI component. The first consultation at Datami is free.

free_consultation

Fill out the form below, and we’ll get in touch with you right away to discuss a plan to protect your business!

(0 assessments, average 0/5.0)

Need stronger security?

We will help you identify vulnerabilities in your system.
Implement robust cybersecurity measures to protect your site. Write and get a free security assessment.

Related content

What Is Cloudflare? Pros & Cons You Should Know Cybersecurity News from Datami
Cybersecurity News from Datami
What Is Cloudflare? Pros & Cons You Should Know

Cloudflare provides robust protection and optimization for websites, but it also carries risks such as security threats and reliance on a single vendor, highlighting the importance of a comprehensive approach to information security.

Nov 12, 2024
Information Security and Cybersecurity: Why Businesses Need Both Cybersecurity News from Datami
Cybersecurity News from Datami
Information Security and Cybersecurity: Why Businesses Need Both

The company signed an NDA, conducted training, adopted a privacy policy — and still lost data. Why? Because it confused information security with cybersecurity.

10 min Nov 14, 2024
Smartphone Security and Cybersecurity Cybersecurity News from Datami
Cybersecurity News from Datami
Smartphone Security and Cybersecurity

Smartphone security is important, as the increase in their usage comes with the risks of data breaches, so users should adhere to basic protection rules, such as updating software and using complex passwords.

Nov 14, 2024
Ranking the Best Secure Browsers with VPN: Key Privacy, Security, and Performance Insights Cybersecurity News from Datami
Cybersecurity News from Datami
Ranking the Best Secure Browsers with VPN: Key Privacy, Security, and Performance Insights

The rating of secure browsers with VPN helps users choose the optimal option for online privacy protection, as modern threats require reliable solutions to ensure security while web surfing.

Nov 14, 2024
Dangerous Smartphone Apps You Should Delete Cybersecurity News from Datami
Cybersecurity News from Datami
Dangerous Smartphone Apps You Should Delete

Malicious apps for Android can steal data, track geolocation, and display unwanted advertisements, so it is important to remove them from devices to ensure security.

Nov 14, 2024
Top Cybersecurity Books to Read Cybersecurity News from Datami
Cybersecurity News from Datami
Top Cybersecurity Books to Read

The best cybersecurity books for ethical hacking, Web3 security, and protecting personal data.

Nov 13, 2024
Back to home page
Order a consultation
We value your privacy
We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies. Cookie policy