Original title:
Runtime detekce útoků na DeFi smart kontrakty
Translated title:
Runtime detection of attacks on DeFi smart contracts
Authors:
Klimau, Aliaksei ; Olekšák, Samuel (referee) ; Homoliak, Ivan (advisor) Document type: Bachelor's theses
Year:
2025
Language:
eng Publisher:
Vysoké učení technické v Brně. Fakulta informačních technologií Abstract:
[eng][cze]
Tato bakalářská práce se zabývá bezpečnostními výzvami v oblasti decentralizovaných financí (DeFi) vývojem nástroje DeFiRuleGuard, který slouží jako proof-of-concept pro běhovou detekci útoků na chytré kontrakty. Systém umožňuje uživatelům definovat vlastní, stavově citlivá pravidla, která jsou vyhodnocována na základě simulovaných exekucí transakcí, přičemž využívá mechanismus temporálního porovnávání stavů k identifikaci nelegitimních změn. Klíčové komponenty zahrnují uživatelské rozhraní pro správu pravidel, rule engine implementovaný v Pythonu s funkcemi lexikální analýzy, parsingu, typové kontroly a vyhodnocování, engine pro simulaci transakcí založený na Node.js a EthereumJS pro testování v lokálním EVM prostředí a backend v Pythonu s FastAPI pro orchestraci. Evaluace úspěšně demonstrovala schopnost DeFiRuleGuard detekovat reentrancy útok, inspirovaný reálnými incidenty jako byl exploit Fei Protocol, prostřednictvím identifikace anomálních stavových přechodů. Práce přispívá flexibilním rámcem pro proaktivní bezpečnostní analýzu a potvrzuje životaschopnost uživatelsky definovaného, simulačně řízeného vyhodnocování pravidel pro zvýšení bezpečnosti chytrých kontraktů.
This thesis addresses the security challenges in Decentralized Finance (DeFi) by developing DeFiRuleGuard, a proof-of-concept tool for the runtime detection of smart contract attacks. The system allows users to define custom, state-sensitive rules that are evaluated against simulated transaction executions, leveraging a temporal comparison mechanism to identify illicit state changes. Key components include a user interface for rule management, a Python-based rule engine with lexing, parsing, type-checking, and evaluation capabilities, a Node.js and EthereumJS-based transaction simulation engine for local EVM environment testing, and a Python FastAPI backend for orchestration. The evaluation successfully demonstrated DeFiRuleGuard’s ability to detect a reentrancy attack, inspired by real-world incidents like the Fei Protocol exploit, by identifying anomalous state transitions. This work contributes by proposing a flexible framework for proactive security analysis, establishing the viability of user-defined, simulation-driven rule evaluation for enhancing smart contract security.
Keywords:
Bezpečnost blockchainu.; Bezpečnostní analýza; Běhová detekce útoků; Chytré kontrakty; Decentralizované finance; DeFi; Ethereum; EVM; Flash půjčky; Manipulace s orákly; Reentrancy útoky; Simulace transakcí; Systémy založené na pravidlech; Blockchain Security; Decentralized Finance; DeFi; Ethereum; EVM; Flash Loans; Oracle Manipulation; Reentrancy Attacks; Rule-Based Systems; Runtime Attack Detection; Security Analysis; Smart Contracts; Transaction Simulation
Institution: Brno University of Technology
(web)
Document availability information: Fulltext is available in the Brno University of Technology Digital Library. Original record: http://hdl.handle.net/11012/254540