NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AiRacleX: Automated Detection of Price Oracle Manipulations via LLM-Driven Knowledge Mining and Prompt Generation

Bo Gao, Yuan Wang, Qingsong Wei, Yong Liu, Rick Siow Mong Goh, David Lo · DOI

TL;DR

This paper introduces AiRacleX, a novel framework that uses Large Language Models (LLMs) to automatically detect price oracle manipulation vulnerabilities in smart contracts before they are deployed. By combining LLM-driven knowledge extraction and sophisticated prompt engineering, AiRacleX significantly improves the detection of these critical DeFi security flaws, outperforming existing state-of-the-art tools.

What Problem Does This Paper Address?

Decentralized Finance (DeFi) relies heavily on price oracles to provide accurate, real-time asset prices for smart contracts. These oracles are crucial for functions like lending, borrowing, and trading. However, they are a prime target for manipulation, where attackers can exploit vulnerabilities to artificially alter asset prices, leading to unfair valuations and financial gains. Detecting these "Price Oracle Manipulations" (POM) is challenging because traditional methods often require manual expertise and are reactive, meaning they identify issues after an attack has occurred. Since smart contracts are often immutable once deployed, fixing these vulnerabilities post-deployment is difficult and costly. This paper addresses the critical need for a proactive, automated system to identify POM vulnerabilities before smart contracts go live.

Methods

AiRacleX employs a three-stage, LLM-driven approach:

  1. Domain Knowledge Synthesizer: This LLM module ingests academic literature on price oracle vulnerabilities to extract and synthesize precise, high-quality domain knowledge. This step aims to filter out noisy data and provide a solid, expert-level understanding of POM without requiring human experts to manually curate it.
  2. Prompt Generator: Using the synthesized knowledge, this LLM generates structured, context-aware "Chain-of-Thought" (CoT) prompts. These prompts guide the detection process by breaking down the complex task of identifying POM into logical steps, enhancing the LLM's reasoning capabilities. Techniques like role-based prompting and negative prompts are used to focus the LLM and avoid irrelevant outputs.
  3. Auditor: This final LLM component takes the generated CoT prompt and the smart contract code as input. It then performs a thorough audit to identify potential POM vulnerabilities, outputting findings in a structured JSON format that includes details like the beneficiary, victim, and a clear explanation of the vulnerability.

The framework also emphasizes optimizing the choice of LLM models for each stage and explores the use of open-source LLMs for enhanced privacy and cost-effectiveness.

Datasets

The evaluation of AiRacleX utilized a curated dataset comprising:

  • DeFiHack Dataset: 31 projects that experienced real-world attacks, with 11 projects specifically sourced from the GPTScan's DeFiHack dataset (two projects unrelated to oracle manipulation were excluded). An additional 20 projects from the SOK paper were included to increase the dataset size.
  • Code4Rena Projects: 14 projects from the Code4rena audit contest platform. This included 6 projects from Zhang et al.'s work and 8 newly curated projects from 2022-2023, filtered using keywords related to POM.

This combined dataset, totaling 45 projects and 60 vulnerabilities, was designed to be representative of real-world scenarios and challenges.

Key Insights and Ideas

  • LLMs as Domain Experts: The framework demonstrates that LLMs can effectively synthesize complex domain knowledge from academic papers, acting as a substitute for human experts in the initial knowledge acquisition phase.
  • Prompt Engineering is Key: The success of LLM-based vulnerability detection is highly dependent on the quality of prompts. AiRacleX's automated generation of structured CoT prompts significantly boosts performance.
  • Smaller Models Can Be Mighty: The research found that smaller, more accessible LLM models (like Haiku and 40-mini) can achieve competitive or even superior results compared to larger, more complex models, especially when combined effectively within the AiRacleX framework. This suggests a path towards more cost-effective and accessible security tools.
  • Automation is Achievable: The framework's ability to automate knowledge synthesis and prompt generation, even slightly surpassing human-curated knowledge in some aspects, points towards a future of fully autonomous vulnerability detection systems.

Key Results

  • Improved Recall: AiRacleX achieved a 2.58-times improvement in recall (0.667 vs. 0.259) compared to the state-of-the-art tool GPTScan on a combined dataset.
  • Comparable Precision: While significantly improving recall, AiRacleX maintained comparable precision to GPTScan.
  • Outperforming Baselines: The best configuration of AiRacleX (Haiku-Haiku-40-mini) achieved the highest F1-score of 0.426, outperforming both GPTScan (0.283) and a zero-shot CoT baseline.
  • Code4Rena Performance: On the challenging Code4Rena dataset, AiRacleX demonstrated significantly higher recall (0.54 vs. 0.13) and F1-score (0.157 vs. 0.107) compared to GPTScan, though precision remained comparable.
  • Novel Vulnerability Detection: AiRacleX successfully identified 20 bugs that were not detected by GPTScan.

Limitations and Future Work

  • False Positives: While AiRacleX shows strong recall, its precision is comparable to GPTScan, indicating that reducing false positives remains an area for further refinement.
  • Extensibility: The authors suggest extending AiRacleX to detect other DeFi issues like accounting problems, privilege escalation, and inconsistent state updates.
  • Automating Knowledge Synthesis: Future work aims to further automate knowledge synthesis, potentially using Retrieval-Augmented Generation (RAG).
  • Instruction-Tuned LLMs: Fine-tuning LLMs with instruction-following datasets is proposed to improve prompt adherence and output alignment.
  • Advanced Prompting: Exploring adaptive and context-aware prompting techniques is suggested to minimize false alarms while maintaining high detection accuracy.

Summary updated

BibTeX
@article{gao2025airaclex,
  author = {Bo Gao and Yuan Wang and Qingsong Wei and Yong Liu and Rick Siow Mong Goh and David Lo},
  title = {{AiRacleX: Automated Detection of Price Oracle Manipulations via LLM-Driven Knowledge Mining and Prompt Generation}},
  journal = {IEEE Transactions on Services Computing},
  year = {2025},
  doi = {10.1109/tsc.2025.3638205},
}
Figure