<?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 Eduard Kotysh on Medium]]></title>
        <description><![CDATA[Stories by Eduard Kotysh on Medium]]></description>
        <link>https://medium.com/@ekotysh?source=rss-43adc097d40e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q8vns4h6pmNzxSdD2D0W8Q.png</url>
            <title>Stories by Eduard Kotysh on Medium</title>
            <link>https://medium.com/@ekotysh?source=rss-43adc097d40e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:47:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ekotysh/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[The Hidden Risks of Cosmos: Unmetered Functions]]></title>
            <link>https://medium.com/oak-security/the-hidden-risks-of-cosmos-unmetered-functions-861bf76078d0?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/861bf76078d0</guid>
            <category><![CDATA[cosmos-sdk]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[interchain-security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 12:09:04 GMT</pubDate>
            <atom:updated>2025-04-30T12:09:04.083Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Hidden Risks of Cosmos SDK: Unmetered Functions</h3><h4><strong>by Eduard Kotysh and Christian Vari</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7GbNV5NVolW5kFAAtzXKUg.jpeg" /></figure><p>At Oak Security, we’ve noticed a recurring pattern during our audits of Cosmos-based chains: developers often underestimate two important functions — <em>BeginBlock </em>and <em>EndBlock</em> [1]. These functions run before and after processing transactions in each block, and here’s the kicker — they’re not subject to gas metering. This isn’t a mistake; it’s how the Cosmos SDK was designed [2]. However, this has prompted concerns about potential vulnerabilities, such as excessive computation leading to potential denial-of-service (DoS) attacks [3].</p><p>The reasoning behind this design choice is pretty straightforward. Since <em>BeginBlock</em> and <em>EndBlock</em> aren’t directly tied to user transactions, initially it didn’t make sense to charge gas fees for their execution. It’s like giving developers a bit of “free” computation time.</p><p>But this freedom can be a double-edged sword, and it can open up a Pandora’s box of potential vulnerabilities. The main issue is that without gas limits, poorly optimized or malicious code in <em>BeginBlock</em> and <em>EndBlock</em> can really wreak havoc. It can slow down the network, cause problems for validators, and even halt the entire chain.</p><p>To show just how big of a deal this can be, we decided to conduct an experiment. We set up a local test network and introduced some random delays in the consensus process to simulate resource-intensive operations in <em>BeginBlock</em>. The results were pretty eye-opening.</p><h3>Experimental Validation</h3><p>To validate these risks, we conducted a controlled experiment on a local network consisting of seven validator nodes. Our test introduced randomized delays in the <em>BeginBlocker</em> function at even block heights starting from block 10, with delays ranging between 5 seconds and 1 minute to simulate resource-intensive operations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*paHsso8cU17z4tMZY77dog.png" /><figcaption>Figure 1: BeginBlock function with randomized delays</figcaption></figure><p>This experiment yielded three significant observations:</p><ol><li><strong>Consensus Timeouts &amp; Multiple Rounds</strong>: The introduction of delays triggered multiple additional consensus rounds at affected block heights, significantly slowing overall chain progression and increasing block times.</li><li><strong>Missed Validator Votes &amp; Slashing Risk</strong>: Several validators failed to sign blocks within required timeframes, with some missing voting phases entirely. This exposed validators to potential slashing penalties, with those having slower processing capabilities or weaker network connections facing higher risk.</li><li><strong>Network Liveness Concerns</strong>: When fewer than two-thirds of validators could sign in time, the chain experienced temporary halts. In production environments, this could lead to situations where block finalization becomes impossible, resulting in a completely stalled network.</li></ol><p>These experimental results confirm that unoptimized, malicious code, or even intentional data processing in <em>BeginBlock</em> and <em>EndBlock</em> functions can severely impact network performance and stability, even on a test network with minimal traffic.</p><h3>Prominent Case Study</h3><h4>Cosmos Hub Interchain Security Vulnerability (January 2024)</h4><p>In early 2024, security researchers identified critical vulnerabilities in the Cosmos Hub&#39;s Interchain Security module, specifically within its <em>EndBlock</em> functions [3]. These vulnerabilities, previously found by Oak Security during an audit, while not exploited in production, demonstrated significant risks associated with unmetered execution:</p><ol><li><strong><em>AssignConsumerKey</em> Exploitation</strong>:</li></ol><ul><li>Location: <em>x/ccv/provider/keeper/relay.go</em></li><li>Issue: Potential for unbounded growth in the <em>consumerAddrsToPrune</em> list</li><li>Risk: O(n) time complexity in unmetered <em>EndBlock</em> execution</li></ul><p>This vulnerability was formally identified in Oak Security&#39;s <a href="https://github.com/oak-security/audit-reports/blob/main/Cosmos/2023-06-23%20Audit%20Report%20-%20Cosmos%20Interchain%20Security%20v1.0.pdf">June 2023 audit</a> of Cosmos Interchain Security, where it received a Major severity rating. The audit specifically noted that &quot;malicious actors could craft transactions with multiple <em>AssignConsumerKey</em> messages and spam the provider chain,&quot; causing the <em>consumerAddrsToPrune</em> AddressList to grow linearly with the number of messages sent [4]. Since this list is iterated over in the <em>EndBlocker</em>, the execution time would increase proportionally, potentially slowing down or even halting the provider chain.</p><p><strong><em>2. SendRewardsToProvider</em> Vulnerability:</strong></p><ul><li>Location: <em>x/ccv/consumer/keeper/distribution.go</em></li><li>Attack Vector: Spamming reward addresses with multiple token denominations via IBC</li><li>Consequence: Forced unbounded iterations over reward tokens in <em>EndBlock</em></li></ul><p>This vulnerability was also independently discovered in an audit by Oak Security, where it was marked as Critical. The auditors explained how the <em>SendRewardsToProvider</em> function in the consumer chain&#39;s <em>EndBlocker</em> retrieves all coins from the reward address and attempts to send each denomination individually to the provider chain via IBC. Oak Security auditors specifically warned that &quot;since anyone is allowed to send coins to the reward address, an attacker could create and send a large number of coins with different denoms to it, for example using a chain with the token factory module, in order to attack the mentioned unbounded iteration and DOS attack the chain.&quot;</p><p>This represents a clear example of how unmetered execution in <em>EndBlock</em> functions becomes particularly dangerous when combined with unbounded iterations over attacker-controlled inputs [4].</p><p><strong>Potential Impact Summary:</strong></p><ul><li>Block finalization time could grow linearly with attack intensity</li><li>Significant performance degradation across the network</li><li>Risk of complete chain halts without intervention</li></ul><p>This case study reveals that even high-profile projects like Cosmos Hub remain susceptible to unmetered execution vulnerabilities.</p><h3>Security Recommendations</h3><p>1. Implement Strict Computation Bounds</p><ul><li><strong>Time Complexity O(1): </strong>All <em>BeginBlock/EndBlock</em> operations should have O(1) complexity since these functions execute unconditionally every block (~7-second intervals) without gas constraints. If this is not feasible, benchmarks should be run and upper bounds should be enforced, for example on iteration of stored entities.</li><li><strong>Context Wrapping</strong>: Wrap potentially resource-intensive operations, such as the execution of CosmWasm smart contracts, in custom gas-metered contexts tied to governance-controlled params:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kRAwBat_5abIj0RaDpScWw.png" /></figure><ul><li><strong>Input Validation</strong>: Implement comprehensive validation for all inputs to <em>BeginBlock</em> and <em>EndBlock</em> functions, including strict bounds checking for iteration limits, token denominations, and data structure sizes.</li></ul><p>2. Comprehensive Testing Methodologies</p><ul><li><strong>Load Testing</strong>: Utilize simulation frameworks (e.g., simapp) to test block execution with elevated validator counts, oversized data structures, and maximum theoretical network loads.</li><li><strong>Chaos Engineering</strong>: Simulate 40% validator downtime during <em>EndBlock</em> and Network partitions during <em>BeginBlock</em>.</li><li><strong>Exception Handling Verification</strong>: Ensure all calls to external modules within <em>BeginBlock</em> and <em>EndBlock</em> implement proper error handling and recovery mechanisms, particularly for CosmWasm smart contracts and other extensible components.</li></ul><p>3. Architectural Safeguards</p><ul><li><strong>Priority Execution Queues: </strong>Ensure critical consensus logic can&#39;t be blocked by lower-priority operations</li><li><strong>Automated Circuit Breakers</strong>: Implement on-chain parameters that allow for the automatic disabling of non-critical <em>BeginBlock</em> and <em>EndBlock</em> logic during performance degradation or attack scenarios</li><li><strong>Governance-Controlled Parameters</strong>: Require explicit governance proposals for modifications to <em>BeginBlock </em>and <em>EndBlock </em>hooks, preventing incremental risk accumulation through seemingly minor additions</li></ul><p>4. Operational Monitoring</p><ul><li><strong>Performance Metrics</strong>: Establish dedicated monitoring for key metrics:<br>- BeginBlock_duration_ms<br>- EndBlock_duration_ms<br>- Iteration counts within unbounded loops<br>- Memory allocation patterns during block execution</li><li><strong>True Anomaly Detection</strong>: Implement alerts for significant deviations in these metrics across validator sets and use historical baseline comparison to differentiate targeted attacks vs natural load spikes.</li></ul><p>The Cosmos SDK provides developers with exceptional flexibility in certain areas, but this flexibility could act as a double-edged sword without rigorous security practices. These unmetered functions represent a unique attack surface where even minor implementation errors can cascade into chain-halting threats. Security auditors must rigorously review these functions with specialized test methodologies, while developers should implement strict computational bounds and monitoring systems as defensive measures.</p><p>Our team at <a href="https://oaksecurity.io/">Oak Security</a> brings a deep understanding of intricate design trade-offs when it comes to Cosmos security models and can help you cover all aspects of architectural review, from early planning, secure design, economic consulting, secure development processes, and in-depth protocol reviews.</p><p>Check out our <a href="https://github.com/oak-security/audit-reports">audit reports</a> or contact us via <a href="/service/mailto:info@oaksecurity.io">email</a> and social media channels on <a href="https://x.com/SecurityOak">X</a> or <a href="https://www.linkedin.com/company/oaksecurity/">LinkedIn</a>.</p><p>REFERENCES</p><ol><li>Cosmos Network Documentation, BeginBlock and EndBlock. <a href="https://docs.cosmos.network/v0.45/building-modules/beginblock-endblock.html">https://docs.cosmos.network/v0.45/building-modules/beginblock-endblock.html</a>. Accessed March 28, 2025.</li><li>Fault Tolerant Systems, Cosmos Security Part 1: Unmetered Functions. <a href="https://www.faulttolerant.xyz/2024-01-16-cosmos-security-1/">https://www.faulttolerant.xyz/2024-01-16-cosmos-security-1/</a>. Published January 16, 2024. Accessed March 28, 2025.</li><li>Gate.io, Cosmos Ecosystem Security Guide: Analyzing Security Challenges in Different Components. <a href="https://www.gate.io/learn/articles/cosmos-ecosystem-security-guide-analyzing-security-challenges-in-different-components/1628">https://www.gate.io/learn/articles/cosmos-ecosystem-security-guide-analyzing-security-challenges-in-different-components/1628</a>. Accessed March 28, 2025.</li><li>Oak Security, Audit Report — Cosmos Interchain Security v1.0. <a href="https://github.com/oak-security/audit-reports/blob/main/Cosmos/2023-06-23%20Audit%20Report%20-%20Cosmos%20Interchain%20Security%20v1.0.pdf">https://github.com/oak-security/audit-reports/blob/main/Cosmos/2023-06-23%20Audit%20Report%20-%20Cosmos%20Interchain%20Security%20v1.0.pdf</a>. Published June 23, 2023. Accessed March 28, 2025.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=861bf76078d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oak-security/the-hidden-risks-of-cosmos-unmetered-functions-861bf76078d0">The Hidden Risks of Cosmos: Unmetered Functions</a> was originally published in <a href="https://medium.com/oak-security">Oak Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Assisted Security Audits]]></title>
            <link>https://medium.com/oak-security/ai-assisted-security-audits-0bd76608e3be?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bd76608e3be</guid>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[security-audit]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[developer-tools]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Tue, 25 Feb 2025 14:58:22 GMT</pubDate>
            <atom:updated>2025-02-25T14:58:22.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Practical Guide with Real-World Examples</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sB3kV1COmE_eBP2C3lQaJg.jpeg" /><figcaption><em>Thanks to our auditors: </em><a href="https://x.com/decentra_chris?s=21"><em>Christian</em></a><em>, </em><a href="https://x.com/lets_p2p"><em>Kirill</em></a><em>, Lucas and Peppe, who have contributed to this article.</em></figcaption></figure><p>The landscape of blockchain security auditing is undergoing a significant change with the emergence of AI-powered tools. As security professionals, we’re witnessing a shift in how audits are conducted, with artificial intelligence becoming an increasingly valuable addition to our tools arsenal. In this article, we explore the current state of AI tools available to blockchain security auditors, examining their practical applications, limitations, and disclose real-world strategies used by our own auditors at <a href="https://www.oaksecurity.io/">Oak Security</a>.</p><p><em>Oak Security has conducted security assessments for over 500 projects, ranging from DeFi protocols like Lido and 1inch to critical infrastructure including Filecoin’s Virtual Machine and the Dusk consensus protocol. As a trusted security auditor of Solana, Polkadot, and Cosmos ecosystems, our team brings extensive experience in evaluating complex blockchain systems.</em></p><h3>Disclaimer: The Privacy Challenge</h3><p>Perhaps the most pressing challenge facing security auditors who wish to leverage AI is the fundamental tension between using these powerful resources and maintaining client confidentiality. Most auditors operate under strict Non-Disclosure Agreements (NDAs), creating a significant constraint on how they can interact with AI platforms. Using a proprietary LLM (Large Language Model) may lead to exposure of sensitive client data (or report findings) to third parties. However, there are several viable approaches to addressing this challenge. Before we dive into these solutions, make sure to review your specific client agreement to understand limitations and confirm it would be suitable and legal in your case.</p><p>To avoid using a proprietary LLM, you can leverage various <a href="https://www.datacamp.com/blog/top-open-source-llms">open-source language models</a> found on GitHub, as they’re released under permissive licenses such as MIT, Apache 2.0, and OpenRAIL-M. By deploying these models within your own private infrastructure, you can maintain full control over the data provided to the LLM and its security protocols.</p><p>While running these models locally provides complete control over data handling, it comes with a technical overhead and potentially reduced performance compared to cloud-based solutions. For this reason, some organizations choose to deploy AI models on dedicated cloud infrastructure, striking a balance between control and performance, though this requires that the organization maintains full ownership of the infrastructure. No-data collection AI tools or tools that support “<a href="https://docs.cursor.com/privacy/privacy">privacy mode</a>” feature represent another potential solution, though auditors should approach such vendor claims with appropriate skepticism and make sure to review their privacy policy. Even with such guarantees validated, many clients may still require additional assurances or sometimes completely prohibit the use of external AI tools with their code, so make sure to confirm this prior to beginning the AI-assisted audit.</p><h3>The AI Toolkit</h3><p>Traditionally, security auditors have relied on a combination of static analysis tools like Mythril, Slither, and Oyente for detecting known vulnerability patterns, alongside dynamic analysis tools like Echidna for fuzzing-based vulnerability discovery. While these tools remain fundamental to the audit process, auditors are beginning to add AI-powered tools as additional aids in their security process.</p><p>Through our practical experience, we’ve observed that AI tools tend to serve 4 common functions in the modern audit workflow:</p><ol><li><strong>Code understanding</strong></li><li><strong>Vulnerability detection</strong></li><li><strong>Attack vector validation</strong></li><li><strong>Documentation/report writing</strong></li></ol><p>Each category addresses specific challenges in the audit workflow, with various tools offering different approaches to solving it.</p><p>Before we dive in, <strong>we want to stress that the effectiveness of any automated tool — whether traditional static analysis or modern AI-based — ultimately depends on the expertise of the human auditor using it.</strong> Like traditional tools, AI assistants require careful human supervision and verification of their outputs.</p><h3>1. Code Understanding</h3><p>AI assistants excel at explaining code sections and complex multi-contract interactions, helping auditors rapidly grasp intricate protocol mechanics and potential edge cases. Tools like <a href="http://claude.ai/">Claude</a> and <a href="https://chatgpt.com/">ChatGPT</a> have proven particularly effective in this domain. ​​For simple smart contracts, they can often act as code explainers and sometimes generate approximate data or control flow graphs, but it is preferable to rely on dedicated tools like <a href="https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor">Solidity Visual Developer</a> for more accurate and comprehensive results.</p><p><strong>Protocol Architecture Analysis:</strong> <a href="https://www.cursor.com/">Cursor</a> has emerged as a particularly useful tool for auditors, integrating LLM capabilities directly into the development environment. One of the main advantages of this tool is its access to the full context of the codebase and its files. This makes it easy to reference code sections when asking general analysis questions about the entire codebase. For instance, in Figure 1, I use the ‘<em>@codebase</em>’ reference in Cursor to examine Uniswap V4’s codebase and ask about its swap coordination logic across all project files simultaneously. Cursor passes the question to the underlying language model along with the context of the current project files in order to retrieve an answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LqRXnZTheZrXAiEb" /><figcaption><strong>Figure 1</strong>: Asking Cursor a Codebase-wide Question in Uniswap V4</figcaption></figure><p><strong>Code Flow Explanation: </strong>Another useful feature of Cursor is the ability to select a piece of code within a contract and press a shortcut (⇧⌘+L on a Mac) to ask anything about it. In this case, only the selected lines of code get automatically added as context for the LLM.</p><p>Let’s take the infamous MakerDAO code nomenclature as an example. It is easy to get confused reading this code due to the unique naming convention. In the following example, I highlight a specific code block and ask Cursor to help me decipher the liquidation logic terminology:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L0OcRgoYxKNwCwAD" /><figcaption><strong>Figure 2: </strong>Asking Cursor to Decipher a Snippet in Maker’s DAI implementation</figcaption></figure><p>What makes Cursor particularly powerful is that it analyzes the selected lines of code while maintaining awareness of the entire codebase’s context, providing explanations that account for a broader project context. This contextual understanding is particularly valuable when investigating bugs that arise from the interplay of different contracts, inheritance patterns, or state modifications across the system.</p><p><a href="https://github.com/github-copilot">GitHub Copilot</a> is also good at assisting in understanding complex functions by providing inline explanations and suggesting potential edge cases. We compared it by running the same two examples, and while the first answer looked similar, Cursor seemed to provide better definitions and a more detailed explanation on the semantics of the Uniswap nomenclature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zerHqmHTHb9d5aN_" /><figcaption><strong>Figure 3: </strong>Asking Copilot a Codebase-wide Question in Uniswap V4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fmUvVCDugxQ1qAky" /><figcaption><strong>Figure 4: </strong>Asking Copilot to Decipher a Snippet in Maker’s DAI implementation</figcaption></figure><p><strong>Model Selection: </strong>It is worth noting that the choice of the underlying model makes a big difference. Some of the models we tried (including the newer OpenAI o1 and o3 models) produced some poor results, such as overly condensed explanations and inconsistent reasoning. Currently, Copilot still defaults to the GPT-4o model, while Cursor relies on the claude-3.5-sonnet, and for a good reason. Both of these models produce consistent quality results and are fairly comparable. When it comes to code explanation, the best performers are still GPT-4o and Claude 3.5 Sonnet.</p><p><strong>Code Visualisation:</strong> Besides the classic <a href="https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor">Solidity Visual Developer</a> extension, tools like <a href="https://www.trustbytes.io/">TRUSTBYTES’s</a> <a href="https://nextjsapp-7dycvtrugq-uc.a.run.app/">app</a> have started shifting focus from vulnerability detection to enhancing auditor understanding through visual representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hYrDd5STeweXSiVI" /><figcaption><strong>Figure 5</strong>: Code Visualization using Trustbytes’ app</figcaption></figure><p>This shift acknowledges an important truth in security auditing: visual tools that help auditors better understand complex protocols may prove more valuable than those attempting to automatically detect vulnerabilities. As one industry player noted, “vulnerabilities often emerge from subtle interactions between seemingly secure components”. Tools that enhance an auditor’s ability to grasp these interactions — often through code visualization — serve to accelerate the critical thinking process rather than bypass it. This is a prime example of a task where AI can assist but not replace human comprehension.</p><p><strong>Limitation: Potential for False Information</strong></p><p>AI systems can sometimes include false information in their responses. The proportion of false to true data varies across different models. It is better to use models that acknowledge when they cannot provide a suitable answer, rather than those that attempt to overcommit without evidence. Any data provided by AI should be verified by the auditor, as it can easily mislead and cause you to build the wrong mental model of the audited project or focus on insignificant details.</p><h3>2. Vulnerability Detection</h3><p>The space that used to be dominated by static analyzers, symbolic analyzers and fuzzers (<a href="https://github.com/crytic/slither">Slither</a>, <a href="https://github.com/ConsenSys/mythril">Mythril</a>, <a href="https://github.com/crytic/echidna">Echidna</a>, <a href="https://mythx.io/">MythX</a> — deprecated, <a href="https://github.com/smartdec/smartcheck">SmartCheck</a> — deprecated, and <a href="https://github.com/eth-sri/securify2">Securify</a> — outdated) is now witnessing the emergence of new AI-based tools. However, the inherent skepticism towards AI vulnerability detection in the security community deserves a mention.</p><p>Typically, security researchers require absolute certainty in tool outputs — a standard that current AI systems struggle to meet consistently. When a tool flags a potential vulnerability, the auditor must still verify the finding by manually tracing execution paths, understanding state changes, and validating edge cases. If this verification consistently takes longer than direct manual analysis, the tool becomes a liability rather than an asset.</p><p>This reality has led some tooling providers like TRUSTBYTES to pivot away from pure AI-based vulnerability detection towards improving auditor’s understanding of the codebase, as we discussed in the previous section. The challenge becomes particularly apparent when dealing with complex smart contract systems. Consider a potential reentrancy finding: while AI might flag suspicious patterns like external calls before state updates, understanding whether the finding represents a genuine vulnerability requires analyzing factors that AI currently struggles with — like complex access control mechanisms, protocol-specific invariants, and cross-contract state dependencies. This limitation explains why many successful AI implementations in security focus on accelerating understanding and pattern recognition rather than attempting direct vulnerability discovery.</p><p>With that out of the way, let’s look at the current landscape of vulnerability detection tools available:</p><h3>Cursor’s Bug Finder</h3><p>One of the new features launched by Cursor is the <a href="https://forum.cursor.com/t/bug-finder-how-is-it-paid/29974">Bug Finder</a>, which replaced the old “Review” functionality and seems to perform better than its predecessor in terms of false positives. This feature scans the changes you’ve made line by line against the committed branch and checks if any bugs have been introduced. This is highly useful to run during the later stages of the audit when you’re verifying remediations or bug fixes by the client. While it’s still experimental, it can be quite expensive to run depending on how many changes were made, as it works line by line to see if any bugs have been introduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O8AUVRVillFgzjAZ" /><figcaption><strong>Figure 6</strong>: Cursor’s Bug Finder Feature</figcaption></figure><p>As it analyzes the current changes, it prepares a neatly formatted Bug Report with any new issues found.</p><p>In our case, we tested it on a sample payment contract by moving the line that updates the balance and payment state before sending the money out to see if Cursor would catch it. Surprisingly, it did a good job at finding this issue (even with a free run of the Bug Finder).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rQ92vkTUSKZzQPbU" /><figcaption><strong>Figure 7</strong>: Cursor’s Bug Finder Catching a Bug</figcaption></figure><p>Interestingly, it also assigns a confidence score to the proposed findings, which can be a useful metric to keep an eye on when verifying its results.</p><p>While we’ve seen good results while using this feature on small changes, it can get expensive to execute a Bug Finder run. In the simple cases tested, only a few lines of code were modified at a time, which cost about $2-$4 per run. However, if verifying architectural changes or logic re-writes, this can get costly quickly, so keep an eye on the runtime cost before you press Submit.</p><h3>Solidity Sentinel</h3><p>Released in October 2023 by Solidity engineer <a href="https://x.com/scorpion9979">Ahmed Ihsan Tawfeeq</a>, <a href="https://theresanaiforthat.com/gpt/solidity-sentinel/">Solidity Sentinel</a> represents an interesting approach to AI-assisted auditing. Built as a specialized GPT model on top of ChatGPT (requiring Plus subscription), fine-tuned on a dataset of smart contract vulnerabilities and audit reports, it focuses specifically on smart contract security analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XqadOHnqql98d-Zr" /><figcaption><strong>Figure 8</strong>. Solidity Sentinel Chat</figcaption></figure><p>Our testing revealed impressive capabilities in vulnerability detection. When analyzing a sample vulnerable contract, Sentinel successfully identified critical issues including reentrancy vulnerabilities, broken randomness implementation, and security flaws in constructors and modifiers. The tool presented findings in a well-structured format, categorizing issues by severity and providing specific remediation steps for each vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1gqCxpL_6g0H5v3M" /><figcaption><strong>Figure 9</strong>. Solidity Sentinel — Summary of Vulnerabilities</figcaption></figure><p>Particularly noteworthy was Sentinel’s ability to generate both a comprehensive security report and offer an improved version of the contract implementing all suggested fixes. The author likely embedded specific prompt instructions about security patterns to look for, as the recommendations demonstrated solid understanding of smart contract security best practices, such as suggesting OpenZeppelin’s ReentrancyGuard, upgrading to Solidity 0.8+ for overflow protection, and implementing pull-based withdrawal patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*33wm8ZZKofqFQO1c" /><figcaption><strong>Figure 10</strong>. Solidity Sentinel — Final Recommendations</figcaption></figure><p>However, the tool has limitations. Most notably, code must be pasted directly into the chat interface rather than uploaded as files, which can be cumbersome for complex projects with multiple contracts and dependencies. This constraint makes it less practical for analyzing large-scale protocols compared to dedicated development environment tools like Cursor.</p><p>If you want to explore other GPT-derivatives geared towards auditors, there are a number of similar tools on <a href="http://theresanaiforthat.com/">theresanaiforthat.com</a>, such as AI Auditor, Solidity Auditor, SecuredAI and others built by community members.</p><h3>LightChaser</h3><p>As the top participant in Code4rena’s bot races, <a href="https://www.lightchaser.online/">LightChaser</a> implements over 1000 detection patterns and 100+ gas optimization checks, helping auditors tick some boxes and cover low-hanging fruit. Interestingly, while TRUSTBYTES pivoted towards code visualization, they have partnered with LightChaser <a href="https://x.com/TRUSTBYTES_X/status/1858554579069071641">recently</a> showing that there is demand for their automated pre-scan product. LightChaser runs locally, which helps with privacy and can be customized towards your project’s needs.</p><p>Here is one of the public audit reports produced by LightChaser over AAVE V3 code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MgaFwP10VFOAZMuR" /><figcaption><strong>Figure 11</strong>: LightChaser report of AAVE V3 code. Source: <a href="https://gist.github.com/ChaseTheLight01/66625ecfb9a2c07744a1c0c3050c560b">https://gist.github.com/ChaseTheLight01/66625ecfb9a2c07744a1c0c3050c560b</a></figcaption></figure><p>It found 67 total issues, with 3 medium severity findings. The total number of findings with pre-scan tools like this can get quite overwhelming, and looking over other public audit reports, it seems to be a common occurrence (<a href="https://gist.github.com/ChaseTheLight01/4a609494e95d69594a7ab70e19536177">Euler Vault Kit</a> report with 180 issues, <a href="https://gist.github.com/thebrittfactor/c400e0012d0092316699c53843ecad41">Axelar</a> with 113 issues). Often, some of the items are very low-hanging format-related issues like “<em>Functions not ordered according to style guide</em>” or “<em>Contract lines should not be longer than 120 characters for readability</em>”. Some higher-severity issues like “<em>Privileged functions can create points of failure</em>” require auditor judgement on which privileged functions deserve to be protected better and weigh-in the pros and cons of moving them under a multisig. While other higher-severity findings are quite useful, such as “<em>isContract is not a reliable way to determine if an address is a EOA or contract</em>” as keeping up with deprecated functions can be challenging manually.</p><h3>Peculiar</h3><p><a href="https://github.com/wuhongjun15/Peculiar">Peculiar</a> [4] represents an innovative approach that combines crucial data flow analysis with pre-trained LLMs to detect smart contract vulnerabilities more accurately. Peculiar introduces a streamlined CDFG (Crucial Data Flow Graph) that focuses specifically on the variables and relationships most relevant to potential vulnerabilities. For example, when analyzing reentrancy vulnerabilities, the CDFG captures the critical data flows around external calls and state modifications while filtering out unrelated code paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QcuO7sQvnteOrJVu" /><figcaption><strong>Figure 12</strong>: Peculiar Architecture</figcaption></figure><p>What sets Peculiar apart is its ability to analyze relationships between different parts of the contract, making it particularly effective at detecting vulnerabilities that span multiple functions or involve complex state modifications.</p><p>The tool’s architecture leverages GraphCodeBERT, a pre-trained model that understands both code structure and semantics, but adapts it specifically for vulnerability detection through a novel graph-guided masked attention mechanism. This allows Peculiar to reason about potential vulnerabilities while considering the broader context of how different contract components interact.</p><p>Below is the comparison of running Peculiar against popular tools like Mythril and Securify over the <a href="https://github.com/smartbugs/smartbugs-wild/tree/master">SmartBugs Wild Dataset</a> containing 47,398 smart contracts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*ORTzaE3HKjeID6ht" /></figure><p>The F1 score is particularly important for vulnerability detection accuracy, because it combines the measure of both, false positives (incorrectly flagging secure contracts as vulnerable) and false negatives (missing actual vulnerabilities). A tool needs to be good at both, identifying real vulnerabilities (high recall) and not raising false alarms (high precision) to be truly useful for auditors.</p><p>We can see that traditional tools like Manticore, Mythril, and Osiris show modest performance with F1 scores around 50% since they primarily rely on static analysis and symbolic execution. Slither shows improved recall (65.41%) but struggles with precision (51.97%). DR-GCN and TMP, which both use machine learning approaches, push performance further with F1 scores of 76.39% and 78.11%. However, Peculiar with its combination of custom pre-trained GraphCodeBERT model and a graph-guided mechanism stands out significantly.</p><p>While this example shows that Peculiar excels at identifying reentrancy vulnerabilities through its flow analysis, auditors should note that its graph construction process can be computationally intensive for very large contracts. The tool is <a href="https://github.com/wuhongjun15/Peculiar">open source</a> and integrates well into automated scanning pipelines.</p><h3>Latest Research</h3><ul><li><strong>SmartLLMSentry</strong> [1] (prototype) is a novel AI framework that combines traditional static analysis with LLM-powered rule generation. It achieved impressive accuracy rates in detecting vulnerabilities like reentrancy (93.12%), timestamp dependency (95.17%), and delegatecall (94.51%). While traditional static analyzers rely on manually crafted rules that need constant updates, SmartLLMSentry automates this process through LLM-based rule generation. The tool shines particularly in complex scenarios — for example, when analyzing contracts with sophisticated access control mechanisms, it can accurately distinguish between true vulnerabilities and secure patterns that might superficially resemble vulnerable code. However, being a research prototype, it’s not yet available as a production tool for auditors. Moreover, the authors state that “the current model’s generated rules are not fully automated and still require some expert intervention”.</li><li><strong>Smart-LLaMA</strong> [2] (prototype): Built on the LLaMA-3.1–8B model, Smart-LLaMA introduces a two-stage approach to vulnerability detection: 1) Smart Contract-Specific Continual Pre-Training followed by 2) Explanation-Guided Fine-Tuning. This allows the model to not only detect vulnerabilities but also provide detailed explanations for its findings. The tool achieved 91–95% accuracy across different vulnerability types. Notably, its human evaluation process involving 32 hours of expert review demonstrated both its capabilities and limitations. For instance, while excelling at detecting timestamp dependency vulnerabilities (95.17% accuracy) and identifying subtle reentrancy patterns, it required human validation for complex cases involving multiple contract interactions. Unlike other tools, Smart-LLaMA focuses on providing comprehensive explanations alongside its detections, making it particularly useful for understanding why a piece of code might be vulnerable. SmartLLaMA also exists currently as a research prototype and not available for production.</li><li><strong>SmartEmbed</strong> [3]: As a specialized detection tool, SmartEmbed uses code embeddings and similarity checking to identify vulnerability patterns across smart contracts. When applied to over 22,000 Solidity contracts, it identified a 90% code clone ratio and detected 194 clone-related bugs with 96% precision. While code clones themselves aren’t necessarily vulnerabilities, they often propagate security issues across projects when vulnerable code patterns are reused. The tool is particularly valuable during the early phases of an audit when trying to identify potential vulnerability patterns that may have been inherited from common codebases or popular implementation patterns. However, it should be noted that the tool focuses specifically on clone-related vulnerabilities and should be used alongside other detection tools for comprehensive coverage.</li></ul><p><strong>Limitation: Lack of Novel Attack Vectors</strong></p><p>A key limitation of these fully automated tools is that they tend to excel at finding <em>known</em> vulnerability patterns, but may miss <em>novel</em> attack vectors. This is largely due to how they are built, as almost all of them work based on previously known vulnerability patterns.</p><p><strong>Limitation: Outdated Pattern Recognition</strong></p><p>To keep such tools relevant, the author must constantly maintain the existing rules by which they operate, which includes updating the vulnerability search patterns in order to keep up with the latest vulnerability types known in the security community. A prime example of this not being done is a tool called <a href="https://github.com/eth-sri/securify2">Securify</a>, which was last published 6 years ago with 37 known vulnerability patterns and has not been updated since.</p><h3>3. Attack Vector Reasoning &amp; Validation</h3><p>A critical phase in any security audit is validating hypotheses for potential attack vectors. AI tools have become good partners in this brainstorming process. <a href="https://www.perplexity.ai/">Perplexity</a> and <a href="https://chatgpt.com/">ChatGPT</a> help auditors reason through attack scenarios by breaking down complex interactions without having to provide the source code. Unlike Claude, which doesn’t support opening URLs or external links, Perplexity and ChatGPT have the ability to read deployed contracts on etherscan and reason about them. Here is an example, where we ask both tools to reason through a hypothetical price manipulation attack on a <a href="https://etherscan.io/address/0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8#code">deployed</a> Uniswap ETH/USDC pool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ipsGSLIZ9zHT0MyJ" /><figcaption><strong>Figure 13:</strong> Perplexity Reasoning through a Price Manipulation Attack</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-_3dqXGXFolRYAPG" /><figcaption><strong>Figure 14:</strong> ChatGPT Reasoning through a Price Manipulation Attack</figcaption></figure><p>Both Perplexity and ChatGPT are able to access the deployed code at a given address and do a good job at breaking down the steps involved in this hypothetical attack.</p><p>Another power player in this task is the aforementioned <a href="https://www.cursor.com/">Cursor</a>.</p><p>Cursor’s deep integration with the development environment provides full visibility into the entire codebase and its dependencies. This comprehensive context is particularly valuable when validating attack vectors that span multiple contracts or rely on complex inheritance patterns. For example, when testing a potential reentrancy attack, Cursor can trace the call flow across inherited contracts, identify all relevant state modifications, and help construct a proof-of-concept that accounts for the full system state.</p><p>In the example below, we highlight a specific line of code that we believe is vulnerable to overflow due to lack of SafeMath and ask Cursor to confirm if this is a bug:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pTUd9D8j0IzQmtLY" /><figcaption><strong>Figure 15</strong>: Cursor Confirms an Overflow Bug in a Vulnerable Contract</figcaption></figure><p>This contextual awareness comes especially handy when:</p><ul><li>Tracing state changes across multiple contracts</li><li>Validating assumptions about contract interactions</li><li>Understanding protocol-wide impact of an exploit</li><li>Analyzing complex inheritance hierarchies</li></ul><p><strong>Limitations</strong>: <strong>Ethical Constraints</strong></p><p>A common challenge you may encounter is AI tools’ built-in ethical constraints when discussing potential vulnerabilities. For instance, when analyzing a possible attack vector, tools like Claude or ChatGPT might refuse to provide specific exploitation details or validate vulnerabilities due to their built-in safety protocols. Consider this example, where we ask about a specific attack vector on the Cosmos network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tNAsKAPPfRvC7obL" /></figure><p>Instead, experienced auditors have learned to:</p><ul><li>Focus queries on defensive patterns: “What security checks would prevent this vulnerability?”</li><li>Break down technical components: “What are the implications of this code pattern?”</li><li>Analyze similar historical vulnerabilities: “How does this compare to known secure implementations?”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lD8S9nYV5H6Vq5u2" /></figure><p>This ethical limitation actually reinforces good security practices by encouraging auditors to think systematically about vulnerabilities rather than focusing on exploit generation. The key is framing queries in terms of security patterns and protective measures rather than attack implementation.</p><h4>&gt;&gt; From our Auditors: Validating Findings &lt;&lt;</h4><p><strong>Christian</strong>: “When validating issues, I use a pre-trained Flan-T5 model on a dataset of report findings as the starting point. I then pass to the model both the description of the issue and the affected functions. Instead of asking the model whether something is an issue or not, I specifically instruct it to go through the functions step by step and cross-check the behavior I’ve described in the issue. This method has two key advantages:</p><ol><li>Focused Analysis: By asking the model to verify the sequence of events rather than to decide if something is an issue, it avoids the pitfalls of binary “yes” or “no” answers.</li><li>Reduced Bias: Models like GPTs tend to justify their initial response once they commit to a “yes” or “no.” This approach prevents the model from anchoring its reasoning to an early assumption. For example, if a GPT starts with “yes” or “no,” it often tailors the rest of the response to justify that position, even when it might not be entirely accurate. This is why having a model fine-tuned for this would increase the value of the analysis.”</li></ol><p><strong>Example</strong>:</p><p>Christian believes there might be an issue in the codec of marshaling/unmarshaling of a Cosmos SDK chain. He checks the hypothesis with his custom LLM. The issue ended up being invalid, and the model provided some hints about it, as shown in Figure 16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cdb5OTY2pk7tFy7r" /><figcaption><strong>Figure 16</strong>: Our Auditor Uses a Custom LLM to Test a Vulnerability Hypothesis</figcaption></figure><h3>4. Documentation and Report Writing</h3><p>The documentation phase of an audit requires both technical accuracy and clear communication for describing the issues, as well as adhering to a standard report format set by the audit company. While you can use general-purpose AI assistants like Claude or ChatGPT here, a better tool has recently been developed by Code4rena’s Engineer 0xTotem called <a href="https://code4rena.com/blog/introducing-c4-documentation-bot">Documentation Bot</a>.</p><p>Documentation Bot is specifically designed for blockchain security auditors. It employs a retrieval augmented generation (RAG) system that anchors all responses in the project’s official documentation.</p><p>The key advantage here lies in its verifiable sourcing. When documenting vulnerabilities, auditors need absolute certainty about protocol behaviors and intended implementations. While Claude or ChatGPT might provide plausible explanations based on their training data, Documentation Bot directly cites project-specific sources bringing a level of trust. Leveraging RAG architecture, it provides real-time access to verified protocol information. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EN3PhMH74Tifxe4sHvjjxw.png" /><figcaption><strong>Figure 17</strong>: Asking Documentation Bot about Liquidation Thresholds</figcaption></figure><p>The difference is crucial for audit reports — Documentation Bot’s responses are grounded in project-specific documentation, reducing the risk of incorrect assumptions or generalizations that could lead to false positives or missed vulnerabilities.</p><h4>&gt;&gt; From our Auditors: Report Writing &lt;&lt;</h4><p>One of our auditors, Christian, uses a custom-tuned LLM to keep a consistent professional tone in the audit report when documenting findings.</p><p><strong>Christian</strong>: “To train the model for report writing, I compiled all the issues I documented during audits over the past year. I structured these findings in a consistent format and used this dataset to fine-tune the model. My approach ensures that the model learns both the technical structure and the professional tone I use in reports.</p><p>Here’s the general structure I follow:</p><ul><li>Introductory Context: “<em>In {section of code}, the function {function name} does…</em>”</li><li>Problem Description: “<em>However, there is something that is not going as planned…</em>”</li><li>Impact Explanation: “<em>Consequently, it allows attackers to…</em>”</li></ul><p>The model has also picked up on specific terminology I like to use. For example, I often use the term “<em>cardinality</em>,” and the fine-tuning process ensured the model adopted this style naturally.</p><p>With this training, I can now pass my raw notes to the model, and it rewrites them in the polished and structured format I expect.”</p><p><strong>Example</strong>:</p><p>Input (Auditor’s Notes):</p><p>“<em>In Example.sol, the X function returns a boolean saying if a token is expired or not. In case the contract is not activated, the X would return 0 which summed with Y is always less than the actual block timestamp. In case the contract is not activated yet, the user would get that its token is expired which is not true. An error should be returned instead saying that the contract is not activated yet.</em>”</p><p>Output (Generated by the model):</p><p>“The X function in Example.sol is designed to determine whether a token has expired. However, when the contract is not activated, the function returns 0. Adding this result to the Y (which is also 0 for non-activated contracts) results in a value less than the current block timestamp, leading the function to incorrectly indicate that the token has expired. Consequently, this behavior misrepresents the token status when the contract has not yet been activated. Instead of returning a misleading expiration status, an appropriate error message should be generated to inform users of the contract’s non-activated state.”</p><h4>Technical Writing Assistance</h4><p>In addition to the above, general-purpose tools like Claude assist in crafting clear, technical explanations of vulnerabilities. For instance, asking to convert a technical finding into a clear report entry is not difficult to do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-XjbfG1TwXgKRH_Hx4xU6g.png" /><figcaption><strong>Figure 18</strong>: Asking Claude to Convert a Technical Finding into Report Entry</figcaption></figure><p>Each category of tools requires careful integration into existing audit workflows and should be viewed as supplements to, rather than replacements for, auditor expertise. <strong>The key is to remember that these tools are limited in different ways (some don’t have full codebase context, some have a knowledge cut-off at an older timeframe), which allows auditors to leverage them effectively in a given situation while maintaining rigorous security standards</strong>.</p><h3>The Importance of Human Oversight in AI-Assisted Vulnerability Detection</h3><p>Recent research from Zaazaa and El Bakkali’s SmartLLMSentry framework [1], along with Yu et al.’s SmartLLaMA study [2], provides valuable insights into the relationship between LLMs and human expertise in smart contract security. While SmartLLaMA achieved impressive accuracy rates of 91–95% across different vulnerability types through its novel two-stage training process, both studies importantly highlight that these AI tools are most effective when supervised by human security auditors.</p><p>The studies focused on four critical vulnerability categories that account for approximately 70% of financial losses in Ethereum smart contract attacks. SmartLLaMA demonstrated particularly strong performance in detecting timestamp dependency vulnerabilities with 95.17% accuracy, identifying issues ranging from block timestamp manipulation risks to insecure random number generation. The system achieved 93.12% accuracy in detecting reentrancy vulnerabilities, successfully identifying both single-function and cross-function reentrancy patterns, while also correctly assessing cases where protective measures like the onlyOwner modifier provided adequate security despite apparent reentrancy patterns.</p><p>However, even with these impressive results, the research revealed important limitations that underscore the necessity of human oversight. The models showed reduced accuracy when analyzing contracts with complex inheritance patterns and struggled with tracking state changes across multiple contracts. Novel attack patterns and previously unseen variations of known vulnerabilities particularly required human validation. These limitations became especially apparent in cases involving sophisticated access control mechanisms, where the models sometimes flagged secure patterns as vulnerable, requiring human expertise to validate the security measures.</p><p>The SmartLLaMA research team demonstrated the value of human supervision by incorporating 32 hours of human expert review in their evaluation process. This extensive validation proved crucial for ensuring reliability, particularly in cases involving complex inter-contract dependencies or context-dependent vulnerabilities that the AI struggled to assess independently. The system achieved 89.78% accuracy in detecting integer overflow/underflow vulnerabilities and 94.51% accuracy for <em>delegatecall</em> vulnerabilities, but required human expertise to validate findings and understand broader security implications, especially in cases involving sophisticated permission systems or complex protocol interactions.</p><p>Security auditors play several irreplaceable roles in this process. Beyond validating the AI’s detection of common vulnerability patterns, they provide critical interpretation of findings within the broader security context. Their expertise is particularly valuable in assessing economic vulnerability implications and deployment context considerations that AI models currently struggle to evaluate. The human auditor’s deep understanding of blockchain architecture and real-world attack vectors becomes essential when dealing with novel vulnerability patterns or complex cross-contract security implications.</p><p>The optimal approach appears to be a collaborative model where LLMs serve as sophisticated analytical assistants, helping auditors process larger volumes of code more efficiently and potentially identifying subtle patterns that might escape human attention. SmartLLaMA’s research supports this conclusion, showing that even with their advanced two-stage training approach, human experts were essential for validating explanations and ensuring their practical applicability, particularly for complex scenarios involving multiple contracts or novel attack vectors.</p><p>This hybrid approach maintains the benefits of automation while preserving the irreplaceable elements of human expertise: contextual understanding, nuanced judgment, and holistic security assessment. SmartLLaMA’s implementation demonstrates this through its architecture, where even after achieving state-of-the-art detection rates, the system incorporates extensive human validation components. As smart contract complexity continues to grow and new vulnerability patterns emerge, this partnership between human auditors and AI tools represents the most robust path forward for blockchain security.</p><h3>Looking Forward</h3><p>The rapid evolution of AI technology suggests we’re only seeing the beginning of its impact on security auditing. Privacy-preserving AI technologies are advancing quickly, potentially offering solutions to current confidentiality challenges. The emergence of specialized audit tools and improvements in local model deployment may soon provide more options for handling sensitive client data.</p><p>Security auditors should maintain active engagement with these developments while contributing to open-source alternatives where possible. The future likely holds more specialized tools designed specifically for the unique requirements of blockchain security auditing.</p><p>In our article, we highlighted several stages of an audit where AI tools can be powerful additions to a security auditor’s arsenal, but their effective use requires careful consideration of privacy, accuracy, and methodology. Success lies not in replacing human expertise but in augmenting it through the judicious application of these tools while maintaining rigorous security practices. As these technologies continue to evolve, their integration into audit workflows will likely deepen, making it necessary for security auditors to be proficient with them.</p><p>As this space is constantly evolving, we would be curious in your experiences using the aforementioned or other tools. If you have any insights/additions to this article, please share them in the comments below!</p><p>Our team at <a href="https://oaksecurity.io/">Oak Security</a> brings a deep understanding of intricate design trade-offs when it comes to Ethereum and Solana security models and can help you cover all aspects of architectural review, from early planning, secure design, economic consulting, secure development processes, and in-depth protocol reviews.</p><p>Check out our <a href="https://github.com/oak-security/audit-reports">audit reports</a> or contact us via <a href="/service/mailto:info@oaksecurity.io">email</a> and social media channels on <a href="https://x.com/SecurityOak">X</a> or <a href="https://www.linkedin.com/company/oaksecurity/">LinkedIn</a>.</p><p>REFERENCES</p><p>[1] O. Zaazaa and H. El Bakkali, “SmartLLMSentry: A Comprehensive LLM Based Smart Contract Vulnerability Detection Framework,” Journal of Metaverse, vol. 4, no. 2, pp. 126–137, Dec. 2024, doi: 10.57019/jmv.1489060.</p><p>[2] L. Yu, S. Cheng, H. Yuan, P. Wang, Z. Huang, J. Zhang, C. Shen, F. Zhang, L. Yang, and J. Ma, “Smart-LLaMA: Two-Stage Post-Training of Large Language Models for Smart Contract Vulnerability Detection and Explanation,” arXiv:2411.06221v1 [cs.CR], Nov. 2024.</p><p>[3] Alam, M. T., Halder, R., &amp; Maiti, A. (2024). Detection Made Easy: Potentials of Large Language Models for Solidity Vulnerabilities. arXiv:2409.10574 [cs.CR].</p><p>[4] Wu, H., Zhang, Z., Wang, S., Lei, Y., Lin, B., Qin, Y., Zhang, H., &amp; Mao, X. “Peculiar: Smart Contract Vulnerability Detection Based on Crucial Data Flow Graph and Pre-training Techniques.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bd76608e3be" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oak-security/ai-assisted-security-audits-0bd76608e3be">AI-Assisted Security Audits</a> was originally published in <a href="https://medium.com/oak-security">Oak Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solana and Ethereum Security Models]]></title>
            <link>https://medium.com/oak-security/solana-and-ethereum-security-models-fb22e750a548?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb22e750a548</guid>
            <category><![CDATA[solidity-security]]></category>
            <category><![CDATA[solana-vs-ethereum]]></category>
            <category><![CDATA[rust-security]]></category>
            <category><![CDATA[rust-vs-solidity]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 15:28:59 GMT</pubDate>
            <atom:updated>2024-10-29T15:28:59.535Z</atom:updated>
            <content:encoded><![CDATA[<p>A Deep Dive, Part 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yygr3khn3Al2YfYhWuaTDw.png" /></figure><p><strong>In Part 2 of this article, we’ll dive into:</strong></p><ul><li>Programming Model Overview</li><li>Execution Environment Security</li><li>Programming Language Safety</li><li>Account Model and State Management</li><li>Transaction Processing</li><li>Platform Maturity</li><li>Security Audits and Tools</li></ul><h3>Intro</h3><p>In <a href="https://medium.com/oak-security/solana-and-ethereum-security-models-6d6f1209f6bf">Part 1</a> of our deep dive on security models of Ethereum and Solana, we weighed the security implications of design choices made, looked at how each system positioned itself in the scalability trilemma and compared the differences between their respective consensus mechanisms. Here is a quick reminder of the key points we discussed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*ABwXsCuzk3u9JVoxzfg23Q.png" /><figcaption><strong>Table 1:</strong> Consensus Layer Security Comparison</figcaption></figure><p>We continue our analysis in Part 2, focusing on the nuances of security from a developer’s perspective. We explore the security implications of each programming model, including language safety, account structure, state management, the encompassing execution environment, and the state of security tools and auditors.</p><p><strong><em>Disclaimer</em></strong>:</p><p><em>It is important to note that this article’s goal is not to steer the reader towards using one chain over another, but instead to make them aware of the various security risks and trade-offs that can be encountered in each system. In our experience, an informed security-minded engineer familiar with the pitfalls and best practices of a particular environment stands a better chance at creating a secure application regardless of the choice of programming model.</em></p><h3>Programming Model Overview</h3><p>Ethereum and Solana have different programming models due to their underlying architecture and design goals. They each have their own benefits and drawbacks as we’ll see below, balancing trade-offs of security and flexibility in order to stay true to their original design philosophy.</p><h3>Ethereum</h3><p>The Ethereum programming model is centered around the Ethereum Virtual Machine (EVM), a decentralized, Turing-complete virtual machine that executes smart contracts. Smart contracts are written in high-level languages like Solidity and Vyper, which are then compiled into EVM bytecode. The EVM provides a virtual machine environment where smart contracts are executed in a controlled and deterministic manner, with well-defined rules for state changes and inter-contract interactions.</p><p>Solidity is the most popular language for writing smart contracts on Ethereum. It draws inspiration from C++ and shares similarities with JavaScript, making it relatively accessible for developers [1], as it adopts object-oriented programming concepts such as classes, inheritance, and interfaces. Solidity also has a strong typing system, which helps catch errors during compilation and ensures type safety during contract execution.</p><p>Users interact with the Ethereum network by sending transactions, which trigger the execution of smart contracts and incur a fee in the native cryptocurrency, Ether, based on the computational effort (gas) required. This model enables the development of a wide range of decentralized applications that leverage the security, transparency, and decentralization of the Ethereum blockchain.</p><p>For developers seeking fine-grained control or optimization, Solidity offers the ability to use inline assembly, providing direct access to the EVM. While this can lead to more gas-efficient contracts, it comes with significant risks. Assembly code bypasses many of Solidity’s built-in safety features and can introduce vulnerabilities if not used carefully. The use of assembly requires a deep understanding of the EVM, and its application is often a case of premature optimization that may compromise contract security and readability.</p><h3>Solana</h3><p>Solana’s programming model, on the other hand, is based on a high-performance, parallelized runtime called the Solana Runtime. Solana smart contracts are written in Rust, a systems programming language known for its performance and memory safety. The Solana Runtime provides a set of libraries and tools for building high-performance blockchain applications, including a parallelized smart contract execution environment called Sealevel.</p><p>Solana’s programming model emphasizes scalability, speed, and low latency, making it well-suited for applications that require high transaction throughput and fast finality. This environment is designed to run multiple contracts in parallel, allowing for efficient use of resources and high transaction processing capacity, however, exposes the system to additional risk, as we’ll cover in the next section.</p><h3>Execution Environment Security</h3><p>To understand the ins and outs of each programming model, we first need to look at the core component that makes each model work, its execution environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*-3-Pvy-nugdjV-c0sQrlsg.png" /><figcaption><strong>Table 2</strong>: Execution Environment Security Comparison</figcaption></figure><h3>Ethereum</h3><p>The Ethereum Virtual Machine is designed with a focus on deterministic execution and strong isolation. It uses a stack-based architecture and has a limited set of opcodes, which helps reduce the attack surface. In general, this design makes it easier to reason about and formally verify smart contracts for several reasons:</p><p><strong>Benefits</strong>:</p><ul><li><strong>Deterministic execution</strong>: The EVM guarantees that given the same input and state, a smart contract will always produce the same output. This predictability is crucial for formal verification, as it allows developers and auditors to reason about the behavior of contracts under different conditions.</li><li><strong>Single-threaded execution:</strong> The EVM’s single-threaded nature is an important security benefit, as it eliminates the possibility of race conditions within a single transaction, which simplifies reasoning about contract behavior and reduces a whole class of potential vulnerabilities.</li><li><strong>Synchronous contract interaction: </strong>The synchronous nature of contract interactions in Ethereum allows for more straightforward reasoning about the order of operations and state changes, which can be beneficial for security analysis.</li><li><strong>Limited instruction set</strong>: The EVM has a relatively small set of opcodes (around 140), which simplifies the analysis of smart contract behavior. Each opcode has a well-defined function, making it easier to understand and model the contract’s execution.</li><li><strong>Stack-based architecture</strong>: The EVM uses a stack-based model for computation, which is simpler to analyze compared to more complex architectures due to the fact that stack operations follow a Last-In-First-Out (LIFO) principle, making the flow of data and operations more straightforward to track and predict.</li><li><strong>Isolation</strong>: Each smart contract runs in its own isolated environment within the EVM. This isolation helps prevent unintended interactions between contracts and simplifies the analysis of a contract’s behavior. However, contracts may still have unintended impact on each other, as shown by vulnerabilities such as re-entrancy and delegatecall.</li><li><strong>Formal semantics:</strong> The EVM’s behavior has been formally specified, which provides a solid foundation for developing formal verification tools and techniques.</li></ul><p>However, these constraints can also lead to slower execution times and higher gas costs due to the following factors:</p><p><strong>Drawbacks</strong>:</p><ul><li><strong>Sequential processing</strong>. In the EVM, instructions execute sequentially, one at a time. While this simplifies reasoning about contract behavior, it also limits the overall throughput potentially increasing execution time for complex contracts.</li><li><strong>High gas costs. </strong>Since the instruction set is limited, it can result in more gas being consumed for complex computations. Furthermore, due to EVM’s stack depth being limited to 1024 elements, such complex operations may require many intermediate results, which in turn may need to use more expensive memory or storage operations to manage data, increasing gas costs even further.</li></ul><h3>Solana</h3><p>Solana’s runtime, on the other hand, uses a more performant approach. At the core is its Sealevel parallel runtime, which allows for concurrent execution of transactions, significantly increasing throughput. However, the increased complexity of parallel execution introduces new potential security concerns, such as race conditions and inconsistent state. Solana’s design attempts to mitigate these risks by implementing Account Locking in conjunction with control mechanisms such as Transaction Pre-processing, where Solana’s runtime analyzes transactions to determine which can be run in parallel without conflicts, and Optimistic Concurrency Control, where, if conflicts are detected, they are rolled back and transactions are re-executed serially. However, like in any distributed system with parallel processing, the chance of race conditions and state inconsistency may still exist.</p><p><strong>Trade-offs:</strong></p><ol><li><strong>Concurrency</strong>. Solana’s complex architecture includes support for multithreading and the Gulf Stream transaction forwarding mechanism, which can lead to race conditions and inconsistent state if not carefully managed [2], whereas the EVM’s sequential execution avoids these issues but at the cost of lower throughput.</li><li><strong>Native Execution on Validators</strong>. Solana executes code directly on validators, without relying on a virtual machine like Ethereum. Solana uses a JIT (Just-in-time) compiler to translate the BPF bytecode into native machine code that can run directly on the validator’s CPU. This JIT compilation happens directly on each validator when the program is first invoked. This approach offers better performance but potentially exposes validators to more risk if there are vulnerabilities in the runtime.</li><li><strong>Compute Units</strong>. Solana uses a system called “compute units” to charge for resource usage on the network. Solana’s compute unit system and Ethereum’s gas fee model both aim to manage resource usage, but they have different security implications. While on EVM, the cost of each operation is known in advance and doesn’t change during execution, in Solana, compute unit consumption can be non-deterministic, as it depends on the current state of the blockchain and can vary between simulations and actual execution. More specifically, in a highly concurrent environment, the account’s state might change due to other transactions being processed in the same block. This could lead to different compute unit consumption than what was initially estimated. This non-determinism can lead to unexpected transaction failures or higher costs, potentially enabling certain types of attacks, where malicious actors create transactions that behave differently in simulation vs. actual execution.</li><li><strong>State Rent</strong>. Unlike other blockchains, Solana charges accounts “rent” for storing data on-chain. This is designed to compensate validators for maintaining data on the blockchain. Alternatively, accounts can maintain a balance equivalent to 2 years&#39; worth of rent to keep their account rent-exempt. With this requirement come a number of security considerations. In general, it helps prevent attackers from cheaply filling the blockchain with useless data and makes large-scale DoS attacks more expensive. Additionally, state rent incentives ensure that validators are compensated for maintaining state, thus enhancing network security. However, this feature introduces its own security issues, such as the possibility of having your state unintentionally and permanently deleted, rendering the program unusable or locking funds forever.</li><li><strong>Resource Exhaustion</strong>. While there are certain limits in place (transaction size limit, compute unit budget, rent economics, and optional rate limiting for validators), the higher throughput and lower fees on Solana could potentially make it easier for attackers to consume large amounts of network resources. As an example, consider a program that attempts to create 1000 new accounts in a single transaction. In practice, this transaction would likely fail due to exceeding compute unit limits or transaction size limits before it could create all 1000 accounts. However, if many such transactions were submitted concurrently, it could still lead to a resource strain on the network. This flexibility in Solana translates to potential resource exhaustion attacks if not properly managed. In contrast, EVM’s strict limits provide clear boundaries in such cases, but end up constraining complex contracts.</li></ol><p>In summary, while Solana’s execution environment is pushing the boundaries of high throughput, it exposes itself to additional risk from high concurrency, native execution and resource strain on the network.</p><h3>Programming Language Safety</h3><p>Ethereum and Solana differ significantly in their smart contract programming languages. The language choice impacts the security landscape of each platform, influencing aspects such as existing vulnerability types, ease of auditing, and the likelihood potential for certain classes of bugs. Understanding these differences and being familiar with the best practices is crucial for developers and auditors working on these projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*e99HEYO33C6Xq93tKzDWDw.png" /><figcaption><strong>Table 3</strong>: Language Security Comparison</figcaption></figure><h3>Ethereum — Solidity</h3><p>Solidity, designed specifically for Ethereum smart contracts, offers a relatively simple syntax due to its JavaScript-like syntax. As a contract-oriented language, Solidity organizes code into contracts similar to classes in object-oriented programming. One of Solidity’s main strengths lies in its tailored design for blockchain environments, particularly the Ethereum Virtual Machine (EVM). While Solidity is the most popular language for Ethereum development, it’s important to note that many features like memory management, gas optimization, and the use of wei/ether units for transactions are actually inherent to the EVM itself and thus applicable to other EVM-compatible languages like Vyper and Fe.</p><p><strong>Type System</strong></p><p>Solidity is statically-typed and requires explicit type declarations for variables, which helps catch errors at compile-time. However, the strength of the type system is mediocre at best when compared to more robust languages like Rust or Haskell. For instance, Solidity does not offer generics, which limits code reusability and type-safe abstractions. Its handling of null values for reference types can lead to unexpected runtime errors, as it lacks a built-in mechanism like Rust’s Option type to enforce null safety at compile-time. Additionally, Solidity’s type inference is limited, often requiring explicit type declarations where more advanced type systems could infer types automatically. These limitations in Solidity’s type system mean that while it can catch basic type mismatches, it may fail to prevent more subtle type-related bugs.</p><p><strong>Access Control and Visibility</strong></p><p>Solidity supports visibility modifiers, which play a crucial role in controlling access to functions and state variables within smart contracts. These visibility modifiers help in defining the scope and accessibility of contract elements, which is crucial for security and gas optimization in smart contract development. For example, using private or internal for functions that don’t need external access can prevent unintended interactions and potentially save gas. It’s worth noting that while private and internal restrict access within the smart contract code, all data on the blockchain is publicly visible. These modifiers prevent other contracts from accessing the data or functions directly, but the information can still be read from the blockchain itself.</p><p><strong>Memory Management</strong></p><p>Solidity’s memory management system combines automated handling with developer-driven decisions, reflecting the unique constraints of blockchain environments. While the language automatically manages basic memory operations like allocation and deallocation for simple value types and function-local variables, it requires developers to make explicit choices for complex data structures. This hybrid approach manifests in Solidity’s distinct data locations: storage, memory, and stack, each with its own cost and persistence characteristics. Developers must carefully consider these locations when working with arrays, structs, and other complex types to optimize gas usage and ensure correct behavior. The system doesn’t demand manual memory allocation and deallocation as in languages like C, but it does necessitate a deep understanding of how data is stored and accessed in the Ethereum Virtual Machine. This aims to balance ease of use with the fine-grained control needed for efficient smart contract development, where every operation has a tangible cost in gas. Consequently, effective memory management in Solidity becomes a crucial skill, directly impacting both the functionality and economic efficiency of smart contracts.</p><p><strong>Inheritance</strong></p><p>Solidity supports a multi-inheritance model, allowing contracts to inherit properties and functions from multiple parent contracts. Additionally, the language supports abstract contracts and interfaces, further enhancing the flexibility of its inheritance system. This allows developers to create complex, hierarchical structures and promote code reuse. While powerful, Solidity’s inheritance model requires careful consideration to avoid potential pitfalls such as the diamond problem or unintended function shadowing. Developers must be mindful of the inheritance hierarchy and use modifiers like super to explicitly call functions from parent contracts when necessary.</p><p><strong>Code Reuse and Organization</strong></p><p>Complementing its inheritance capabilities, Solidity offers robust mechanisms for code organization and modularization. Within a single source file, developers can define several distinct contracts, promoting modular design and separation of concerns. This feature allows for logical grouping of related functionalities and facilitates easier testing and maintenance. Furthermore, Solidity’s import functionality lets programmers incorporate code from external files, enabling the use of shared libraries, interfaces, and pre-existing contracts. This modular approach extends beyond single files, allowing developers to create reusable components that can be shared across multiple projects. Solidity also supports the creation of libraries, which are deployed once and can be used by multiple contracts, saving gas costs and promoting standardization.</p><p><strong>Community</strong></p><p>Solidity has a large and active community that plays a crucial role in the language’s evolution and security. This ecosystem of developers, researchers, and blockchain enthusiasts contributes significantly to identifying and mitigating common vulnerabilities in smart contracts. The community-driven approach has led to the development of extensive documentation, best practices, and security guidelines, which are continually updated to address emerging threats. Organizations like OpenZeppelin provide widely used, audited contract libraries that implement common functionalities securely, reducing the risk of vulnerabilities compared to custom implementations. Furthermore, community-driven initiatives like EIPs (Ethereum Improvement Proposals) facilitate discussions and implementations of standards and language improvements, ensuring that Solidity evolves to meet the changing needs of the blockchain.</p><p><strong>Drawbacks</strong></p><p>Solidity’s flexibility can be a double-edged sword. Its less strict type system, fine-grained memory management, complex inheritance, and implicit conversions can lead to subtle bugs and security issues if not carefully managed. Notably, Solidity contracts are prone to various well-known vulnerabilities such as reentrancy attacks and integer overflow/underflow problems, though a recent language update has introduced built-in overflow protection for arithmetic operations (starting with Solidity version 0.8.0) that automatically inserts checks for integer overflow and underflow [4]. Re-entrancy can be addressed by using re-entrancy guards or by following the Checks-Effects-Interactions design pattern, which reduces the risk of re-entrancy attacks by ensuring state changes are complete before external interactions [5].</p><h3>Ethereum — Vyper</h3><p>Drawing inspiration from Python, Vyper is an alternative language to Solidity that compiles to bytecode targeting the EVM. It features a clean, readable syntax that aims to make smart contract development more accessible and less error-prone. Its key features include strong typing, built-in bounds and overflow checking, and restrictions on complex language constructs that could lead to vulnerabilities or excessive gas consumption. Unlike Solidity, which offers a wide range of features and flexibility, Vyper intentionally limits its functionality to reduce the potential for complex, error-prone code. This approach is based on the principle that simpler code is easier to audit and less likely to contain hidden vulnerabilities. For instance, Vyper removes features like modifiers, inheritance, and recursive calling, which can lead to unexpected behavior or be exploited if not carefully implemented.</p><p>Vyper enforces stricter safety measures by default. It has fewer implicit type conversions, reducing the risk of unexpected behavior due to type coercion. Vyper also implements automatic bounds and overflow checking for arithmetic operations [6]. This means that any arithmetic operation that would result in an overflow or underflow will cause the transaction to revert, preventing silent errors that could lead to unexpected behavior or vulnerabilities.</p><p>Finally, Vyper also eliminates infinite loops and adopts a more explicit approach to decimal arithmetic, reducing the risk of precision errors that could be exploited in financial contracts. While these limitations may make some complex operations more verbose or cumbersome to implement in Vyper, they align with its core philosophy of prioritizing security and auditability over feature richness. This design approach can lead to smart contracts that are potentially more secure by default, though it may require developers to adapt their coding practices and problem-solving approaches when transitioning from Solidity to Vyper.</p><p>While Vyper was designed with certain security principles in mind, it can, like any language, contain vulnerabilities. In July 2023, a critical vulnerability was discovered in the Vyper compiler that was exploited by multiple attackers, resulting in an estimated $52 million loss from various projects, including Alchemix, JPEG’D, and Metronome [7]. This vulnerability allowed for potential re-entrancy attacks in certain smart contracts, particularly those using view functions within state-changing functions. This incident significantly impacted the perception of Vyper’s security and highlighted that no language is inherently immune to vulnerabilities while stressing the importance of auditing not just smart contracts, but also the tools and compilers used in their development.</p><h3>Solana — Rust</h3><p>Solana’s use of Rust for smart contract development presents a notably different approach to blockchain programming compared to Ethereum’s Solidity and Vyper. Rust, as a systems programming language, brings its own set of security advantages to the table. Its ownership model and strict type system catch many common programming errors at compile-time, preventing issues like null or dangling pointer references, data races, and buffer overflows. This compile-time safety net can significantly reduce the occurrence of certain classes of vulnerabilities that might slip through in Solidity or Vyper code.</p><p>However, unlike Solidity and Vyper, Rust wasn’t specifically designed for blockchain development. This means it lacks some of the blockchain-specific abstractions and safety features that are built into Ethereum’s smart contract languages. For instance, Solidity provides native constructs for handling Ether, emitting events, and managing contract storage, which are understood by the Ethereum Virtual Machine (EVM). Vyper goes a step further by intentionally limiting certain features to enhance security, such as disallowing recursive calling and infinite loops. In contrast, Rust requires these blockchain-specific features to be implemented through libraries or frameworks, which can introduce additional complexity and potential for error if not carefully managed.</p><p>Also, Rust’s more general-purpose nature allows for greater flexibility in implementing complex, safe systems without sacrificing performance, which can be advantageous for certain types of blockchain applications, such as Game engines, Cryptographic libraries, zero-knowledge proof algorithms, or any systems processing large amounts of data in real-time. Its performance characteristics and fine-grained control over system resources align well with Solana’s focus on high throughput and low latency. However, this power comes with increased responsibility for developers to implement blockchain-specific safety checks and best practices that are automatically enforced in languages like Vyper.</p><p>Let’s look at some of Rust’s advantages in details:</p><h4>Ownership Model</h4><p>Rust’s ownership model is a unique approach to memory management that ensures memory safety without the need for a garbage collector. At its core, the model is based on three key rules: each value in Rust has an owner (a variable), there can only be one owner at a time, and when the owner goes out of scope, the value is automatically dropped (deallocated). This system is enforced at compile-time through a set of rules that track the lifetime of values and references. Having these properties helps prevent dangling pointers, eliminates double free errors, and ensures memory is freed as soon as it’s no longer needed. It also increases performance since no garbage collection cycles are needed.</p><h4>Strict Typing System</h4><p>Rust’s strict typing system is a cornerstone of its approach to ensuring program correctness and safety. The system is characterized by its rigorous enforcement of type rules, with no implicit type coercion or automatic type conversion between incompatible types. This strictness extends to generics, traits, and lifetimes, allowing for powerful abstractions without sacrificing type safety. Rust’s enums and pattern matching further enhance type safety by enabling exhaustive checks on all possible variants. Thanks to this, Rust is able to catch type-related errors early and improve code clarity and self-documentation.</p><h4>Race Condition Prevention (Not Re-entrancy)</h4><p>The language prevents data races at compile-time by enforcing the rule that data can either have multiple readers or a single writer, but not both simultaneously. This is achieved through the concepts of shared and mutable borrows: multiple immutable references (&amp;T) to data are allowed, but only one mutable reference (&amp;mut T) can exist at a time. Rust’s Send and Sync traits further ensure thread safety by controlling which types can be safely transferred between threads or shared across thread boundaries. The Mutex and Arc types provide safe mechanisms for sharing mutable state between threads when necessary. By embedding these concurrency rules into the type system, Rust forces developers to explicitly handle potential race conditions, making it much harder to accidentally introduce threading bugs. While related, data races are not the same concept as reentrancy. Solana’s protection against reentrancy isn’t primarily achieved through Mutex and Arc types. Instead, it’s built into the architecture of how Solana executes transactions via mechanisms, such as Account Locking, Cross-Program Invocation restrictions, and atomic execution of instructions within a transaction.</p><h4>Explicit Handling of All Cases</h4><p>Finally, Rust’s emphasis on explicit handling of all possible cases through pattern matching, particularly when used with enums, leads to a more robust code.</p><p><strong>Exhaustive checking</strong>: The Rust compiler requires that all possible cases in a pattern match be handled explicitly. This means developers must consider and account for every potential scenario, reducing the likelihood of overlooking edge cases or unusual states.</p><p><strong>No implicit defaults</strong>: Unlike switch statements in some languages that might have an implicit “fall-through” behavior, Rust’s pattern matching requires explicit handling of each case. This eliminates unintended default behaviors and makes the code’s intent clearer.</p><p><strong>Compile-time error detection:</strong> If a new variant is added to an enum, the compiler will flag all pattern matches on that enum that don’t handle the new case. This ensures that when the code evolves, developers are forced to update all relevant parts of the program to handle new states or conditions.</p><h4>Large Set of Reusable Libraries</h4><p>As a general-purpose programming language used in a wide variety of domains including systems programming, web development and game development, Rust has a very active open-source community, more reusable libraries and a larger ecosystem compared to Solidity. However, although the official Rust package registry, crates.io, hosts tens of thousands of packages, Solidity’s libraries are specifically tailored for blockchain development.</p><p>All these features collectively make Rust an attractive choice for security-critical applications, as they can eliminate entire classes of vulnerabilities before deployment.</p><p>However, Rust’s power comes with increased responsibility. The language has a steeper learning curve, which can potentially lead to misuse of its paradigm and syntax by less experienced developers. Additionally, while Rust excels in general-purpose programming, it lacks some of the blockchain-specific abstractions found in Solidity, such as the following:</p><h4>Shortcomings:</h4><p><strong>No built-in types for blockchain addresses or native currency. </strong>Rust requires custom implementations, whereas Solidity has a built-in address type for representing Ethereum addresses along with native support for handling Ether with msg.value and address.transfer().</p><p><strong>No built-in concept of contract storage. </strong>Manual implementation of state persistence is needed, often through serialization and external storage APIs. Solidity provides storage and memory keywords for different data persistence levels.</p><p><strong>No built-in support for event emission. </strong>Rust requires custom implementation or framework support for event emission, while Solidity provides native event keyword for declaring and emitting blockchain events.</p><p><strong>No native concept of blockchain-specific function modifiers. </strong>Function behavior must be implemented manually or through framework macros, whereas solidity supports function modifiers (e.g., payable, view, pure) to declare function properties and behavior.</p><p><strong>No native ABI (Application Binary Interface) generation for blockchain interactions. </strong>Rust requires manual implementation or the use of external libraries for ABI handling. In contrast, Solidity provides automatic ABI generation for contract functions and events, as well as built-in support for ABI encoding and decoding of function calls and parameters.</p><p><strong>Lack of native gas counting</strong>. When writing Solana smart contracts in Rust that compile to WebAssembly, it’s difficult to predict and assign appropriate computational costs (gas fees) to different operations, since Rust doesn’t natively support this kind of resource tracking.</p><p><strong>Presence of non-deterministic features</strong>. System languages may support non-deterministic features, such as access to system time, non-deterministic iteration over maps and sets. These can be addressed when using WebAssembly.</p><p><strong>Supply chain risks.</strong> Many libraries that are not blockchain specific can lead to a higher attack surface for blockchain applications through supply chain attacks but also risks through breaking changes or unsupported libraries.</p><p>Typically, frameworks and libraries exist that address these shortcomings, but they add complexity, may require more boilerplate code for certain blockchain operations and could potentially introduce errors if not implemented correctly.</p><p>Ultimately, the security of smart contracts depends not just on the chosen language, but also on developer expertise, platform-specific considerations, and rigorous testing and auditing processes. Solidity benefits from a mature ecosystem of blockchain-specific security tools and patterns, while Rust relies more on its inherent safety features to prevent vulnerabilities. Both languages can be used to write secure smart contracts, but they require different approaches and considerations in terms of security best practices and potential pitfalls.</p><h3>Account Model and State Management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*x3JnCrayyapJt1p4lOQHBA.png" /><figcaption><strong>Table 4</strong>: Account and State Management Security Comparison</figcaption></figure><h3>Ethereum</h3><p>Ethereum’s account-based model bears similarities to traditional banking systems, with each account having a unique address and associated balance. However, Ethereum distinguishes itself by featuring two types of accounts:</p><ul><li><strong>Externally Owned Accounts (EOAs)</strong> and</li><li><strong>Contract Accounts</strong></li></ul><p>EOAs are controlled by private keys, allowing users to initiate transactions and manage funds directly. Their security largely depends on user practices in key management. In contrast, Contract Accounts contain and execute code, functioning as autonomous entities on the blockchain. Contract accounts face risks related to code exploits and logic flaws. Their complexity can lead to unintended behaviors, especially in interactions with other contracts.</p><p><strong>Ownership.</strong> While Contract Accounts don’t have conventional owners, they can incorporate privileged access functions to manage administrative rights when necessary. This dual-account system enables Ethereum to support both simple transactions and complex smart contract operations within a unified framework.</p><p><strong>State Management.</strong> Building upon this structure, Ethereum’s storage model further differentiates EOAs from Contract Accounts. EOAs utilize a minimal form of global storage, primarily for the account’s balance and nonce (transaction count). Contract Accounts, however, have access to both temporary local storage and persistent global storage, allowing them to maintain complex state information. This versatility enables smart contracts to store and manipulate arbitrary data structures, enhancing their functionality. Nevertheless, this flexibility also introduces potential security considerations. Although each contract’s storage is isolated, preventing direct access or modification by other contracts, indirect vulnerabilities can arise. For instance, improper use of the <em>‘delegatecall’</em> function can allow a malicious contract to execute another contract’s code within its own storage context, potentially causing unintended state changes, which can lead to severe security vulnerabilities. Moreover, upgradeable contracts employing proxy patterns must carefully manage storage layouts to avoid collisions during upgrades. Finally, the account model necessitates meticulous nonce management in EOAs to prevent replay attacks, adding another layer of complexity to Ethereum’s security landscape.</p><h3>Solana</h3><p>Solana’s account and state model differs significantly from Ethereum’s. While the basic structure of accounts is uniform (each account has balance, data and an owner), Solana maintains a clear separation between program code and data storage. There are two primary types of accounts:</p><ul><li><strong>Program Accounts</strong>, which contain executable code and</li><li><strong>Data Accounts</strong>, which store state information and can be modified by their owning programs</li></ul><p>Solana maintains a clear separation between program code and data. This separation of concerns can enhance security by making it harder for malicious programs to directly manipulate state in unexpected ways. However, Cross-Program Invocation requires careful consideration. While enabling composability, it introduces complexity in security analysis due to potential unexpected interactions between programs.</p><p><strong>Ownership</strong>. Each account has a single owner (usually a program), which is the only entity allowed to modify the account’s data. This ownership model can improve security by limiting the ability of malicious programs to interfere with accounts they don’t own.</p><p><strong>Rent</strong>. Solana introduces the concept of “rent,” where accounts must maintain a minimum balance to cover the cost of storing their data on the network, encouraging efficient use of blockchain storage. This has a couple of security implications. Primarily, it helps prevent state bloat by discouraging unnecessary account creation and retention, which reduces the attack surface for potential Denial-of-Service (DoS) attacks on the chain. The system also provides an automatic cleanup mechanism for accounts with insufficient balance, mitigating risks from abandoned accounts. Furthermore, the rent system creates an economic disincentive for attacks by making it costly to create and maintain multiple accounts. This aligns incentives for users and developers to write efficient programs and manage account lifetimes carefully, potentially reducing security vulnerabilities from poorly optimized contracts. However, state pruning also introduces its own security risks. If rent is not paid, state may be unintentionally deleted, which can render Solana programs unusable and lock funds forever. Additionally, garbage collection timing creates a potential security risk: When closing an account (by setting its balance to zero), the actual removal doesn’t happen until after the entire transaction finishes. This means that the account can be <a href="https://solana.com/docs/core/fees#garbage-collection">“reopened” within the same transaction</a> via a later instruction. This is risky because developers might assume an account is fully cleared as soon as it’s closed when in reality its data persists until the transaction ends. To prevent security issues, programs should always explicitly clear account data when closing accounts.</p><p><strong>State Management.</strong> Solana’s state model is closely tied to its account structure and is designed for high performance and scalability. Instead of Ethereum’s global state trie, Solana uses a more localized approach to state management. Each account in Solana is responsible for its own state, and this state is directly accessible and modifiable by the programs associated with that account. This design choice allows for parallel execution of transactions, as long as they don’t interact with the same accounts, contributing significantly to Solana’s high throughput. However, this model also introduces new challenges. Developers must carefully manage account permissions and program interactions to prevent unauthorized access or modifications. Additionally, Solana’s emphasis on performance leads to a more complex programming model, where developers need to be mindful of resource usage and optimize their code for efficient execution within Solana’s runtime environment.</p><h3>Transaction Processing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*15YKe9gJaTRjn4rvl1qLkA.png" /><figcaption><strong>Table 5</strong>: Transaction Processing Security</figcaption></figure><p>Ethereum processes transactions sequentially in blocks, using a proof-of-stake consensus mechanism. This sequential approach provides predictable transaction ordering, but results in slower finality times, typically taking several minutes for transactions to be confirmed. This can make it more vulnerable to front-running attacks, as we’ve covered in <a href="https://medium.com/oak-security/solana-and-ethereum-security-models-6d6f1209f6bf">Part 1</a> of our deep dive, where malicious actors exploit the predictable ordering to insert their own transactions ahead of others. However, its larger and more diverse validator set enhances decentralization and overall network security.</p><p>While Solana’s rapid parallel processing and near-instant finality can provide certain advantages in transaction speed and user experience, the impact on issues like double-spending or front-running may be less significant than initially apparent. As seen in more established networks like Ethereum, sophisticated MEV extraction and front-running can occur at speeds much faster than block finality, potentially negating some of the security benefits of faster finality times. Note that MEV and front-running are mitigated by efforts such as MEV-Boost and private relays.</p><p>Solana’s transaction processing model, while innovative, does have some disadvantages. The high-throughput design can lead to increased network congestion during peak usage, potentially causing transaction failures or timeouts. Additionally, developers face a steep learning curve when designing smart contracts for Solana, as they must carefully consider potential race conditions and balance the benefits of parallel processing with the constraints imposed by the PoH-based transaction ordering. This can make certain types of applications more challenging to implement correctly on the Solana platform.</p><h3>Platform Maturity</h3><p>Ethereum, launched in 2015, has enjoyed a significant head start in terms of ecosystem maturity. With a longer history, it has more battle-tested components in many areas, such as smart contracts, development tools, and wallet ecosystems. This further permeates into the core internal components of the system as well, such as multiple consensus client implementations (which contributes to its decentralization and resilience), well-documented patterns and anti-patterns of its primary language, Solidity, and stability of the EVM itself. Tools like Foundry, Truffle, Hardhat, and Remix have been around longer, have gone through multiple iterations, and offer more comprehensive features. They benefit from years of community contributions and a vast ecosystem of plugins and extensions. Tools like Ethers.js, Web3.js, Slither and Echidna have been battle-tested in production environments for years and are considered industry standards.</p><p>Solana, introduced in 2020, represents a newer approach to blockchain architecture. While it lacks Ethereum’s long-term track record, it has rapidly developed a growing ecosystem. Solana’s consensus mechanism, combining PoS with PoH, is innovative but has faced challenges with network stability. With 9 total outages Solana has experienced during its lifetime, according to Solana’s <a href="https://status.solana.com/uptime?page=3">uptime tracker</a>, and the most recent 5-hour outage happening just in <a href="https://blockworks.co/news/solana-downtime-post-mortem">February of this year</a>, Solana still seems to be stuck in the early stage of maturity.</p><p>Its use of Rust for smart contracts offers potential security advantages but has a steeper learning curve and fewer established best practices compared to Solidity. Finally, Solana provides the <a href="https://www.anchor-lang.com/">Anchor framework</a>, which is similar to Ethereum’s Truffle framework for ease of development. Beyond that, it abstracts away security-relevant complexity, particularly in areas like account access control.</p><p><strong>Integration</strong></p><p>Besides the maturity difference in the components themselves, the integration between different tools and third-party services should also be considered.</p><p><strong>Template Contracts</strong></p><p>Ethereum’s <a href="https://github.com/OpenZeppelin/openzeppelin-contracts">OpenZeppelin contracts</a>, for example, are pre-audited, standardized contracts that significantly reduce development time and potential security risks. They have undergone numerous audits and have been battle-tested in high-stakes environments. This level of security vetting is still ongoing for many of Solana’s equivalent tools and integrations.</p><p><strong>Standards</strong></p><p>Adherence to community-accepted standards, such as Ethereum’s <a href="https://eips.ethereum.org/erc">ERC</a> ensures interoperability between different parts of the ecosystem. Solana has taken a similar path with <a href="https://spl.solana.com/feature-proposal">SPL</a> (Solana Program Library). Compared to Ethereum, these standards are newer and still evolving, but rapidly gaining adoption.</p><p><strong>Documentation and Help</strong></p><p>The Ethereum community has produced comprehensive guides, best practices, and security patterns accumulated over years of development and real-world usage. Key resources include: Ethereum Foundation’s <a href="https://ethereum.org/en/developers/docs/smart-contracts/security/">official documentation</a>, OpenZeppelin’s extensive <a href="https://github.com/OpenZeppelin/openzeppelin-contracts">library</a> of audited smart contracts and security tools, Consensys <a href="https://consensys.github.io/smart-contract-best-practices/">security best practices</a>, interactive developer tutorials like <a href="https://cryptozombies.io/">CryptoZombies</a>, and numerous answers in communities like <a href="https://ethereum.stackexchange.com/">StackExchange</a> and <a href="https://www.reddit.com/r/ethereum/">Reddit</a>.</p><p>In comparison, Solana has many of the same outlets, but they are still catching up in terms of size, depth and breadth of security content. Solana’s community resources, for example, while growing, are <a href="https://solana.stackexchange.com/">not as numerous</a> (7,000 answers vs 60,000 on Ethereum). The Solana <a href="http://solanacookbook.com/">Cookbook</a> provides practical examples, but it doesn’t have the same depth of security-specific content as Ethereum’s resources. Although not directly comparable to OpenZeppelin, Solana’s <a href="https://github.com/solana-labs/solana-program-library">spl-token repository</a> offers a foundation for building token-based applications on Solana. On the tutorial side, several developer resources exist on the <a href="https://solana.com/developers">official website</a> which have grown significantly lately, from the <a href="https://beta.solpg.io/">Solana Playground</a> to actual <a href="https://solana.com/developers/courses">courses</a> you can take, supplemented by the addition of Solana <a href="https://buildspace.so/solana-core">BuildSpace</a> community-driven tutorial.</p><p>Overall, the maturity gap between Ethereum and Solana ecosystems is noticeable but slowly shrinking. While Solana is growing rapidly and provides accessible entry points for newcomers, Ethereum’s documentation is more extensive and mature making it a safer and easier choice by default for developers.</p><h3>Security Audits and Tools</h3><p>As two of the most prominent smart contract platforms, Ethereum and Solana have each fostered unique ecosystems of security audit firms and tooling. These resources play a crucial role in safeguarding the billions of dollars locked in smart contracts and decentralized applications. Our comparison in this section delves into the intricate web of audit firms, analysis tools, formal verification methods and best practices that have emerged to protect these frontiers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*PaNV4QuiE21lqp9TBZIOBA.png" /><figcaption><strong>Table 6</strong>: Audits and Tooling Comparison</figcaption></figure><h3>Security Audit Landscape</h3><p><strong>Ethereum</strong></p><p>The growth and evolution of the security audit landscape has been staggering since Ethereum’s inception. Starting with just a handful of players in the first year of launch: <a href="https://www.openzeppelin.com/">OpenZeppelin</a>, <a href="https://www.solidified.io/">Solidified</a> (acquired by <a href="http://oaksecurity.io/">Oak Security</a>), <a href="https://consensys.io/diligence/">Consensys Diligence</a>, New Alchemy and <a href="https://quantstamp.com/">Quantstamp</a>, there are now over 70 firms providing security audit services on Ethereum [8]. Nowadays, the Ethereum security audit landscape is characterized by a diverse ecosystem of professional audit firms, competitive platforms, and bug bounty programs, each playing a crucial role in enhancing the security of smart contracts and decentralized applications.</p><p>Established security audit firms like <a href="https://www.trailofbits.com/">Trail of Bits</a>, <a href="https://www.openzeppelin.com/">OpenZeppelin</a> and Oak Security’s <a href="https://www.solidified.io/">Solidified</a> have significantly shaped the security standards in the Ethereum ecosystem. These firms employ expert auditors who conduct thorough independent code reviews, perform automated and manual testing, then combine their findings to provide comprehensive reports detailing vulnerabilities and recommendations. Their work has helped establish best practices and raise awareness about common security pitfalls in smart contract development.</p><p>In recent years, audit competition platforms like <a href="https://code4rena.com/">Code4rena</a> and <a href="https://www.sherlock.xyz/">Sherlock</a>, and <a href="https://cantina.xyz/welcome">Cantina</a> have emerged, introducing a more open approach to security audits. These platforms allow multiple auditors to compete in finding vulnerabilities, increasing coverage while often compromising a deep understanding of the targeted codebase. Simultaneously, bug bounty platforms such as <a href="https://immunefi.com/">Immunefi</a> have gained prominence, offering substantial rewards for discovering critical vulnerabilities in live projects. This multi-faceted approach has created a more robust security landscape, incentivizing a wider pool of talent to contribute to the overall security of the Ethereum ecosystem.</p><p><strong>Solana</strong></p><p>Solana’s audit landscape is less mature and diverse than Ethereum’s. While there are professional audit firms that specialize in Solana, such as <a href="https://osec.io/">Ottersec</a>, <a href="https://kudelskisecurity.com/">Kudelski Security</a>, <a href="https://neodyme.io/">Neodyme</a> and <a href="http://www.sec3.dev/">Sec3</a>, the number of firms with deep expertise in Solana’s architecture and Rust programming language is more limited. This is partly due to Solana’s newer status, its unique architecture with emphasis on high throughput, and its use of Rust, which has a smaller developer community compared to Ethereum’s Solidity.</p><p>The competitive audit and bug bounty scenes are also less developed on Solana. While platforms like Immunefi do support Solana projects, the number and size of bounties are generally smaller than those for Ethereum projects. Solana-specific audit competition platforms are scarce, with most projects relying on traditional audit firms or in-house security measures.</p><p><strong>Auditor Track Record</strong></p><p>While the selection of the right security partner can be a daunting task, we recommend paying special attention to the past track record of each audit firm. Resources such as <a href="https://rekt.news/leaderboard/">Rekt Leaderboard</a> outline past project exploits along with their responsible audit partner, which gives you an idea of their quality of work. The fewer times you see an established auditor appear on this list, the better.</p><p><strong>Report Transparency</strong></p><p>In an effort to share the results of an audit with everyone (not just the client company), in late 2017, Solidified became the first Ethereum auditor to make a policy of public disclosure for all of its <a href="https://github.com/solidified-platform/audits">audit reports</a>. Several other auditors like Trail of Bits and OpenZeppelin soon followed suit, while others kept the disclosures private citing non-disclosure agreements and other restrictive contracts as the prime reason to avoid disclosure. While there certainly should be a grace period given to the client to address and deploy fixes to the discovered issues, we believe that ultimately, vulnerability findings should live in the public domain, so that users can make an informed decision about the safe use of a protocol. Thus, we recommend selecting an auditor that openly discloses past audit reports for transparency of all, not just the client.</p><h3>Formal Verification Methods</h3><p>Formal verification of smart contracts is a mathematical proof of correctness for a specific program and can be a powerful tool for improving security, but it’s not infallible. The effectiveness of formal verification depends heavily on the correctness and completeness of the specification. If the specification itself is flawed or doesn’t capture all possible scenarios, vulnerabilities can still slip through even after formal verification.</p><p>Additionally, formal verification typically is time-consuming, expensive, and requires specialized expertise, potentially slowing down development cycles. The process may not catch all possible issues, particularly those related to real-world interactions or mismatches between formal specifications and actual intended behavior.</p><p><strong>Ethereum</strong></p><p>Formal verification on Ethereum has seen considerable development but is still not mainstream for most smart contracts on Ethereum. The use of Solidity and the EVM has led to the creation of several specialized tools and frameworks for formal verification:</p><ol><li><a href="https://github.com/runtimeverification/evm-semantics?tab=readme-ov-file">K Framework</a>: Used to create formal semantics for EVM (KEVM), allowing for rigorous analysis of smart contracts.</li><li><a href="https://www.certora.com/prover">Certora Prover</a>: A popular tool for formal verification of Solidity contracts, used by major DeFi projects.</li><li><a href="https://github.com/ethereum/act">Act</a>: A specification language for formal verification of Ethereum smart contracts.</li><li><a href="https://docs.soliditylang.org/en/v0.8.26/smtchecker.html">SMTChecker</a>: Tool integrated into the Solidity compiler, it uses SMT (Satisfiability Modulo Theories) solvers for automated reasoning about contracts.</li></ol><p>These tools have been adopted by large Ethereum projects, especially in DeFi, where the high stakes involved justify the investment in formal methods.</p><p><strong>Solana</strong></p><p>The formal verification landscape in Solana is less developed compared to Ethereum, primarily due to:</p><ul><li>Rust ecosystem: Solana uses Rust, which has its own set of formal verification tools not specific to blockchain (like KLEE or MIRAI). However, these are not as tailored to smart contract verification as Ethereum’s tools.</li><li>Younger ecosystem: Solana’s shorter history means there’s been less time for specialized formal verification tools to be developed and mature.</li><li>Different focus: Solana’s architecture emphasizes high throughput and low latency, which has led to a focus on different types of security concerns.</li></ul><p>Despite these challenges, progress is being made, notably with Certora’s development of the <a href="https://www.certora.com/blog/sol-formal-verification">Solana Certora Prover (SCP)</a>, which is an extension of their original Certora Prover (CP) designed specifically for Solana’s ecosystem.</p><p><strong>Reliance on Specification</strong></p><p>To reiterate the word of caution: formal verification is only as good as the specifications it’s based on — if they are incomplete or incorrect, the verification may provide a false sense of security. Therefore, while formal verification is a powerful tool, it should be seen as part of a comprehensive security strategy rather than a silver bullet, and its limitations should be well understood by development teams.</p><h3>Tooling</h3><p>Blockchain security tools play a crucial role in identifying and mitigating vulnerabilities within smart contracts, serving as the first line of defense against potential exploits and financial losses. These tools employ various techniques, including static and dynamic analysis, symbolic execution, and formal verification, to scrutinize smart contract code for common vulnerabilities such as reentrancy attacks, integer overflow/underflow, and access control issues. Security auditors leverage these automated tools as an integral part of their auditing process, using them to perform initial scans and identify potential problem areas. This allows auditors to focus their manual review efforts on the most critical or complex sections of code, significantly enhancing the efficiency and thoroughness of the audit. While these tools are invaluable in catching many common vulnerabilities, they are most effective when combined with the expertise of skilled security professionals who can interpret the results, understand the context, and identify more nuanced or project-specific issues that automated tools might miss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*oR8XaAihr9ePFshHajCGrg.png" /></figure><p>It’s easy to see that Ethereum boasts a more comprehensive suite of tools, particularly in areas such as static and dynamic analysis, formal verification, fuzzing, and symbolic execution. These tools are tailored specifically for Solidity and EVM bytecode. In contrast, Solana’s security tooling is still developing, often relying on adaptations from Rust’s ecosystem or custom solutions. Solana’s unique architecture and use of Rust lead to different approaches in tool development, especially evident in areas like compute units and bytecode analysis.</p><h3>Summary</h3><p>As we conclude this comparison, it’s evident that both Ethereum and Solana offer distinct approaches to blockchain security, each with its own strengths. Ethereum’s well-established ecosystem provides a more comprehensive suite of battle-tested tools, pre-audited contracts and execution environment, while Solana’s innovative architecture introduces novel security considerations and solutions. As the blockchain landscape evolves, both platforms will undoubtedly continue to refine their security measures.</p><p>Despite these differences, one principle remains constant across all blockchain platforms: The security model is a complex and multi-faceted paradigm that needs to be approached with careful consideration, proper expertise and tailored tooling. Developers must ensure they leverage the appropriate tools, conduct thorough security audits, and stay informed about the latest security best practices specific to their chosen blockchain ecosystem.</p><p>Our team at <a href="https://oaksecurity.io/">Oak Security</a> brings a deep understanding of intricate design trade-offs when it comes to Ethereum and Solana security models and can help you cover all aspects of architectural review, from early planning, secure design, economic consulting, secure development processes, and in-depth protocol reviews.</p><p>Check out our <a href="https://github.com/oak-security/audit-reports">audit reports</a> or contact us via <a href="/service/mailto: info@oaksecurity.io">email</a> and social media channels on <a href="https://x.com/SecurityOak">X</a> or <a href="https://www.linkedin.com/company/oaksecurity/">LinkedIn</a>.</p><h3>References</h3><p>[1] Solidity Language Influences</p><p><a href="https://docs.soliditylang.org/en/v0.8.25/language-influences.html">https://docs.soliditylang.org/en/v0.8.25/language-influences.html</a></p><p>[2] Understanding Solana’s Parallel Execution Model</p><p><a href="https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192">https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192</a></p><p>[3] Understanding Solana Resource Metering</p><p><a href="https://jstarry.notion.site/jstarry/Understanding-Solana-Resource-Metering-7e825a68c4854224ad30b9c1f43d224e">https://jstarry.notion.site/jstarry/Understanding-Solana-Resource-Metering-7e825a68c4854224ad30b9c1f43d224e</a></p><p>[4] Solidity v0.8.0 Breaking Changes</p><p><a href="https://docs.soliditylang.org/en/v0.8.27/080-breaking-changes.html">https://docs.soliditylang.org/en/v0.8.27/080-breaking-changes.html</a></p><p>[5] Solidity Security Considerations, Checks-Effects-Interactions</p><p><a href="https://docs.soliditylang.org/en/v0.8.26/security-considerations.html">https://docs.soliditylang.org/en/v0.8.26/security-considerations.html</a></p><p>[6] Vyper Documentation</p><p><a href="https://docs.vyperlang.org/en/stable/index.html">https://docs.vyperlang.org/en/stable/index.html</a></p><p>[7] Vyper Vulnerability Exposes DeFi Ecosystem</p><p><a href="https://cointelegraph.com/news/vyper-vulnerability-exposes-defi-ecosystem-stress-tests">https://cointelegraph.com/news/vyper-vulnerability-exposes-defi-ecosystem-stress-tests</a></p><p>[8] List of 74 Blockchain Auditing Companies on Ethereum</p><p><a href="https://www.alchemy.com/list-of/blockchain-auditing-companies-on-ethereum">https://www.alchemy.com/list-of/blockchain-auditing-companies-on-ethereum</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb22e750a548" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oak-security/solana-and-ethereum-security-models-fb22e750a548">Solana and Ethereum Security Models</a> was originally published in <a href="https://medium.com/oak-security">Oak Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solana and Ethereum Security Models]]></title>
            <link>https://medium.com/oak-security/solana-and-ethereum-security-models-6d6f1209f6bf?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d6f1209f6bf</guid>
            <category><![CDATA[solana-vs-ethereum]]></category>
            <category><![CDATA[decentralized-system]]></category>
            <category><![CDATA[solana-security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[ethereum-security]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 13:25:00 GMT</pubDate>
            <atom:updated>2024-09-17T13:25:00.749Z</atom:updated>
            <content:encoded><![CDATA[<p>A Deep Dive, Part 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyXsJl49wU95JO4MATBErw.png" /></figure><p><strong>When comparing the security of two large ecosystems such as Ethereum and Solana, one has to view it through multiple different lenses and keep in mind the original design goal of each system.</strong></p><p><strong>In Part 1 of this article, we’ll dive into:</strong></p><ul><li>Design Goals</li><li>Positioning in the Scalability Trilemma</li><li>Consensus Mechanism Security</li><li>Front-running and MEV</li><li>Validator Malevolence</li><li>Node Client Centralization</li><li>Node Infrastructure Censorship</li></ul><h3>Original Design Goals</h3><p>At the time of creation, Ethereum’s original design philosophy has centered around simplicity, even when it meant compromising on execution time and efficiency [1]. In these early days, Ethereum’s goal was to build a secure and decentralized blockchain with smart contracts and foster a community of developers who could easily contribute and extend the ecosystem. The complexity, when inevitable, was pushed into the middle layers of the protocol that were not part of the core consensus and were not to be seen by the end users.</p><p>As the time went on and the Ethereum ecosystem gained popularity, Ethereum devs had to shift the priority towards addressing the growing pains, such as network congestion, high fees and making the ecosystem generally more scalable [2]. As Vitalik then said: “If we don’t fix scaling before the next bull run, people are going to be stuck paying $500 transaction fees”. This upgrade came in the shape of Proof of Stake consensus, and more recently, proto-danksharding (EIP-4844). As we dive deeper into these architectural upgrades later in this article, it’s important to keep in mind that Ethereum devs had to add these scaling solutions later, on top of the already existing architecture influenced by original design philosophy.</p><p>In the case of Solana, the architectural plan <em>from the get-go</em> focused on optimizing latency and throughput of transactions, as evident by the introduction of PoH generators in the original whitepaper [3]. This vision came as a direct result of wanting to solve Ethereum’s scalability issues at the time when congestion and high fees plagued the network.</p><p>This difference in original design choices matters when it comes to security, as each architecture knowingly made various sacrifices in order to achieve its initial goals and thus, had positioned itself differently in the Scalability Trilemma triangle. Let’s dive deeper.</p><h3>Scalability Trilemma</h3><p>The scalability trilemma is a modern iteration on a well-known CAP theorem [4], the concept of balancing the trade-offs between three important properties of distributed networks: Decentralization, Security and Scalability. By time-tested general consensus, systems can usually guarantee only two of the given properties, sacrificing the third. Let’s review how the latest innovations in Ethereum and Solana stack up when compared in the context of the trilemma triangle and viewed through the lens of security.</p><h3>Ethereum</h3><p>Ethereum’s goal with danksharding and beyond is to attempt to satisfy all three properties of the Trilemma triangle without significantly sacrificing any one: Scalability, Security or Decentralization. Finding this balance between three guarantees rather than excelling at two of the three is an ambitious technical goal. It’s a classic jack-of-all-trades versus a specialist scenario that tends to produce heavy monolithic chains and give up market share to lean specialized competitors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*N5Ll34fcMkQMfLN4" /></figure><p><strong>Figure 1</strong>: Originally emphasizing the Security/Decentralization tuple, Ethereum claims to have moved to the middle of the Trilemma triangle with introduction of staking and proto-danksharding, as it attempts to add scale without giving up its existing strengths. <br><strong>Source: </strong><a href="https://ethereum.org/en/roadmap/vision">https://ethereum.org/en/roadmap/vision</a></p><p>When it comes to Ethereum, there are 3 major recent developments that shift its place in the trilemma: Staking, Proto-danksharding (EIP-4844), and Rollups.</p><h4>Staking</h4><ul><li>The initial claims of proof-of-stake (PoS) democratizing network influence and thus creating further decentralization have been highly contested by the community. The minimum required stake to become a validator (32 ETH) is seen by some as a barrier to entry for smaller participants, potentially limiting decentralization. Even if one decides to pool stake with others, it necessitates further trust in additional parties or smart contracts. As <a href="https://dune.com/queries/2394100/3928083">on-chain data shows</a>, roughly 60% of staked ETH is concentrated among four major staking pool providers (Lido, Coinbase, ether.fi, and Binance). This certainly makes it difficult to assert influence from an individual ETH stake and goes counter to the whole democracy goal. Additionally, while some providers like Rocketpool decentralize their infrastructure, most pool owners choose to run their own centralized node infrastructure, which warrants serious concerns about security if any of those pools were ever exploited.</li><li>As a whole, however, the Ethereum network did become more resilient to 51% attacks due to a number of protection mechanisms: a) the introduction of automatic slashing that deters an attack, b) the communal coordination to hard fork and manually slash the offending validators’ deposits in case of validator collusion, and c) the sheer amount of stake needed to pull off this attack in the first place [5].</li><li>It’s important to highlight the Slashing mechanism that was introduced with PoS, which penalizes validators for misbehaving, making the network more secure not just in case of 51% attacks, but in many other cases, such as double signing, surround voting, avalanche attacks, inactivity leak and others [10].</li></ul><p><strong>Effect</strong>: Decentralization decreased. Security of the network increased. However, risk to an individual staking end-user has increased due to pool centralization and slashing.</p><h4>Proto-danksharding (EIP-4844)</h4><ul><li>Introduced in March 2024, this was the first “prototype” phase of Danksharding scaffolding, thus called “<em>Proto</em>-danksharding”. The ultimate goal in the full Danksharding upgrade is to split Ethereum blockchain data into separate blobs, where each blob will serve as free space for smart contracts, for example rollups that can fill them with their batched bundles of transactions. However, Proto-danksharding is the prep step in this upgrade, where the data blobs are created and used, but without actually splitting the blockchain data or splitting the validation process of data availability. The challenge with splitting the data is a classic problem in distributed systems. Upon sharding, since not every node has all the data, there needs to be a way to guarantee data availability without requiring every node to download everything. In this environment, validators that are responsible for different shards must communicate and combine their results. Transactions or smart contracts that need to interact across different shards become much more complex. These complexities carry with it additional security implications that must be considered. Until that data split time comes, Proto-danksharding allows rollups to start using the blobs to save on transaction costs, but avoids the complexities associated with split of data availability.</li><li>This resulted in significantly reduced storage overhead and cheap transactions that leveraged rollups.</li><li>However, once the remaining phase of Danksharding upgrade arrives, the drawback of dealing with data availability complexities will certainly affect security. This is because in a sharded environment, with potentially 1000s of blobs, each containing a subset of smart contracts, you may need to first locate the contract and make sure the contract is available (through data sampling) before interacting with it. This increases the complexity and hence attack surface and creates new security challenges that haven’t been there before.</li></ul><p><strong>Effect</strong>: Scalability increased. Security may decrease.</p><h4>Rollups</h4><ul><li>Rollups have become the talk of the town this year, as these layer-2 (L2) solutions raced each other to address Ethereum’s scalability problems through off-chain computation and zero-knowledge (ZK) proofs. While integrating these solutions can help scale, relying on their architecture can affect decentralization and security of the system. When you start depending on rollups for speed, you open yourself up to a larger attack surface consisting of additional things working correctly, specifically: underlying implementation of fraud/ZK proofs, trusting the operator of validation and sequencing, and trusting the privileged admin entity that distributes control of the rollup through governance.</li><li>Many L2 rollups continue to utilize centralized sequencers to manage transactions, which can lead to potential biases in transaction processing. These sequencers, responsible for ordering transactions, may manipulate the sequence to favor their own interests, compromising security (front-running) and the decentralized nature of the L2 chain.</li><li>This is the case with the currently most used rollup Arbitrum. The Sequencers for both Arbitrum One and Arbitrum Nova are currently maintained by the Arbitrum Foundation, a centralized entity, which presents a risk to security and decentralization [6].</li></ul><p><strong>Net Result</strong>: Scalability increased at the cost of Decentralization and some Security.</p><h3>Solana</h3><p>Solana shipped a number of notable innovations to optimize for latency and throughput, such as its Proof of History timestamp mechanism, Turbine network sync, and parallel transaction processing runtime. However, while these design choices excelled at scalability, they have also produced unwanted side-effects of centralization, network instability and an attractive environment for spam bots. During periods of intense transaction activity, Solana’s weaknesses got exposed leading to network outages on multiple occasions. Let’s look at the major risk factors that earn Solana its place in the scalability trilemma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*kmTT1GPHu2ms8nx8" /></figure><p><strong>Figure 2</strong>: Solana, designed for high scalability and low fees, opens the road for fast parallel processing, while sacrificing certain security guarantees. A decreasing superminority together with a low count of validators threaten decentralization.</p><h4>Spam Attacks</h4><p>Solana’s low transaction fees and lack of a dynamic fee market inadvertently invite frequent spam attacks, where bots sometimes submit thousands of transactions per second overwhelming the network. Since the base fees are so cheap and the optional priority fees are manual in nature, there is currently no good deterrence against spam. As a result, the chain gets overwhelmed producing frequent outages due to such network congestions [8].</p><h4>Low Validator Count</h4><p>Solana imposes a very high bar to becoming a validator due to top-end hardware requirements, especially RAM [9]. This results in fewer entities qualified to become validators and a more centralized ecosystem. This problem coupled with the lack of protection against spam attacks poses a systemic risk to the entire network.</p><h4>Decreasing Superminority</h4><p>The Superminority (minimum number of validator entities that could potentially collude and disrupt the network) has been decreasing recently. As of this writing, top 19 stakers control over 33% of the network (down from 21 a few months ago) and could potentially collude, compromising consensus and raising questions about Solana’s security [7]. It is difficult to compare this metric to Ethereum, where the large staking pools like Lido initially seem to imply a dangerously low superminority of 2 or 3; however, since these pools leave control of the voting keys to the individual validators, their share cannot be counted as one entity. Ideally, you want to see this threshold increase over time in order to distribute the power evenly across many independent entities and reduce the possibility of collusion.</p><h3>Consensus Mechanisms</h3><p>Now that we’ve looked at security of Ethereum and Solana from the trilemma context, let’s dive deeper into their architectural differences. At the very core of their architecture, there are several main components that establish the crypto-economic security of the entire system: Consensus Mechanism, Virtual Machine, and the nodes. In this section, we will contrast the consensus mechanisms used by Ethereum and Solana.</p><h3>Traditional PoS vs Hybrid PoS+PoH</h3><p>Consensus mechanism is a central set of rules that allows a network of nodes to agree on the state of a blockchain. Ethereum relies on the Proof of Stake (PoS) set of rules to provide its crypto-economic security by incentivizing honest behavior through ETH rewards and penalizing malicious actions through Slashing. Solana, on the other hand, uses a custom combination of PoS algorithm called “Tower BFT” (Byzantine Fault Tolerance) with a unique Proof of History (PoH) consensus mechanism. PoH acts as a trusted cryptographic clock enabling the network to keep a verifiable record of time across all nodes. PoH doesn’t rely on absolute time accuracy. Instead, it focuses on proving that a finite amount of time has elapsed by using a verifiable delay function (VDF). Given that there is a trusted timeline that every node can reference, they can quickly agree on the order of events, thus reaching consensus more efficiently and resulting in low transaction latency.</p><p>Let’s look deeper into how these optimizations affect security.</p><h4>Front-running and MEV</h4><p>In the following section, we differentiate between front-running, where arbitrary users try to observe pending transactions and try to inject a transaction with a higher gas fee to extract value from the target transaction, and MEV, where this front-running is performed or offered by a validator to third parties.</p><p>Front-running has been a frequent issue for Ethereum, where opportunists (called Searchers) seek out high-impact transactions in the visible mempool and pay a large gas fee to validators in order to prioritize their own transaction resulting in profits. The most common example of this technique is DEX arbitrage, where Searchers identify discrepancies in asset prices across exchanges and simultaneously buy and sell the asset on different exchanges to capitalize on the price differences and bag a profit. While this strategy has been popular since 2020, it has since been heavily automated with the use of bots that compete against each other and end-users for a chance to extract maximum value from front-running these high-impact transactions (Maximal Extractable Value or MEV bots).</p><p>This technique has been possible on Ethereum because of two reasons:</p><ul><li>availability of a transparent mempool, where everyone can see a queue of unconfirmed transactions waiting to be included in a block</li><li>pay-for-order rules, where validators are incentivized for prioritizing high gas fee transactions</li></ul><p>Solana, on the other hand, does not have a built-in mempool. Instead, users’ transactions are forwarded directly to the leaders according to the Gulfstream protocol, without a separate mempool layer.</p><p>Secondly, since Solana transactions are ordered based on a pre-agreed cryptographic timeline in PoH, the pay-for-order rules largely do not apply within a block, meaning there is a very limited discretion available from the validators and no guarantee that a given transaction will be included more quickly within a block The only sure way to influence the order here is to have a malicious validator emit a block without the high-impact transaction, in an attempt to delay it until some profitable action could be taken. This type of censorship attack is temporary in nature, as it’s only possible during the validator’s own leader slots. The slot schedule is constantly rotated, so as long as the validator pool is deep with an evenly spread stake, this attack is not going to persist for long</p><p>However, prioritization across blocks is more likely in Solana. By appending an optional priority fee called Compute Unit Price to a transaction, and optimizing the transaction to use fewer compute units, one can incentivize the validators to include it in the current block rather than the next [10]. While this option exists, it is still constrained by the PoH structure and timing of when the transaction was received, as validators have very limited discretion at transaction selection and make no guarantees.</p><p>Finally, rational validators themselves can theoretically engage in front-running strategies, but in practice, due to Solana’s rapid block times and PoH architecture, the window of opportunity is very short (typically less than a second versus 10x this time on Ethereum). which seems to be happening in practice.</p><p>While not the same as front-running, Maximal Extractable Value (MEV) is a related concept, where validators earn additional revenue (tips) for providing a service of processing certain transaction bundles. Jito Labs, a key infrastructure builder on Solana, played a significant role in enabling MEV by developing a custom validator client, a Block Engine interface between validators and searchers that optimizes profitability, and a specialized mempool service that allowed for a centralized location where MEV traders could bid on opportunities to front-run, sandwich, or backrun pending transactions. Together, these innovations attempted to centralize and structure MEV extraction in a controlled way that could potentially make it more efficient and equitable for all parties involved [11]. As validators started earning significant profits from reordering transactions (<a href="https://blockworks.co/news/solana-mev-validators-ethereum">$7M/week in May</a>), the mempool’s presence also has allowed MEV bots to perpetuate sandwich attacks, causing significant financial losses for traders and users in the Solana ecosystem. This ultimately led Jito to <a href="https://x.com/jito_labs/status/1766228889888514501">suspend its mempool service</a> and The Solana Foundation to <a href="https://x.com/Echoeweb/status/1800294166842282448">remove several validators</a> from its delegation program for breaching best practices, thus shifting focus to long-term success and growth of the ecosystem. At the same time, Game Theory dictates that engaging in MEV would be the dominant strategy, leading to the well-known prisoner dilemma. Only time will tell whether MEV will be as regularly extracted as currently happening on Ethereum.</p><p>Due to these considerations, Ethereum’s inherent architecture of having a transparent mempool and pay-for-order rules create a larger opportunity for front-running.</p><h4>Validator Malevolence</h4><p>Block Proposer (or Leader in Solana) is an important role from a security standpoint, as it grants rights to censor or alter transactions that go into a block by proposing new blocks or attesting to the validity of a given block. The rules for block producer/leader selection must be carefully designed. At minimum, they need to be able to discourage adversarial behavior, minimize the attack surface &amp; opportunity time, and have airtight checks-and-balance rules to quickly identify malicious activity, revoke validation rights, punish and revert the damage. Let’s look at how each of these systems accomplishes this.</p><p><strong>Validator Selection. </strong>On Ethereum, nodes must put up a large stake of 32 ETH in order to be considered a validator. While this may seem like a role reserved for the elite few, a concept of pooled staking allows an average user to group together with others and activate a set of validator keys as well. The role of block proposer is then selected at random from the total validator pool [12].</p><p>Solana’s requirements are more flexible in terms of solo stake, as there is no minimum amount to become a validator (and a potential leader); however, the more coins you stake, the better your chances are of becoming a leader due to a stake-weighted ordering [13]. This may seem like a case of buy-your-way into a leader position, but the leader selection process on Solana also depends on a precomputed schedule with a seeded pseudo-random selection, which constantly rotates in order to prevent censorship and ensure network resilience [13]. Since the leader selection constantly rotates, this attack is temporary in nature as long as rotation works as intended. In theory, if leader rotation can be influenced so that the same leader is selected repeatedly, the censorship of transactions could last long enough to cause a serious attack. However, in practice, this is quite difficult to achieve, as leader slots are calculated one epoch in advance, so that all validators have enough time to finalize their ledger state before the next schedule is generated.</p><p>Both designs provide fairness in validator selection as long as the pool is large enough for pseudo-randomness and rotation to work as intended.</p><p><strong>Discouragement and Punishment.</strong> If malicious validator behavior is detected on Ethereum, the stake is gradually slashed (burned) over a course of 36 days, followed by the validator being ejected from the network and its reputation damaged. If multiple validators are behaving maliciously simultaneously, the slashing magnitude increases helping protect against a larger attack on the network consensus. If finality cannot be agreed upon by the majority (2/3) of the validators for more than 4 epochs (~25min), a special emergency protocol called “The Inactivity Leak” will activate that slowly burns away the stake of improper validators encouraging them to submit correct attestations. This works as long as the majority of validators can still be identified.</p><p>In contrast, Solana has not implemented any automatic Slashing rules for validators yet, although it’s been talked about. Besides missing out on the rewards, the main punishment for validator misbehavior on Solana lies with the community. The burden falls on existing validators to manually flag malicious activity and reduce its reputation. However, this approach is limited and not likely to be effective against well-resourced and motivated attackers. As a result, Ethereum has a much more comprehensive protection mechanism against misbehaving validators. Solana lacks any automated means for punishing bad validator behavior.</p><h4>Node Client Centralization</h4><p>Each node on Ethereum must run two clients: an execution client and a consensus client. The behavior of these clients relies on the correctness of its software and user’s intentions. While several client implementations exist, the majority of users tend to use the same client. This is often due to familiarity of use, availability of good documentation, or implicit trust in the development team behind the client.</p><p>The danger of having the majority of clients run the same software is a central point of failure. This may come in the form of a software bug that brings down all the clients running that software, or an intentional exploit that launches an attack on the entire network. Let’s review the current state of distribution of client software.</p><p><strong>Ethereum Execution Client Risks.</strong></p><p>The execution clients process newly broadcasted transactions within the Ethereum network, executing them through the EVM (Ethereum Virtual Machine), and maintaining a real-time snapshot of the entire blockchain state and data. Presently, there are several independently developed execution clients that exist in Ethereum. Geth and Nethermind dominate the space (cumulatively at 83%):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*VWgtBd_4QLCqxG53" /></figure><p><strong>Figure 3</strong>: Ethereum Execution Client Diversity. <strong>Source</strong>: <a href="http://ethernodes.org/">ethernodes.org</a></p><p>Looking at this chart, we can see a highly uneven distribution with geth largely owning nearly a 50% share of all client software. This makes the network vulnerable to large-scale client attacks, as we’ve already seen happen in 2016 (<a href="https://blog.ethereum.org/2016/09/22/ethereum-network-currently-undergoing-dos-attack">Shanghai DDoS attack</a> via geth) and more recently, in 2021, where a hole in Nethermind was used to trick clients to endorse a particular branch of the chain (<a href="https://x.com/vdWijden/status/1437712249926393858">Chain overtake attempt</a> via nethermind). Currently, the execution client distribution is still highly centralized, and the risk of an attack happening through this vector remains high.</p><p><strong>Ethereum Consensus Client Risks.</strong></p><p>The consensus clients implement the Proof of Stake (PoS) algorithm to facilitate agreement among nodes in the network. They validate data from the execution client, ensuring that all nodes synchronize and agree on the same state. Additionally, they run the validator logic. Validators, as we’ve covered earlier, carry out an important role on the network, and even though they are quite lightweight pieces of software and perform only a small number of tasks, it is critical that they are performed correctly. Thus, consensus clients are quite important to diversify and keep well-secured, as the point of infliction here could result in a more devastating consequence for everyone, including loss of staked Ether for unsuspecting validator owners, delay of finality for the chain, and loss of transactional guarantee for users, for example.</p><p>This painful scenario begins when the number of validators using subverted client software exceeds 1/3 of total validators. In this case, the supermajority cannot be achieved and Ethereum will activate the emergency protocol Inactivity Leak in order to restore it. This will cause delays and transactional failures, which will likely cause upstream dapp issues, but the chain should eventually recover.</p><p>The situation gets much worse if the same client software used by 2/3+ validators has a bug or forks its own chain. Since it takes 2/3rds of validators to reach finality, it’ll be capable of finalizing on its own. The same is true for even 51% of subverted clients, as they will be capable of achieving a 2/3rds majority due to the snowball effect. This will cause a large set of validators being stuck on the wrong chain and lose their staked Ether upon rejoining. Slashing of this magnitude would be enormous and would undoubtedly shake the feeling of trust in the security of the Ethereum network, even if it recovers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gwtxBEFmPwxDNpV2" /></figure><p><strong>Figure 4</strong>: Ethereum Consensus Client Diversity. <strong>Source</strong>: <a href="https://blockprint.sigp.io/">Blockprint</a></p><p>Currently, Prysm consensus client is used by over 1/3 of total validators, which creates a potential for loss of supermajority scenario, as described above. While the consensus clients have gone a long way of getting diversified over the last couple of years (Prysm used to comprise 2/3rds of validators in 2022!) the present dominance of Prysm still presents a high risk of causing Inactivity Leak emergency protocol.</p><p><strong>Solana Client Diversity.</strong></p><p>On Solana, client diversity is much worse and is an ongoing focus of development. Originally launched with only a single validator client in 2020, Solana has been slow to diversify. In Aug 2022, Jito Labs added a forked client called Jito, although a fork means that any potential vulnerabilities from the official client would surface in Jito, thus, not really providing a robust alternative.</p><p>As of this writing, 2 additional clients are in development:</p><ul><li>Firedancer by Jump Crypto [14]</li><li>Sig by Syndica [15]</li></ul><p>Both are still in their infancy and have not been time-tested.</p><h4>Node Infrastructure Centralization</h4><p>While some developers run their own nodes, others prefer to outsource this task to a third party and focus on development. In such cases, devs typically leverage a node service provider that takes upon itself to manage the underlying infrastructure and the tasks of scaling, securing and maintenance of the end-point, thus abstracting away the complexities for the end user. However, as is often the case, relying on a third party in a distributed network creates its own risks.</p><p>Infura, originally launched in 2016 at Devcon 2, had become a wildly popular Ethereum Node-as-a-Service provider over the years. Just three years after launch, 63% of all surveyed dapps were using it to talk to the Ethereum blockchain [16]. Unfortunately, this popularity inadvertently created a central point of failure. In 2020, the over-reliance on Infura infrastructure had become apparent when its outage had caused a major delay in price feeds forcing exchanges like Binance to suspend withdrawals [17]. The outages continued, and in 2022, key applications like Metamask, Optimism and Arbitrum had stopped working due to Infura node outage causing speculation about the entire chain being unstable [18].</p><p>Plagued by outages, the team at Infura promised to decentralize their infrastructure, and in 2023 they announced DIN (Decentralized Infrastructure Network) — a network of trusted big-name partners (Microsoft, Chainstack, Tencent Cloud, etc.) that will share the burden of supporting the node infrastructure, and fail-over onto each other in case of outages. However, at the time of writing, DIN remains in the centralized federated testing phase with a limited number of partners, and thus centralization risk still remains. Additionally, with the introduction of new DIN infrastructure, new bugs and misconfigurations may surface upstream, so it wouldn’t be a surprise if this effort encounters a few bumps down the road.<br>The same issue is prevalent in Solana, with fully-managed Node providers like Syndica and Infura.</p><h4>Node Infrastructure Censorship</h4><p>While Consensys is working on overcoming the centralization issue with Infura, a larger risk still remains — censorship. No matter how diverse the DIN network becomes, the partners comprising this network are well-known established companies that operate within their local jurisdiction. As long as these partner corporations remain in control of delivering rpc calls to the blockchain, the transactions that rely on their node infrastructure will always be at the mercy of governments and law enforcement, and thus, at risk of censorship.</p><h3>Summary</h3><p>Designing a secure distributed system is hard. While we didn’t cover all potential security risks, we highlighted how key design choices made by each architecture influences its security. From this analysis, it should be apparent that even the brightest minds behind successful projects like Ethereum and Solana constantly wrestle with security trade-offs and always leave room to adjust for unforeseen complexities later.</p><p>One element that always helps against the unforeseen is having a transparent peer review process with a strong technical community. For our given blockchains, this takes many forms, from fellowship of Ethereum Magicians and Solana Community [19, 20] who often discuss proposed architectural changes to the protocol, to Bug Bounty Programs [21], which attract highly competent hackers to test the system under scope, to audits with reputable security research firms.</p><p>While startup projects don’t typically amass strong technical communities early on, they can begin by reviewing their design with a competent security audit firm as the first step in defense in depth. Our team at <a href="https://www.oaksecurity.io/">Oak Security</a> brings a deep understanding of intricate design trade-offs when it comes to security, and can help you cover all aspects of architectural review, from early planning, secure design, economic consulting, secure development processes and in-depth protocol reviews.</p><p>Join us next week for Part 2, where we’ll discuss how the programming models of Solana and Ethereum and their respective environments compare when it comes to security.</p><h3>References:</h3><p>[1] <a href="https://ethereumbuilders.gitbooks.io/guide/content/en/design_philosophy.html">Ethereum Design Philosophy</a></p><p>[2] <a href="https://thedefiant.io/news/defi/vitalik-on-scaling-eth-after-shapella">Vitalik on Scaling Ethereum After Shapella</a></p><p>[3] <a href="https://solana.com/solana-whitepaper.pdf">Solana Whitepaper</a></p><p>[4] <a href="https://en.wikipedia.org/wiki/CAP_theorem">CAP Theorem</a></p><p>[5] <a href="https://ethresear.ch/t/responding-to-51-attacks-in-casper-ffg/6363">Responding to 51% Attacks in Casper</a></p><p>[6] <a href="https://docs.arbitrum.foundation/state-of-progressive-decentralization">The state of Arbitrum’s progressive decentralization</a></p><p>[7] <a href="https://solanabeach.io/validators">Solana Validator Stats</a></p><p>[8] <a href="https://crypto.news/solana-network-plagued-by-bot-spams-record-number-of-transactions-fail/">Solana Plagued by Bot Spams</a></p><p>[9] <a href="https://docs.solanalabs.com/operations/requirements">Solana Validator Requirements</a></p><p>[10] <a href="https://solana.com/developers/guides/advanced/how-to-use-priority-fees">Solana Priority Fees</a></p><p>[11] <a href="https://solanacompass.com/learn/Cove/mev-on-solana-with-buffalu-from-jito-labs">Understanding MEV on Solana</a></p><p>[12] <a href="https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/">Ethereum PoS</a></p><p>[13] <a href="https://docs.solanalabs.com/consensus/leader-rotation">Solana Validator Leader Rotation</a></p><p>[14] <a href="https://jumpcrypto.com/firedancer/">Solana Firedancer Client</a></p><p>[15] <a href="https://www.syndica.io/sig">Solana Sig Validator Client</a></p><p>[16] <a href="https://medium.com/fluence-network/dapp-survey-results-2019-a04373db6452">Fluence Report</a></p><p>[17] <a href="https://decrypt.co/47846/ethereum-backbone-infura-suffers-major-damage">Crucial Ethereum Service Infura Suffers Major Outage</a></p><p>[18] <a href="https://decrypt.co/98457/metamask-ethereum-apps-down-infura-outage">MetaMask, Ethereum Apps Down as Infura Suffers Outage</a></p><p>[19] <a href="https://ethereum-magicians.org/">Fellowship of Ethereum Magicians</a></p><p>[20] <a href="https://solana.com/community">Solana Community</a></p><p>[21] <a href="https://ethereum.org/en/bug-bounty/">Ethereum Bug Bounty Program</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d6f1209f6bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oak-security/solana-and-ethereum-security-models-6d6f1209f6bf">Solana and Ethereum Security Models</a> was originally published in <a href="https://medium.com/oak-security">Oak Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I have a great idea for a DeFi protocol. Where should I deploy it?]]></title>
            <link>https://medium.com/oak-security/i-have-a-great-idea-for-a-defi-protocol-where-should-i-deploy-it-d048a46dcb12?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d048a46dcb12</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[blockchain-security]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Wed, 04 Sep 2024 09:48:52 GMT</pubDate>
            <atom:updated>2024-09-04T09:48:52.089Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>(Security Edition)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*alAeyEoD0CdbED2SNIf7vA.png" /></figure><p>Coming on the heels of a recent <a href="https://rekt.news/astroport-rekt/">Terra IBC re-entrancy exploit</a> that caused major losses for token holders of various applications such as ASTRO (Astroport) just a couple weeks ago, where smart contract applications were affected by an underlying chain issue, we decided to put together a brief guide for developers on what to pay attention to when selecting a chain for smart contract deployment, citing real-world exploits that serve as stark reminders of each case study.</p><p>When you have a great smart contract idea, your focus tends to be on the push to market, or economic and marketing aspects rather than the security of the underlying chain. We believe it’s crucial to do proper due diligence on each potential chain candidate in order to understand the risks and weigh in the trade-offs that contribute to its security and long-term stability. Not only will these characteristics affect the reliability of your application, but they can also impact your users’ trust, investors’ trust, and bring with it potential legal and regulatory compliance requirements.</p><p>Here are some key research topics you should consider when selecting a chain:</p><h3>Check the Basics: Network Size and Decentralization</h3><p>The primary security benefit of decentralization is its resistance to single points of failure. In a highly decentralized network, there’s no central point of authority that can be easily compromised to bring down the entire system. This distribution of power and data across many nodes makes it extremely difficult for malicious actors to manipulate the network.</p><p>However, most of the modern chains are decentralized to some extent making marginal trade-offs to balance security and latency. This degree of decentralization can vary widely between different blockchain networks, and this marginal variation can have profound implications for smart contract security.</p><ul><li><strong>Validator Size &amp; Diversity</strong>: Make sure the validators are plenty and diversified among groups. More validator nodes controlled by many different entities make the network more resilient to attacks.</li></ul><blockquote>Case in Point: Ronin Bridge Hack (2022): The Ronin network, which powers the popular game Axie Infinity, suffered a <a href="https://rekt.news/ronin-rekt/">major hack</a> resulting in the loss of over $600 million. The attack was possible because the network relied on only 9 validator nodes, 5 of which were compromised. On top of the already low total number of validators, it’s important to note that 4 of them were controlled by the same entity — Sky Mavis and the remaining by Axie DAO and other parties. In late 2021, Sky Mavis requested temporary authorization from Axie DAO to use their validators in order to help manage the increased network load. Once this arrangement was made, it was never revoked, and Sky Mavis was in possession of the majority of the validators on the network. Once the attacker had compromised Sky Mavis systems, they were able to gain control of the majority of Ronin network validators and approve transactions. In essence, an attacker needed to compromise just one target to gain control of the entire network.</blockquote><ul><li><strong>Node Client Software Diversity</strong>. Consider chains where multiple mature node clients are utilized by node operators to enhance resilience against potential node client vulnerabilities. In addition to validator diversity, it’s beneficial to have variety in the node client software they use. Many prominent chains are working on diversifying their client software. Ethereum, for instance, has <a href="https://clientdiversity.org/">made progress</a> in diversifying both consensus and execution clients in recent years. In the Cosmos ecosystem, an alternative client implementation of Cosmos SDK, <a href="https://github.com/rumos-io/gears">Gears</a>, is currently under development, and an alternative client implementation of Tendermint/CometBFT, <a href="https://github.com/informalsystems/tendermint-rs">tendermint-rs</a>, exists. Other efforts such as <a href="https://github.com/turbofish-org/orga">Orga</a>, <a href="https://github.com/left-curve/grug">Grug</a>, or <a href="https://github.com/CosmosSwift">CosmosSwift</a> do not currently aim for compatibility with Cosmos SDK, but may serve as a base for future clients. Solana has seen contributions from <a href="https://jumpcrypto.com/firedancer/">Jump Crypto</a> and <a href="https://www.syndica.io/sig">Syndica</a> to increase diversity. Typically, more established networks have had a longer opportunity to cultivate a wider range of client implementations. It’s advisable to research and understand the risks in this area.</li></ul><blockquote>Case in Point: An attack happened in 2016 via an <a href="https://blog.ethereum.org/2016/09/22/ethereum-network-currently-undergoing-dos-attack">out-of-memory attack on geth, the G</a>o Ethereum client, affecting ~7000 nodes, and more recently, another attempt had occurred in 2021, where a vulnerability in the Ethereum Nethermind client was used to trick nodes to endorse a particular branch of the chain (<a href="https://x.com/vdWijden/status/1437712249926393858">Chain overtake attempt</a> via Nethermind).</blockquote><ul><li><strong>Geographical Node Distribution</strong>: Find out who hosts the nodes of your chain of choice and how well are they distributed across different data centers. Widely distributed nodes protect against data center bans, outages, and regulatory censorship.</li></ul><blockquote>Case in Point: While today, Solana’s validators are evenly distributed across various data centers, a prominent historical incident in 2022 rings a bell. On Nov 2, 2022, one of the key cloud providers for Solana validators (Hetzner) suddenly <a href="https://www.theblock.co/post/182283/1000-solana-validators-go-offline-as-hetzner-blocks-server-access">blocked all Solana activity</a> due to breach of ToS taking 1000 validators offline. While the network had recovered, as this share was roughly equal to a quarter of the network’s security vote, it still acts as a stark warning to distribute the validators across a large enough group of providers geographically in order to avoid losing supermajority.</blockquote><h3>Understand the Inner-Workings: Consensus, Cryptography and Upgradability</h3><p>While you don’t need to know exactly how everything works on your chain of choice, there are three key areas that you should have a good understanding of, as they are core to ensuring the security of the system you’ll be developing on.</p><p><strong>Consensus mechanism:</strong> Make sure your chain uses a robust and secure consensus algorithm (like Proof of Stake or derived versions of it). This helps prevent attacks and ensures network integrity. Each mechanism has trade-offs in terms of security, decentralization, and scalability. Knowing how nodes agree on the state of your chain, and where your chain lands in this scalability trilemma is a must.</p><p><strong>Cryptographic robustness</strong>: The security of a blockchain relies heavily on its cryptographic foundations. The strength of the cryptographic algorithms used is crucial for long-term security. Check the following three requirements are implemented:</p><ul><li><strong>Hash Functions</strong>: Should be collision-resistant and preimage-resistant.</li><li><strong>Digital Signatures</strong>: Must use strong algorithms like ECDSA or EdDSA.</li><li><strong>Key Management</strong>: Secure key generation and storage practices are implemented.</li></ul><p><strong>Upgradeable contracts</strong>: The ability to upgrade smart contracts allows developers to patch vulnerabilities or improve functionality without completely redeploying. Understand your path to upgradability in case an urgent patch is needed. Also, understand the chain’s ability to implement upgrades and improvements. While there are various upgrade mechanisms present that balance flexibility, security, and complexity differently, the choice depends on specific project requirements and risk tolerance. As this is quite a deep topic in itself, we will dive into these trade-offs in a future article.</p><h3>Beware of Complexity: Interoperability and Protocol Dependencies</h3><p>We started this article with the Terra incident affecting Astroport and other applications, because we wanted to highlight the hidden dangers associated with underlying interoperable systems.</p><p>In this particular incident, while the smart contracts themselves weren’t exploited, a vulnerability in the underlying protocol’s dependency caused its token to <a href="https://x.com/larry0x/status/1818504253654147437">become a target of collateral damage</a> due to its liquidity value, as we examine later in this article.</p><p>Let’s unravel the Astroport chain of dependency to understand what had happened:</p><blockquote>Case in Point: Astroport is a decentralized exchange deployed on multiple blockchains, including Terra. Terra, in turn, uses the Inter-Blockchain Communication (IBC) protocol to enable interoperability with other compatible blockchains. As part of this interoperability, the IBC protocol leverages a third-party module called ibc-hooks that provides an enhancement ability to execute callbacks on the source chain after an IBC transfer is completed on the destination chain.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*vfh80rMqLe-rJQEgHliJcg.png" /></figure><blockquote>In this hierarchy, the IBC-hooks middleware interacts with the core IBC functionality. Thus, when IBC-hooks is exploited with a severe vulnerability, its impact, if unchecked, can extend all the way back up the chain of dependency. One such exploit was <a href="https://github.com/cosmos/ibc-go/security/advisories/GHSA-j496-crgh-34mx">discovered in April 2024</a> known as the IBC reentrancy infinite mint bug. While IBC itself had this hole quickly patched that same month and took the initiative to coordinate with all affected chains to incorporate the fix, Terra had accidentally re-introduced the outdated fork of its ibc-go implementation in June, allowing this vulnerability to re-surface. As this vulnerability traveled back up the dependency chain, it found Terra welcoming it with open arms. Astroport, being the largest liquidity provider on Terra, naturally became the target for the attacker, who then proceeded to <a href="https://blog.astroport.fi/post/the-day-lightning-struck-twice">mint 58 million ASTRO tokens</a> artificially inflating its supply and causing the token price to drop by around 70%. While the Astroport team had demonstrated commendable diligence in auditing their code and swiftly addressing the problem by freezing some of the stolen ASTRO tokens, this specific attack was beyond their control.</blockquote><p>This incident highlights a crucial lesson for blockchain developers: while cross-chain functionality can significantly boost an application’s utility, it also introduces layers of complexity that can harbor unforeseen vulnerabilities. Especially when developing smart contracts that rely on multiple chains like a decentralized exchange, be aware of the complexity of cross-chain protocols and other inter-dependent modules, which carry hidden dangers and require especially rigorous security reviews. Here are some pointers:</p><ul><li><strong>Analyze Dependencies:</strong> Treat each point of interaction with another system as an increase to the application’s attack surface. Security flaws in connected chains can potentially impact the primary chain. Similarly, a flaw in a dependent module can propagate up the dependency chain to your application. One such common example in cross-chain systems is the reliance on price oracles. Oracles might have different levels of security and implementation on various chains. As a result, a vulnerability in one chain’s oracle integration could potentially be used to indirectly attack another chain that relies on that data. More generally though, each point of interaction with another dependent system is a potential vulnerability and thus increases the attack surface.</li><li><strong>Complexity of Asset Representation</strong>: Look for chains that provide built-in safety checks to prevent common errors in asset transfers, offer standardized interfaces, automated conversion processes, and unified representations eliminating the need for custom code. When dealing with bridges, the process of transferring assets from one chain to another utilizes several moving parts that all have to work together in order for the operation to succeed. This typically involves a multi-step process: locking an asset on the source chain, relaying the lock information to the destination chain, verifying the validity of the relay, and minting an equivalent representation asset on the destination chain. The complexity of managing these cross-chain asset representations makes it difficult to secure due to the size of the attack surface.</li><li><strong>Complexity of Security Audits</strong>: Interoperable systems require more comprehensive, lengthy, and highly specialized security audits with multiple firms that know the nuances of that particular dependency chain. The risks of missing vulnerabilities are higher the deeper the dependency chain goes. As system complexity is increased and the attack surface gets larger, significantly more time is required to understand the design and possible attack vectors, check all the dependencies, assess economic incentives, test invariants, fuzz, etc.</li></ul><blockquote>Case in Point: Poly Network, a cross-chain protocol that allows users to transfer tokens across different blockchains had <a href="https://mudit.blog/poly-network-largest-crypto-hack/">suffered a major hack</a> on August 10, 2021, resulting in the theft of approximately $610 million worth of cryptocurrencies across Ethereum, Binance Smart Chain, and Polygon networks. The attacker exploited a vulnerability in the cross-chain contract that allowed them to modify the keeper role (which manages the transfer of assets) and execute unauthorized transactions. Despite previous audits, the complexity of the cross-chain protocol made it difficult to identify this specific vulnerability. The hack affected multiple blockchains simultaneously due to the interoperable nature of Poly Network.</blockquote><h3>Know Who’s in Control: Governance Model</h3><p>Even if the network itself is properly distributed and secured, its governance model can override the protection mechanisms in place. With the constantly changing landscape of cryptography and potential attack vectors over time, all systems must have a way to propagate updates and improvements. Effective governance allows for timely responses to newly discovered vulnerabilities, implementation of enhanced security measures, and scalability. Moreover, governance determines how conflicts are resolved and how the community responds to external threats or internal disputes.</p><p>The flip side of this is that governance itself can become a target for adversaries seeking to manipulate the direction of the protocol, making the security of the governance process itself a crucial consideration. Thus, it is paramount to ensure that the governance model of a given chain is fair, decentralized, and transparent, with proper checks-and-balances mechanisms implemented.</p><p>Look for the following properties to be present:</p><ul><li>multiple layers of approval for significant changes</li><li>wide distribution of voting rights among stakeholders</li><li>mandatory waiting periods before significant changes</li><li>transparency in decision-making process with publicly available participation results</li><li>mechanisms to prevent concentration of voting power (i.e. quadratic voting)</li><li>clear dispute resolution process</li><li>path of upgrading the governance model itself</li><li>activeness, engagement, and responsiveness of voters</li></ul><blockquote>Case in Point: Tornado Cash Sanctions and Ethereum’s Censorship Resistance. In August 2022, the U.S. Treasury sanctioned Tornado Cash, a popular Ethereum mixer. While not a direct protocol governance decision, this external action led to a significant portion of Ethereum validators <a href="https://cryptobriefing.com/is-ethereum-under-attack-unpacking-the-mev-boost-censorship-controversy/">choosing to censor Tornado Cash</a> transactions to comply with regulations. By February 2023, over 78% of blocks were being built by OFAC-compliant MEV-Boost relays, potentially allowing for transaction censorship at scale. This situation highlighted how external pressures and validator decisions can lead to decreased network neutrality and potential centralization of block production, undermining the security principles of the blockchain.</blockquote><ul><li><strong>Development Control:</strong> It’s important to note that development control must also adhere to the overall governance model. If a small group of developers has control over the codebase and doesn’t follow the instituted checks-and-balances system, it introduces risks of centralized technical decision-making and potential vulnerabilities.</li></ul><blockquote>Case in Point: In February 2020, when Justin Sun’s Tron Foundation acquired Steemit Inc., the Steem community <a href="https://www.coindesk.com/tech/2020/03/03/steem-community-mobilizes-popular-vote-in-battle-with-justin-sun/">became concerned</a> about the centralization of power. In an attempt to prevent this, the community Witnesses (block producers) implemented a soft fork to temporarily freeze the voting power of a large stake of STEEM tokens owned by Steemit Inc. However, a centralized Steemit development team, now under new ownership, pushed a hard fork to reverse the community’s soft fork, using their influence and connections to mobilize exchanges to vote with customer funds.</blockquote><h3>Verify Security Hygiene</h3><p>No system offers perfect security. With any protocol, the introduction of new features will require a continuous peer review process. Make sure the security lifecycle of your chain includes the following:</p><ul><li><strong>Consistent Security Audits with Competent Firms:</strong> Blockchain protocols must undergo continuous security audits with multiple prominent firms and publish the report findings. Pay attention to the quality of the auditing firms, as they <a href="https://rekt.news/leaderboard/">vary drastically</a>.</li><li><strong>Presence of Bug Bounty Programs:</strong> Look for the presence of active bug bounty programs that incentivize the community to find and report vulnerabilities.</li><li><strong>Formal Verification Support</strong>: Platforms that support formal verification of smart contracts can mathematically prove the correctness of their code, reducing the risk of bugs and vulnerabilities.</li><li><strong>Auditing Tools</strong>: Blockchains that have built-in or widely available auditing tools signal maturity and help developers check their code for vulnerabilities before deployment.</li><li><strong>Track Record of Incidents:</strong> Perhaps most importantly, research the frequency of incidents on this chain. Look at the amount and frequency of downtime encountered and what was affected. This can serve as a preview of the level of stability you can expect from this chain.</li><li><strong>Circuit breakers:</strong> A common safety mechanism that can be integrated to prevent unintended consequences of errors or malicious attacks is a circuit breaker. By implementing a circuit breaker, developers can ensure that, in the event of unforeseen circumstances, the smart contract execution can be halted, preventing further damage or exploitation. While this is generally considered a good practice, circuit breakers pose a centralization concern and could potentially be exploited by a malicious party, for example by triggering a halt while shorting the protocol’s token. Consequently, one must ensure that the specific circuit breaker clauses implemented do address these concerns and do not accidentally disrupt the natural market dynamics.</li><li><strong>Rate limits:</strong> Another good security practice in smart contracts is the presence of rate limits. These can be used to time-limit access to high-value functions, restrict voting frequency in governance contracts, or limit the frequency and amount of token transfers over time.</li></ul><h3>Assess Platform Maturity</h3><p>While some newer protocols may flaunt a game-changing consensus mechanism, or exhibit a novel governance model, the stability and wide acceptance of other less exciting chains may in the end count for more. Shiny new features are not always perceived safe until proven stable by time, load, and lack of incidents. When selecting a chain, pay attention to the following signals of maturity:</p><ul><li>Incident-free uptime and reliability (typically found on dashboard stats)</li><li>Number of daily active users and transactions</li><li>Number of active developers</li><li>Quality and number of smart contracts deployed</li><li>Venture capital funding in this platform</li><li>Adoption by mainstream companies and institutions</li></ul><p>In Summary, remember that security and stability often involve trade-offs with performance and features. While you won’t likely find a chain that satisfies all the mentioned attributes in this guide, decide on what matters most in your case and what shortcomings your application can deal with. Once you’ve selected your platform, always stay informed about the latest developments to ensure your application remains secure.</p><p>If you have any questions about how to choose your platform or any other security-related concerns, <a href="https://www.oaksecurity.io/#request-a-quote">get in touch here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d048a46dcb12" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oak-security/i-have-a-great-idea-for-a-defi-protocol-where-should-i-deploy-it-d048a46dcb12">I have a great idea for a DeFi protocol. Where should I deploy it?</a> was originally published in <a href="https://medium.com/oak-security">Oak Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[State of the Dapps Partners with Solidified Public Audit Platform]]></title>
            <link>https://medium.com/stateofthedapps/state-of-the-dapps-partners-with-solidified-public-audit-platform-a32cd4d2c996?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a32cd4d2c996</guid>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Sun, 24 Sep 2017 13:53:19 GMT</pubDate>
            <atom:updated>2017-09-24T13:53:19.308Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4339B51RUqCW5rYBCubsOg.png" /></figure><p>Today, we are excited to announce our partnership with <a href="https://dapps.ethercasts.com/">State of the Dapps</a>, the most complete directory of decentralized apps on the web.</p><p>SotD provides detailed information about each project and its development status. Solidified aims to supplement that data with a technical score of the project quality and its smart contracts.</p><p>The biggest part of Dapp’s readiness for production lies in the quality of its smart contracts. We encourage every Dapp developer to do their due diligence and perform a comprehensive audit with the community through the Solidified platform in order to get confidence in project’s quality.</p><p><a href="https://solidified.io/#sub">Sign up with Solidified</a> to learn more about how our process works and be first in line to try our Beta platform.</p><p>Opening in November, Solidified is the first community-driven audit platform for smart contracts, where any developer can review their smart contract prior to publishing it live with a lot of independent blockchain experts. As a result, Solidified produces a technical score representing experts’ consensus on the quality of the smart contracts, and Dapp’s readiness to go live.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a32cd4d2c996" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stateofthedapps/state-of-the-dapps-partners-with-solidified-public-audit-platform-a32cd4d2c996">State of the Dapps Partners with Solidified Public Audit Platform</a> was originally published in <a href="https://medium.com/stateofthedapps">State of the ÐApps Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Solidified — Audit Platform for Smart Contracts]]></title>
            <link>https://medium.com/solidified/introducing-solidified-audit-platform-for-smart-contracts-1efdd0dd17bb?source=rss-43adc097d40e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1efdd0dd17bb</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Eduard Kotysh]]></dc:creator>
            <pubDate>Mon, 04 Sep 2017 15:17:53 GMT</pubDate>
            <atom:updated>2017-09-04T16:20:52.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hu2eCYiKc73mKpMf4fbG_g.png" /></figure><p>With the increasing popularity of Smart Contracts among developers and hackers alike, there is an urgent need for better quality control.</p><p>Developers want an affordable way to confirm their contract will work as expected, that doesn’t require a massive upfront investment of $20k — $50k.</p><p>Community wants a safer and more stable ecosystem, that can last a month without millions being stolen due to coding errors.</p><p>Lots of segmented efforts have been done to create <a href="https://github.com/ConsenSys/smart-contract-best-practices">best practices</a> and some <a href="https://github.com/bkrem/awesome-solidity#tools">tooling</a>, but no formal verification standard has emerged. Moreover, no reputable, community-driven platform exists to help bring all this together.</p><p>Today, we’re happy to introduce <a href="http://www.solidified.io/"><strong>Solidified</strong></a>, a platform for crowd-sourced review of smart contracts, where any developer can bring their contract for review with our large network of verified blockchain experts.</p><p>Solidified takes its name from Solidity language and carries the spirit of “hardening” your code through many iterations of peer-review.</p><p>In the spirit of transparency, all audit feedback, results, patches and community sentiment are visible to the public.</p><p>We’ve developed Solidified with a Certification standard in mind, requiring all auditors go through a standardized review process, which combines a list of known Smart Contract pitfalls, security considerations, Solidity construct usage and best practices.</p><p>We’ve also developed a “Spec of Intended Behavior”, supplied by developer at the time of submission, that encompasses all conditions that should hold during contract execution, along with estimated gas calculations and evaluation criteria for correctness.</p><p>Our scheduled launch is November, 2017.</p><p>We are currently recruiting blockchain experts. Our expert community consists of some of the best smart contract developers who write decentralized code for living. <em>The first 1000 experts we accept will receive an inaugural reputation bonus on our platform</em>. <strong>Apply </strong><a href="http://www.solidified.io/#sub-reviewer"><strong>here</strong></a><strong>.</strong></p><p>To learn more, checkout our <a href="http://www.solidified.io/files/Solidified%20Whitepaper.pdf">whitepaper</a> or <a href="http://www.solidified.io/#sub">register</a> on our website.</p><p>Come solidify your contract with us!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1efdd0dd17bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/solidified/introducing-solidified-audit-platform-for-smart-contracts-1efdd0dd17bb">Introducing Solidified — Audit Platform for Smart Contracts</a> was originally published in <a href="https://medium.com/solidified">Solidified</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>