<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>curiousapple</title>
        <link>https://paragraph.com/@curiousapple</link>
        <description>undefined</description>
        <lastBuildDate>Sun, 29 Nov 2026 01:04:10 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>curiousapple</title>
            <url>https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/df9ac9f72846fc44745335252e0fed1d2a1bc926a8d49a7aa8c2fb253f5f9448.webp</url>
            <link>https://paragraph.com/@curiousapple</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[ERC1271 Replay - 15+ Teams Affected]]></title>
            <link>https://paragraph.com/@curiousapple/erc1271-replay-15-teams-affected</link>
            <guid>fwlBuaAuGsWwLRPTLKxB</guid>
            <pubDate>Tue, 30 Jan 2024 10:27:59 GMT</pubDate>
            <description><![CDATA[Sep 25, 2023, I found an issue in a widely used implementation of the ERC1271 pattern that affected 15+ teams. This blog describes the sequence of events regarding how it all came together. If you are a wallet team or a security researcher, consider reading this. Severity of the issue is subjective to the wallet&apos;s use case, ranging from High to Medium.Chapter 1 - SparkChapter 2 - Discussions: Who’s responsible, Wallets or External Applications ?Chapter 3 - Search and ReportChapter 4 - Fi...]]></description>
            <content:encoded><![CDATA[<p>Sep 25, 2023, I found an issue in a widely used implementation of the ERC1271 pattern that affected 15+ teams. This blog describes the sequence of events regarding how it all came together. If you are a wallet team or a security researcher, consider reading this. Severity of the issue is subjective to the wallet&apos;s use case, ranging from High to Medium.</p><ul><li><p>Chapter 1 - Spark</p></li><li><p>Chapter 2 - Discussions: Who’s responsible, Wallets or External Applications ?</p></li><li><p>Chapter 3 - Search and Report</p></li><li><p>Chapter 4 - Fix, Learnings, Shoutouts and Bounties</p></li></ul><hr><h2 id="h-chapter-1-spark" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Chapter 1: Spark</h2><p>Sep 25: I was looking into <strong>Cowswap</strong> and found that they don&apos;t include the user address in their order struct, unlike most other intent-based projects such as Uniswap X.</p><p>Thinking more on this, I realised that this could lead to smart contract signatures being replayed between multiple accounts if those accounts have a common owner.</p><p>If you are unaware, smart contract signatures are implemented by ERC1271, where a caller calls a smart contract and the smart contract checks if the given digest was signed by one of the owners.</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-1271">https://eips.ethereum.org/EIPS/eip-1271</a></p><p><strong>Reference Implementation from EIP</strong></p><pre data-type="codeBlock" text="function isValidSignature(
    bytes32 _hash,
    bytes calldata _signature
) external override view returns (bytes4) {
    // Validate signatures
    if (recoverSigner(_hash, _signature) == owner) {
      return 0x1626ba7e;
    } else {
      return 0xffffffff;
    }
}
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isValidSignature</span>(<span class="hljs-params">
    <span class="hljs-keyword">bytes32</span> _hash,
    <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">calldata</span> _signature
</span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">override</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">bytes4</span></span>) </span>{
    <span class="hljs-comment">// Validate signatures</span>
    <span class="hljs-keyword">if</span> (recoverSigner(_hash, _signature) <span class="hljs-operator">=</span><span class="hljs-operator">=</span> owner) {
      <span class="hljs-keyword">return</span> <span class="hljs-number">0x1626ba7e</span>;
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-keyword">return</span> <span class="hljs-number">0xffffffff</span>;
    }
}
</code></pre><p>Now, what if the given signed digest (<code>_hash</code>) is independent of the smart contract account?</p><p><strong>Can a smart contract signature signed by a smart account with owner A be replayed on any other smart account owned by A?</strong> <strong>More broadly, can a signature signed by EOA A be replayed on a smart account owned by A?</strong></p><p>It turns out the answer is <strong>YES</strong> if the signed digest doesn&apos;t include the smart account address. That&apos;s the crux of the issue.</p><blockquote><p>You can find the initial report to Cow here <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://gist.github.com/0xcuriousapple/f68f63ab25f463f8f9fb5759209ab497">https://gist.github.com/0xcuriousapple/f68f63ab25f463f8f9fb5759209ab497</a> <br>Since they don&apos;t include the signer (user address) inside the order struct and thereby in the signed digest, CowSwap orders could be replayed for smart contract accounts having the same owners. For Cow, it&apos;s more severe since their nonce handling is unique. Basically, they mark orders as filled or not based on the order hash. Therefore, for this to occur on Cow, you don&apos;t even need nonces to be in sync.</p></blockquote><p>The Cow team was diligent throughout the report and agreed that it exists. They assured that they will monitor such orders on their own and start hashing the user address as an extra parameter moving forward.</p><p><strong>Note that not all wallets were vulnerable to this line of attack.</strong></p><p>Some wallets, like Safe or Sequence, hash the account address on their own, nullifying this attack vector.</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/safe-global/safe-smart-account/blob/8ffae95faa815acf86ec8b50021ebe9f96abde10/contracts/handler/CompatibilityFallbackHandler.sol#L60-L61">https://github.com/safe-global/safe-smart-account/blob/8ffae95faa815acf86ec8b50021ebe9f96abde10/contracts/handler/CompatibilityFallbackHandler.sol#L60-L61</a></p><p>Hence, <strong>the Cow team also pointed out that ideally, wallets should handle this like a SAFE.</strong></p><hr><h2 id="h-chapter-2-discussions-whos-responsible-wallets-or-external-applications" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Chapter 2 : Discussions: Who’s responsible, Wallets or External Applications ?</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/e915f14dbcbe4cc9274ab6125544a9fa879c34040ca6edab881148ba7c6f5f6d.webp" alt="Img sourced from Nick McDonell’s The Council of Animals" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Img sourced from Nick McDonell’s The Council of Animals</figcaption></figure><p>Initially, I thought that this was a Cowswap-related issue, so I only raised it with them. But the argument that wallets should ideally handle this was gaining traction.</p><p><strong>Out of all the wallets I could index, only Safe, Sequence, and BlocTo were the non-vulnerable ones.</strong></p><p>I also found that there are other protocols like CowSwap that expect wallets to handle this case. For example, <strong>Uniswap&apos;s Permit 2, Arcade, Lens and ETH Attestation.</strong></p><p>Hence, now I was unsure whose responsibility this really is? wallets or external applications ?</p><p>The Cow team put up a conversation with the Safe team, who pointed out that ideally wallets should handle this and not rely on the example implementation of ERC1271.</p><p>I consulted with some other relevant parties, including the authors of ERC4337, other application developers, and Francisco Giordano (<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/frangio">@frangio</a>) (one of the authors of ERC1271).</p><p>The opinions differed on whose responsibility this is, but in the end, there was a majority consensus that wallets should handle this.</p><p><strong>The main argument for this being a wallets issue is that, from the external application&apos;s point of view, this case creates a distinction between smart accounts and EOAs.</strong></p><p><strong>An external application should have measures in place to prevent signature replay in general cases, such as</strong> <code>chain.id</code>. <strong>However, in the case of a common owner of smart accounts, it should ideally be blocked at the source, i.e. in wallets code, since it&apos;s specific to them.</strong></p><p>Frangio also took on the task of making the necessary amendments in the official EIP itself and has been leading conversations there 🫡</p><p>However, it&apos;s been nearly 3 months, and it has been lagging due to multiple points of view. Issue in the EIP reference implementation sparked a wider discussion about security disclosures for EIPs, which remains unresolved. You can follow its progress here</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/ethcatherders/EIPIP/issues/291">https://github.com/ethcatherders/EIPIP/issues/291</a></p><p>Moving ahead, I decided to report it to all affected wallets</p><hr><h2 id="h-chapter-3-search-and-report" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Chapter 3 : Search and Report</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/bebaefdb1a669b2d962c0d5606fad389f1f219358d50f0b4ff749a182e81f072.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>It was time for the endgame: finding and reporting to all affected wallets. I used all tools at my disposal:</p><ul><li><p>Alchemy&apos;s list of wallets</p></li><li><p>GitHub</p></li><li><p>Codeslaw</p></li><li><p>TinTin&apos;s sanctuary</p></li></ul><p>For days, my schedule was searching for <code>isValidSignature</code> implementations, determining if it was affected, finding contact information, writing a custom issue report for each team, and report.</p><blockquote><p><em>Personal rant: It was pure pain, solely due to the nature of this issue. Multiple teams were affected, and there was no easy way to reach all of them at once. It was a widely adopted implementation, with thousands of instances on direct search. Therefore, you had to be creative and persistent with your searches. Moreover, finding a vulnerable implementation was just the beginning; finding contact information and establishing communication was a bigger problem.</em></p></blockquote><p>In parallel, <strong>Howy</strong>, an engineer at Alchemy, also found this issue around October 27th on his own for their LightAccount and reported it to Uniswap first due to its wider use. You can find his proof of concept for Permit 2 here: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/omgwiNNING/replay-sig-poc">https://github.com/omgwiNNING/replay-sig-poc</a> <br>He created a Telegram group and added the Uniswap team and affected wallets. Since I was in touch with the affected wallets, I also joined the group. The wallet community and its members have been having discussions there since that point onwards.</p><p>The group is pretty dormant now, but if you would like to join, reach out to me or Howy.</p><p><strong>When it was all said and done, the following were the wallets that accepted the issue.</strong></p><ol><li><p>Ambire</p></li><li><p>ZeroDev</p></li><li><p>Biconomy <em>(Resolved from </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/bcnmy/scw-contracts/blob/5e97846a633a9bd9be320f63abd66e036dc9abef/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol#L117-L122"><em>V2</em></a><em> onwards, and is still present in V1)</em></p></li><li><p>Soul Wallet</p></li><li><p>Etherspot</p></li><li><p>Openfort</p></li><li><p>Thirdweb</p></li><li><p>Unipass</p></li><li><p>Instadapp</p></li><li><p>Enso</p></li><li><p>OKX</p></li><li><p>Light Account (Alchemy)</p></li><li><p>Hats Wallet</p></li><li><p>Fuse</p></li><li><p>Solady</p></li></ol><p>Ambire&apos;s report for reference: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://gist.github.com/0xcuriousapple/6e45a013b1a4878c584941f2958c19bc">Ambire&apos;s Report</a></p><blockquote><p>There were some more wallets to above list, 5-6 if I recall correctly. Some discarded the issue, some never responded, while others clarified why it doesn&apos;t impact them, like Argent, for example. Even though Argent uses the same reference implementation, this doesn&apos;t apply to them because the signer of the account in their case cannot be used separately as an EOA. It&apos;s generated on the device and not exposed to users.</p></blockquote><hr><h2 id="h-chapter-4-fix-learnings-shoutouts-and-bounties" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Chapter 4: Fix, Learnings, Shoutouts and Bounties</h2><h3 id="h-fix" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Fix:</h3><p>This issue could be fixed by adding the account address inside the signed digest. You can refer to Safe&apos;s implementation for the solution.</p><p>However, in the direct implementation like Safe, you will find that it results in opaque signatures for users.</p><p>Hence, we (Ivo, Frangio, Vectorised) have been having discussions to solve it in a way that doesn&apos;t result in opaque signatures for users (such that they can verify them on their hardware wallets).</p><p>Both Frangio and Vectorised have put together their solutions on their github.</p><ul><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/frangio/eip712-wrapper-for-eip1271/">frangio/eip712-wrapper-for-eip1271</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/Vectorized/solady/pull/688">Vectorized/solady pull request #688</a></p></li></ul><p>Note that none of the above has been audited as of now and is just for reference.</p><h3 id="h-learnings" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Learnings:</h3><ol><li><p><strong>Regarding EIP Reference Implementations :</strong> The broader question here is: Should you consider EIP reference implementations secure by default or not? Should EIP authors take responsibility and have their implementations audited? Or should they leave out the reference implementation part altogether, given the lack of a standard disclosure process and the inability to make amendments?</p><p>For now, you shouldn&apos;t rely on and copy reference EIP implementations as they are. They are only provided for reference and have not been audited.</p></li><li><p><strong>Regarding Signatures:</strong> Be cautious about signatures. They can be tricky and will always remain tricky simply because someone has the ability to execute them on your behalf. Any leak there and you&apos;re done.</p></li><li><p>Please, please include your security contact information in your deployed contract source. This will make it easier for anyone to reach out to you.</p></li></ol><h3 id="h-shoutout-to-the-people-who-helped-during-this-in-no-particular-order" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Shoutout to the people who helped during this, in no particular order:</h3><ul><li><p>Frangio (Co-author of ERC1271), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/frangio_">@frangio_</a></p></li><li><p>Ivo (Ambire), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/Ivshti">@Ivshti</a></p></li><li><p>Felix (Cow), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/fleupold_?lang=en">@fleupold</a></p></li><li><p>Taek (Zerodev), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/leekt216">@leekt216</a></p></li><li><p>Vectorised (Solady), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/optimizoor">@optimizoor</a></p></li><li><p>Howy (Alchemy), <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/howydev">@howydev</a></p></li><li><p>and many others</p></li></ul><h3 id="h-shoutout-to-the-teams-who-paid-bounty-for-this-in-no-particular-order" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Shoutout to the teams who paid bounty for this, in no particular order:</h3><ul><li><p>Ambire (Immunefi)</p></li><li><p>Instadapp (Immunefi)</p></li><li><p>Biconomy (Their Own)</p></li><li><p>Cow (Immunefi)</p></li></ul><p><strong>Thanks,</strong><br><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/0xcuriousapple">@0xcuriousapple</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/2ea272219f58df46af63cae9424e9e8d54b2b59167e56b90d8467919514ba828.png" alt=" Img sourced from @comedywildlifephoto " blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Img sourced from @comedywildlifephoto</figcaption></figure>]]></content:encoded>
            <author>curiousapple@newsletter.paragraph.com (curiousapple)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/7ad944fdf2a7024527a6468f0cf56b0ddfddf980cbd9bdc3db45e4c29489a168.jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>