Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/pages/config/contributors.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,19 @@
"role": "contributor",
"description": "Frameworks Contributor"
},
"quillaudits": {
"slug": "quillaudits",
"name": "QuillAudits",
"avatar": "https://avatars.githubusercontent.com/quillaudits",
"github": "https://github.com/Quillhash",
"twitter": "https://twitter.com/QuillAudits",
"website": "https://www.quillaudits.com",
"company": "QuillAudits",
"job_title": "Smart Contract Audit Firm",
"role": "contributor",
"description": "Leading smart contract audit firm specializing in Web3 security solutions, DeFi auditing, and DApp penetration testing.",
"badges": []
},
"smagdali": {
"slug": "smagdali",
"name": "smagdali",
Expand Down
91 changes: 91 additions & 0 deletions docs/pages/wallet-security/smart-contract-interaction-security.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: "Smart Contract Interaction Security | SEAL"
description: "Secure smart contract interactions: manage approvals, understand permit risks, protect against MEV, and recognize common attack patterns like address poisoning and ice phishing."
tags:
- Engineer/Developer
- Security Specialist
contributors:
- role: wrote
users: [quillaudits, dickson]
- role: reviewed
users: []
- role: fact-checked
users: []
---

import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } from '../../../components'

<TagProvider>
<TagFilter />

# Smart Contract Interaction Security

<TagList tags={frontmatter.tags} />
<AttributionList contributors={frontmatter.contributors} />

> 🔑 **Key Takeaway**: Before interacting with any smart contract, verify the contract address, simulate the transaction, review all approvals, and understand what you are signing. Most fund losses come from user-side interaction mistakes, not wallet compromises.

Check failure on line 26 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:26:121 MD013/line-length Line length [Expected: 120; Actual: 263] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md

This page assumes you already have a properly secured wallet (see [Wallet Security overview](/wallet-security/overview)). For verifying contract addresses, transaction data, and signatures before signing, see [Signing & Verification](/wallet-security/signing-and-verification/signing-verification) and [Verifying Standard Transactions](/wallet-security/signing-and-verification/verifying-standard-transactions). For simulation and verification tools, see [Tools & Resources](/wallet-security/tools-and-resources).

Check failure on line 28 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:28:121 MD013/line-length Line length [Expected: 120; Actual: 513] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md

This page focuses on **approval management, permit risks, MEV protection, and common attack patterns**.

## Token Approval Hygiene

Every `approve()` call grants a spender address permission to move your tokens. Most dApps request unlimited approval by default.

Check failure on line 34 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:34:121 MD013/line-length Line length [Expected: 120; Actual: 129] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md

- **Set exact amounts.** Approve only what the current transaction needs, not `type(uint256).max`. This limits exposure if the spender contract is later exploited.

Check failure on line 36 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:36:121 MD013/line-length Line length [Expected: 120; Actual: 163] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md
- **Revoke unused approvals.** Use [Revoke.cash](https://revoke.cash/) or the [Etherscan Token Approval Checker](https://etherscan.io/tokenapprovalchecker) to audit and revoke outstanding approvals.

Check failure on line 37 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:37:121 MD013/line-length Line length [Expected: 120; Actual: 198] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md
- **Audit approvals regularly.** Schedule periodic reviews, especially after heavy dApp usage.

### The `permit()` and EIP-2612 Risk

EIP-2612 `permit()` allows approvals via off-chain signatures instead of on-chain transactions. This is more dangerous: no on-chain transaction is visible until the permit is submitted by a third party, and users can unknowingly authorize token transfers on phishing sites.

Check failure on line 42 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:42:121 MD013/line-length Line length [Expected: 120; Actual: 273] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md

A common pattern is a fake "login" prompt that is actually a permit signature request. **If a signature contains fields like `spender`, `value`, `nonce`, and `deadline`, you are signing a permit — not a login message.**

Check failure on line 44 in docs/pages/wallet-security/smart-contract-interaction-security.mdx

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/pages/wallet-security/smart-contract-interaction-security.mdx:44:121 MD013/line-length Line length [Expected: 120; Actual: 219] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md

## Slippage and MEV Protection

When trading on DEXes, your transactions are visible in the public mempool before execution, creating MEV (Maximal Extractable Value) attack opportunities.

### Slippage Tolerance

- **Too high** (5–10%): You become a sandwich attack target.
- **Too low** (0.1%): Transactions fail in volatile markets, wasting gas.
- **Recommended**: 0.5–1% for liquid pairs. Adjust for volatile or low-liquidity tokens.

### MEV Protection

- **Use private mempools.** [Flashbots Protect](https://protect.flashbots.net/) and [MEV Blocker](https://mevblocker.io/) route transactions through private channels invisible to MEV searchers.
- **Set transaction deadlines.** Prevent stale transactions from executing at unfavorable prices.
- **Inspect multi-hop routes.** Aggregators can route through intermediary tokens/pools you did not intend to touch. Verify the full path before signing, especially for illiquid or newly listed assets.

## Common Attack Patterns

### Address Poisoning

An attacker sends tiny (often 0-value) transactions from an address resembling yours or a known recipient, polluting your transaction history. They may also airdrop scam tokens/NFTs that surface in explorers, Safe interfaces, or wallet UIs to bait bad copy-paste behavior. **Always verify the full address**, not just the first and last characters, and do not copy recipients from "recent activity" alone.

### Clipboard Malware

Malware monitors your clipboard and replaces copied addresses with attacker-controlled ones. **Verify the pasted address character-by-character** in your wallet's confirmation screen. If you suspect clipboard hijacking, stop transacting immediately and move funds from a known-clean device after rotating credentials.

### Fake Airdrops and Approval Traps

Unknown tokens appear in your wallet. Interacting with them (swapping or "claiming") triggers a malicious `approve()` or `setApprovalForAll()` granting the attacker control over your legitimate tokens. **Ignore unknown tokens.**

### Ice Phishing

The victim signs an `approve()` setting the attacker as spender. Unlike credential phishing, this grants direct on-chain token access through a legitimate mechanism. The deception is in the social engineering, not the transaction itself. This pattern is commonly referred to as ["ice phishing"](https://www.microsoft.com/en-us/security/blog/2022/02/16/ice-phishing-on-the-blockchain/) in Microsoft threat research.

## Quick Reference Checklist

- [ ] **Verify the contract address** — Cross-reference against official docs and block explorer labels (see [Verifying Standard Transactions](/wallet-security/signing-and-verification/verifying-standard-transactions))
- [ ] **Simulate the transaction** — Preview balance changes before signing (see [Tools & Resources](/wallet-security/tools-and-resources))
- [ ] **Check approval amounts** — Set exact amounts, not unlimited. Revoke approvals you no longer need.
- [ ] **Read what you are signing** — Inspect EIP-712 domains, types, and values. If you don't understand it, don't sign it.
- [ ] **Use MEV protection for DEX trades** — Route through Flashbots Protect or MEV Blocker.

---

</TagProvider>
<ContributeFooter />
1 change: 1 addition & 0 deletions vocs.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const config = {
{ text: 'Using EIP-7702', link: '/wallet-security/signing-and-verification/verifying-7702' },
]
},
{ text: 'Smart Contract Interaction Security', link: '/wallet-security/smart-contract-interaction-security', dev: true },
{ text: 'Seed Phrase Management', link: '/wallet-security/seed-phrase-management' },
{ text: 'Tools & Resources', link: '/wallet-security/tools-and-resources' },
]
Expand Down
Loading