Insecurity Through Obscurity: Veiled Vulnerabilities in Closed-Source Contracts

Sen Yang, Kaihua Qin, Aviv Yaish, Fan Zhang · 2025

Read Insecurity Through Obscurity: Veiled Vulnerabilities in Closed-Source Contracts by Sen Yang, Kaihua Qin, Aviv Yaish, Fan Zhang (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-13398.txt.

Introduction

Sen Yang, Kaihua Qin, Aviv Yaish, and Fan Zhang study hidden flaws in closed-source smart contracts in a paper from 2025. Most blockchains show a contract's code, yet many teams hide theirs to guard trade secrets. Hidden code can also hide weak spots, a trap the authors call insecurity through obscurity.

The team built SKANF, a tool that unscrambles contract code and tests it. It replays past transactions to hunt flaws in how contracts handle assets. Tests on real trading bots found flaws that hidden code had masked. The work shows that secrecy is a weak shield. Open checks serve users better than closed code.

Catalog record

CREATORSen Yang, Kaihua Qin, Aviv Yaish, Fan Zhang
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE113 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-13398

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Insecurity Through Obscurity: Veiled Vulnerabilities in Closed-Source Contracts Sen Yang, Kaihua Qin, Aviv Yaish, Fan Zhang Abstract . Most blockchains cannot hide the binary code of programs (i.e., smart contracts) running on them. To conceal proprietary business logic and to potentially deter attacks, many smart contracts are closed-source and in many cases exhibit code obfuscation, either intentionally introduced to hide internal logic or unintentionally produced by optimizations. However, we demonstrate that such obfuscation can obscure critical vulnerabilities rather than enhance security, a phenomenon known as insecurity through obscurity . To systematically analyze these risks on a large scale, we present skanf , a novel EVM bytecode analysis tool tailored for closed-source and obfuscated contracts. skanf combines control-flow deobfuscation with symbolic execution based on historical transactions to identify and exploit asset management vulnerabilities. Our evaluation on real-world Maximal Extractable Value (MEV) bots reveals that skanf detects vulnerabilities in 1,046 contracts and successfully generates exploits for 394 of them, with potential losses of $10.6M. Additionally, we uncover 104 real-world MEV bot attacks that collectively resulted in $2.76M in losses. CCS: Security and privacy Distributed systems security 1. Introduction On public blockchains such as Ethereum, smart contract bytecode—and source code, if developers choose to release it—are publicly accessible. While transparency is a core feature, it allows a contract’s logic to be examined, reverse-engineered, or copied. As a result, many developers choose not to publish their smart contract source code. Furthermore, bytecode obfuscation is commonly observed, either intentionally introduced by developers to protect their contracts from attacks ( DeGatchi, 2023 ; DeGatchi, 2024 ; Ma et al., 2025 ) , or as a byproduct of compiler optimizations in languages such as Vyper ( Team, 2025c ) and Huff ( Team, 2025a ) . To provide context, our empirical study of Ethereum ( App. A ) shows that about 15% of the most active contracts (top 50K, ranked by the number of transactions interacted with them) are closed-source. Among these closed-source contracts, obfuscated contracts collectively hold more than $37M worth of crypto assets. While obfuscation may have certain benefits due to “security through obscurity” (e.g., some practitioners deem obfuscation necessary for deterring frontrunning attacks ( DeGatchi, 2024 ) ), this paper is motivated by the observation that obfuscation can also introduce insecurity . To see the motivation, consider the recent “Destroyer Inu” incident, where 22 ETH (worth $51,056 at the time) were stolen from a closed-source smart contract equipped with layers of obfuscation. The attack exploits a well-known vulnerable pattern (misuse of tx.origin ( by Example, 2025 ) followed by improper asset management), but existing tools could not detect the full exploit because of control flow obfuscation. E.g., Mythril ( ConsenSys, 2025 ) recognizes the superficial misuse of tx.origin but misses the much more severe asset management vulnerability, only reporting a “low” risk. In this case, obscurity arguably renders the contract less secure by hindering analysis, making this a prime instance of insecurity through obscurity ( Meunier, 2008 ) 1 1 1 Compare this with modern cryptographic schemes following Kerckhoffs’s principle that a system should not be compromised if adversaries uncover its method of operation ( Petitcolas, 2019 ) , or, as Shannon said: “the enemy knows the system” ( Shannon, 1949 ) . . This work. While bytecode-level analyzers exist, they remain limited in their ability to scale to large, closed-source contracts, especially when control-flow obfuscation is present, leaving gaps in our understanding of their security, particularly for asset-heavy targets attractive to attackers. In this paper, we aim to develop effective code analysis techniques to address this gap. We focus on a broad class of security vulnerabilities that we refer to as asset management vulnerabilities . These vulnerabilities allow an adversary to steal assets, creating a strong incentive for exploitation if the vulnerabilities cannot be detected promptly. Real-world testbed: MEV bots. While our tool is general, we use MEV (Maximal Extractable Value) bots as the testbed for efficacy evaluation and as concrete examples to study the security of closed-source smart contracts in the wild. MEV bots are highly optimized smart contracts deployed by MEV searchers to facilitate MEV extraction ( Daian et al., 2020 ) . While some MEV bots are considered toxic, many play a beneficial role ( Ethereum Foundation, 2025b ; Garimidi and Bonneau, 2025 ) . For example, arbitrage bots align DEX prices with the broader market, providing users with accurate prices. We choose MEV bots as our testbed because they are commonly closed-source, and a subset of them are obfuscated (we identify 6,554 closed-source MEV bots as of the time of writing; six of the top 10, ranked by the number of transaction bundles they sent ( libMEV, 2025 ) , exhibit some form of obfuscation). Moreover, they handle large volumes of assets, making any asset management vulnerabilities particularly relevant and detrimental. We summarize our goals as three research questions (RQs): • RQ1: How can we effectively deobfuscate the control flow given smart contract bytecode? Vulnerability detection is only possible if this can be accomplished. • RQ2: How can we scale vulnerability detection to complex closed-source contracts, where existing symbolic execution tools suffer from path explosion? Even after deobfuscation, detecting such vulnerabilities can still be challenging, given the complexity of MEV bots. • RQ3: How many MEV bot contracts have been exploited in practice, and how much did they lose? Answering this question helps in understanding the severity of asset management vulnerabilities and estimating how much loss could be reduced if skanf were used by searchers. Challenges. Numerous tools ( Dedaub, 2025 ; ConsenSys, 2025 ; Frank et al., 2020 ; Gritti et al., 2023 ; Grech et al., 2019 ) are available to identify smart contract bugs. However, we highlight three limitations that render them inefficient for our tasks. The first challenge is control-flow obfuscation . Smart contracts may employ indirect jumps that depend on runtime values, obscuring the execution path. Existing tools typically misclassify such basic blocks as unreachable ( Grech et al., 2019 ; Grech et al., 2022 ; Lagouvardos et al., 2025 ) or raise errors when encountering symbolic jump destinations ( ConsenSys, 2025 ; Frank et al., 2020 ; Gritti et al., 2023 ; Ruaro et al., 2024 ) . Secondly, detecting asset management vulnerabilities requires a fine-grained analysis of a smart contract’s logic, and simple pattern matching, as done by existing tools, does not suffice. E.g., JACKAL ( Gritti et al., 2023 ) flags CALL instructions with a fixed function selector as safe, overlooking vulnerabilities where function parameters can be manipulated. Mythril ( ConsenSys, 2025 ) only flags vulnerable CALL instructions when calldata can be completely controlled by the adversary, missing attacks that only require partially adversarial calldata. The third challenge is the complexity of our real-world targets, which involve trading, flash loans, DEX swaps, and other interactions with DeFi protocols. This can result in path explosion and expensive constraint solving, making symbolic execution inefficient without scalable methods for input generation. Our Methods. In this paper, we present the design and implementation of skanf 2 2 2 The name skanf stands for S en, K aihua, A viv ’ n F an. , a tool for detecting asset management vulnerabilities in closed-source and obfuscated

Read the complete text