<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bryan</title>
    <description>The latest articles on DEV Community by Bryan (@bryan_rev).</description>
    <link>https://dev.to/bryan_rev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235848%2F16fcf700-9478-443c-b7cb-6ee7e37020da.png</url>
      <title>DEV Community: Bryan</title>
      <link>https://dev.to/bryan_rev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bryan_rev"/>
    <language>en</language>
    <item>
      <title>Your old token approvals are a loaded gun: how ERC-20 approve, Permit2 and setApprovalForAll get you drained</title>
      <dc:creator>Bryan</dc:creator>
      <pubDate>Mon, 09 Nov 2026 20:30:41 +0000</pubDate>
      <link>https://dev.to/bryan_rev/your-old-token-approvals-are-a-loaded-gun-how-erc-20-approve-permit2-and-setapprovalforall-get-34j4</link>
      <guid>https://dev.to/bryan_rev/your-old-token-approvals-are-a-loaded-gun-how-erc-20-approve-permit2-and-setapprovalforall-get-34j4</guid>
      <description>&lt;p&gt;Most people think a wallet gets drained when someone steals the seed phrase. In 2026 the more common story is quieter: &lt;strong&gt;an approval you signed months ago gets used against you.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;January 2026: an aggregator partner (SwapNet) was exploited and about &lt;strong&gt;$16.8M&lt;/strong&gt; left users' wallets through approvals they had granted earlier. No new signatures.&lt;/li&gt;
&lt;li&gt;The same month, a single wallet lost about &lt;strong&gt;$13.3M&lt;/strong&gt; through an approval granted on January 1.&lt;/li&gt;
&lt;li&gt;October 29, 2026: Binance lost about &lt;strong&gt;$6.3B&lt;/strong&gt; (a different vector — exchange hot wallets), which tells you how active attackers are right now.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's how approvals actually work, why they're dangerous, and the free scanner I built to clean them up across 6 EVM chains.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an approval really is
&lt;/h2&gt;

&lt;p&gt;ERC-20 tokens don't let contracts pull your funds by default. A dApp first asks you to call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function approve(address spender, uint256 amount) external returns (bool);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, &lt;code&gt;spender&lt;/code&gt; can call &lt;code&gt;transferFrom(you, anyone, amount)&lt;/code&gt; whenever it wants. Two details make this risky:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Amount is almost always &lt;code&gt;type(uint256).max&lt;/code&gt;&lt;/strong&gt; — "unlimited", so the UI doesn't have to ask again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There is no expiry.&lt;/strong&gt; The allowance stays until you set it back to 0.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NFTs are worse: &lt;code&gt;setApprovalForAll(operator, true)&lt;/code&gt; gives one contract every token in a collection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Permit and Permit2
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;permit&lt;/code&gt; (EIP-2612) lets you grant an allowance with an off-chain &lt;strong&gt;signature&lt;/strong&gt; — no transaction, no gas, and no scary-looking wallet popup. Drainer sites love it.&lt;/p&gt;

&lt;p&gt;Uniswap's &lt;strong&gt;Permit2&lt;/strong&gt; adds a layer: you approve the Permit2 contract once per token, and apps get spending rights through Permit2 allowances. Cleaning up means checking both the token → Permit2 approval and the Permit2 → app allowances.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why "I stopped using that dApp" doesn't help
&lt;/h2&gt;

&lt;p&gt;The allowance lives in the &lt;strong&gt;token contract&lt;/strong&gt;, not in the dApp. When a router, aggregator or bridge contract gets exploited later, the attacker inherits every allowance users ever gave it. That's exactly what happened in the cases above.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to clean up
&lt;/h2&gt;

&lt;p&gt;Revoking = sending &lt;code&gt;approve(spender, 0)&lt;/code&gt; (or &lt;code&gt;setApprovalForAll(operator, false)&lt;/code&gt;). It costs normal gas: cents on BNB Chain, Base, Arbitrum, Optimism and Polygon.&lt;/p&gt;

&lt;p&gt;The annoying part is &lt;em&gt;finding&lt;/em&gt; the approvals: they're spread across chains and buried in years of logs. That's why I built &lt;strong&gt;&lt;a href="https://revokly.pages.dev" rel="noopener noreferrer"&gt;Revokly&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;scans &lt;strong&gt;Ethereum, BNB Chain, Base, Arbitrum, Optimism and Polygon&lt;/strong&gt; in one pass;&lt;/li&gt;
&lt;li&gt;shows each spender, token and amount, with unlimited ones flagged;&lt;/li&gt;
&lt;li&gt;revokes in one click from MetaMask, Rabby, Trust Wallet or any WalletConnect wallet;&lt;/li&gt;
&lt;li&gt;runs in the browser — no signup, keys never leave your wallet, and it only ever asks you to sign &lt;code&gt;approve(spender, 0)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's free. Feedback very welcome in the comments.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 60-second habit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;After every new dApp, airdrop claim or mint → re-scan.&lt;/li&gt;
&lt;li&gt;When a protocol you used is hacked → revoke immediately, on every chain you used it on.&lt;/li&gt;
&lt;li&gt;Savings on a hardware wallet; a small separate hot wallet for experiments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 &lt;a href="https://revokly.pages.dev" rel="noopener noreferrer"&gt;Check your wallet on Revokly&lt;/a&gt; · &lt;a href="https://revokly.pages.dev/learn/wallet-drained-what-to-do" rel="noopener noreferrer"&gt;Wallet drained? What to do&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>security</category>
      <category>ethereum</category>
      <category>blockchain</category>
    </item>
  </channel>
</rss>
