<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[SolidityScan - Medium]]></title>
        <description><![CDATA[Smart-contract scanning tool built to discover vulnerabilities, mitigate risks in your code, and publish audit reports. - Medium]]></description>
        <link>https://medium.com/solidityscan?source=rss----3e911405e793---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SolidityScan - Medium</title>
            <link>https://medium.com/solidityscan?source=rss----3e911405e793---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 13 Nov 2026 06:11:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/solidityscan" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Aperture Finance Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/aperture-finance-hack-analysis-22dca439ff33?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/22dca439ff33</guid>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[web3-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Thu, 29 Jan 2026 10:28:48 GMT</pubDate>
            <atom:updated>2026-01-29T10:28:47.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzM9E_zBea0KIn1PFGk4oQ.png" /><figcaption>Fig: Aperture Finance Hack Banner</figcaption></figure><h3>Overview:</h3><p>On January 25, 2026, <strong>Aperture Finance</strong> (<a href="https://x.com/ApertureFinance">@ApertureFinance</a>) was exploited across multiple chains Ethereum, Arbitrum, and Base resulting in total losses exceeding $3.67 million USD. The root cause in incident was an arbitrary-call vulnerability caused by insufficient input validation, which allowed attackers to abuse existing ERC20 and NFT approvals and drain assets using transferFrom().</p><p>The protocol is closed source making the analysis a bit difficult. After decompiling the bytecode and reviewing on-chain execution traces, it became evident that user-controlled parameters were passed into low-level calls without proper constraints. This enabled attackers to redirect execution to token contracts and invoke malicious calls in the context of the victim contracts.</p><p>These vulnerabilities fall under OWASP SC Top 10: Arbitrary External Call / Input Validation Failures, a class of issues that becomes especially dangerous when contracts hold broad token approvals.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Attack Transaction: </strong><a href="https://etherscan.io/tx/0x8f28a7f604f1b3890c2275eec54cd7deb40935183a856074c0a06e4b5f72f25a">0x8f28a</a></li><li><strong>Victim Contract:</strong><a href="https://etherscan.io/address/0xD83d960deBEC397fB149b51F8F37DD3B5CFA8913">0xD83d9</a></li><li><strong>Attacker Addresses: </strong><a href="https://etherscan.io/address/0xe3e73f1e6ace2b27891d41369919e8f57129e8ea">0xe3e73</a></li><li><strong>OWASP SC Top 10: </strong><a href="https://scs.owasp.org/sctop10/SC06-UncheckedExternalCalls/">SC06:2025 Unchecked External Calls</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbHfDCDdC7jV6aDIQyclfA.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>At the bytecode level the internal swap function 0x1d33() constructs and performs a low-level external call using parameters derived from user input: target (address used in call), calldata (call data / function selector), expectedOutput (value compared against a balance delta later)</li><li>The contract did not sufficiently constrain target or calldata to known, safe DEX/router contracts or to an expected function selector. Consequently, an attacker could set target to any contract (including an ERC-20 token contract) and craft calldata that invoked that token’s transferFrom(victim, attacker, amount) (or equivalent). Because the low-level call executes from the victim contract’s context, the token transfer honoured any approvals the victim held, enabling theft.</li></ul><p>Two additional enabling factors made the exploit feasible:</p><ul><li>The contract relied on an attacker-controlled <strong>expectedOutput</strong> to validate the swap result (balance delta comparison), making that check meaningless when the attacker crafted both the call and the expected result.</li><li>The project’s closed-source nature required decompilation to find these specifics, but did not change the attack surface: any low-level call + approvals = risk unless constrained.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6-hpbfCy6QIRZLMIFMXzw.png" /></figure><h3>Transaction walkthrough</h3><blockquote>Caller (attacker contract 0x5c92...) calls 0x67b34120() on victim.</blockquote><blockquote>Victim executes WETH.deposit() - WETH balance on victim increases by 100 wei.</blockquote><blockquote>Victim invokes 0x1d33() with the attacker-provided tuple (target, calldata, expectedOutput).</blockquote><blockquote>0x1d33() makes a low-level call(target, calldata).</blockquote><blockquote>target is a token contract; calldata maps to transferFrom(victim, attacker, amount).</blockquote><blockquote>transferFrom runs in the victim context and moves tokens using prior approval.</blockquote><blockquote>0x1d33() checks balanceAfter - balanceBefore == expectedOutput. The attacker-controlled expectedOutput makes this check trivially pass.</blockquote><blockquote>Victim continues and calls NonfungiblePositionManager.mint(); attacker receives minted position while approved assets are siphoned.</blockquote><h3>Mitigation and Best Practices:</h3><ul><li>Any function that performs call(target, calldata) must enforce target ∈ {approved routers/DEXes} and restrict calldata to a known set of function selectors + ABI formats. If a swap needs flexibility, route everything through trusted adapters/wrappers rather than accepting raw user-controlled target/data.</li><li>Never validate execution success using user-supplied output deltas; instead compute outcomes from trusted sources (router return values, audited adapters, or balance-change accounting bound to exact input/output tokens). Add hard checks on tokenIn/tokenOut, minimum amounts, and revert on any unexpected token movement.</li><li>Avoid holding broad ERC20 approvals (especially type(uint256).max) inside operational contracts; use per-swap scoped approvals and reset allowances immediately after use. For user flows, prefer Permit2 / EIP-2612 permits, and add explicit restrictions preventing calls that can trigger transferFrom() on arbitrary tokens or siphon assets via pre-existing approvals.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*F73WV4Po0L3S4N6q.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22dca439ff33" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/aperture-finance-hack-analysis-22dca439ff33">Aperture Finance Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DMi Token Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/dmi-token-hack-analysis-63c6cf552b84?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/63c6cf552b84</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Tue, 09 Dec 2025 10:35:12 GMT</pubDate>
            <atom:updated>2025-12-09T10:35:11.525Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mX6SOAGo6X3GeSzxnN677A.png" /><figcaption>Fig: DMi Token Hack Analysis</figcaption></figure><h3>Overview:</h3><p>On December 8, 2025, the <strong>DMi token </strong>(<a href="https://dexscreener.com/bsc/0x86be038dfbf6506ca186af1001b7db201ed0586e">DMI/WBNB pair</a><strong>) </strong>on BSC Chain<strong> </strong>suffered a AMM reserve-manipulation exploit, resulting in an estimated theft of ~138.68 WBNB (~$124.4K USD) in a single atomic attack transaction.</p><p>The vulnerability originated from a critical logic flaw in the DMi token’s<strong> </strong><strong>transfer() </strong>implementation, which redirected /burned the entire transferred amount whenever the recipient was the PancakeSwap pair. This behaviour violated the invariant assumptions of the AMM and caused token balance desynchronization between the pair’s <em>actual on-chain balances</em> and its <em>internal reserves</em> used for swap pricing..</p><p>This attack is a canonical case of <strong>SC03:2025 Logic Errors</strong> under OWASP Smart Contract Top 10; specifically, <em>breaking AMM reserve invariants via erroneous ERC20 transfer semantics</em>.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Attack Transaction:</strong><a href="https://bscscan.com/tx/0x2330a8cf71d301a0f5c2f617f6e0a4c3ec5005ac1953fbccbb72f905113b9b6a">0x2330a</a></li><li><strong>Victim Contract: </strong><a href="https://bscscan.com/token/0xfbe049df1364fe120a0e7f0ddf586dbb38c79219#readProxyContract">0xfbE04</a> (proxy), <a href="https://bscscan.com/address/0xd88c707e32651ba7e9a08446ab0fcfb962934cf8#code">0xd88c7</a> (DMi)</li><li><strong>Attacker Addresses:</strong><a href="https://bscscan.com/address/0x47f7b5d64644e88c9f773a379674c768dfe78e05#crosschaintx">0x47f7B</a> , <a href="https://bscscan.com/address/0x6dc0d33a5e17ecd7286419071bed86843d01ae5b">0x6DC0D</a></li><li><strong>Attack Contract:</strong><a href="https://bscscan.com/address/0xdd065a63792b5ed26d412bfe74591074dfdc28e1#code">0xdD065</a></li><li><strong>OWASP SC Top 10:</strong><a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/"> SC03:2025 Logic Errors</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6wtVJpSRk4zNSAUqA7OZ-g.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the exploit lies in the transfer-handling logic of the DMi token, specifically within the <strong>transfer</strong>() function. This function contains a critical branch that treats transfers to the PancakeSwap liquidity pair differently from all other transfers.</li><li>Instead of delivering the transferred tokens to the pair contract; as required by the AMM design, the function diverts the entire amount to an external fee/ burn address (<strong>outfee_add</strong>). This behavior fundamentally violates the ERC-20 contract expectations under which AMMs operate.</li><li>In a PancakeSwap-style AMM, whenever a user inputs tokens into a swap, the pair contract must actually receive those tokens so its on-chain token balance and its internal reserves remain synchronized. These reserves are the basis of the AMM pricing formula (x * y = k), and every swap relies on the assumption that the pair’s balances accurately reflect the tokens transferred to it.</li><li>However, the DMi implementation breaks this assumption outright. Whenever a caller attempts to send DMi tokens to the pair, the contract silently executes:</li></ul><pre>if (_isPancakePair(to)) {<br>    _transfer(owner, outfee_add, amount);<br>} else {<br>    _transfer(owner, to, amount);<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*C3mHOGtc-DNos3xHXVwImA.png" /><figcaption>Fig: Vulnerable transfer() Function</figcaption></figure><ul><li>So, rather than sending tokens to the pair, the contract diverts 100% of the tokens to a fee/burn address (outfee_add) whenever the receiver is the liquidity pool.</li><li>This means the pair contract receives zero tokens, even though the AMM logic believes it should have received <strong>amount</strong>. As a result, the pair’s true ERC-20 balance diverges immediately from its reserve variables (<strong> </strong>reserve0, reserve1), leaving the AMM in a corrupted, desynchronized state.</li><li>This violation alone is enough to break the AMM’s pricing model, but the situation becomes significantly worse because transferFrom() does <strong>not</strong> apply the same redirect behavior:</li></ul><pre>_transfer(from, to, amount); // always transfers directly to &#39;to&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*QWzECGd0QXF5ii6-TZDEXQ.png" /><figcaption>Fig: _transferFrom() Function</figcaption></figure><ul><li>This asymmetry enabled the attacker to craft precise sequences where certain token inflows to the pair are delivered normally (via transferFrom()), while others are silently removed from the pair&#39;s expected balance (via transfer()).</li><li>By combining these two inconsistent behaviors inside a single atomic transaction, the attacker intentionally created moments where the AMM believed the pair possesses a large quantity of DMi tokens, while in reality those tokens were never deposited or have been burned or redirected.</li></ul><h3>Attack Sequence:</h3><blockquote>The attacker first obtained a <strong>flash loan of ~102.7 WBNB</strong> from the Moolah lending contract.</blockquote><blockquote>They forwarded the borrowed WBNB into their exploit proxy contract to begin the manipulation.</blockquote><blockquote>The contract then performed a sequence of <strong>DMi transfers and swaps</strong> against the DMi/WBNB PancakePair.</blockquote><blockquote>Whenever the attacker used transfer(), the DMi token <strong>redirected all tokens away from the pair</strong>, preventing the pair from receiving the expected swap input.</blockquote><blockquote>When using transferFrom(), tokens were delivered normally to the pair, creating an intentional imbalance between the pair’s actual token balance and its internal reserves.</blockquote><blockquote>This alternating pattern caused the AMM to enter a state of reserve desynchronization, as reflected by Swap events showing tiny amount0In but massive amount1Out.</blockquote><blockquote>Sync events soon showed the pair’s DMi reserve collapsing to extremely low values (e.g., reserve1 = 502), confirming the manipulated reserve state.</blockquote><blockquote>With the AMM’s reserves distorted, the attacker triggered a final swap that overpaid WBNB, far beyond what should occur in a valid trade.</blockquote><blockquote>The attacker’s proxy contract received the inflated WBNB output, repaid the flash loan, and sent the remaining <strong>138.68 WBNB</strong> as profit to the attacker’s wallet.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QgkYzxglxCoYCu3Jcd-E_g.png" /><figcaption>Fig: Attack Sequence Visualized</figcaption></figure><h3>Mitigation and Best Practices:</h3><ul><li>Ensure transfer() and transferFrom() both route through a single internal function that computes fees and performs token movements identically. Asymmetric behaviors create exploitable ordering conditions inside a single transaction.</li><li>Transfer hooks such as _transfer_before() must never modify balances, trigger value transfers, or update external state. Restrict them to pure accounting and move all externalized reward distribution to explicit claim functions to avoid reentrancy and side-effect desync.</li><li>Transfers to liquidity pools must always deposit the tokens into the pair contract. If fees are required, deduct only a portion and forward the remainder to the pair. Redirecting or burning the full amount instantly breaks AMM reserve invariants.</li><li>Any conditional path that changes how tokens reach a recipient; especially AMM pairs, should be explicitly validated, audited, and bounded. Default behaviors must revert when unsafe or undefined, rather than silently redirecting or consuming tokens.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_tUy94Xfm1wwkVqD.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63c6cf552b84" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/dmi-token-hack-analysis-63c6cf552b84">DMi Token Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Abracadabra Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/abracadabra-hack-analysis-f2efcdee9c05?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/f2efcdee9c05</guid>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 06:23:48 GMT</pubDate>
            <atom:updated>2025-10-07T06:23:43.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzdW0DtSMI6w62Yd8odxRw.png" /><figcaption>Fig: Abracadabra Money Hack Banner</figcaption></figure><h3>Overview:</h3><p>On October 4, 2025, <strong>Abracadabra Money (</strong><a href="https://x.com/MIM_Spell"><strong>@MIM_Spell</strong></a><strong>)</strong>, a decentralized lending platform on Ethereum that issues USD-pegged <strong>MIM</strong> (Magic Internet Money) loans, suffered a critical solvency bypass exploit via the <strong>cook</strong>() multi-action entrypoint., resulting in an estimated loss of ~$1.7 million USD. This protocol has been attacked for the third time in past 2 years; with heavy losses every time ($13.5M in January 2024, $6.5M in March 2024, and now ~$1.7M in October 2025).</p><p>The vulnerability was located in the cook() function of the <em>PrivilegedCauldronV4</em> and <em>PrivilegedCheckpointCauldronV4</em> contracts, where an uninitialized “<strong>else</strong>” branch unintentionally reset internal status flags, disabling collateral checks during borrow operations.</p><p>This flaw allowed the attacker to borrow MIM without any collateral, performing the attack across six Cauldron instances and draining approximately 1,724,494 MIM, which was later swapped into <strong>~395 ETH</strong> in profits.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Attack Transaction:</strong> <a href="https://etherscan.io/tx/0x842aae91c89a9e5043e64af34f53dc66daf0f033ad8afbf35ef0c93f99a9e5e6">0x842aa</a></li><li><strong>Victim Contracts (Cauldron instances): </strong><a href="https://etherscan.io/address/0x46f54d434063e5F1a2b2CC6d9AAa657b1B9ff82c">0x46f54</a>, <a href="https://etherscan.io/address/0x289424aDD4A1A503870EB475FD8bF1D586b134ED">0x28942</a>, <a href="https://etherscan.io/address/0xce450a23378859fB5157F4C4cCCAf48faA30865B">0xce450</a>, <a href="https://etherscan.io/address/0x40d95C4b34127CF43438a963e7C066156C5b87a3">0x40d95</a>, <a href="https://etherscan.io/address/0x6bcd99D6009ac1666b58CB68fB4A50385945CDA2">0x6bcd9</a>, <a href="https://etherscan.io/address/0xC6D3b82f9774Db8F92095b5e4352a8bB8B0dC20d#code">0xC6D3b</a></li><li><strong>Attacker Address:</strong> <a href="https://etherscan.io/address/0x1aaade3e9062d124b7deb0ed6ddc7055efa7354d">0x1AaaDe</a></li><li><strong>Attack Contract:</strong><a href="https://etherscan.io/address/0xB8e0A4758Df2954063Ca4ba3d094f2d6EdA9B993#code">0xB8e0A</a> (Self-Destructed)</li><li><strong>OWASP SC Top 10:</strong><a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/"> SC03:2025 Logic Errors</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uX-OgpOmWeTG8IX2FN-Z1w.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the exploit lies in the <strong>cook() function, </strong>which is<strong> </strong>the core batching mechanism in Abracadabra’s <em>CauldronV4</em> contracts. This function is designed to let users chain multiple operations such as deposits, borrows, and repayments into a single atomic transaction.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npig4jzkRgu2rhVgPmOFqQ.png" /><figcaption>Fig: Vulnerable cook() Function</figcaption></figure><ul><li>The cook() function processes an array of encoded actions, executing them sequentially in a loop. Each action (represented by an integer code (e.g., ACTION_BORROW = 5) and associated encoded parameters (datas[])) modifies a temporary execution context called CookStatus, which tracks key control flags such as whether a solvency check must be performed at the end. To track transient control flags during this batch, the function uses a local struct:</li></ul><pre>struct CookStatus {<br>    bool needsSolvencyCheck;// Indicates if solvency must be verified at the end<br>    bool hasAccrued;         // Tracks whether interest has been accrued<br>}</pre><ul><li>Each action can modify CookStatus. For instance:</li></ul><pre>if (action == ACTION_BORROW) {<br>    (value1, value2) = _borrow(to, _num(amount, value1, value2));<br>    status.needsSolvencyCheck = true;<br>}</pre><ul><li>This ensures that any borrow or collateral removal triggers a final solvency validation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qesaXhhejc_JacFoBUVYog.png" /><figcaption>Fig: Vulnerable <strong>_additionalCookAction()</strong></figcaption></figure><ul><li>So, here the vulnerability arises from <strong><em>_additionalCookAction</em>()</strong>, designed to allow extended, undefined or custom actions like (<strong>action = 0</strong>):</li></ul><pre> function _additionalCookAction(<br>    uint8 action,<br>    CookStatus memory,<br>    uint256 value,<br>    bytes memory data,<br>    uint256 value1,<br>    uint256 value2<br>) internal virtual returns (bytes memory, uint8, CookStatus memory) {}</pre><ul><li>For any unknown action IDs (<strong>action = 0</strong>), cook() delegates execution to _additionalCookAction(). In the V4 implementation, _additionalCookAction() returns a default-initialized CookStatus, effectively resetting needsSolvencyCheck to false. This means any prior borrow or collateral removal flag is silently cleared, allowing the final solvency check in cook() to be bypassed:</li></ul><pre>status = returnStatus; // returnStatus has needsSolvencyCheck = false<br>...<br><br>if (status.needsSolvencyCheck) {<br>    (, uint256 _exchangeRate) = updateExchangeRate();<br>    require(_isSolvent(msg.sender, _exchangeRate), &quot;Cauldron: user insolvent&quot;);<br>}</pre><ul><li>As a result, the attacker borrowed ~1.7M MIM without sufficient collateral, exploiting the fact that the batching mechanism’s transient control flags were improperly preserved across custom actions.</li><li>The attacker got away with about 1,724,494 MIM- roughly $1.7 million USD at the time of the incident. Those MIM were successively swapped to ETH, yielding approximately 395 ETH in net proceeds before the attacker self-destructed the exploit contract.</li><li>Abracadabra Team acknowledged the incident via their official X account: <a href="https://x.com/MIM_Spell/status/1975130787486831018">https://x.com/MIM_Spell/status/1975130787486831018</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*lQ3aAbpFFBCCZWeoD07FHA.png" /><figcaption>Fig: Official Status from Abracadabra Money Team</figcaption></figure><ul><li>The Abracadabra Team also stated that during the incident, no user funds were lost, and the effect has now been already full mitigated.</li></ul><h3>Attack Sequence:</h3><blockquote>The attacker funded their exploit contract using Tornado Cash to obfuscate the source of funds.</blockquote><blockquote>Then, they called the cook() function on multiple CauldronV4 contracts, passing actions = [5, 0] to trigger the exploit.</blockquote><blockquote>The ACTION_BORROW (5) executed a borrow operation, which set the needsSolvencyCheck flag to true.</blockquote><blockquote>And, the ACTION_0 then called the empty _additionalCookAction() function, which reset the needsSolvencyCheck flag to false.</blockquote><blockquote>As a result, the final solvency check in cook() was skipped, allowing the attacker to bypass collateral verification.</blockquote><blockquote>Thus, the attacker successfully kept the borrowed MIM without providing any collateral.</blockquote><blockquote>They repeated this sequence across six different CauldronV4 contracts to maximize the stolen amount.</blockquote><blockquote>Then, attacker then swapped the stolen MIM through a series of conversions: MIM → DAI → USDC → WETH → ETH.</blockquote><blockquote>Finally, the exploit contract self-destructed, transferring approximately 395 ETH in profit to the attacker’s wallet.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*12v6asWjSpiLCG0QLAmdjw.png" /><figcaption>Fig: Attack Sequence Visualized</figcaption></figure><h3>Mitigation and Best Practices:</h3><ul><li>Avoid relying on transient state across actions. Never assume that a local struct or flag will persist safely through multiple actions. Always design control flags to be immutable or explicitly validated at critical checkpoints.</li><li>When extension hooks return status structs, merge boolean flags (e.g., needsSolvencyCheck ||= returnStatus.needsSolvencyCheck) instead of doing status = returnStatus. This prevents later/unknown actions from clearing security-critical flags.</li><li>Replace silent fall-throughs with an explicit revert(&quot;Unknown cook action&quot;) for unsupported action codes, or make the default hook explicitly revert() unless intentionally overridden. Never allow a no-op default that can reset state.</li><li>Any custom or undefined actions (like ACTION_CUSTOM) should either be disabled or strictly validated to prevent unintended side effects, especially in multi-action batch functions.</li><li>Use fuzzing, symbolic execution, and formal verification tools to test all possible action sequences, ensuring no combination can bypass security-critical checks.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iXAXPib9p1ktH3Bl.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2efcdee9c05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/abracadabra-hack-analysis-f2efcdee9c05">Abracadabra Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NGP Token Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/ngp-token-hack-analysis-414b6ca16d96?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/414b6ca16d96</guid>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 06:46:55 GMT</pubDate>
            <atom:updated>2025-09-19T07:12:26.151Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dxp1ON_YJtHNnIkqWmHKHA.png" /></figure><h3>Overview:</h3><p>On <strong>September 18, 2025</strong>, the NGP token (<a href="https://x.com/newgoldprotocol">@newgoldprotocol</a>) deployed on <strong>BNB Chain (</strong>BSC<strong>)</strong> suffered a price oracle manipulation attack <strong>(</strong><a href="https://scs.owasp.org/SCWE/SCSVS-ORACLE/SCWE-028/"><em>OWASP SCWE-028</em></a><strong>)</strong>, resulting in an estimated <strong>loss of ~$2M USD</strong>.</p><p><strong>Note</strong>: <a href="https://solidityscan.com/">SolidityScan AI Scanner</a> was able to detect all of these NGP Token vulnerabilities that cost them ~2M USD in losses!</p><p>The vulnerability stemmed from broken transfer fee logic combined with insecure reliance on a single DEX pair reserve as a price oracle. Specifically, the token contract’s getPrice() function derived token price directly from the PancakeSwap NGP/USDT reserves without safeguards, while the _update() function’s sell-fee logic deducted tokens from the pool before user transfers, allowing the attacker to artificially distort pool reserves.</p><p>By chaining these flaws with flash loans, the attacker was able to bypass buy limits, manipulate the pool’s spot price, and drain the liquidity pool.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract:</strong> <a href="https://bscscan.com/address/0xd2f26200cd524db097cf4ab7cc2e5c38ab6ae5c9">0xd2F26</a></li><li><strong>Attack Transaction:</strong> <a href="https://bscscan.com/tx/0xc2066e0dff1a8a042057387d7356ad7ced76ab90904baa1e0b5ecbc2434df8e1">0xc2066</a></li><li><strong>Attacker Address:</strong> <a href="https://bscscan.com/address/0x0305ddd42887676ec593b39ace691b772eb3c876">0x0305d</a></li><li><strong>OWASP SC Top 10:</strong> <a href="https://scs.owasp.org/sctop10/SC02-PriceOracleManipulation/">SC02:2025 — Oracle Price Manipulation</a></li><li><strong>OWASP SCWE:</strong> <a href="https://scs.owasp.org/SCWE/SCSVS-ORACLE/SCWE-028/">SCWE-028: Price Oracle Manipulation</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwWtPickRyCrv7OPVrOYVA.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of this vulnerability lies in a combination of three interdependent design mistakes: relying on a spot AMM reserve as an on-chain price oracle, implementing fee logic that mutates the AMM pair’s token balance &amp; calls sync() before the seller’s tokens are actually transferred, and whitelisting the DEAD address which allows bypassing of buy/cooldown protections.</li><li>Each alone is dangerous; together they enable a single-transaction (flash-loan powered) price-manipulation that defeats the contract’s intended limits and extracts liquidity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*rRWzy9CStSVW-9zV5HZTlg.png" /><figcaption>Fig: Vulnerable `getPrice()` Function</figcaption></figure><ul><li>The NGP contract’s getPrice() (its just a convenience wrapper; internally the price comes from: getTokenPrice() ) function calculates the token price using a simple ratio of USDT reserves to NGP reserves in the AMM pool. Using this ratio:</li></ul><pre>price = (usdtReserve * 1e18) / tokenReserve;</pre><ul><li>This approach constitutes the first major flaw in the contract’s price oracle logic. By relying solely on the instantaneous reserve balances of the <em>NGP-USDT </em>pair, the contract exposes itself to manipulation, since any sudden, temporary change in the pool’s reserves can drastically skew the reported token price.</li><li>This spot price is then used to enforce maximum purchase limits through the maxBuyAmountInUsdt check in the _update() function:</li></ul><pre>require(((value * getPrice()) / 1e18) &lt;= maxBuyAmountInUsdt, &quot;Exceeds max buy amount&quot;);</pre><ul><li>Because the contract relies exclusively on the instantaneous reserves of a single liquidity pool, the price can be easily manipulated within a single transaction. The attacker could temporarily increase or decrease the token or USDT balances in the pool using a flash loan, causing getPrice() to report an artificially low or high price. This allowed the attacker to bypass the intended buy limits, acquiring far more NGP than the contract’s safeguards would normally permit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ygzDkXU7t78GjdyFBVtROA.png" /><figcaption>Fig: Vulnerable `_update()` Function</figcaption></figure><ul><li>Compounding this, the contract contains a critical vulnerability in its fee deduction and pool syncing logic. When NGP tokens are sold, the contract deducts several fees- market, burn, treasury, and reward; before the seller’s tokens are fully transferred to the pool. The relevant code is in the _update() function:</li></ul><pre>super._update(mainPair, treasuryAddress, treasuryAmount);<br>super._update(mainPair, rewardPoolAddress, rewardAmount);<br>IUniswapV2Pair(mainPair).sync(); // reserves updated before seller transfer<br>value = value - totalFee;<br>super._update(from, to, value);</pre><ul><li>By mutating the AMM pair’s reserves and calling sync() before the seller’s transfer, the contract artificially inflates the token price. In normal circumstances, this might have been intended to reflect fee deductions, but in combination with manipulated pool reserves, it allowed the malicious actor to sell NGP at a drastically inflated price.</li><li>During the exploit, a flash loan of approximately $211 million was used to reduce the NGP reserves to extremely low levels, such that selling 1.36 million NGP caused the pool reserves to drop from 477,000 to just 0.035 tokens. This broke the AMM curve (k=xy) and enabled the attacker to drain the pool almost entirely.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*3QmtPCIAJaZGiS4XEjIwmA.png" /><figcaption>Fig: Whitelisting logic that led to bypass</figcaption></figure><ul><li>Another critical enabler of the attack was the whitelist logic, which included the DEAD address. Whitelisted addresses bypass key restrictions, including maxBuyAmountInUsdt and the per-account buy cooldown. The attacker initially swapped tokens to the DEAD address to bypass these protections, allowing accumulation of large amounts of NGP across multiple accounts without triggering safeguards. This step was essential to execute the subsequent sell-side manipulation effectively.</li><li>Ultimately, the attacker combined these vulnerabilities in a <strong>single atomic transaction</strong>: manipulating the price via flash loan, bypassing buy limits through the whitelist, and exploiting premature fee and sync logic to sell at an inflated price. After draining the pool, the attacker converted the stolen funds to ETH; resulting in an estimated <strong>loss of ~$2M USD on New Gold Protocol’s side</strong>.</li></ul><h3>Attack Sequence:</h3><blockquote>The attacker took large flash loans of USDT from multiple DeFi platforms (Morpho, Venus) in a single transaction.</blockquote><blockquote>Then, they manipulated the NGP-USDT pool via getPrice(), which relies on instantaneous reserves.</blockquote><blockquote>Using the whitelisted DEAD address, they bypassed _checkAndUpdateBuyCount(), _checkTransferCooldown(), and maxBuyAmountInUsdt in _update().</blockquote><blockquote>Then, they bought a large amount of NGP at artificially low prices.</blockquote><blockquote>Selling these tokens triggered pre-transfer fee deductions and IUniswapV2Pair.sync(), inflating the token price.</blockquote><blockquote>Then, the attacker extracted a disproportionate amount of USDT/BUSD liquidity.</blockquote><blockquote>Flash loans were repaid, leaving attacker with ~$2M profit.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJQn6-FKpQLKI4Q_64r3fA.png" /><figcaption>Fig: Attack Sequence Visualized</figcaption></figure><h3>Detection by SolidityScan:</h3><ul><li><a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> was able to<strong> detect the all 3 vulnerable hotspots in New Gold Protocol’s </strong><a href="https://bscscan.com/address/0xd2f26200cd524db097cf4ab7cc2e5c38ab6ae5c9"><strong>NGP Token Contract</strong></a><strong> (BSC) that led to a ~$2M USD exploit .</strong></li><li>Scanning the contract early on with <strong>SolidityScan</strong> would have flagged this critical vulnerability. <strong>This single scan could have saved New Gold Protocol over 2 Million USD!</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9jg_bIRWprqnprpv3dep-w.png" /><figcaption>Fig: SolidityScan AI scanner detected the actual vulnerabilities that led to this exploit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxqgfP8GpqNh6wxd8muC6w.png" /><figcaption>Fig: Detection of whitelist logic flaw; with proepr exploit scenario</figcaption></figure><p>Try it yourself at: <a href="https://solidityscan.com/"><strong>https://solidityscan.com</strong></a> !</p><p>Sign up and scan the Victim Contract : <a href="https://bscscan.com/address/0xd2f26200cd524db097cf4ab7cc2e5c38ab6ae5c9"><strong>NGP Token Contract</strong></a><strong> (BSC) on </strong>Mainnet. A detailed vulnerability report will be ready in just few seconds!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GwP8jbqpoYLrG4836p7vZg.png" /><figcaption>Fig: Scan your On-Chain Contracts!</figcaption></figure><p><strong>Don’t wait for a hack postmortem to learn from — catch critical bugs <em>before</em> they go live.</strong></p><ul><li>Integrate <a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> into your development <strong>CI/CD pipeline</strong> and secure every deploy!</li></ul><h3>Mitigation and Best Practices:</h3><ul><li>Avoid relying on instantaneous spot prices from a single AMM pair. Use <strong>time-weighted average price (TWAP)</strong> or multi-source oracle feeds to prevent intra-block manipulation and flash loan attacks.</li><li>Deduct fees <strong>only after the token transfer is complete</strong>. Prematurely mutating pool balances or calling sync() before transfer completion can distort AMM pricing and enable exploitative selling.</li><li>Carefully manage whitelisted addresses. Avoid including addresses like DEAD or any that could be used to bypass <strong>buy limits, cooldowns, or fee logic</strong>. Limit whitelist modifications to highly trusted admin actions with multi-signature approval.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Le6LFJ3Q2xy3A1xT.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=414b6ca16d96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/ngp-token-hack-analysis-414b6ca16d96">NGP Token Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SuperRare Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/superrare-hack-analysis-488d544d89e0?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/488d544d89e0</guid>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[web3-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 12:24:29 GMT</pubDate>
            <atom:updated>2025-09-15T04:08:19.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBwP0iuV6d9Z_wqrQoBDhw.png" /></figure><h3>Overview:</h3><p>On July 28, 2025, <strong>SuperRare’s (</strong><a href="https://x.com/SuperRare"><strong>@SuperRare</strong></a><strong>) RareStakingV1 contract</strong> was exploited for approximately <strong>$730,000 USD</strong> (~11.9M RARE tokens). The vulnerability stemmed from a <strong>broken access control check</strong> in the updateMerkleRoot() function, allowing <strong>any unauthorized users to submit malicious Merkle roots</strong>. This enabled an attacker to calculate a malicious Merkle root, submit it via a frontrunner transaction, and fraudulently claim the tokens. This vulnerability falls under <a href="https://scs.owasp.org/sctop10/SC01-AccessControlVulnerabilities/">OWASP SC01: Access Control Vulnerabilities.</a></p><p>The stolen funds, valued at ~$730,000, remain in the attacker’s contract and have not yet been swapped yet. Notably, the $RARE token itself was unaffected, with the exploit limited to the staking contract’s reward pool.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract: </strong><a href="https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC#code">0xfFB51</a> (RareStakingV1)</li><li><strong>Attack Transaction: </strong><a href="https://etherscan.io/tx/0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1">0xd8137</a> (executed by a frontrunner)</li><li><strong>Attacker Addresses: </strong><a href="https://etherscan.io/address/0x5B9B4B4DaFbCfCEEa7aFbA56958fcBB37d82D4a2">0x5B9B4</a></li><li><strong>OWASP SC Top 10</strong>: <a href="https://scs.owasp.org/sctop10/SC01-AccessControlVulnerabilities/">SC01:2025 Access Control Vulnerabilities</a></li><li><strong>OWASP SCWE: </strong><a href="https://scs.owasp.org/SCWE/SCSVS-AUTH/SCWE-016/">SCWE-016</a> ,<a href="https://scs.owasp.org/SCWE/SCSVS-CODE/SCWE-013/"> SCWE-013</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3oyfGmz7KhactAEOERmGQ.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the vulnerability in the SuperRare RareStakingV1 contract lies in a <strong>critical logic flaw in access control </strong>within the updateMerkleRoot function.</li><li>The updateMerkleRoot function was designed to allow the contract owner or a predefined authorized address to update the currentClaimRoot — a critical state variable that defines the Merkle root used for verifying token claims in the staking system. This update is intended to facilitate legitimate changes to the Merkle tree structure while ensuring that only trusted parties can modify it and thereby protecting the integrity of the staking rewards pool.</li><li>However, the wrong implementation of this function led to a significant loss of funds!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubS7gbT7m8vHJExlpPYikA.png" /><figcaption>Fig: Vulnerable updateMerkleRoot() Function</figcaption></figure><ul><li>The function, intended to restrict Merkle root updates to the contract owner or a specific authorized address, contained a misconfigured require statement:</li></ul><p>require((msg.sender != owner() || msg.sender != address(0xc2F394a45e994bc81EfF678bDE9172e10f7c8ddc)), &quot;Not authorized to update merkle root&quot;);</p><ul><li>This logic uses != (not equal) with an || (OR) operator, which incorrectly allows <strong>any address</strong> to pass the check. Specifically, the condition evaluates to true for any msg.sender that is <strong>not the owner</strong> or <strong>not the authorized address</strong>—conditions that are always met by any address, since an address cannot simultaneously be both the owner and the authorized address.</li><li>This effectively removes all access control, enabling unauthorized users to update the Merkle root. <strong>This logic is inverted and flawed!</strong></li><li>The attacker abused this logic flaw by calculating a <strong>malicious Merkle root</strong>, such as0x93f3c, and utilized claim() function to withdraw approximately ~11.9M $RARE Tokens worth ~$730,000 USD.</li></ul><h3>Attack Sequence:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvkwhmDGSOyqptn5ZPat3Q.png" /><figcaption>Fig: Attack Sequence Visualized</figcaption></figure><h3>Detection by SolidityScan:</h3><ul><li><a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> was able to<strong> detect the exact vulnerable line in SuperRare’s </strong><a href="https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC#code"><strong>RareStakingV1</strong></a><strong> (Ethereum) contract that led to a ~$730K USD exploit .</strong></li><li>Scanning the contract early on with <strong>SolidityScan</strong> would have flagged this critical vulnerability. <strong>This single scan could have saved SuperRare over 730K USD!</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBTwJEN9AbY91EFxia2XrQ.png" /><figcaption>Fig: Solidityscan was able to catch the vulnerability!</figcaption></figure><ul><li>Try it yourself at: <a href="https://solidityscan.com/"><strong>https://solidityscan.com</strong></a> ! Sign up and scan the Victim Contract (<a href="https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC#code"><strong>RareStakingV1</strong></a>) on Ethereum (Mainnet). A detailed vulnerability report will be ready in just few seconds!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbXeqIT7349IZ5p01Qs3bg.png" /><figcaption>Fig: Simple steps to scan any contract on SolidityScan!</figcaption></figure><ul><li><strong>Don’t wait for a hack postmortem to learn from — catch critical bugs <em>before</em> they go live.</strong></li><li>Integrate <a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> into your development <strong>CI/CD pipeline</strong> and secure every deploy!</li></ul><h3>Mitigation and Best Practices:</h3><ul><li>Ensure that only authorized parties (e.g., the <strong>contract owner</strong> or a <strong>predefined trusted address</strong>) can update the currentClaimRoot by implementing a strict require check.</li><li>Use a robust access control mechanism, such as <strong>OpenZeppelin’s </strong><strong>AccessControl</strong>, to manage permissions for sensitive functions like updateMerkleRoot.</li><li>Avoid relying solely on msg.sender for access control; incorporate <strong>multi-factor validation</strong> or <strong>role-based checks</strong> to prevent unintended access.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*nYAfl2rejVr1zceH.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=488d544d89e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/superrare-hack-analysis-488d544d89e0">SuperRare Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arcadia Finance Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/arcadia-finance-hack-analysis-a03a722e554d?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/a03a722e554d</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 05:59:37 GMT</pubDate>
            <atom:updated>2025-09-15T04:11:27.321Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HYmzHsgtzdcEWlVvscYT-w.png" /></figure><h3>Overview:</h3><p>On <strong>July 15, 2025</strong>, Arcadia Finance (<a href="https://x.com/ArcadiaFi">@ArcadiaFi</a>)— a liquidity and asset management protocol — was exploited for nearly <strong>$3.5 million on Base</strong>. The attacker leveraged a critical trust assumption flaw in the <a href="https://basescan.org/address/0xC729213B9b72694F202FeB9cf40FE8ba5F5A4509">RebalancerSpot</a> contract. Specifically, a swapData parameter allowed arbitrary external calls to unvalidated router addresses.</p><p>By registering their own malicious smart contract as both the router and a whitelisted ArcadiaAccount, the attacker spoofed privileged execution contexts and hijacked control flow. This allowed unauthorized withdrawals from other user accounts via manipulated rebalance flows.</p><p>The root issue lies in the assumption that the router address passed via swapData would not be a contract with elevated permissions — which was not enforced in code. Once triggered, the attacker repaid debts of a target account to meet health checks, used the Rebalancer to invoke a custom malicious call, and drained LP tokens from the victim’s position.</p><p>This vulnerability is an example of <a href="https://scs.owasp.org/sctop10/SC06-UncheckedExternalCalls/">OWASP SC06:2025 Unchecked External Calls</a>.</p><h3>Smart Contract Hack Overview:</h3><p><em>On Base:</em></p><ul><li><strong>Victim Contract: </strong><a href="https://basescan.org/address/0xC729213B9b72694F202FeB9cf40FE8ba5F5A4509#code">0xC7292</a> (RebalancerSpot)</li><li><strong>Attack Transactions: </strong><a href="https://basescan.org/tx/0x06ce76eae6c12073df4aaf0b4231f951e4153a67f3abc1c1a547eb57d1218150">0x06ce7</a>, <a href="https://basescan.org/tx/0x0b9bed09d241cef8078e6708909f98574c33ee06abcc2f80bc41731cd462d60b">0x0b9be</a>, <a href="https://basescan.org/tx/0x723989a674074eab665dc93cef3b123f0f5cea764dbfbeb6c8a8c80278d0bc09">0x72398</a></li><li><strong>Attacker Addresses: </strong><a href="https://basescan.org/address/0x0fa54e967a9cc5df2af38babc376c91a29878615">0x0fa54</a></li><li><strong>OWASP SC Top 10: </strong><a href="https://scs.owasp.org/sctop10/SC06-UncheckedExternalCalls/">SC06:2025 Unchecked External Calls</a></li><li><strong>OWASP SCWE-042:</strong> <a href="https://scs.owasp.org/SCWE/SCSVS-COMM/SCWE-042/">Insecure Use of External Calls</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTT0aohQQJk_ScmqVw44CA.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the Arcadia Finance exploit lies in the lack of validation in the SwapLogic._swapViaRouter() function. This allowed an attacker to inject a malicious router via the router.call(data) mechanism, leveraging the trusted context of the Rebalancer contract (msg.sender) to perform unauthorized actions on victim accounts.</li><li>The exploit path traverses multiple contracts: RebalancerSpot.sol, Rebalancer.sol, and SwapLogic.sol.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-vZ--46sT2Puzj4eWWhrfw.png" /><figcaption>Fig: rebalance() function in Rebalancer.sol</figcaption></figure><ul><li>In the Rebalancer.sol contract, the rebalance() function is externally callable and enables anyone to initiate a rebalance operation if they are registered as the initiator. The attacker first registers as a valid initiator and then calls rebalance() with carefully crafted swapData. This data encodes a malicious router address and a payload (data) that performs unauthorized operations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L9wsMlLT0tzV5-FVBtzMzQ.png" /><figcaption>Fig: Rebalancer.executeAction() function</figcaption></figure><ul><li>During the rebalance process, the Rebalancer contract calls flashAction() on the user-supplied ArcadiaAccount, designating itself (address(this)) as the callback. This causes the ArcadiaAccount to invoke the executeAction() function on the Rebalancer, completing the flash execution flow.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*PSQ6objBjrAfI4Fhq8iKZA.png" /><figcaption>Fig: _swap() in Rebalancer.executeAction()</figcaption></figure><ul><li>Inside Rebalancer.executeAction(), the swap logic is delegated to SwapLogic._swap(), which further calls _swapViaRouter(). <strong>Here lies the critical flaw.</strong></li><li>The _swapViaRouter() function performs two key actions: <br><em>1. Approves the exact </em><em>amountIn of the input token to the attacker-controlled router via </em><em>safeApproveWithRetry().<br>2. Executes an arbitrary low-level call to the router via:</em></li></ul><pre>(bool success, bytes memory result) = router.call(data);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PphdyMvp18ksdphk_ixfLQ.png" /><figcaption>Fig: Vulnerable _swapViaRouter() in SwapLogic.sol</figcaption></figure><ul><li>Because this low-level call is performed from within the Rebalancer contract, the called contract (i.e., the malicious router) sees msg.sender == Rebalancer.</li><li>In Arcadia’s architecture, ArcadiaAccount contracts maintain a list of authorized AssetManager addresses — typically including the Rebalancer. Therefore, if a contract is called from the Rebalancer’s context, it can inherit those elevated privileges.</li><li>The attacker exploited this by designing a malicious router contract that, when called, triggered sensitive functions on a <em>different</em> ArcadiaAccount (the victim&#39;s). Because the Rebalancer was already whitelisted in that victim account, and because the account was in a “healthy” state (no outstanding debt), the call succeeded.<strong><em> The withdrawal executed as if it were from a trusted manager.</em></strong></li><li>This resulted in the unauthorized draining of liquidity provider (LP) tokens from user accounts. The Rebalancer approved the malicious contract for token transfers, and the malicious contract called sensitive functions with elevated context — effectively bypassing all access control.</li><li>The total loss amounted to approximately $3.5 million across LP positions, all stemming from this unchecked assumption: that the router supplied in swapData would always point to a safe, external DEX (like Uniswap or 1inch).</li><li>The exploiter then swapped the stolen funds for ~840 $ ETH &amp; bridged them from Base to Ethereum. <strong><em>Currently, the stolen fund is parked at: <br></em></strong><a href="https://basescan.org/address/0x0fa54e967a9cc5df2af38babc376c91a29878615"><strong><em>https://basescan.org/address/0x0fa54e967a9cc5df2af38babc376c91a29878615</em></strong></a><strong><em> (~3.6M USD)</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfaX4NSaml4YrU4s_pssMw.png" /><figcaption>Fig: Attack Call Sequence</figcaption></figure><ul><li>Arcadia Team promptly acknowledged the attack and released a statement via X. More details to follow from official sources. <br>Read here: <a href="https://x.com/ArcadiaFi/status/1944984622183370867"><strong>https://x.com/ArcadiaFi/status/1944984622183370867</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*bDjntceBId2ZS0JpSgIbhw.png" /><figcaption>Fig: Arcadia’s acknowledgement on X</figcaption></figure><h3>Attack Sequence:</h3><blockquote>Attacker creates multiple Arcadia Accounts and takes ~$1.5B flashloan from Morpho Blue to fund the exploit.</blockquote><blockquote>Then, links Asset Manager to their own Arcadia Account, setting self as initiator. And creates a small LP position to trigger the rebalance flow.</blockquote><blockquote>Fully repays the debt of a <em>victim</em> Arcadia Account using the flashloan — bringing it to a “healthy” state.</blockquote><blockquote>Calls rebalance() on their own account, injecting malicious swapData.</blockquote><blockquote>Inside SwapLogic._swapViaRouter(), the attacker’s malicious contract is called via router.call(data).</blockquote><blockquote>That malicious contract executes arbitrary calls to the victim Arcadia Account (e.g., calling sensitive functions). These calls succeed because: <br>1. The <em>Rebalancer</em> is already whitelisted in the victim account. <br>2. The account is healthy (no active debt), so failsafes are bypassed.</blockquote><blockquote>Victim’s funds are transferred out to the attacker.</blockquote><blockquote>And the flashloan is repaid using part of the stolen funds.</blockquote><blockquote>Attacker now retains the remaining stolen assets.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV_rZEniPmIC5-0Jq8iPxw.png" /><figcaption>Fig: Attack Sequence Visualized</figcaption></figure><h3>Detection by SolidityScan:</h3><ul><li><a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> was able to<strong> detect the exact vulnerable line in Arcadia Finance’s </strong><a href="https://basescan.org/address/0xC729213B9b72694F202FeB9cf40FE8ba5F5A4509"><strong>RebalancerSpot</strong></a><strong> (Base) contract that led to a $3.5M exploit .</strong></li><li>Scanning the contract early on with <strong>SolidityScan</strong> would have flagged this critical vulnerability. <strong>This single scan could have saved Arcadia Finance over $3.5M USD and protected user funds.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YZgRJN8rkB4_lLv8AiZiTw.png" /><figcaption>Fig: Solidityscan was able to catch the vulnerability!</figcaption></figure><ul><li>Try it yourself at: <a href="https://solidityscan.com/"><strong>https://solidityscan.com</strong></a> ! Sign up and scan the Victim Contract (<a href="https://basescan.org/address/0xC729213B9b72694F202FeB9cf40FE8ba5F5A4509">RebalancerSpot</a>) on Base (Mainnet). A detailed vulnerability report will be ready in just few moments!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryNQb6HZ6WelYz0YbO9QLw.png" /><figcaption>Fig: Simple steps to scan any contract on SolidityScan!</figcaption></figure><ul><li><strong>Don’t wait for a hack postmortem to learn from — catch critical bugs <em>before</em> they go live.</strong></li><li>Integrate <a href="https://solidityscan.com/"><strong>SolidityScan</strong></a> into your development <strong>CI/CD pipeline</strong> and secure every deploy!</li></ul><h3>Mitigation and Best Practices:</h3><ul><li>Ensure that only trusted DEX contracts (e.g., Uniswap, 1inch) can be passed as routers in swapData. Maintain an allowlist of approved router addresses.</li><li>Also, do not rely solely on msg.sender for access control in contexts involving delegate calls or external router calls. Add explicit checks on the origin of privileged actions.</li><li>Before executing arbitrary low-level call()s (like in _swapViaRouter()), verify that the target contract cannot execute unintended privileged logic.</li><li>Before performing privileged actions like withdrawals, verify that the action is appropriate for the account’s state (e.g., debt must be active, initiator must be whitelisted, etc.).</li><li>Carefully audit any flow that uses flashloans or allows callbacks — especially if it allows arbitrary calldata injection — since these can introduce hidden reentrancy and privilege escalation vectors.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*C83NR-CrJMshQSt5.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a03a722e554d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/arcadia-finance-hack-analysis-a03a722e554d">Arcadia Finance Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GMX v1 Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/gmx-v1-hack-analysis-ed0ab0c0dd0f?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/ed0ab0c0dd0f</guid>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Thu, 10 Jul 2025 07:22:32 GMT</pubDate>
            <atom:updated>2025-09-15T04:17:10.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ziop31G-mnvXNTOBn2hkQg.png" /><figcaption>Fig: GMX Hack Analysis</figcaption></figure><h3>Overview:</h3><p>On <strong>July 9, 2025</strong>, <strong>GMX (</strong><a href="https://x.com/GMX_IO"><strong>@GMX_IO</strong></a><strong>)</strong> — a decentralized perpetuals trading protocol on Arbitrum — was exploited for over <strong>$42 million</strong>. The attacker abused a r<strong>efund-based reentrancy-like vulnerability </strong>in the PositionManager.executeDecreaseOrder() function, along with an <strong>internal accounting desynchronization</strong> in the GLP pricing mechanism.</p><p>The root cause includes the implicit assumption in executeDecreaseOrder() that the _account parameter is an Externally Owned Account (EOA), when in fact it can be a malicious smart contract. This vulnerability is an combination of <a href="https://scs.owasp.org/sctop10/SC05-Reentrancy/">OWASP SC05: Reentrancy Attacks</a> and <a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/">SC03: Logic Errors.</a></p><p>This allowed the attacker to deploy a malicious contract and spoof GMX’s keeper execution flow to gain reentrant access into core vault logic. By hijacking control flow during ETH refunds and exploiting a stale getAum() (Assets Under Management) calculation, the attacker repeatedly minted GLP at a low price, opened phantom short positions that artificially inflated AUM, and redeemed GLP at a higher price—draining liquidity from GMX’s vault across ETH, USDC, and WBTC.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract: </strong><a href="https://arbiscan.io/address/0x489ee077994b6658eafa855c308275ead8097c4a">0x489ee</a> (vault), <a href="https://arbiscan.io/address/0x321f653eed006ad1c29d174e17d96351bde22649">0x321f6</a> (GLP Manager),</li><li><strong>Attack Transaction: </strong><a href="https://arbiscan.io/tx/0x03182d3f0956a91c4e4c8f225bbc7975f9434fab042228c7acdc5ec9a32626ef">0x03182</a> (Arbitrum)</li><li><strong>Attacker Addresses: </strong><a href="https://arbiscan.io/address/0xdf3340a436c27655ba62f8281565c9925c3a5221">0xDF334</a>, <a href="https://arbiscan.io/address/0x7d3bd50336f64b7a473c51f54e7f0bd6771cc355">0x7D3BD</a></li><li><strong>OWAPS SC Top 10:</strong> <a href="https://scs.owasp.org/sctop10/SC05-Reentrancy/">SC05: Reentrancy Attacks</a> and <a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/">SC03: Logic Errors.</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kd5KsOK9b0y1PQbKKGd1jw.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the GMX exploit lies in the improper trust assumption in the PositionManager.executeDecreaseOrder() function, which allowed a <strong>malicious smart contract to hijack execution flow</strong>, and in the <strong>flawed AUM (Assets Under Management) accounting logic</strong> in the GlpManager.sol during leveraged position handling.</li><li>This vulnerability led to a sophisticated multi-step attack where the attacker was able to <strong>artificially inflate the protocol’s AUM</strong>, redeem GLP for more assets than deserved, and ultimately extract over <strong>$42 million</strong> worth of tokens from the GMX vault.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uKvC5kFAZ5YnbsaudYRXw.png" /><figcaption>Fig: Vulnerable executeDecreaseOrder() Function</figcaption></figure><ul><li>In the PositionManager.sol contract, the function executeDecreaseOrder() is designed to be called by a privileged <strong>keeper bot</strong>, and takes the _account as a parameter representing the user whose position is being reduced.</li></ul><pre>IOrderBook(orderBook).executeDecreaseOrder(_account, _orderIndex, _feeReceiver);</pre><ul><li>The vulnerability arises because _account can be <strong>any address</strong>, including a <strong>smart contract</strong>, yet GMX implicitly assumes it to be an <strong>EOA </strong>(Externally Owned Account).</li><li>Within the executeDecreaseOrder(),the function internally calls<strong> </strong>getDecreaseOrder(), which returns the full position details — including size, index token, and collateral. Then, after updating short data, the system enables leverage and calls into the order book to execute the order. During this process, the _account (attacker’s contract) is refunded ETH for gas costs using a call{value: ...} with no gas limit, which causes the fallback function of the attacker’s contract to execute.</li><li>This gives the attacker a <strong>reentrancy window</strong> to call other GMX functions while the state is in an inconsistent, pre-settlement phase — specifically, they were able to call increasePosition() and open large <strong>short positions </strong>on WBTC while enableLeverage = true inside the callback of their malicious contract.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZdX9Io2lPmuO2GFAsl8d7g.png" /><figcaption>Fig: GlpManager.sol’s getAum() function</figcaption></figure><ul><li>The second key vulnerability lies in how GlpManager.sol calculates the <strong>value of GLP tokens</strong> during redemption, using the getAum() function.</li></ul><pre>function getAum(bool maximise) public view returns (uint256) {<br>    ...<br>    uint256 price = maximise ? vault.getMaxPrice(token) : vault.getMinPrice(token);<br>    ...<br>    uint256 size = _vault.globalShortSizes(token);<br><br>    if (size &gt; 0) {<br>        (uint256 delta, bool hasProfit) = getGlobalShortDelta(token, price, size);<br>        if (!hasProfit) {<br>            aum = aum.add(delta); // Unrealized short losses are added to AUM<br>        } else {<br>            shortProfits = shortProfits.add(delta);<br>        }<br>    }<br>    ...<br>}</pre><ul><li>The problem here is <strong>timing</strong>. When a short position is first opened (via reentrancy), the short size is updated immediately, but the <strong>average short price</strong> lags behind. During this in-between state, the system wrongly assumes that the position is opened at a much lower price, resulting in unrealized losses being calculated and <strong>added to AUM</strong>.</li><li>Thus, the AUM — used in GLP redemption via unstakeAndRedeemGlp() to determine how much value each GLP token represents — becomes artificially inflated due to mispriced unrealized losses, even though no real losses exist yet.</li><li>This allowed the attacker to redeem their GLP at an overstated value, exploiting the stale AUM calculation and <strong>draining excess assets from the vault.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VZ_wjy3B4Ytmy5o3y_-sLw.png" /><figcaption>Fig: Attacker redeems profit via unstakeAndRedeemGlp</figcaption></figure><h3>Attack Sequence:</h3><blockquote>The attacker deploys a malicious contract compatible with GMX’s OrderBook interface and places a crafted decreaseOrder() using this contract.</blockquote><blockquote>GMX’s keeper bot calls executeDecreaseOrder() with the attacker&#39;s contract as _account.</blockquote><blockquote>As part of order execution, ETH is refunded to _account using call{value:}. This triggers the fallback function in the attacker&#39;s contract — <strong>creating a reentrancy window</strong></blockquote><blockquote>Within the callback, the attacker immediately reenters GMX logic and calls increasePosition()to open a large short on WBTC.</blockquote><blockquote>The vault updates globalShortSizes right away, but globalShortAveragePrices still reflects old data. This discrepancy leads the system to believe the short is deeply underwater.</blockquote><blockquote>When getAum() is called, the unrealized loss from the perceived underwater short is added to AUM — <strong>artificially inflating it</strong>.</blockquote><blockquote>The AUM becomes artificially inflated, making GLP appear more valuable.</blockquote><blockquote>The attacker then calls unstakeAndRedeemGlp() to redeem GLP tokens at the inflated AUM rate — extracting more assets than deserved.</blockquote><blockquote>The attacker repeats the process across various vault tokens (e.g., WBTC, ETH, USDC), draining ~$42 million from GMX’s liquidity pool.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQWxpqf5IJ6_HTXIcNUykg.png" /><figcaption>Fig: Attack Flow Visualized</figcaption></figure><ul><li>GMX Team confirmed that the exploit is isolated to GMX V1’s GLP pool on Arbitrum. V2 contracts, GMX tokens, and liquidity pools on Avalanche remain unaffected. All GLP trading, minting, and redemption has been paused on both Arbitrum and Avalanche as a precaution. More details can be found in this X thread:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*YBO57janj1XQNDPVHC876g.png" /><figcaption>Fig: GMX Team’s official statement on the exploit!</figcaption></figure><ul><li>Team member from GMX (<a href="https://x.com/xdev_10">@xdev_10</a>) also confirmed the order keeper bot was not compromised. It executed the order flow as expected. The exploit originated from the malicious smart contract crafted by the attacker, which was used to create and hijack execution during order fulfillment.</li><li>GMX has sent an on-chain message to the exploiter, offering a 10% (nearly 4M USD) white-hat bounty for the return of funds. <em>“If 90% of the stolen assets are returned within 48 hours, GMX commits to no legal action.”</em> The message was embedded in this <a href="https://arbiscan.io/tx/0x92a39e66e54aff033cd7b41b468de7891cf459593495d68d78099cc889547380">on-chain transaction</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3E1TYu5qKnidxRt4gKxbyQ.png" /><figcaption>Fig: GMX’s on-chain message to the attacker. Whitehat bounty offer of 4M USD!</figcaption></figure><ul><li>GMX Team is working with security partners and lead auditors to conduct a full investigation. A detailed post-mortem will be published after the review is complete. Preliminary analysis can be found here:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*OELzJQICwgyTnF46XGZTBg.png" /><figcaption>Fig: Initial Analysis of incident by GMX Team</figcaption></figure><h3>Mitigation and Best Practices:</h3><ul><li>Never assume an address is an EOA. Always validate inputs like _account to avoid smart contract callbacks. Also avoid using call{value: ...} without gas limits. Prefer pull-based refund mechanisms or deferred withdrawals.</li><li>Atomically update globalShortAveragePrices alongside globalShortSizes to prevent AUM miscalculations during leveraged actions.Use pull-based refunds, reentrancy guards, CEI pattern, and smooth AUM calculations to harden liquidity-sensitive logic.</li><li>Ensure off-chain bots verify all assumptions (e.g., _account type) and consider invariant testing to catch stale-state exploits early.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*C83NR-CrJMshQSt5.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed0ab0c0dd0f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/gmx-v1-hack-analysis-ed0ab0c0dd0f">GMX v1 Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ResupplyFi Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/resupply-hack-analysis-d4e3baaa294a?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/d4e3baaa294a</guid>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 08:21:45 GMT</pubDate>
            <atom:updated>2025-09-15T04:19:40.619Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CaYJmDFWXCDxmCJrojgnwQ.png" /></figure><h3>Overview:</h3><p>On <strong>June 26, 2025</strong>, ResupplyFi (<a href="https://x.com/ResupplyFi">@ResupplyFi</a>) — a decentralized lending protocol — was exploited for approximately <strong>$9.56 million</strong>. The attacker targeted the <a href="https://etherscan.io/address/0x6e90c85a495d54c6d7e1f3400fef1f6e59f86bd6"><strong>ResupplyPair</strong></a> contract which uses the manipulated rate, just hours after its deployment. The root cause was an exchange rate manipulation bug triggered via a classic <strong>ERC4626 “first donation” vault attack</strong>, resulting in a division-by-large-value scenario that collapsed the exchangeRate to zero.</p><p>This manipulated rate was used to compute the borrower’s Loan-to-Value (LTV) in the _isSolvent() check. Since ltv = 0 when exchangeRate = 0, the attacker bypassed the solvency check and borrowed $10 million reUSD using just 1 wei of collateral. This vulnerability falls under <a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/">OWASP SC03: Logic Errors.</a></p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract: </strong><a href="https://etherscan.io/address/0x6e90c85a495d54c6d7e1f3400fef1f6e59f86bd6#code">0x6e90c</a></li><li><strong>Attack Transaction: </strong><a href="https://etherscan.io/tx/0xffbbd492e0605a8bb6d490c3cd879e87ff60862b0684160d08fd5711e7a872d3">0xffbbd</a></li><li><strong>Attacker Addresses: </strong><a href="https://etherscan.io/address/0x6D9f6E900ac2CE6770Fd9f04f98B7B0fc355E2EA">0x6D9f6</a>, <a href="https://etherscan.io/address/0x3112a1c8de5894b200297382529aafb3acf9928a">0x31129</a></li><li><strong>OWASP SC Top 10:</strong> <a href="https://scs.owasp.org/sctop10/SC03-LogicErrors/">SC03: Logic Errors.</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TCko9m-0ICvd3tPA48EHzg.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the vulnerability that enabled the ResupplyFi exploit stemmed from a flawed implementation of the<strong> </strong><strong>_updateExchangeRate() and </strong><strong>_isSolvent() </strong>functions within the ResupplyPairCore.sol contract. Specifically, the contract relied on an inverse exchange rate calculation using a price oracle tied to an ERC4626 vault (cvcrvUSD), whose share price (pricePerShare) was used directly to derive the value of collateral.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7Zjd02Tkg5Q_V7hKt6JYQ.png" /><figcaption>Fig: Vulnerable _updateExchangeRate() Function</figcaption></figure><ul><li>In _updateExchangeRate(), the contract retrieves the price using an oracle call to getPrices(address(collateral)), which returns the pricePerShare of the underlying ERC4626 vault. It then inverts this price using 1e36 / price, because debt is denominated in units of collateral.</li></ul><pre>price = IOracle(_exchangeRateInfo.oracle).getPrices(address(collateral));<br><br>_exchangeRate = 1e36 / IOracle(_exchangeRateInfo.oracle).getPrices(address(collateral));</pre><ul><li>Because the vault was nearly empty, the attacker exploited the ERC4626 donation logic — they made a small deposit and a large donation to the vault, drastically inflating pricePerShare. As a result, the oracle returned an extremely high price.</li><li>This led to 1e36 / price being evaluated to 0 due to Solidity’s integer division flooring behavior. Critically, the implementation did not include any validation like require(_exchangeRate &gt; 0), so this invalid value was saved to storage as the current exchange rate.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RwrEd9SGtIR1R8uogj1XCQ.png" /><figcaption>Fig: Vulnerable _isSolvent() Function</figcaption></figure><ul><li>This incorrect _exchangeRate = 0 value then flowed into the _isSolvent() function, which uses the exchange rate to calculate a borrower&#39;s Loan-to-Value (LTV) ratio.</li><li>The _isSolvent() function is responsible for ensuring that users cannot borrow more than they are allowed to, based on the current value of their collateral. It blindly uses the stored _exchangeRate to compute the user&#39;s effective LTV ratio. However, if _exchangeRate is zero (as manipulated by the attacker), then the entire numerator of the LTV formula collapses to zero, and _ltv = 0.</li></ul><pre>_ltv = ((_borrowAmount * _exchangeRate * LTV_PRECISION) / EXCHANGE_PRECISION) / _collateralAmount;</pre><ul><li>This causes the function to always return true, regardless of how much the user is attempting to borrow, as long as they have a non-zero amount of collateral (even 1 wei). This behavior completely bypasses the core economic invariant that the borrowed amount must be backed by sufficient collateral.</li><li>As a result, the attacker was able to borrow $10 million worth of reUSD using just 1 wei of collateral. After swapping and redistributing the stolen funds, they successfully escaped with an estimated profit of $9.56 million, split across 2 addresses.</li></ul><h3>Attack Sequence:</h3><blockquote>Attacker deposited 1 wei into an empty cvcrvUSD ERC4626 vault, then made a large donation to artificially inflate pricePerShare.</blockquote><blockquote>Called borrow() on the newly deployed ResupplyPair, triggering an oracle price fetch and exchangeRate = 1e36 / price.</blockquote><blockquote>Due to the inflated price, exchangeRate computed to zero via Solidity floor division.</blockquote><blockquote>The _isSolvent() check returned true, since LTV became zero, bypassing collateral validation.</blockquote><blockquote>Attacker borrowed 10 million reUSD using just 1 wei of collateral, and walked away with ~$9.56 million split across multiple wallets.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUs0XVBOaAX56e5CxzrLyg.png" /><figcaption>Fig: Attack Sequence simplified</figcaption></figure><ul><li>Within few hours of the exploit, <strong>ResupplyFi</strong> governance executed a series of emergency transactions (e.g., execTransaction) to zero out borrow limits and reset interest rates, as seen in UpdateRate and SetBorrowLimit events.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GIZtVLb2P-xj7TdGi8QZGg.png" /><figcaption>Fig: Mitigation events</figcaption></figure><ul><li>These actions were intended to freeze the protocol&#39;s borrowing capability and limit further losses while further investigations are on-going. Read more here: <a href="https://x.com/ResupplyFi/status/1938092252431036491">https://x.com/ResupplyFi/status/1938092252431036491</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*enDQBE7BfXEr_dgSH6p4kA.png" /><figcaption>Fig: ResupplyFi Team’s acknowledgment of the attack.</figcaption></figure><h3>Mitigation and Best Practices:</h3><ul><li>Always add sanity checks like require(_exchangeRate &gt; 0) and upper/lower bounds to prevent zero or extreme values from being written to storage due to manipulated oracle inputs or division errors.</li><li>Also, avoid using uninitialized or low-liquidity ERC4626 vaults as collateral or oracles. Consider enforcing a minimum liquidity threshold before a vault can be used for borrowing or price calculations.</li><li>Ensure a minimum borrow threshold relative to the value of collateral. And temporarily cap borrowing limits on newly deployed pairs until they are battle-tested.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*QKxDZ6RZzG8snGii.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4e3baaa294a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/resupply-hack-analysis-d4e3baaa294a">ResupplyFi Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meta Pool Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/meta-pool-hack-analysis-fef7796f2303?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/fef7796f2303</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Fri, 20 Jun 2025 07:23:28 GMT</pubDate>
            <atom:updated>2025-09-15T04:23:45.248Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kywHGJb6MPNcaXdru9qFkg.png" /><figcaption>Fig: Meta Pool Hack Analysis</figcaption></figure><h3>Overview:</h3><p>On <strong>June 17, 2025</strong>, the Ethereum-based liquid staking protocol <strong>Meta Pool (</strong><a href="https://x.com/meta_pool"><strong>@meta_pool</strong></a><strong>) </strong>was exploited through a critical vulnerability in its Staking contract, which inherits from <a href="https://docs.openzeppelin.com/contracts/4.x/erc4626">OpenZeppelin’s </a><a href="https://docs.openzeppelin.com/contracts/4.x/erc4626">ERC4626Upgradeable</a> standard. The vulnerability stemmed from the failure to override or restrict the publicly exposed mint() function, which allowed attackers to mint <strong>9701 mpETH</strong> without providing any ETH. This vulnerability falls under <a href="https://scs.owasp.org/sctop10/SC01-AccessControlVulnerabilities/">OWASP SC01: Access Control Vulnerabilities</a> and is indicative of <a href="https://scs.owasp.org/SCWE/SCSVS-AUTH/SCWE-016/">SCWE-016.</a></p><p>The attack impacted multiple chains, including <strong>Ethereum</strong>, <strong>Optimism</strong>, and <strong>Linea</strong>, leading to a combined loss of approximately <strong>56.35 ETH (~$142K) </strong>across these networks. The exploit was first front-run by an <strong>MEV bot called <em>Yoink</em></strong>, and later reproduced manually by a separate attacker using a flash loan.</p><p>Meta Pool’s design enables users to stake ETH/WETH and receive a liquid staking token called <strong>mpETH</strong>, which is redeemable either instantly (via an internal liquidity pool) or with delay (via validator exits). The Staking.sol contract, built atop ERC4626, manages this staking logic — but a misconfigured function left the system open to free minting.</p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract:</strong><br> <a href="https://etherscan.io/address/0x3747484567119592ff6841df399cf679955a111a">0x3747484567119592ff6841df399cf679955a111a</a></li><li><strong>Attack Transactions:<br></strong><a href="https://etherscan.io/tx/0x57ee419a001d85085478d04dd2a73daa91175b1d7c11d8a8fb5622c56fd1fa69">0x57ee…fa69</a> <em>(primary mint &amp; swap)<br></em><a href="https://etherscan.io/tx/0x691c8070749f00a5a5be3135d3912ff97d0dad05a0fb2b77b235aaa13260f002">0x691c…f002</a><em><br></em><a href="https://etherscan.io/tx/0x4858abc51876e1de9f506f34799d4f1852b4255f467b9e1f40951c631ddfa747">0x4858…a747</a><br><a href="https://etherscan.io/tx/0x4f43fc6d674e85f7d306debb4a3d48e7688c2fe5a6332dd9ad57558a15c86ef9">0x4f43…ef9</a> (<em>MEV-Bot txn)</em></li><li><strong>Attacker Address:</strong><br> <a href="https://etherscan.io/address/0x48f1d0f5831eb6e544f8cbde777b527b87a1be98">0x48f1d0f5831eb6e544f8cbde777b527b87a1be98</a></li><li><strong>Stolen funds Parked at</strong>: <a href="https://etherscan.io/address/0x45dd46c45fe6681168927a261842abb55a8b910a">0x45dd4</a></li><li><strong>OWASP SC Top 10: </strong><a href="https://scs.owasp.org/sctop10/SC01-AccessControlVulnerabilities/">SC01: Access Control Vulnerabilities</a></li><li><strong>OWASP SCWE: </strong><a href="https://scs.owasp.org/SCWE/SCSVS-AUTH/SCWE-016/">SCWE-016</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MtafzhTsCNz6bEibAv80Mw.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the vulnerability that led to Meta Pool exploit lies in the unrestricted exposure of a critical inherited function — mint()—from OpenZeppelin’s ERC4626Upgradeable standard, which was not correctly overridden or access-controlled in the Meta Pool staking contract-Staking.sol .</li><li>As a result, attacker was able to mint a large amount of mpETH tokens without providing any ETH, violating the core economic invariant of the system—that each mpETH token must be backed 1:1 with ETH.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*uCEKe03jT_R1wGo0iEDqOQ.png" /><figcaption>Fig: mint() function</figcaption></figure><ul><li>The mint() function in the ERC4626 standard is designed to allow users to <strong>request a specific number of shares</strong> (in this case, mpETH) and have the contract calculate how much ETH needs to be deposited. Internally, mint() delegates this logic to _deposit(), which handles asset transfers, pool interactions, and share minting.</li><li>However, in Meta Pool’s implementation, mint() was: <em>Left fully exposed to the public, not marked as </em><em>payable, and lacked any ETH transfer validation or access restrictions.</em></li><li>This meant that <strong>any user could call </strong><strong>mint() </strong>without sending ETH, and the contract would still proceed with the _deposit() logic, assuming ETH had been received.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tixqYIPq6ALcJhr-I-Fqng.png" /><figcaption>Fig: vulnerable _deposit() function</figcaption></figure><ul><li>Inside _deposit(), the process is split into two phases:<br>1. Swap ETH for mpETH from the internal liquidUnstakePool via _getmpETHFromPool().<br>2. Mint new mpETH shares for any remaining unmet portion.</li><li>Crucially, the swap logic in _getmpETHFromPool() is only triggered if both ETH is received and the pool has available mpETH. Since mint() is not payable, and no ETH is held by the contract at that point, the swap fails or is skipped entirely. The fallback logic kicks in and mints the full amount of shares, despite no ETH being provided.</li><li>Recognizing this oversight, the attacker executed the exploit in two stages:</li></ul><blockquote>1. First, they used a <strong>flash loan</strong> to borrow WETH, converted it to ETH, and called the depositETH() function to <strong>drain all </strong><strong>mpETH from the internal liquidity pool</strong>, ensuring that the _getmpETHFromPool() logic would be bypassed in future calls.</blockquote><blockquote>2. Then, they directly called the <strong>unrestricted </strong><strong>mint() function</strong>, which minted thousands of mpETH for free due to the missing ETH validation and the empty pool</blockquote><ul><li>Finally, the attacker swapped part of the minted mpETH for ETH, repaid the flash loan, and kept the rest as profit. The attack succeeded entirely within the bounds of the contract’s logic, due to unsafe reliance on inherited behavior and insufficient validation around economic invariants.</li></ul><h4>Attack Sequence:</h4><blockquote>Attacker flash-loaned 200 WETH from Balancer; converted 107 WETH to ETH.</blockquote><blockquote>Called depositETH() to drain all mpETH from the liquidUnstakePool.</blockquote><blockquote>Invoked mint() to mint ~9702 mpETH without providing any ETH.</blockquote><blockquote>Swap logic was skipped; fallback minting executed</blockquote><blockquote>Swapped some mpETH to ETH, repaid flash loan, and kept ~56.35 ETH profit.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNA_jghMDtnxOBv4u_Vpew.png" /><figcaption>Fig: Attack Sequential Diagram</figcaption></figure><ul><li>Upon identifying the exploit, Meta Pool swiftly disabled the mpETH token&#39;s transfer functionality by upgrading the contract. This prevented further unauthorized movement of the exploited tokens across chains or into liquidity pools. Read more details here: <a href="https://x.com/meta_pool/status/1935119387486519582">https://x.com/meta_pool/status/1935119387486519582</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*Kj_bguHzU-WUxdk7Qx4gjA.png" /><figcaption>Fig: Post from Meta Pool’s Co-Founder</figcaption></figure><ul><li>Meta Pool maintained open channels with the community through Discord and hosted a Twitter Space on June 17 to directly address user concerns. They committed to continuous updates and scheduled time during Governance Call 19 to ensure DAO members were informed and engaged in shaping the recovery and future safeguards.</li></ul><h3>Mitigation and Best Practices:</h3><ul><li>Always review and override inherited public/external functions (e.g., mint(), redeem()) from standards like ERC4626, ERC20, or upgradeable contracts.</li><li>Ensure that any function that depends on receiving ETH is marked payable and includes explicit value checks (require(msg.value &gt; 0)) before executing asset logic.</li><li>Avoid exposing the raw interfaces of standards like ERC4626 or ERC20 directly to users.</li><li>Instead, expose custom facade functions (e.g., secureMint(), safeStake()) that include additional safety checks, protocol-specific validations, and allow fine-grained control. Also, deactivate or restrict base standard functions that are not meant to be user-facing in the protocol context.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*olv9S2YFHL5MGA5F.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fef7796f2303" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/meta-pool-hack-analysis-fef7796f2303">Meta Pool Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bankroll Network Hack Analysis]]></title>
            <link>https://medium.com/solidityscan/bankroll-network-hack-analysis-5d7cdec35075?source=rss----3e911405e793---4</link>
            <guid isPermaLink="false">https://medium.com/p/5d7cdec35075</guid>
            <category><![CDATA[defi-hack]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Shashank]]></dc:creator>
            <pubDate>Thu, 19 Jun 2025 11:04:47 GMT</pubDate>
            <atom:updated>2025-09-15T04:26:24.133Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview:</h3><p>On June 19, 2025, a previously dormant DeFi protocol called <strong>Bankroll Network (</strong><a href="https://x.com/Bankroll_Status">@bankroll_status</a><strong>)</strong> — specifically, its BankrollNetworkStack contract—was exploited due to a <strong>critical integer underflow vulnerability</strong> in its sell() function. This vulnerability existed in contracts deployed on <strong>Ethereum Mainnet</strong> and <strong>Binance Smart Chain (BSC)</strong>. The attacker exploited this flaw to manipulate dividend accounting and drain funds from users who had previously interacted with or approved the contract. The attack has resulted in an approximate loss of <strong>$65,000</strong> so far. This vulnerability is an example of <a href="https://scs.owasp.org/sctop10/SC08-IntegerOverUnderFlow/">OWASP SC08:2025 — Integer Overflow and Underflow.</a></p><p>Bankroll Network was previously exploited for nearly <strong>$235K</strong> on September 23rd, 2024. Read more here: <a href="https://blog.solidityscan.com/bankroll-network-hack-analysis-e77fd8442dfa">https://blog.solidityscan.com/bankroll-network-hack-analysis-e77fd8442dfa</a></p><h3>Smart Contract Hack Overview:</h3><ul><li><strong>Victim Contract</strong>: BSC: <a href="https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e#code#L665">0xAdEfb</a></li><li><strong>Attack Transactions</strong>: Ethereum: <a href="https://etherscan.io/tx/0x8905a0aca5849626c0de026c2d2894ddfa8060a27725221f01aac9fb0b3d6629">0x8905a</a> , BSC: <a href="https://bscscan.com/tx/0x7226b3947c7e8651982e5bd777bca52d03ea31d19b515dec123595a4435ae22c">0x7226b</a></li><li><strong>Attacker Addresses</strong>: <a href="https://bscscan.com/address/0x2dea406bb3bea68d6be8d9ef0071fdf63082fb52">0x2deA4</a> , <a href="https://etherscan.io/address/0x172dca3e72e4643ce8b7932f4947347c1e49ba6d">0x172Dc</a></li><li><strong>OWASP SC Top 10:</strong> <a href="https://scs.owasp.org/sctop10/SC08-IntegerOverUnderFlow/">SC08:2025 — Integer Overflow and Underflow</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OrPRDbn3LtSDUQ7buYV6gg.png" /><figcaption>Fig: Attack Transaction</figcaption></figure><h3>Decoding the Smart Contract Vulnerability:</h3><ul><li>The root cause of the vulnerability lies in the <a href="https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e#code#L682">sell()</a> function of the BankrollNetworkStack contract. Thesell()function is intended to allow users to burn tokens in exchange for ETH-equivalents, update internal dividend trackers, and allocate exit fees. However, its internal logic failed to securely handle accounting updates, especially for signed integers.</li><li>The sell()function directly subtracts a calculated signed integer value from a user’s payout balance without overflow or underflow protection:</li></ul><pre>payoutsTo_[_customerAddress] -= _updatedPayouts;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lj0i045Hy0M5l5ns7MCX0A.png" /><figcaption>Fig: Vulnerable sell() function</figcaption></figure><ul><li>In Solidity 0.6.8, such arithmetic on int256 types does <strong>not revert</strong> when an underflow occurs. This is unlike Solidity 0.8+, where built-in checks prevent such errors.</li><li>The contract was compiled with <strong>Solidity 0.6.8</strong>, a version in which integer overflow and underflow do not revert by default. As a result, attacker was able to exploit this legacy behavior to manipulate contract state.</li><li>Users who have interacted with the compromised Bankroll contracts are strongly advised to immediately revoke token approvals to prevent unauthorized withdrawals.</li><li>If you have previously approved any of the following BSC contract addresses, <strong>revoke permissions as soon as possible</strong>:</li></ul><blockquote>0x16d0a151297a0393915239373897bcc955882110</blockquote><blockquote>0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e</blockquote><blockquote>0x0a15B914388d48d77fE70c8a832cD992dD05e76E</blockquote><blockquote>0x313E71df70b106BD8e456cfbAfd3583595EdE490</blockquote><blockquote>0xeF6676536a1d98942d149f52708770e11Db47BcE</blockquote><h3>Mitigation and Best Practices:</h3><ul><li>Upgrade all smart contracts to Solidity version 0.8.0 or later, which includes automatic overflow and underflow checks for both uint and int types, eliminating silent arithmetic errors like the one exploited in this attack.</li><li>If using older Solidity versions is unavoidable, implement or import a SafeMathInt library to securely handle arithmetic operations on int256 values, ensuring overflows/underflows revert safely.</li><li>Add explicit state transition validations (e.g., bounds checks on payouts and balances) to ensure logical consistency and prevent arithmetic or accounting manipulation.</li><li>To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at <a href="https://credshields.com/">CredShields</a> provide smart contract security and end-to-end security of web applications and externally exposed networks. Our public audit reports can be found on <a href="https://github.com/Credshields/audit-reports">https://github.com/Credshields/audit-reports</a>. Schedule a call at <a href="https://credshields.com/">https://credshields.com/</a></li><li>Scan your Solidity contracts against the latest common security vulnerabilities with 494+ detections at <a href="https://solidityscan.com/">SolidityScan</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2AS26Kips-1g_fDu.png" /><figcaption>Fig: SolidityScan — Smart Contract Vulnerability Scanner</figcaption></figure><h3>Conclusion:</h3><p>SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at <a href="https://solidityscan.com/signup?utm_source=blog&amp;utm_medium=blog&amp;utm_campaign=solidity_scan_loop_blog">https://solidityscan.com/signup</a></p><p>Follow us on our Social Media for Web3 security-related updates.</p><p>SolidityScan — <a href="https://www.linkedin.com/company/solidity-scan/">LinkedIn</a> | <a href="https://twitter.com/SolidityScan">Twitter</a> | <a href="https://t.me/solidityscan">Telegram</a> | <a href="https://discord.gg/Vp5qyb4Q">Discord</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d7cdec35075" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidityscan/bankroll-network-hack-analysis-5d7cdec35075">Bankroll Network Hack Analysis</a> was originally published in <a href="https://medium.com/solidityscan">SolidityScan</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>