TaintSentinel: Path-Level Randomness Vulnerability Detection for Ethereum Smart Contracts

1 st Hadis Rezaei, 2 nd Ahmed Afif Monrat, 3 rd Karl Andersson, 4 th Francesco Palmieri · 2025

Read TaintSentinel: Path-Level Randomness Vulnerability Detection for Ethereum Smart Contracts by 1 st Hadis Rezaei, 2 nd Ahmed Afif Monrat, 3 rd Karl Andersson, 4 th Francesco Palmieri (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-2510-18192.txt.

Introduction

Hadis Rezaei and three co-authors hunt weak randomness in Ethereum smart contracts at the level of single execution paths. Blockchains are deterministic, so contracts that fake randomness invite exploitation in finance and gaming. Existing detectors, the authors observe, lack precision on this flaw, which motivates a path-sensitive design.

TaintSentinel tracks data flow with domain rules along each path. A dual-stream neural network adds pattern spotting, and evidence-based starting values cut false alarms. The layered design aims at the complex cases where simple scans cry wolf. Contract auditors get a deeper check for a costly class of bugs.

Catalog record

CREATOR1 st Hadis Rezaei, 2 nd Ahmed Afif Monrat, 3 rd Karl Andersson, 4 th Francesco Palmieri
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE43 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2510-18192

Browse the full library · About the Tower of Babel

Full text

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

TaintSentinel: Path-Level Randomness Vulnerability Detection for Ethereum Smart Contracts 1 st Hadis Rezaei, 2 nd Ahmed Afif Monrat, 3 rd Karl Andersson, 4 th Francesco Palmieri Abstract The inherent determinism of blockchain technology poses a significant challenge to generating secure random numbers within smart contracts, leading to exploitable vulnerabilities, particularly in decentralized finance (DeFi) ecosystems and blockchain-based gaming applications. From our observations, the current state-of-the-art detection tools suffer from inadequate precision while dealing with random number vulnerabilities. To address this problem, we propose TaintSentinel , a novel path-sensitive vulnerability detection system designed to analyze smart contracts at the execution path level and gradually analyze taint with domain-specific rules. This paper discusses a solution that incorporates a multi-faceted approach, integrating rule-based taint analysis to track data flow, a dual-stream neural network to identify complex vulnerability signatures, and evidence-based parameter initialization to minimize false positives. The system’s two-phase operation involves semantic graph construction and taint propagation analysis, followed by pattern recognition using PathGNN and global structural analysis via GlobalGCN . Our experiments on 4,844 contracts demonstrate the superior performance of TaintSentinel relative to existing tools, yielding an F1-score of 0.892, an AUC-ROC of 0.94, and a PRA accuracy of 97%. © 2025 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. I Introduction Smart contract vulnerabilities have become critical threats to blockchain security. These problems have caused cumulative losses exceeding $14 billion since 2020 [ 1 , 2 ] . The year 2024 marked another record high, with $2.2 billion lost in platform hacks [ 1 ] . Bad randomness vulnerabilities are a highly dangerous yet overlooked research focus within these vulnerabilities [ 3 , 4 ] . The deterministic nature of blockchain systems makes truly random values impossible to generate, thereby creating critical security risks when predictable values are used instead. Bad randomness is categorized as a major vulnerability in the OWASP Top 10 Smart Contract Vulnerabilities 2025 [ 4 ] , which notes that this challenge can compromise systems that rely on random outcomes. Block number manipulation incidents have led to the theft of more than 400 Ethereum from blockchain lottery platforms [ 5 ] . Despite such financial impacts, bad randomness remains poorly understood compared to well-researched vulnerabilities, such as reentrancy and integer overflow [ 6 ] . This research gap is becoming increasingly critical. Randomness is now essential for various decentralized applications, including DeFi protocols, gaming platforms, and lottery systems [ 7 ] . Existing detection methods have three main drawbacks. First, there are limited specific tools for bad randomness detection. Dozens of general-purpose analyzers exist, yet only two tools specifically address this problem: TONScanner [ 3 ] and RNVulDet [ 8 ] . Second, existing tools rely on simplistic rule-based detection that merely searches for known randomness sources (e.g., block.timestamp, blockhash). They diminish any presence of these sources as vulnerable without considering the actual usage context or security implications, leading to high false positive rates. Third, all current approaches do not use path-sensitive analysis and only function at the contract level. They overlook context-dependent vulnerabilities that only appear in particular execution flows and are unable to differentiate between critical paths where randomness influences financial outcomes and non-critical paths where randomness is employed for benign purposes. Taint analysis is a potential method for detecting vulnerabilities [ 9 ] . It proceeds by monitoring the flow of data from predictable blockchain sources (such as block.timestamp, block.difficulty) to a crucial sink. Traditional methods, however, are insufficient for detecting vulnerabilities in smart contracts. Empirical analysis of Ethereum smart contracts reveals that current automated tools flag the vast majority of them as insecure [ 10 ] . This is a reflection of incredibly high false positives. Such findings demonstrate that existing tools do not satisfy standards for realistic deployment [ 11 ] . This paper introduces TaintSentinel , a novel architecture for detecting bad randomness vulnerabilities in smart contracts, which we describe in detail in Section IV . Our work makes the following contributions: 1. We provide the first path-level bad randomness detection system that analyzes complete execution paths rather than isolated code segments. 2. We apply rule-augmented taint analysis specifically optimized for detecting randomness vulnerabilities, combining traditional taint tracking with domain-specific rules. 3. We introduce a novel dual-input graph neural network with a gated fusion mechanism that combines path-specific vulnerability patterns with global contract context. 4. We implement evidence-based parameter initialization that distinguishes between high-risk and low-risk contexts, significantly reducing false positives compared to existing tools that flag every blockchain variable use as vulnerable. The remainder of this paper is organized as follows: Section II provides relevant background to the area. Section III surveys related work. Section IV presents the TaintSentinel framework architecture. Section V reports experimental results and comparative analysis. Finally, Section VI concludes with future research directions. II Background Understanding the technical foundations of smart contract execution and vulnerability analysis is crucial for developing effective randomness detection frameworks. This section reviews blockchain determinism, taint analysis principles, and existing detection limitations. II-A Smart Contracts and Blockchain Security Smart contracts are coded in the programming language of Solidity on the Ethereum blockchain, and are self-executing computer programs [ 12 ] . These contracts cannot be altered post-deployment, hence, it is important to focus on security analysis before deployment. Blockchain technology’s distinct security obstacles are accentuated due to its transparent and decentralized structure, especially in the case of generating randomness in systems designed to be deterministic. II-B Bad randomness vulnerability Bad randomness vulnerabilities occur when contracts rely on predictable blockchain-provided values for random number generation [ 13 , 14 ] . Common vulnerable patterns include using block.timestamp , block.difficulty , or block.hash as randomness sources. For example, the code uint random = uint(keccak256(block.timestamp)) % 10; appears random but enables attackers to predict outcomes through timestamp manipulation or transaction timing attacks. These vulnerabilities manifest in four primary attack categories: front-running (where attackers observe pending transactions), miner manipulation (miners influence block parameters), timestamp dependency (predictable time-based values), and block hash prediction (exploiting known hash values) [ 13 , 14 ] . II-C Taint Analysis in Smart Contract Security Taint analysis is a static analysis technique that deals with the flow of potentially hazardous data in the execution paths of a program [ 15 ] . In the context of smart contract security, taint analysis marks suspicious input data (taint sources) and examines how this data affects contract code to pinpoint operations impacted by tainted data. Standard taint analysis is executed in three steps: marking the sources (source identification, marking dangerous inputs), monitoring data flow through operations (propagation tracking), and locating critical usage points (sink detection, determining critical usage points). However, these approaches to taint analysis for smart contracts are limited to a single contract level and do not separate the constituent execution flows or the paths and conditions within the contract that trigger the vulnerabilities [ 16 ] . ⬇ 1 contract VulnerableLottery { 2 uint256

Read the complete text