<?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[Stories by Omniscia on Medium]]></title>
        <description><![CDATA[Stories by Omniscia on Medium]]></description>
        <link>https://medium.com/@omniscia.io?source=rss-f435df75f45d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jtaNxSyKZO5hEOWEmhwoSg.png</url>
            <title>Stories by Omniscia on Medium</title>
            <link>https://medium.com/@omniscia.io?source=rss-f435df75f45d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 14 Apr 2026 10:36:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omniscia.io/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Ensuring Trust in DeFi: Myso Finance Audit Deep-Dive]]></title>
            <link>https://medium.com/@omniscia.io/ensuring-trust-in-defi-myso-finance-audit-deep-dive-72627cf07e05?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/72627cf07e05</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Fri, 26 May 2023 11:32:29 GMT</pubDate>
            <atom:updated>2023-05-30T19:51:45.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilQz_yxilKA4C6bDqae49Q.jpeg" /><figcaption><a href="https://omniscia.io/">omniscia.io</a></figcaption></figure><p>The <a href="https://omniscia.io/about-us">Omniscia </a>team recently had the opportunity to conduct an exhaustive security audit for <a href="https://www.myso.finance/">Myso Finance</a>, a pioneering entity within the domain of peer-to-peer lending and borrowing protocols. This endeavor reiterates our unwavering dedication to upholding the highest standards of cybersecurity within the Web3 landscape and underscores Myso Finance’s unrelenting commitment to delivering a secure and trustworthy platform.</p><p>Borrowing and lending protocols in the decentralized finance (DeFi) space walk a particularly thin line due to their inherent complexity and the significant amount of value they often manage. They function as the backbone of DeFi, enabling users to earn interest on deposits and take out loans in a permissionless and open manner, but this also exposes them to a variety of unique risks and potential exploits.</p><blockquote><em>“Our in-depth audit of Myso Finance serves as a testament to their unwavering commitment to upholding a secure, efficient, and reliable platform. At Omniscia, we take immense pride in being a part of this journey, bolstering security in the Web3 space. We eagerly look forward to continuing our work with partners like Myso Finance, who place paramount importance on user safety and system efficiency</em>.<em>”</em></blockquote><blockquote>— <strong>Yvan Nashr, Founder &amp; CEO, Omniscia.io</strong></blockquote><h3>Audit Results</h3><p>As always, our audit methodology was rigorous, entailing a meticulous line-by-line examination of Myso Finance’s codebase to ensure the proper execution of all state transitions and fundamental formulas within the system.</p><p>Over the course of the audit we identified potential vulnerabilities that could lead to severe operational malfunctions if left unaddressed. These potential issues were immediately communicated to the Myso Finance team, who promptly remediated all findings.</p><p>One of the most notable vulnerabilities within the system was its insufficient validation of the interest factor described in<a href="https://omniscia.io/reports/myso-finance-lending-protocol-644911cef1412d00142bf698/manual-review/LenderVaultImpl-LVI#LVI-04M"> LVI-04M</a>. Lenders were able to create seemingly lucrative debt repayment terms at a “-100%” interest rate, essentially providing their loans without expecting any return.</p><p>Due to the design of the Myso Finance system, borrowers who acquired those loans would be unable to repay them as the system would fatally fail with a division-by-zero error. This permitted lenders to provide these loans to unsuspecting borrowers and “force” them to enter default when their repayment period expires, acquiring the borrower’s collateral at that point. The Myso Finance team has since alleviated this exhibit in the latest iteration of the codebase.</p><p>The Omniscia team also identified <a href="https://omniscia.io/reports/myso-finance-lending-protocol-644911cef1412d00142bf698/code-style">31 optimizations</a>, 14 of which directly led to significant gas reductions. All optimization suggestions were addressed by the Myso Finance team to ensure the smart contracts in scope comply with the latest best practices and standards in Solidity.</p><blockquote><em>“</em>Working alongside the security professionals from Omniscia has been an absolute privilege. We deeply appreciate their meticulous and high-quality work, as their expertise has played a pivotal role in fortifying our code security and protecting our users. Their exceptional ability to swiftly comprehend our intricate codebase and identify critical edge cases has exceeded our expectations. Collaborating with them has not only strengthened our auditor diversification but has also made a significant contribution to enhancing the quality of our code.<em>”</em></blockquote><blockquote>— <strong>Aetienne Sardon, Founder &amp; CEO, MYSO Finance</strong></blockquote><p>All in all, the Myso Finance team was extremely responsive and demonstrated their dedication to security and system efficiency, reflecting a harmonious blend of agility and technological sophistication. Shout-out to ChainSecurity and TrailOfBits for their audits of previous iterations, showcasing Myso Finance’s dedication to security and auditor diversification.</p><p><strong>→ Read the full technical report </strong><a href="https://omniscia.io/reports/myso-finance-lending-protocol-644911cef1412d00142bf698/"><strong>here</strong></a><strong>.</strong></p><p><a href="https://omniscia.io"><strong><em>Omniscia.io</em></strong></a><em> is one of the fastest growing and most trusted blockchain security firms and has rapidly become a true market leader. To date, our team has collectively </em><strong><em>secured $200+ billion worth of digital assets, for 300+ happy clients by detecting 1,500+ high-severity issues</em></strong><em> in widely adopted smart contracts.</em></p><p><strong><em>Founded at the start of 2020</em></strong><em>, and with a track record spanning back to 2017, our team has been at the forefront of auditing smart contracts, providing expert analysis and identifying potential vulnerabilities to ensure the highest level of security of popular smart contracts, as well as complex and sophisticated decentralized protocols.</em></p><p><a href="https://omniscia.io/about-us#clients"><strong><em>Our clients, ecosystem partners, and backers</em></strong></a><em> include leading ecosystem players such as </em><strong><em>L’Oréal, Polygon, AvaLabs, Gnosis, Morpho, Myso Finance, CLabs, Olympus DAO, Fetch.ai, and LimitBreak</em></strong><em>, among others.</em></p><p><em>Make sure you follow us on Twitter, and other socials, and subscribe to our newsletter to stay ahead of the curve. Remember, it’s better to be secured late than sorry. 🔐</em></p><p><a href="https://twitter.com/Omniscia_sec"><strong><em>Twitter</em></strong></a><strong><em> /</em></strong><a href="https://www.linkedin.com/company/omniscia"><strong><em> LinkedIn</em></strong></a><strong><em> /</em></strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong><em> Newsletter</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72627cf07e05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euler Finance Incident Post-Mortem]]></title>
            <link>https://medium.com/@omniscia.io/euler-finance-incident-post-mortem-1ce077c28454?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ce077c28454</guid>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[web3]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Mon, 13 Mar 2023 16:16:14 GMT</pubDate>
            <atom:updated>2023-03-13T17:40:21.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Koxi14vPYRfhZiSLpg9Xzw.png" /><figcaption><a href="https://omniscia.io/">omniscia.io</a></figcaption></figure><p>This article is meant to analyze the Euler Finance incident that occurred on the 13th of March at approximately 08:50 UTC in an impartial way and identify the root cause.</p><h3>Vulnerability Analysis</h3><p>The vulnerability that was exploited stems from how Euler Finance permits donations to be performed without a proper account health check.</p><p>The vulnerable code was introduced in <a href="https://forum.euler.finance/t/eip-14-contract-upgrades/305">eIP-14</a>¹ which introduced multiple changes throughout the Euler Ecosystem. The flaw lies in the first change performed to the EToken implementation (<a href="https://euler-xyz.github.io/euler-contracts-upgrade-diffs/eip14/EToken.html">EToken::donateToReserves feature</a>²).</p><p>The logic within the Liquidation module will attempt to repay the full debt of the violator, however, if the collateral they possess would not satisfy the expected repayment yield, <a href="https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/modules/Liquidation.sol#L139-L151">the system defaults to whatever collateral the user has</a>³.</p><p>The assumption of this code block states that a borrower’s available collateral will be insufficient only when:</p><blockquote><em>This can happen when borrower has multiple collaterals and seizing all of this one won’t bring the violator back to solvency</em></blockquote><p>This security guarantee is not upheld by the donation mechanism which permits the user to create “bad debt” in the form of leverage that is uncollateralized by donating their EToken units without affecting their DToken balance⁴.</p><h3>Core Problem</h3><p>The Euler Finance protocol permits its users to create artificial leverage by minting and depositing assets in the same transaction via EToken::mint. This mechanism permits tokens to be minted that exceed the collateral held by the Euler Finance protocol itself.</p><p>The donation mechanism introduced by Euler Finance in <a href="https://forum.euler.finance/t/eip-14-contract-upgrades/305">eIP-14</a>¹ (EToken::donateToReserves) permits a user to donate their balance to the reserveBalance of the token they are transacting with. The flaw lies in that it does not perform any health check on the account that is performing the donation.</p><p>As a donation will cause a user’s debt (DToken) to remain unchanged while their equity (EToken) balance decreases, a liquidation of their account will cause a portion of DToken units to remain at the user thus creating bad debt.</p><p>The above flaw permits the attacker to create an over-leveraged position and liquidate it themselves in the same block by artificially causing it to go “under-water”.</p><p>When the violator liquidates themselves, a percentage-based discount is applied that will cause the liquidator to incur a significant portion of EToken units at a discount, guaranteeing that the they will be “above-water” and incur only the debt that matches the collateral they will acquire.</p><p>The end result is a violator with a significant amount of “bad debt” (DToken) and a liquidator with an over-collateralization of their debt (DToken &gt; EToken) due to <a href="https://docs.euler.finance/euler-protocol/eulers-default-parameters#maximum-liquidation-discount">the percentage-based liquidation incentives the Euler Protocol possesses</a>⁵. As evidenced in the transaction itself⁶, the maximum 20% discount was applied during the attack’s liquidation.</p><h3>Attack Scenario</h3><p>In order for the attacker to be able to liquidate themselves, they had to deploy at least two contracts to exploit the vulnerability. The <a href="https://etherscan.io/tx/0xc310a0affe2169d1f6feec1c63dbc7f7c62a887fa48795d327d4d2da2d6b111d">attack transaction</a>⁶ submitted at approximately 2023–02–01 06:29:18 UTC invokes a contract that had been deployed in an earlier transaction⁷.</p><p>This contract performs the following steps during the attack transaction’s execution:</p><p><strong>a. Primary Contract:</strong></p><ul><li>Acquire a 30m DAI flash-loan from AAVE V2</li><li>Deploy the two contracts (<a href="https://etherscan.io/address/0x583c21631c48d442b5c0e605d624f54a0b366c72">violator</a>⁸ &amp; <a href="https://etherscan.io/address/0xa0b3ee897f233f385e5d61086c32685257d4f12b">liquidator</a>⁹) for the attack</li><li>Transfer the full 30m DAI loan balance to the violator</li></ul><p><strong>b. </strong><strong>violator Contract:</strong></p><ul><li>Deposit 20m DAI to the DAI EToken of Euler Finance, receiving ~19,56m eDAI tokens</li><li>Create a 200m artificial eDAI leverage, minting ~195,68m eDAI and 200m dDAI to the violator</li><li>Repay 10m DAI on the violator’s position, causing their dDAI balance to go to 190m</li><li>Create another 200m artificial eDAI leverage, minting ~195,68m eDAI and 200m dDAI to the violator</li><li>Donate 100m eDAI to the reserve of the EToken</li></ul><p><strong>At this point, we have the following </strong>violator<strong> state:</strong></p><ul><li>eDAI: ~310,93m</li><li>dDAI: 390m</li></ul><p>In the above state, the violator contains a significantly larger amount of dDAI tokens than eDAI tokens that will never be collateralized as their backing was “erased” during the donation call. The liquidator will exploit this due to the calculations within the Liquidation module.</p><p>As stated earlier, the Liquidation module will liquidate <strong>up-to the collateral balance</strong> of the user. The liquidator can thus liquidate the violator, incurring their full ~310,93m eDAI balance but only a portion of their dDAI balance, further exacerbated by the liquidation discount of Euler Finance⁵.</p><p>As the maximum discount will be applied to this position due to how low its health level is, the liquidator will incur a ~310,93m eDAI balance with a conversion rate of 1.25 eDAI tokens per dDAI. This will ultimately evaluate to a post-fee ~259,31m dDAI balance.</p><p><strong>liquidator Contract:</strong></p><ul><li>Liquidate the position, acquiring ~310,93m eDAI tokens and ~259,31m dDAI tokens</li><li>Withdraw the full reserve of DAI tokens by burning the corresponding eDAI tokens</li></ul><p>At the withdrawal step, the eDAI to DAI exchange rate honored by EToken is skewed as the <a href="https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/BaseLogic.sol#L292-L296">exchange rate calculated</a>¹⁰ factors in the total borrows of the system which are artificially increased by the liquidation’s repayExtra value.</p><p>As such, an exchange rate of roughly 0,97 eDAI per DAI is utilized for the redemption. As the user is already “above-water” due to the maximum 20% liquidation discount that was applied during their liquidation, they are able to “burn” the ~38m eDAI required to release the ~38.9m DAI held by the contract.</p><p>Ultimately, the attacker was able to retain the following assets post-execution of their transaction:</p><ul><li>+~8,877,507 DAI = ~8,779,854.423 USD</li></ul><p>The contracts the attacker utilized also possess non-zero eDAI and dDAI balances with a health factor of ~1.05 for the liquidator contract in particular. As such, <strong>users should avoid re-depositing DAI tokens to the </strong><strong>EToken as they may still be vulnerable</strong>.</p><p>We can assess the financial impact of the DAI asset and calculate an estimated profit of roughly ~8,779,854.423 USD as of 2023-03-13 12:42:00 UTC.</p><p>The attack has been replicated to multiple other assets. As such, <strong>the deposit warning applies to the following </strong><strong>EToken assets</strong>: DAI, WETH</p><h3>Security Audit</h3><p>Omniscia has performed multiple security audits of the Euler Finance protocol. The changes in question, however, were introduced in <a href="https://forum.euler.finance/t/eip-14-contract-upgrades/305">eIP-14</a>. As evidenced in the message board itself, Omniscia performed an audit of only the Chainlink integration component that is <a href="https://omniscia.io/reports/euler-finance-chainlink-support/">publicly available here</a>.</p><p>The EToken::donateToReserve feature that is at the crux of this vulnerability was not in scope of any audit conducted by Omniscia. As such, <strong>the code that causes the vulnerability was never in scope of any audit conducted by our team.</strong></p><p><strong>The donateToReserves function was </strong><a href="https://www.hacknote.co/17c261f7d8fWbdml/1821f966f40pJG_t#n_0"><strong>audited</strong></a><strong> by the Sherlock team</strong> in July 2022. Euler Finance and Sherlock have confirmed that Euler had an active coverage policy with Sherlock at the time of exploit.</p><h3>Conclusion</h3><p>The attack ultimately arose from an incorrect donation mechanism and did not account for the donator’s debt health, permitting them to create an unbacked DToken debt that will never be liquidated.</p><h3>Sources</h3><ol><li>Euler Improvement Proposal 14: <a href="https://forum.euler.finance/t/eip-14-contract-upgrades/305">https://forum.euler.finance/t/eip-14-contract-upgrades/305</a></li><li>Euler Improvement Proposal 14 Delta: <a href="https://euler-xyz.github.io/euler-contracts-upgrade-diffs/eip14/EToken.html">https://euler-xyz.github.io/euler-contracts-upgrade-diffs/eip14/EToken.html</a></li><li>Euler Liquidator Collateral Default Logic: <a href="https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/modules/Liquidation.sol#L139-L151">https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/modules/Liquidation.sol#L139-L151</a></li><li>Euler EToken Faulty Donation Mechanism: <a href="https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/modules/EToken.sol#L356-L386">https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/modules/EToken.sol#L356-L386</a></li><li>Euler Liquidation Discount: <a href="https://docs.euler.finance/euler-protocol/eulers-default-parameters#maximum-liquidation-discount">https://docs.euler.finance/euler-protocol/eulers-default-parameters#maximum-liquidation-discount</a></li><li>Etherscan Attack Transaction Link: <a href="https://etherscan.io/tx/0xc310a0affe2169d1f6feec1c63dbc7f7c62a887fa48795d327d4d2da2d6b111d">https://etherscan.io/tx/0xc310a0affe2169d1f6feec1c63dbc7f7c62a887fa48795d327d4d2da2d6b111d</a></li><li>Etherscan Address of Primary Contract: <a href="https://etherscan.io/address/0xebc29199c817dc47ba12e3f86102564d640cbf99">https://etherscan.io/address/0xebc29199c817dc47ba12e3f86102564d640cbf99</a></li><li>Etherscan Address of Violator Contract: <a href="https://etherscan.io/address/0x583c21631c48d442b5c0e605d624f54a0b366c72">https://etherscan.io/address/0x583c21631c48d442b5c0e605d624f54a0b366c72</a></li><li>Etherscan Address of Liquidator Contract: <a href="https://etherscan.io/address/0xa0b3ee897f233f385e5d61086c32685257d4f12b">https://etherscan.io/address/0xa0b3ee897f233f385e5d61086c32685257d4f12b</a></li><li>Euler BaseLogic Exchange Rate Calculation: <a href="https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/BaseLogic.sol#L292-L296">https://github.com/euler-xyz/euler-contracts/blob/fa9398728165676a5666939d8c34a7578d8e1919/contracts/BaseLogic.sol#L292-L296</a></li></ol><p><a href="http://omniscia.io/"><strong><em>Omniscia.io</em></strong></a><em> is one of the fastest growing and most trusted blockchain security firms and has rapidly become a true market leader. To date, </em><strong><em>our team has collectively</em></strong><em> </em><strong><em>secured over $200+ billion worth of digital assets, worked with 260+ clients and detected over 1300+ high-severity issues</em></strong><em> in our clients’ smart contracts.</em></p><p><em>Founded at the start of 2021 by blockchain cybersecurity veterans, </em><a href="https://omniscia.io/"><em>omniscia.io</em></a><em> is a pioneer in Web3 security, utilizing years of experience, developing proprietary tooling and a tried-and-tested approach to securing smart contracts and complex decentralized protocols out there — including the likes Aave, YFI, lien, 1inch, fetch, compound, synthetix, and many others.</em></p><p><a href="https://omniscia.io/about-us#clients"><strong><em>Our clients, partners and backers</em></strong></a><em> include leading ecosystem players such as L’Oréal, Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, LimitBreak, and many more.</em></p><p><strong>Be sure to follow our social medias and subscribe to our newsletter for more updates:</strong></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> / </strong><a href="https://www.linkedin.com/company/omniscia"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong>Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ce077c28454" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Platypus Finance Incident Post-Mortem]]></title>
            <link>https://medium.com/@omniscia.io/platypus-finance-incident-post-mortem-7b71a0a47a5e?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b71a0a47a5e</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[avalanche]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Fri, 17 Feb 2023 15:04:43 GMT</pubDate>
            <atom:updated>2023-02-17T15:04:43.013Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uML3gkPeN_UQXH_v3cdc8g.png" /><figcaption><a href="https://omniscia.io/">omniscia.io</a></figcaption></figure><p>This article is meant to analyze the Platypus Finance incident that occurred on the 17th of February 2023 at approximately 19:16 UTC¹ in an impartial way and identify the root cause.</p><h3>Vulnerability Analysis</h3><p>The vulnerability that was exploited stems from incorrect integration between the PlatypusTreasure² ³ and the MasterPlatypusV4⁴ ⁵contracts of the Platypus Finance ecosystem and namely an improper logical check being present in the MasterPlatypusV4 contract.</p><p>The PlatypusTreasure contract was recently launched⁶ ⁷ to support the USP stablecoin of Platypus Finance. The contract contains a mechanism that allows borrowing the USP stablecoin with assets that are presently staked in the IMasterPlatypus implementation referenced by the collateral settings of an LP asset (PlatypusTreasure::_getCollateralAmount).</p><p>While this by itself is not a vulnerable feature, the problem arises in how the outdated MasterPlatypusV4 implementation integrates with the an IPlatypusTreasure contract. The MasterPlatypusV4 contract implementation that was referenced by the proxy at the time of the attack was deployed on the 14th of November, 2022⁸, and contained a fatal misconception in its emergencyWithdraw mechanism.</p><p>The contract was built with the integration of IPlatypusTreasure at a later point as evidenced by its platypusTreasure member and its optionality in the codebase. Within the withdrawal workflows of the MasterPlatypusV4 contract, the IPlatypusTreasure::isSolvent function is invoked to perform a debt solvency evaluation.</p><h3>Core Problem</h3><p>The MasterPlatypusV4::emergencyWithdraw function <strong>performs its solvency check before updating the LP tokens associated with the stake position</strong>. As a result, it is possible for a user to withdraw their funds while they are being utilized as collateral for a debt position in PlatypusTreasure as the solvency check will succeed in all circumstances.</p><p>The MasterPlatypusV4::withdraw function is not susceptible to the same attack vector as it <strong>performs a solvency check after the stake position has been updated</strong>, ensuring that the PlatypusTreasure::isSolvent function takes into account the stake position with reduced LP tokens.</p><p>The issue could have been prevented by re-ordering the MasterPlatypusV4::emergencyWithdraw statements and performing the solvency check after the user’s amount entry has been set to 0 which would have prohibited the attack from taking place.</p><p>Alternatively, the MasterPlatypusV4::emergencyWithdraw could utilize the debtAmount variable yielded by PlatypusTreasure::isSolvent and ensured that it is 0, preventing emergency withdrawals with active debt positions.</p><h3>Attack Scenario</h3><p>Given that it is possible to provide collateral for a debt and proceed to withdraw it without repaying the debt, the exploiter is able to create what is known as “bad debt” in the system and acquire the debt’s upside.</p><p>The attack was executed in a single transaction which was submitted at approximately 2023–02–17 19:16:54 UTC¹ in which they performed the following:</p><ul><li>Acquired a 44,000,000 USDC loan off the Aave V3 protocol</li><li>Deposited the same amount of USDC in the Platypus Finance Pool to acquire the LP-USDC asset</li><li>Deposited the newly created LP-USDC tokens to the MasterPlatypusV4 implementation</li><li>Performed a borrow operation on the PlatypusTreasure contract of the maximum amount of USP they were able to borrow, which amounted to roughly ~41,794,533 units</li><li>Performed an emergency withdrawal of the LP-USDC assets they had deposited in the MasterPlatypusV4 implementation, thereby causing their debt to become “bad” as it becomes no longer serviceable</li><li>Withdrew all USDC funds associated with the LP-USDC position they had created in the second step, acquiring ~43,999,999 USDC in return</li><li>Performed liquidation of 9,250,000 USP tokens in numerous currencies via the Platypus Finance Pool</li></ul><p>Interestingly, the attacker’s contract performed multiple staticcall operations to the 0x000000000000000000636F6e736F6c652e6c6f67 address during the transaction’s execution. This address is in fact the “console” address in use by the hardhat toolkit⁹, indicating that the attacker used the hardhat toolkit to produce their contract.</p><p>The attacker did not liquidate the full ~41,794,533 amount of USP tokens they acquired, instead opting for smaller trades presumably due to insufficient liquidity in the USP pools they utilized. In detail, the transaction performed the following swaps before repaying the flash-loan:</p><ul><li>Exchange 2,500,000 USP for ~2,425,762 USDC</li><li>Exchange 2,500,000 USP for ~1,946,900 USDC.e (Bridged USDC)</li><li>Exchange 1,600,00 USP for ~1,552,550 USDT</li><li>Exchange 1,250,00 USP for ~1,217,581 USDT.e (Bridged USDT)</li><li>Exchange 700,000 USP for ~687,369 BUSD</li><li>Exchange 700,000 USP for ~691,984 DAI.e (Bridged DAI)</li></ul><p>Ultimately, the attacker was able to retain the following assets post-execution:</p><ul><li>+~2,425,762 USDC = ~2,427,390 USD @ 1.00067117</li><li>+~1,946,900 USDC.e = ~1,948,206 USD @ 1.00067117</li><li>+~1,552,550 USDT = ~1,553,651 USD @ 1.00070943</li><li>+~1,217,581 USDT.e = ~1,219,725 USD @ 1.00176158</li><li>+~687,369 BUSD = ~688,527 USD @ 1.00168506</li><li>+~691,984 DAI.e = ~692,355 USD @ 1.00053726</li><li>+~33,044,533 USP = Indeterminate Evaluation</li></ul><p>As the value of the USP asset is no longer considered canonical, we can assess the financial impact of the stablecoin assets it was liquidated to and sum a total estimated profit of roughly ~8,529,854 USD as of 2023-02-17 15:20:00 UTC.</p><h3>Security Audit</h3><p><a href="https://omniscia.io/">Omniscia</a> performed two security audits of the Platypus Finance platform simultaneously on November 21st, 2021 with a conclusion date of December 5th, 2021 and a final delivery date of December 24th, 2021. The publicly available audits¹⁰ ¹¹ <strong>did not cover the </strong><strong>USP stablecoin or the </strong><strong>PlatypusTreasure implementation</strong>.</p><p>While the MasterPlatypus implementation was in scope in the “governance” audit of the protocol, <strong>we performed an audit of the V1 implementation which contained no integration points with an external </strong><strong>platypusTreasure system</strong>.</p><p>The Platypus Finance protocol has introduced numerous updates since the time the audit was finalized, including all contracts involved in the vulnerability (MasterPlatypusV4, USP, and PlatypusTreasure). <strong>These contracts were never in scope of any audit conducted by us and thus are considered to be unaudited code by our team</strong>.</p><h3>Conclusion</h3><p>The attack ultimately arose from improper integration of the MasterPlatypusV4 contract with PlatypusTreasure and did not perform its solvency check in the correct order, enabling collateral to be withdrawn with an active debt. As a result, “bad debt” could be created in the system at the expense of the protocol’s USP token which was then exchanged for multiple stablecoins.</p><h3>Sources</h3><ol><li>Snowtrace Transaction of the Attack: <a href="https://snowtrace.io/tx/0x1266a937c2ccd970e5d7929021eed3ec593a95c68a99b4920c2efa226679b430">https://snowtrace.io/tx/0x1266a937c2ccd970e5d7929021eed3ec593a95c68a99b4920c2efa226679b430</a></li><li>Snowtrace Address of the PlatypusTreasure Contract’s Proxy: <a href="https://snowtrace.io/address/0x061da45081ace6ce1622b9787b68aa7033621438">https://snowtrace.io/address/0x061da45081ace6ce1622b9787b68aa7033621438</a></li><li>Snowtrace Address of the PlatypusTreasure Contract: <a href="https://snowtrace.io/address/0xbcd6796177ab8071f6a9ba2c3e2e0301ee91bef5">https://snowtrace.io/address/0xbcd6796177ab8071f6a9ba2c3e2e0301ee91bef5</a></li><li>Snowtrace Address of the MasterPlatypusV4 Contract’s Proxy: <a href="https://snowtrace.io/address/0xff6934aac9c94e1c39358d4fdcf70aeca77d0ab0">https://snowtrace.io/address/0xff6934aac9c94e1c39358d4fdcf70aeca77d0ab0</a></li><li>Snowtrace Address of the MasterPlatypusV4 Contract: <a href="https://snowtrace.io/address/0xc007f27b757a782c833c568f5851ae1dfe0e6ec7">https://snowtrace.io/address/0xc007f27b757a782c833c568f5851ae1dfe0e6ec7</a></li><li>Snowtrace Transaction of the PlatypusTreasure Contract’s Proxy Deployment: <a href="https://snowtrace.io/tx/0x326d5c2e0ebb68c5f267b1f2fb654729ef5bb2bcaf09a5adea382e206b17315d">https://snowtrace.io/tx/0x326d5c2e0ebb68c5f267b1f2fb654729ef5bb2bcaf09a5adea382e206b17315d</a></li><li>Snowtrace Transaction of the USP Minter Set to PlatypusTreasure’s Proxy: <a href="https://snowtrace.io/tx/0x535ee1baa8688a5fb23c4b7d84aae65081e2663a783eb58357661e85c613d01b">https://snowtrace.io/tx/0x535ee1baa8688a5fb23c4b7d84aae65081e2663a783eb58357661e85c613d01b</a></li><li>Snowtrace Transaction of the MasterPlatypusV4 Contract’s Deployment: <a href="https://snowtrace.io/tx/0x0723124dfd5abdeafbfeab072a02610c868a7b7b32f641aa50fc157eca636d7d">https://snowtrace.io/tx/0x0723124dfd5abdeafbfeab072a02610c868a7b7b32f641aa50fc157eca636d7d</a></li><li>Hardhat console.sol Address: <a href="https://github.com/NomicFoundation/hardhat/blob/hardhat@2.12.7/packages/hardhat-core/console.sol#L5">https://github.com/NomicFoundation/hardhat/blob/hardhat@2.12.7/packages/hardhat-core/console.sol#L5</a></li><li>Omniscia Security Audit of Platypus Finance’s Core: <a href="https://omniscia.io/platypus-finance-core-implementation/">https://omniscia.io/platypus-finance-core-implementation/</a></li><li>Omniscia Security Audit of Platypus Finance’s Governance: <a href="https://omniscia.io/platypus-finance-governance-staking/">https://omniscia.io/platypus-finance-governance-staking/</a></li></ol><p><a href="http://omniscia.io/"><strong><em>Omniscia.io</em></strong></a><em> is one of the fastest growing and most trusted blockchain security firms and has rapidly become a true market leader. To date, </em><strong><em>our team has collectively</em></strong><em> </em><strong><em>secured over $200+ billion worth of digital assets, worked with 220+ clients and detected over 1000+ high-severity issues</em></strong><em> in our clients’ smart contracts.</em></p><p><em>Founded at the start of 2021 by blockchain cybersecurity veterans, omniscia.io is a pioneer in Web3 security, utilizing years of experience, developing proprietary tooling and a tried-and-tested approach to securing smart contracts and complex decentralized protocols out there — including the likes Aave, YFI, lien, 1inch, fetch, compound, synthetix, and many others.</em></p><p><a href="https://omniscia.io/about-us#clients"><strong><em>Our clients, partners and backers</em></strong></a><em> include leading ecosystem players such as L’Oréal, Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, LimitBreak, Fetch.ai and many more.</em></p><p><strong>Be sure to follow our social medias and subscribe to our newsletter for more updates:</strong></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> / </strong><a href="https://www.linkedin.com/company/omniscia"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong>Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b71a0a47a5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bonq Protocol Incident Post-Mortem]]></title>
            <link>https://medium.com/@omniscia.io/bonq-protocol-incident-post-mortem-4fd79fe5c932?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fd79fe5c932</guid>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[ethereum-security]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Thu, 02 Feb 2023 16:13:00 GMT</pubDate>
            <atom:updated>2023-02-02T17:54:22.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiXyTUdu_jRptv8NW4PzIQ.png" /></figure><p>This article is meant to analyze the Bonq Protocol incident that occurred on the 1st of February at approximately 6.32pm UTC in an impartial way and identify the root cause.</p><h3>Vulnerability Analysis</h3><p>The vulnerability that was exploited stems from how the Bonq Protocol has integrated their WALBT / BEUR trove with price oracles which are used to assess what the “true” price of the WALBT asset is.</p><p>In detail, the troves that were exploited utilized a ConvertedPriceFeed smart contract¹ to assess the price of the WALBT token against the price of real-world euro (EUR), meant to be represented in a one-to-one manner by Bonq’s euro stablecoin.</p><p>To achieve this, the ConvertedPriceFeed fetches the USD-denominated price of the WALBT asset from a custom Tellor Price Feed² and divides it by the USD-denominated price of EUR from a custom Chainlink feed³, accommodating for decimals via a DECIMAL_PRECISION constant used in a multiplication before the division.</p><p>The end result of the ConvertedPriceFeed::price() function is the value of WALBT denominated in euros and is used in multiple trove calculations of the Bonq Protocol to assess the health of a trove and whether it should be liquidated.</p><h3>Core Problem</h3><p>The TellorPriceFeed built by Bonq to take advantage of the TellorFlex oracle system⁴ has been integrated incorrectly as it immediately consumes the latest data point reported to the TellorFlex oracle via the TellorFlex::getCurrentValue function.</p><p>The Tellor trustless oracle system works by incentivizing users to discredit improper data measurements by invoking functions on the TellorFlex contract that permit them to slash the TRB assets that the malicious party had staked to submit their incorrect data point.</p><p>As time needs to pass between a false data point’s submission to the Tellor network and its detection and consequent discreditment by an honest party, data points from Tellor oracles <strong>must be consumed after a sufficient dispute window has passed</strong>.</p><h3>Attack Scenario</h3><p>This pre-condition was not satisfied in the TellorPriceFeed implementation which made use of the TellorFlex::getCurrentValue function which yields the latest reported value of the oracle. As a result, the hacker was able to exploit this by submitting a false price to the TellorFlex oracle and forfeiting their 10 TRB tokens in the process.</p><p>As the value of the exploit greatly outweighed the value of the 10 TRB tokens that would be slashed, the end result of the attack was a significantly high profit for the attacker. The attack occurred in two separate transactions to maximize the profit of the attacker.</p><p>First, they submitted a transaction at approximately 2023–02–01 06:29:18 UTC in which they performed the following:</p><ul><li>Staked 10 TRB units on the TellorFlex oracle</li><li>Reported a false price of exactly 5.000.000 USD per WALBT token, significantly overvaluing the token</li><li>Created a Trove of the WALBT asset</li><li>Transferred 0.1 WALBT tokens to the Trove⁵</li><li>Recorded the newly submitted collateral of the Trove</li><li>Borrowed a total of 100.000.000 BEUR tokens</li><li>Created another Trove of the WALBT asset</li><li>Transferred ~13.25973256272339977 WALBT tokens to the second Trove⁶</li><li>Recorded the newly submitted collateral of the second Trove</li></ul><p>Interestingly, the attacker did not borrow more BEUR tokens from the second Trove they created. The reason they created two different Troves under opposite circumstances was a requirement for their attack as this setup ensured that TroveFactory::firstTrove() and TroveFactory::lastTrove() would yield the attacker’s Troves.</p><p>The Troves are ordered by their collateralization ratio, permitting the attacker to “manipulate” the internal ordering of the Troves within the TroveFactory as they see fit. This was a crucial step for the next transaction to succeed.</p><p>In their second transaction submitted at approximately 2023–02–01 06:31:06 UTC, the following sequence of events transpired:</p><ul><li>Staked 10 TRB units on the TellorFlex oracle using an alternative address (presumably to avoid being prohibited from a second submission)</li><li>Reported a false price of exactly 0.0000001 USD per WALBT token, significantly undervaluing the token</li><li>Queried all Troves of the WALBT token in sequence using the firstTrove, lastTrove, and nextTrove mechanisms of the TroveFactory proxied via BonqProxy</li><li>For each trove:<br>– Evaluated whether the WALBT asset is associated with the Trove via containsTrove<br>– Evaluated whether the Trove has a non-zero debt via Trove::debt(), invoking Trove::liquidate() in such a case</li><li>Once no more Troves remained, the hacker proceeded to invoke Trove::repay() on the second Trove they opened in the first transaction with the maximum of uint256⁷to ensure their debt repayment will succeed regardless of the underlying debt</li><li>The Trove ultimately extracted a total of ~1.341.461 BEUR tokens from the hacker to repay the debt, rendering the Trove empty of any debt</li><li>As a final action, the hacker invoked Trove::decreaseCollateral() with an amount of roughly ~113.813.998 WALBT tokens</li></ul><p>The hacker did not iterate through the 0x4248FD3E2c055a02117eB13De4276170003ca295 and 0x5343c5d0af82b89DF164A9e829A7102c4edB5402 Troves they opened in their first transaction as they did not wish to liquidate them.</p><p>As the debt of a particular CommunityLiquidationPool is “shared” in that it carries over to the next trove that claims it via CommunityLiquidationPool::claimCollateralAndDebt performed within a Trove’s liquidate() -&gt; _updateCollateral() -&gt; getLiquidationRewards() call-chain, the attacker wished to accumulate all the debt of the liquidated Troves to their own Trove #2 created in the first transaction.</p><p>This permitted them to Trove.repay() the remaining debt associated with the liquidated troves and extract the ~113.813.998 WALBT tokens that were ultimately liquidated throughout the iterative process explained above.</p><p>Ultimately, the attacker was able to retain the following assets post-execution of both transactions:</p><ul><li>+~113.813.998 WALBT = ~4,552,559.92 USD</li><li>+~98.658.539 BEUR = Indeterminate Evaluation</li><li>-20 TRB = ~358.2 USD</li></ul><p>As the value of the BEUR asset is no longer considered canonical, we can assess the financial impact of the WALBT and TRB assets and sum a total estimated profit of roughly ~4,552,201.92 USD as of 2023-02-01 15:27:00 UTC.</p><h3>Security Audit</h3><p><a href="https://omniscia.io/">Omniscia</a> performed a security audit of the Bonq Protocol on August 15th, 2022 with a conclusion date of August 30th, 2022 and a final delivery date of October 12th, 2022. The <a href="https://omniscia.io/reports/bonq-borrowing-protocol/">publicly available audit</a>⁸ highlighted multiple issues with the oracle system they wished to implement at the time.</p><p>The formal response by the Bonq Protocol team was that they need to re-visit their approach with regards to the pricing oracles and that they will not move forward with the implementations audited at the time, opting to <strong>integrate Chainlink oracles in the future</strong>.</p><p>The Bonq Protocol has introduced numerous updates since the time the audit was finalized, including all contracts involved in the vulnerability (ConvertedPriceFeed, ChainlinkPriceFeed, and TellorPriceFeed). <strong>These contracts were never in scope of any audit conducted by the Omniscia team and thus are considered to be unaudited code</strong>.</p><h3>Conclusion</h3><p>The attack ultimately arised from improper integration of the Tellor oracle system and did not account for how the system dynamics of the Tellor system <strong>mandate a time delay before a data point is considered safe to use</strong>.</p><h3>Sources</h3><ol><li>Polygon Address of WALBT / BEUR Conversion Oracle: <a href="https://polygonscan.com/address/0x7D4c36c79b89E1f3eA63A38C1DdB16EF8c394bc8">https://polygonscan.com/address/0x7D4c36c79b89E1f3eA63A38C1DdB16EF8c394bc8</a></li><li>Polygon Address of Bonq’s WALBT Tellor Price Feed: <a href="https://polygonscan.com/address/0xa1620af6138d2754f7250299dc9024563bd1a5d6">https://polygonscan.com/address/0xa1620af6138d2754f7250299dc9024563bd1a5d6</a></li><li>Polygon Address of Bonq’s BEUR Chainlink Feed: <a href="https://polygonscan.com/address/0x96923e13b9e7C4eB853D9c37ee32E2293eE872B8">https://polygonscan.com/address/0x96923e13b9e7C4eB853D9c37ee32E2293eE872B8</a></li><li>Polygon Address of WALBT / USD Tellor Price Feed: <a href="https://polygonscan.com/address/0x8f55d884cad66b79e1a131f6bcb0e66f4fd84d5b">https://polygonscan.com/address/0x8f55d884cad66b79e1a131f6bcb0e66f4fd84d5b</a></li><li>Polygon Address of WALBT Trove #1: <a href="https://polygonscan.com/address/0x4248FD3E2c055a02117eB13De4276170003ca295">https://polygonscan.com/address/0x4248FD3E2c055a02117eB13De4276170003ca295</a></li><li>Polygon Address of WALBT Trove #2: <a href="https://polygonscan.com/address/0x5343c5d0af82b89DF164A9e829A7102c4edB5402">https://polygonscan.com/address/0x5343c5d0af82b89DF164A9e829A7102c4edB5402</a></li><li>Maximum of uint256 in Solidity (usually expressed as type(uint256).max): 115792089237316195423570985008687907853269984665640564039457584007913129639935</li><li>Omniscia Audit of Bonq Protocol (August 2022): <a href="https://omniscia.io/reports/bonq-borrowing-protocol/">https://omniscia.io/reports/bonq-borrowing-protocol/</a></li></ol><p><strong>Follow us on twitter — </strong><a href="https://twitter.com/Omniscia_sec"><strong>https://twitter.com/Omniscia_sec</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fd79fe5c932" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types De Cyberattaques Dans Le Web3]]></title>
            <link>https://medium.com/@omniscia.io/types-de-cyberattaques-dans-le-web3-a5c1823382bd?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5c1823382bd</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[solidity-development]]></category>
            <category><![CDATA[smart-contract-auditors]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Wed, 18 Jan 2023 20:47:01 GMT</pubDate>
            <atom:updated>2023-01-18T20:47:01.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPpPe5DsoJg6jEPrZkth9Q.png" /><figcaption><a href="https://omniscia.io">omniscia.io</a></figcaption></figure><p>Il existe de nombreuses manières d’effectuer des <a href="https://www.futura-sciences.com/tech/definitions/piratage-cyberattaque-18946/"><strong>cyberattaques</strong></a> dans le <a href="http://cryptoast.fr/web-3-version-decentralisee-internet/"><strong>web3</strong></a>. Au cours des dernières des années, les cyberattaques se sont multipliées, octobre 2022 a été un record en termes de montants dérobés avec un total de 760 millions de dollars.</p><p>Voici les cyberattaques les plus courantes dans le web3 :</p><h3><strong>Advanced Persistent Threat ou menace persistante avancée</strong></h3><p>L’APT est une approche d’attaque par laquelle une équipe d’exploitants établit une présence illicite et durable sur un réseau. Elle est généralement exécutée par un groupe de criminels bien organisé. Ils utilisent des applications pour cibler l’infrastructure des sociétés cryptos ou des applications malveillantes pour voler des clés privées afin d’exécuter des attaques ultérieures. Parfois, ils attaquent même les employés de l’entreprise avec des campagnes de <a href="https://www.economie.gouv.fr/dgccrf/Publications/Vie-pratique/Fiches-pratiques/Phishing-hameconnage"><strong>phishing</strong></a> utilisant des logiciels malveillants.</p><h3><strong>Supply chain vulnerabilities ou attaque contre la vulnérabilité du système</strong></h3><p>Dans la plupart des cas, les projets Web3 nécessitent différentes bibliothèques logicielles tierces. Comme ces codes sont développés par des équipes externes, il est très probable que des problèmes connus soient négligés. Il est essentiel que les équipes de développement surveillent les vulnérabilités potentielles de ces composants logiciels tiers, s’assurent que les mises à niveau sont installées et suivent les mises à jour des projets dont elles dépendent.</p><h3><strong>Attaques de gouvernance</strong></h3><p>De nombreux projets Web3 comportent un volet de <a href="https://coinacademy.fr/academie/gouvernance-defi/">gouvernance</a> permettant à leurs détenteurs de jetons de participer aux décisions relatives au réseau. Cela ouvre également une porte dérobée aux mauvais acteurs pour faire avancer des propositions malveillantes susceptibles d’endommager l’ensemble du réseau.</p><p>Les attaques contre la gouvernance se sont multipliées récemment. Les attaquants contractent d’énormes <strong>“</strong><a href="https://cryptoast.fr/flash-loan/"><strong>flash-loan</strong></a><strong>”</strong> pour faire basculer les votes. Grâce à cette participation, l’attaquant peut approuver l’exécution d’un code qui a transféré des actifs vers son propre portefeuille. L’attaquant a ensuite juste à rembourser instantanément le “flash-loan” avec son bénéfice.</p><h3><strong>Attaques de manipulation des prix</strong></h3><p>Dans le monde des cryptomonnaies, la volatilité du marché n’a rien de nouveau et les fluctuations soudaines des prix sont courantes. Les projets Web3 utilisent généralement des oracles pour obtenir des données sur la chaîne. Les attaquants ont trouvé des moyens de tromper les oracles et de provoquer de grands pics de prix qui deviennent rentables lorsqu’ils sont bien joués par les mauvais acteurs.</p><h3>Comment renforcer la sécurité de vos smart contracts</h3><p>Chez<strong> </strong><a href="http://omniscia.io"><strong>Omniscia</strong></a>, nous proposons des solutions à mettre en place en amont pour éviter que toutes ces attaques ne se produisent. Pour ce qui concerne les APT et les attaques contre la vulnérabilité des systèmes, nous effectuons un test de pénétration où nous simulons des attaques sur un système pour éprouver sa sécurité et identifier ses vulnérabilités.<strong> </strong>Dans le cas des attaques de gouvernance et des attaques de manipulation des prix nos services <strong>d’audit de smart-contracts</strong> et <strong>d’analyse de tokenomics</strong> permettent d’éviter tous les risques possibles.</p><p>Même si souvent, aucun smart-contract n’est piraté et que le post-mortem montre des techniques intelligentes de manipulation des prix ou des failles dans la gouvernance, l’audit de smart-contract est une étape nécessaire à tout projet qui veut accueillir de la liquidité au sein de son protocole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*adL47WG6qoUQSf4T.jpeg" /></figure><p><a href="http://omniscia.io"><strong><em>Omniscia.io</em></strong></a><strong><em> </em></strong><em>est l’une des sociétés de sécurité blockchain les plus fiables et dont la croissance ne cesse d’augmenter et nous sommes rapidement devenus un véritable leader du marché.</em></p><p><em>En quelques chiffres, notre équipe a collectivement s</em><strong><em>écurisé plus de 200 milliards de dollars d’actifs numériques</em></strong><em>, travaillé avec </em><strong><em>220+ clients</em></strong><em> et détecté plus de 1000 problèmes de haute gravité dans les smart-contracts de nos clients.</em></p><p><strong><em>Fondée au début de l’année 2021 par des vétérans</em></strong><em> en cybersécurité blockchain, utilisant des années d’expérience, développant des outils propriétaires et une approche testée et approuvée pour sécuriser les smart-contracts et les protocoles décentralisés complexes existants — y compris ceux de </em><strong><em>Aave, YFI, 1inch, fetch, compound, synthetix</em></strong><em>, et bien d’autres.</em></p><p><em>Parmi nos clients, partenaires et bailleurs de fonds figurent des acteurs majeurs de l’écosystème tels que </em><strong><em>Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, allianceBlock, Boson Protocol</em></strong><em>, et bien d’autres.</em></p><p><em>Surtout, n’oubliez pas de suivre nos médias sociaux et de vous abonner à notre newsletter être au courant des dernières mises à jour :</em></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> /</strong><a href="https://www.linkedin.com/company/omniscia"><strong> LinkedIn</strong></a><strong> /</strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong> Newsletter</strong></a></p><blockquote>Source: <a href="http://a16z.com">a16z.com</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5c1823382bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Qu’est-ce Qu’un Audit De Smart-Contract ?]]></title>
            <link>https://medium.com/@omniscia.io/quest-ce-qu-un-audit-de-smart-contract-869ffde38e32?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/869ffde38e32</guid>
            <category><![CDATA[ethereum-security]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Wed, 18 Jan 2023 20:20:51 GMT</pubDate>
            <atom:updated>2023-01-18T20:20:51.185Z</atom:updated>
            <content:encoded><![CDATA[<h3>Qu’est-ce Qu’un Audit De Smart-Contract ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*heBeXNVjmA_jyt8L5f81uw.png" /><figcaption><a href="https://omniscia.io">omniscia.io</a></figcaption></figure><p><strong>Un audit de </strong><a href="http://journalducoin.com/lexique/smart-contract/(opens in a new tab)"><strong>smart-contract</strong></a> est un examen poussé au niveau du code informatique interne aux contrats intelligents. Il se concentre sur la robustesse des smart-contracts et des potentielles failles se trouvant dans le code de ceux-ci afin d‘améliorer leur sécurité.</p><p>Dans le cas d’<a href="http://omniscia.io">Omniscia</a>, nous ne nous contentons pas seulement de vérifier la sécurité et la véracité des contrats. Nous vérifions aussi leur efficience pour leur tâche à effectuer ainsi que leur optimisation.</p><p>Effectivement, pour qu’ils puissent fonctionner, les smart-contracts impliquent des séries de transactions compliquées entraînant des <a href="https://cryptoast.fr/gas/">frais de<strong> </strong>Gas</a><strong>.</strong> En ce sens, une optimisation du code permettra de réduire et de limiter certaines étapes déclenchant ainsi une baisse des <strong>frais de gas</strong> sur un contrat.</p><p>Cette optimisation permet parfois de faire économiser beaucoup d’argent étant donné les coûts de gas de certains réseaux peu scalables comme Ethereum. De surcroît, les étapes inutiles sur un smart-contrat augmentent aussi considérablement les risques d’<a href="https://www.avast.com/fr-fr/c-exploits">exploit</a>, alors autant les éviter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*Qu3Q6_e__lNOxjmUqA-r-w.png" /></figure><p>De surcroît, nous nous occupons également de tester la fiabilité des <a href="https://www.redhat.com/fr/topics/api/what-are-application-programming-interfaces"><strong>API</strong></a> utilisées pour interagir avec les applications décentralisées. Parfois même du réseau sur lequel les contrats sont hébergés pour éviter toute forme de vulnérabilité face aux attaques par déni de service <a href="https://www.numerama.com/cyberguerre/1099384-quest-ce-quune-attaque-ddos.html#:~:text=Une%20attaque%20distribu%C3%A9e%20par%20d%C3%A9ni,ce%20dernier%20de%20fonctionner%20normalement.">(DDoS)</a>.</p><p>Pour la communauté crypto, les audits représentent une assurance de la confiance et du sérieux des équipes. Cette confiance est nécessaire à la poursuite de ces projets afin de gagner la confiance de la communauté crypto.</p><p>Cependant, certaines failles sont toujours détectées même après avoir effectué plusieurs audits. Aucun système informatique ne peut être fiable à 100 %. C’est pourquoi il est important de faire preuve de prudence et de procéder à des audits régulièrement.</p><p>Contrairement à nos concurrents, nos rapports sont “web-based” et ont été conçus par des ingénieurs pour des ingénieurs. Ils comportent donc des fonctionnalités qui permettent à nos clients d‘être plus flexibles face aux problèmes que nos ingénieurs découvrent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0HEyG3M_PY3sboX0.jpeg" /></figure><p><a href="http://omniscia.io"><strong><em>Omniscia.io</em></strong></a><em> est l’une des sociétés de sécurité blockchain les plus fiables, dont la croissance ne cesse d’augmenter</em>.<em> Nous sommes rapidement devenus un véritable leader du marché des audits de smart-contract.</em></p><p><em>En quelques chiffres, notre équipe a collectivement </em><strong><em>sécurisé plus de 200 milliards de dollars d’actifs numériques</em></strong><em>, travaillé avec </em><strong><em>220+ clients</em></strong><em> et détecté plus de 1000 problèmes de haute gravité dans les smart-contracts de nos clients.</em></p><p><strong><em>Fondée au début de l’année 2021 par des vétérans</em></strong><em> en cybersécurité blockchain, utilisant des années d’expérience, développant des outils propriétaires et une approche testée et approuvée pour auditer les smart-contracts et les protocoles décentralisés complexes existants — y compris ceux de </em><strong><em>Aave, YFI, 1inch, fetch, compound, synthetix</em></strong><em>, et bien d’autres.</em></p><p><em>Parmi nos clients, partenaires et bailleurs de fonds figurent des acteurs majeurs de l’écosystème tels que </em><strong><em>Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, allianceBlock, Boson Protocol</em></strong><em>, et bien d’autres.</em></p><p><em>Surtout, n’oubliez pas de suivre nos médias sociaux et de vous abonner à notre newsletter pour plus de mises à jour :</em></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> / </strong><a href="https://www.linkedin.com/company/omniscia/"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong>Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=869ffde38e32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Les Risques De Sécurité Dans Le Web3]]></title>
            <link>https://medium.com/@omniscia.io/les-risques-de-s%C3%A9curit%C3%A9-dans-le-web3-585914b7bb7d?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/585914b7bb7d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[web3-security]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Wed, 18 Jan 2023 20:15:33 GMT</pubDate>
            <atom:updated>2023-01-18T20:16:08.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HgOwtbOXYW3l8nxNMk2UCw.png" /><figcaption><a href="https://omniscia.io">omniscia.io</a></figcaption></figure><p><strong>26 milliards de dollars</strong>. C’est ce que les protocoles de finances décentralisés <a href="https://cryptoast.fr/defi-finance-decentralisee-explications/"><strong>(DeFi)</strong></a> ont perdu à ce jour, et vu les différents risques de sécurité dans le <a href="https://cryptoast.fr/web-3-version-decentralisee-internet/"><strong>Web3</strong></a> ce chiffre ne semble pas près à ralentir sa croissance.</p><p>Dans le Web3, la valeur est intégrée au Web lui-même sous la forme de cryptomonnaies. C’est une opportunité en or pour les <a href="https://www.kaspersky.fr/resource-center/threats/what-is-cybercrime#:~:text=Les%20cybercriminels%20qui%20ciblent%20les,supprimer%20ou%20voler%20des%20donn%C3%A9es."><strong>cybercriminels</strong></a> de monétiser leurs attaques. Ce chiffre, bien qu’impressionnant, ne reflète pas toutes les pertes associées aux risques de sécurité dans le web3, car la diversité de leurs menaces s’étend bien au-delà de DeFi.</p><p>Voici donc les différents risques liés à la sécurité dans le web3 :</p><p><strong>Clés privées compromises :</strong></p><p>Les <a href="https://www.journaldunet.fr/patrimoine/guide-des-finances-personnelles/1208977-wallet/"><strong>wallets</strong></a> de cryptomonnaies des investisseurs sont piratés <strong>tous les jours.</strong> De nombreuses pertes proviennent de <a href="https://www.journaldunet.fr/patrimoine/guide-des-finances-personnelles/1209002-cle-privee/"><strong>clés privées</strong></a><strong> compromises</strong> qui peuvent être divulguées ou volées de différentes manières.</p><p>Cela se produit en raison de pratiques de génération de <strong>clés</strong> faible. Comment ? Les clés privées peu complexes sont faciles à deviner, et les mauvais acteurs peuvent facilement en prendre le contrôle.</p><p><strong>La perte ou le vol de la phrase d’amorçage:</strong></p><p>Tous les utilisateurs de cryptomonnaies savent qu’une <strong>phrase de démarrage</strong> est une clé qui donne accès à tous les actifs cryptographiques d’un portefeuille. Pourtant, ces derniers temps, un grand nombre de piratages ont impliqué l’exposition accidentelle ou le vol de la phrase de démarrage.</p><p><strong>Front running et attaques sandwich:</strong></p><p>En raison du mode de fonctionnement de la blockchain, les transactions ne sont pas ajoutées instantanément au grand livre distribué. Au lieu de cela, elles sont stockées dans des « <a href="https://cryptoast.fr/mempool-blockchain/"><strong>mempools</strong></a> » publics avant d’être ajoutées aux blocs.</p><p>Le temps qui s’écoule entre l’initiation d’une transaction et son inclusion dans le bloc est une occasion pour les cybercriminels d’effectuer des attaques par anticipation.</p><p>Les acteurs malveillants recherchent des transactions qui peuvent être compromises en utilisant la valeur extractible par le mineur ou « <a href="https://academy.stakedao.org/fr/quest-ce-que-la-mev/"><strong>Miner Extractable Value</strong></a> » (MEV). Les attaquants créent alors leur propre transaction avec un <a href="https://cryptoast.fr/gas/">frais de gas</a> plus élevé pour la placer avant la transaction originale. Ainsi, ils peuvent s’emparer de certains bénéfices.</p><p><strong>Attaques à 51 :</strong></p><p>Les attaques à 51 % constituent l’un des types d’attaques les plus courants au sein du web3.</p><p>Elles sont plus fréquentes chez des <a href="https://cryptoast.fr/qu-est-ce-que-le-pow-proof-of-work/">protocoles PoW</a>, en raison de leurs algorithmes de consensus, où <a href="https://www.cryptoencyclopedie.com/single-post/quest-ce-quun-mineur-blockchain-bitcoin">les mineurs</a> utilisent leur puissance de calcul pour voter.</p><p>Pour réaliser une attaque à 51 %, les exploitants prennent le contrôle d’une part importante de <strong>la puissance de calcul</strong> d’une blockchain.</p><p>En conséquence, le réseau de la blockchain est <strong>corrompu</strong>, ce qui permet aux attaquants de <strong>traiter les transactions plus rapidement</strong> que le mineur. Les attaquants peuvent arrêter la confirmation et l’ordre des nouvelles transactions, et réécrire le contenu du grand livre distribué qu’est la blockchain.</p><p><strong>Rug Pulls :</strong></p><p>Alors que de nombreuses attaques proviennent principalement de menaces externes, les rug pulls sont des <strong>attaques</strong> <strong>internes</strong>, émergeant des propriétaires et des développeurs de la <a href="https://blockchainfrance.net/2018/09/14/quest-ce-quune-application-decentralisee-dapp/">Dapp</a>. Le “rug pull” est un type d’escroquerie relativement nouveau. Son nom vient de l’expression “tirer le tapis”.</p><p>Elle fonctionne de la manière suivante : un développeur attire les investisseurs vers un nouveau projet crypto, puis <strong>retire les fonds</strong> des utilisateurs <strong>avant que le projet ne soit construit</strong> ou via <strong>une faille cachée au sein du code.</strong></p><p><strong>Se protéger contre les hacks:</strong></p><p>Nous pensons qu’il est de la responsabilité de chaque utilisateur web3 de réfléchir à ses options de protection individuelle. Et chez Omniscia, il est de <strong>notre responsabilité</strong>, de vous fournir des <strong>rapports d’audit de hauts standards</strong> afin de faire du web3 un endroit plus sûr.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OlCA0Up0V_tO_GPU.jpeg" /></figure><p><a href="http://omniscia.io"><strong><em>Omniscia.io</em></strong></a><em> est l’une des sociétés de sécurité blockchain les plus fiables et dont la croissance ne cesse d’augmenter et nous sommes rapidement devenus un véritable leader du marché.</em></p><p><em>En quelques chiffres, notre équipe a collectivement </em><strong><em>sécurisé plus de 200 milliards de dollars</em></strong><em> d’actifs numériques, travaillé avec </em><strong><em>220+ clients</em></strong><em> et détecté plus de 1000 problèmes de haute gravité dans les smart-contracts de nos clients.</em></p><p><strong><em>Fondée au début de l’année 2021</em></strong><em> par des vétérans en cybersécurité blockchain, utilisant des années d’expérience, développant des outils propriétaires et une approche testée et approuvée pour sécuriser les smart-contracts et les protocoles décentralisés complexes existants — y compris ceux de </em><strong><em>Aave, YFI, 1inch, fetch, compound, synthetix</em></strong><em>, et bien d’autres.</em></p><p><em>Parmi nos clients, partenaires et bailleurs de fonds figurent des acteurs majeurs de l’écosystème tels que </em><strong><em>Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, AllianceBlock, Boson Protocol</em></strong><em>, et bien d’autres.</em></p><p><em>Surtout, n’oubliez pas de suivre nos médias sociaux et de vous abonner à notre newsletter pour plus de mises à jour :</em></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> /</strong><a href="https://www.linkedin.com/company/omniscia"><strong> LinkedIn</strong></a><strong> /</strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong> Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=585914b7bb7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Les Cyberattaques Dans La DeFi]]></title>
            <link>https://medium.com/@omniscia.io/les-cyberattaques-dans-la-defi-553f3c2eee85?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/553f3c2eee85</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[ethereum-security]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Wed, 18 Jan 2023 20:10:53 GMT</pubDate>
            <atom:updated>2023-01-18T20:16:29.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRqdP2sED1P55wudNR6A_g.png" /><figcaption><a href="https://omniscia.io/">omniscia.io</a></figcaption></figure><p><strong>Les </strong><a href="https://www.oracle.com/fr/cloud/cyberattaque-securite-reseau-informatique.html#:~:text=Une%20cyberattaque%20cible%20les%20Syst%C3%A8mes,ou%20d%C3%A9truire%20un%20syst%C3%A8me%20sensible.&amp;text=Le%20gouvernement%20a%20class%C3%A9%20les,&#39;image%2C%20espionnage%20et%20sabotage."><strong>cyberattaques</strong></a><strong> dans la </strong><a href="https://cryptoast.fr/defi-finance-decentralisee-explications/"><strong>DeFi</strong></a> ne sont pas nouvelles. Tous ceux qui s’intéressent aux cryptomonnaies et à la DeFi ne savent que trop bien qu’ils sont désormais des cibles populaires pour <strong>les acteurs malveillants</strong>. Dans cet article, nous souhaitons donner un aperçu de l’état de la cybersécurité dans la finance décentralisée et de ce qui peut être fait pour l’améliorer.</p><p>Les pirates profitent des<strong> </strong><a href="http://gdt.oqlf.gouv.qc.ca/ficheOqlf.aspx?Id_Fiche=8354651(opens in a new tab)"><strong>vulnérabilités</strong></a>, des <strong>erreurs de logique</strong> et des <strong>failles de programmation</strong> dans l’architecture du code des projets ainsi que du lancement de <a href="https://www.cnil.fr/fr/cnil-direct/question/le-phishing-cest-quoi"><strong>campagnes de phishing</strong></a> pour voler des fonds numériques directement aux utilisateurs DeFi.</p><p><strong>Cible principale : les projets DeFi</strong></p><p>Les protocoles décentralisés sont sans aucun doute la première cible de cyberattaques dans la DeFi, car les récompenses sont énormes.</p><p><strong>Les hackers</strong> poursuivent les projets sans relâche, <strong>ils étudient leurs codes</strong>, gardent un œil sur les nouvelles mises à jour et fonctionnalités et finissent par trouver une faille qui leur permet de <strong>s’introduire dans le système</strong>.</p><p>Le risque de perdre des fonds peut provenir des vulnérabilités des <a href="http://journalducoin.com/lexique/smart-contract/(opens in a new tab)">smart</a>-contracts, des défauts de protocole et de sa conception, des fuites de clés, des hacks « <a href="http://linkweb.fr/creation-site-internet-toulouse/front-end/(opens in a new tab)">frontend</a> », de l’arbitrage, etc. Parfois, une erreur de code mineure dans les contrats intelligents peut provoquer un désastre et entraîner la compromission d’actifs valorisés plusieurs millions.</p><p><strong>Cible constante : les utilisateurs DeFi</strong></p><p>Les cybercriminels ne ciblent pas seulement les protocoles, ils ciblent également<strong> </strong>les<strong> </strong><a href="https://www.journaldunet.fr/patrimoine/guide-des-finances-personnelles/1208977-wallet/"><strong>portefeuilles numériques</strong></a><strong> des utilisateurs</strong>.</p><p>Compte tenu de l’évolution constante des cyberattaques dans la DeFi, il est tout simplement impossible pour un investisseur DeFi d’être au courant de toutes les menaces. Pourtant, il est indispensable que chacun soit conscient de toutes ses actions dans le monde de la blockchain et de l’importance de <strong>renforcer sa cybersécurité personnelle</strong>. Vos actifs numériques nécessitent une sécurité fiable.</p><p>Les pirates peuvent voler des cryptomonnaies de diverses manières, qu’il s’agisse de tenter de s’approprier votre mot de passe, de vous inciter à révéler des informations par des tentatives d’hameçonnage (phishing) ou d’autres méthodes.</p><p><strong>La protection : le maître mot</strong></p><p>Avec autant de menaces qui nous visent, <strong>que faut-il faire ?</strong></p><p>Pour l’instant, les développeurs DeFi semblent rechercher <strong>l’innovation</strong> dans leurs algorithmes plus que <strong>la protection</strong>. Mais avec une attaque à grande échelle faisant surface dans les projets DeFi, les équipes doivent s’assurer que des outils et des précautions efficaces sont en place pour protéger tous les actifs.</p><p>Cependant, pour un utilisateur individuel, nous avons ce conseil : n’accordez aucune confiance à un projet avant qu’il n’est prouvé sa fiabilité et même lorsque c’est le cas, il faut toujours rester prudent. Lorsque vous utilisez la DeFi, <strong>ayez toujours la sécurité à l’esprit.</strong></p><p><strong>Conclusion:</strong></p><p>L’équipe d’Omniscia est sûre que la DeFi a un énorme potentiel, nous travaillons chaque jour dans le but de renforcer la protection individuelle et d’améliorer la sécurité de l’ensemble de l’industrie Web3 !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lGgUPiug5TtPDDJi.jpeg" /></figure><p><a href="http://omniscia.io"><em>Omniscia.io</em></a><em> est l’une des sociétés de sécurité blockchain les plus fiables et dont la croissance ne cesse d’augmenter et nous sommes rapidement devenus un véritable leader du marché.</em></p><p><em>En quelques chiffres, notre équipe a collectivement sécurisé plus de 200 milliards de dollars d’actifs numériques, travaillé avec 220+ clients et détecté plus de 1000 problèmes de haute gravité dans les smart-contracts de nos clients.</em></p><p><em>Fondée au début de l’année 2021 par des vétérans en cybersécurité blockchain, utilisant des années d’expérience, développant des outils propriétaires et une approche testée et approuvée pour sécuriser les smart-contracts et les protocoles décentralisés complexes existants — y compris ceux de Aave, YFI, 1inch, fetch, compound, synthetix, et bien d’autres.</em></p><p><em>Parmi nos clients, partenaires et bailleurs de fonds figurent des acteurs majeurs de l’écosystème tels que Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, allianceBlock, Boson Protocol, et bien d’autres.</em></p><p><em>Surtout, n’oubliez pas de suivre nos médias sociaux et de vous abonner à notre newsletter pour plus de mises à jour : </em><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> /</strong><a href="https://www.linkedin.com/company/omniscia"><strong> LinkedIn</strong></a><strong> /</strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong> Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=553f3c2eee85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Optimizer’s Guide to Solidity pt. 4 — Binary Size Tricks]]></title>
            <link>https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-4-binary-size-tricks-adaed69c2ce8?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/adaed69c2ce8</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 19:53:48 GMT</pubDate>
            <atom:updated>2023-02-06T16:03:42.742Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Optimizer’s Guide to Solidity pt. 4 — Binary Size Tricks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dY8lSVF12-j_M52hwsVcQ.png" /></figure><p>​This is part 4 of our continuing series delving deep into the internals of the EVM and how the <a href="https://omniscia.io/"><strong>Omniscia</strong></a><strong> </strong>team regularly “exploits” peculiar traits of the EVM to minimize the execution cost of the smart contracts it audits. If you are not up to date on ‘The Optimizer’s Guide to Solidity’ series, we encourage you to check out <a href="https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-1-access-of-mapping-entries-9f852aa5e38"><strong>part 1</strong></a>, <a href="https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-2-variable-access-types-ca0efe44889b"><strong>part 2</strong></a> and <a href="https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-3-hidden-gas-costs-3132357440ac"><strong>part 3</strong></a><strong> </strong>on our <a href="https://medium.com/@omniscia.io"><strong>medium page</strong></a>.</p><p>Today we will discuss two types of optimizations which rely on how the EVM represents certain variable types and primitive function results under the hood. Both optimizations are simple to apply to any codebase and applicable to all production-ready versions of Solidity so no distinction needs to be made between them. In order to properly comprehend how these optimizations work, we first need to acknowledge a peculiar trait of the EVM.​</p><h3>Solidity vs. EVM Data Types​</h3><p>While Solidity presents us with multiple data types of varying binary precision (i.e. uint96 or address a.k.a. uint160), the EVM is fairly rudimentary in that it treats all data points as 32-bytes / 256-bits in length. Since the EVM has no knowledge of data types that are less than 256-bits, any sub-256-bit data type requires additional operations to be properly utilized. It is important to note that Arithmetic operations are especially expensive. For instance an addition between two uint96variables needs to overflow at type(uint96).max which will not happen at the EVM level and needs to be simulated via bitwise shifts (aka. padding / unpadding operations). As such, any variable that is declared as less than 256-bits will incur a non-negligible increase in gas cost wherever it is utilized.​</p><h3>Optimal Data Types​</h3><p>For projects to identify the optimal data type required by a given variable, one must first assess the actual storage needs of the said variable. Here are a few factors to take into consideration when evaluating storage needs:​</p><ul><li>Is the variable stored in the storage of the contract or is it simply an input argument for a given function?</li><li>Does the project need to conform to the said data type because it integrates with external projects that expect it (i.e. Compound)?</li><li>Is the variable part of a tight-packing code segment (i.e. contract-level variables in sequence or a struct declaration)?​</li></ul><p>Generally, if the latter two queries do not apply then it is fair to assume that the variable type can be safely upcasted to uint256. We will use the following example of a Comp-like token compiled <strong>with a </strong><strong>pragma version of </strong><strong>0.8.X and up</strong> (thus possessing safe arithmetics by default) to showcase how one can evaluate what data type to upcast:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKyCISTN33JRQ_B81N08_g.png" /><figcaption>Example Snippet of Unoptimized Data Types</figcaption></figure><p>In the above example, the Checkpoint struct contains properly defined data types as they are tight-packed into a single 32-byte storage slot. That said, the input argument of the transfer function, the Transfer event as well as the balanceOf mapping contain a uint96 variable which is suboptimal. To optimize such code blocks, one should only adjust the transfer and balance related data types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJ3RLjXWPosMf1i1YvBYg.png" /><figcaption>Example Snippet of Optimized Data Types</figcaption></figure><p>​As observed above, we introduced an additional check to ensure that the amount variable can be safely cast to a uint224 data type as casting operations <strong>are not safely performed even with safe-arithmetics</strong>. The extra gas cost incurred by this check can be avoided entirely by instead evaluating the totalSupply of the system whenever tokens are minted and ensuring that it fits in a uint224. This would indirectly guarantee that no single balance can exceed the uint224 threshold.</p><h3>​ABI Encoding System &amp; Usage</h3><p>​The ABI encoding mechanism contains two variations; the abi.encode and the abi.encodePacked functions. The former encodes the input argument(s) based on the ABI encoding standard whilst the packed variation attempts to minimize the total number of bytes utilized by the end-result bytes. Using the encodePacked function when the input arguments can be tightly packed into less than 256-bit slots makes sense. However, it is highly ineffective when the input arguments are 256-bits (or are packed in 256-bit slots regardless).</p><p>​The abi.encode-prefixed functions are usually utilized in conjunction with the keccak256 instruction meant to generate the hash of a particular set of variables. Another important trait of the EVM is that the keccak256 function operates on 256-bit inputs at a time. This means that a sub-256-bit input will incur the same gas cost to generate the hash than a 256-bit input. As a result, keccak256 operations should be optimally performed on bytes variables that have a length that is a multiple of 32.​</p><p>Let us take the following snippet as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iiIp72XOkqmU60-9kSpgw.png" /><figcaption>Example Snippet of Unoptimized Encoding</figcaption></figure><p>By assimilating all the information laid out above, we can deduce that the encodePacked function can be swapped with the encode variation without any operational change. Most importantly, the gas cost benefit incurred by this change will be significant since the logic of encodePacked would otherwise attempt to pack the two address arguments and fail, thus incurring additional gas in the process.</p><p>Optimized, the above snippet would turn into:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1a4ygmu2b_uHer7znH7IrQ.png" /><figcaption>Example Snippet of Optimized Encoding</figcaption></figure><p>The above code is an excerpt of the Uniswap V2 ERC20 implementation that is used by its LP system. This is further evidence that mature bluechip projects in the Ethereum ecosystem are taking advantage of this optimization.​</p><h3>Verdict</h3><p>​Traditional developers tend to optimize their data types to minimize the memory and storage footprint of their applications. However, as illustrated in this article, the EVM expects all data to be in 256-bit sizes and it has no concern for memory restraints since they are guaranteed by the way the EVM’s stack system is defined. As a result, developers need to be extremely cautious when coding smart contracts that use sub-256-bit data types. Above all, they must ensure that this choice is for the benefit of the contract’s operational cost rather than an incorrectly assumed optimization of the contract’s memory / storage needs.</p><p>Be sure to check out our <a href="https://medium.com/@omniscia.io">Optimizer’s Guide to Solidity</a> series, where <a href="https://omniscia.io/">our team</a> of security engineers outlines valuable tips and insights that address many of the challenges developers face when developing and deploying secure, scalable and optimized decentralized applications/smart contracts.</p><p><a href="http://omniscia.io/"><strong><em>Omniscia.io</em></strong></a><em> is one of the fastest growing and most trusted blockchain security firms and has rapidly become a true market leader. To date, </em><strong><em>our team has collectively</em></strong><em> </em><strong><em>secured over $200+ billion worth of digital assets, worked with 220+ clients and detected over 1000+ high-severity issues</em></strong><em> in our clients’ smart contracts.</em></p><p><em>Founded at the start of 2021 by blockchain cybersecurity veterans, omniscia.io is a pioneer in Web3 security, utilizing years of experience, developing proprietary tooling and a tried-and-tested approach to securing smart contracts and complex decentralized protocols out there — including the likes Aave, YFI, lien, 1inch, fetch, compound, synthetix, and many others.</em></p><p><a href="https://omniscia.io/about-us#clients"><strong><em>Our clients, partners and backers</em></strong></a><em> include leading ecosystem players such as Polygon, AvaLabs, Morpho, Euler, CLabs, Olympus DAO, Fetch.ai, Boson Protocol, and many more.</em></p><p><strong>Be sure to follow our social medias and subscribe to our newsletter for more updates:</strong></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> / </strong><a href="https://www.linkedin.com/company/omniscia"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong>Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adaed69c2ce8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Optimizer’s Guide to Solidity pt. 3 — Hidden Gas Costs]]></title>
            <link>https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-3-hidden-gas-costs-3132357440ac?source=rss-f435df75f45d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3132357440ac</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Omniscia]]></dc:creator>
            <pubDate>Thu, 20 Oct 2022 12:07:37 GMT</pubDate>
            <atom:updated>2022-10-20T16:42:07.893Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Optimizer’s Guide to Solidity pt. 3 — Hidden Gas Costs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJYAuZ8Xe2-p-nLZBrYq-Q.png" /><figcaption><a href="http://omniscia.io">omniscia.io</a></figcaption></figure><p>​Today we are diving deeper into the internal working of the Ethereum Virtual Machine (EVM) to illustrate how the Omniscia team regularly “exploits” peculiar traits of the EVM to minimize the execution cost of solidity smart contracts for <a href="https://omniscia.io/about-us#clients">its clients</a>. In case you are not up to date on ‘The Optimizer’s Guide to Solidity’ series, you can find part <a href="https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-1-access-of-mapping-entries-9f852aa5e38">one here</a> and <a href="https://medium.com/@omniscia.io/the-optimizers-guide-to-solidity-pt-2-variable-access-types-ca0efe44889b">two here</a>. In order to stay up to date with all the security tips and insights we share, be sure to <a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html">subscribe</a> to our newsletter where we will be publishing many tips and insights solidity developers can leverage to design and develop more secure and gas-efficient smart contracts.</p><p>This week we look at two different types of optimizations that are relatively simple to apply to any codebase and that are relevant to a majority of smart contracts we audit for our clients. The first optimization is applicable to all versions of Solidity. The second optimization discussed in this article is only valid for pragma versions 0.8.0 onwards. However, lets first clarify at a high level how one can assess the cost of any EVM instructions.</p><h3>EVM Instruction Cost Assessment</h3><p>​At the very core, the reasoning behind introducing “gas costs” to transactions and “gas limits” to assembled blocks on EVM blockchains is to <strong>1)</strong> introduce an additional revenue stream to incentivize stakers (previously miners) to secure and validate the network and <strong>2)</strong> act as a protection measure against Denial-of-Service (DoS) attacks by prohibiting the execution of computationally expensive tasks via the upper gas limit (e.g. for loops with significant limits that would otherwise delay the median block creation rate).​</p><p>To strike a balance between block builder compensation and a competitively priced computational system, EVM blockchains dynamically adjust their block gas limit based on the demand for bandwidth amongst network actors. Transactional gas costs are generally slow to evolve and revolve around a simplistic basis; the computational cost of performing a transaction. This may seem simple to perform within centralized and / or traditional computing environments. However, it differs greatly in blockchain ecosystems due to the way state changes of the blockchain ledger are propagated across the network of nodes that validate the instructions performed on a decentralized network.</p><p>In this article we illustrate how the hidden cost of memory can inflate the cost of otherwise straightforward transaction types on EVM blockchains, and how developers can optimize their dapps to reduce their gas footprint.​</p><h3>EVM: Local Variable Hidden Cost</h3><p>​When declaring a local variable that is the result of a statement, we incur a hidden gas cost proportional to the amount of “memory” needed for the local variable we declared. This extra cost is usually offset when reading variables from storage (SLOAD), storing them to a local variable (MSTORE plus hidden cost [A0–1](https://github.com/wolflo/evm-opcodes/blob/main/gas.md#a0-1-memory-expansion) chapter of evm-opcodes), and reading them on each utilization (MLOAD).</p><p>This is not the case when dealing with primitive instructions of the EVM. Indeed, each transaction on a blockchain contains a set of unavoidable data. Consequently, sets of data are exposed to all smart contracts via primitive EVM instructions that consume very small amounts of gas. This is due to the fact that they do not require extra memory to read special data slots, as they are already loaded in-memory as part of the EVM’s block creation workflow.</p><p>The instruction set is significant and revolves around contextual data of a transaction, such as the msg.sender, block.timestamp, and more. As such, the following contract implementation is in fact inefficient:​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kICqSALPixfG4a8d8g_vew.png" /><figcaption>Snippet from “Context.sol” of Aave v3 @ f3e037b</figcaption></figure><p>The Context contract is an implementation that was introduced by OpenZeppelin with the intention to streamline the development process of a contract that can be easily upgraded to a meta-transaction compatible one. However, thus far it has been mostly misused and has led to non-negligible gas increase for various protocols including both Aave V2 and Aave V3. To illustrate a tangible example of the IncentivizedERC20 implementation of Aave V3, we have provided a caption below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riZSX6W4j2qTKjTs7HEBiA.png" /><figcaption>Snippet from “IncentivizedERC20.sol” of Aave v3 @ f3e037b</figcaption></figure><p>​In the above function, we incur the _msgSender implementation’s msg.sender gas cost (CALLER: 2), and the _msgSender() invocation itself (JUMP: 2 as well as the memory allocation of the returned variable) twice. By optimizing the above segment, we can reduce the instructions’ gas cost by half:​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbJugeAfCOGIo4TDhrdQZg.png" /><figcaption>Optimized Snippet from “IncentivizedERC20.sol” of Aave v3 @ f3e037b​</figcaption></figure><p>While the optimization by itself may be insignificant, it will lead to tangible savings when applied across the entire codebase.</p><h3>​Solidity: Mathematical Hidden Cost​</h3><p>Hidden gas costs are not only limited to the EVM. Developers need to be cognizant that the Solidity language itself has introduced some hidden costs in its latest minor semver 8, which enforces safe arithmetics by default. Given that a lot of applications already perform safety checks for unsafe arithmetic operations, as part of their error handling workflows, built-in safe arithmetic checks become superfluous and thus incur an increase in gas redundantly.</p><p>Thankfully, Solidity also introduced a new code-block declaration style that instructs the compiler to perform arithmetic operations unsafely: unchecked code blocks. These blocks can be cleverly utilized to significantly reduce the gas cost of a particular contract as long as the operation is guaranteed to be performed safely by surrounding statements and / or conditions. As an example, let’s take a look at this segment of the Compound CToken implementation’s _reduceReservesFresh function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSFi4MOkC_lYqCMC_zzAcg.png" /><figcaption>Snippet from “CToken.sol” of Compound @ a3214f6​</figcaption></figure><p>The totalReservesNew calculation and assignment are performed after the condition reduceAmount &gt; totalReserves has been evaluated to false. This means that the trait totalReserves &gt;= reduceAmount has been guaranteed by the execution context and as such the calculation of totalReservesNew can be performed in an unchecked code block as it is guaranteed to be performed properly. After optimization the above code block should resemble the caption below:​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XBpnxxaBrj50COna4llkIA.png" /><figcaption>Optimized Snippet from “CToken.sol” of Compound @ a3214f6</figcaption></figure><p>Another way to avoid built-in safe arithmetics from incurring extra gas is during incrementation operations (++ and --). These operations are usually performed in for loops and in any post-0.8.X version. Each incrementation is performed with bound-checks when they are entirely redundant. A very simple example illustrating this is provided below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lw9tLyIgIOQqGnFguHuxOA.png" /><figcaption>Example Snippet of Loops​</figcaption></figure><p>Due to the inherent constraints of Solidity, bar.length is guaranteed to fit within a uint256 variable, meaning that performing a safe incrementation on each loop for the i variable would be redundant. To optimize such code blocks, we relocate the incrementation to the end of the unchecked code block:​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_y_WmM6Q0lDiuMv-LNaONg.png" /><figcaption>Optimized Example Snippet of Loops</figcaption></figure><h3>​Verdict​</h3><p>The EVM is an intrinsically complex machine and as a consequence multiple tools have been developed to aid developers in creating solutions within its system using high-level languages (such as Solidity). The simplifications performed at the liberty of the Solidity compiler, however, are usually poorly relayed to the developer community and as such, programmers end up creating inefficient programs.</p><p>To counteract this, our <a href="https://medium.com/@omniscia.io">Optimizer’s Guide to Solidity</a> series outlines valuable tips and insights that address many of the challenges developers face when developing and deploying secure, scalable and optimized decentralized applications/smart contracts.</p><p><a href="http://omniscia.io/"><strong><em>Omniscia.io</em></strong></a><em> is one of the fastest growing and most trusted blockchain security firms and has rapidly become a true market leader. To date, </em><strong><em>our team has collectively</em></strong><em> </em><strong><em>secured over $200+ billion worth of digital assets, worked with 220+ clients and detected over 1000+ high-severity issues</em></strong><em> in our clients’ smart contracts.</em></p><p><em>Founded at the start of 2021 by blockchain cybersecurity veterans, omniscia.io is a pioneer in Web3 security, utilizing years of experience, developing proprietary tooling and a tried-and-tested approach to securing smart contracts and complex decentralized protocols out there — including the likes Aave, YFI, lien, 1inch, fetch, compound, synthetix, and many others.</em></p><p><a href="https://omniscia.io/about-us#clients"><strong><em>Our clients, partners and backers</em></strong></a><em> include leading ecosystem players such as Polygon, AvaLabs, CLabs, Olympus DAO, Fetch.ai, allianceBlock, Boson Protocol, and many more.</em></p><p><strong>Be sure to follow our social medias and subscribe to our newsletter for more updates:</strong></p><p><a href="https://twitter.com/Omniscia_sec"><strong>Twitter</strong></a><strong> / </strong><a href="https://www.linkedin.com/company/omniscia"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://omniform1.com/signup/v1/631e03a0f165844c16eebdf9_6328e109bc50e2a56235e2cf.html"><strong>Newsletter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3132357440ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>