[論文レビュー] GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysis
GPTScan は GPT ベースのコード理解と静的分析を組み合わせ、Solidity スマートコントラクトのロジック脆弱性を検出します。複数のデータセットで高い精度と再現率を達成し、静的検証によって偽陽性を減らします。
Smart contracts are prone to various vulnerabilities, leading to substantial financial losses over time. Current analysis tools mainly target vulnerabilities with fixed control or data-flow patterns, such as re-entrancy and integer overflow. However, a recent study on Web3 security bugs revealed that about 80% of these bugs cannot be audited by existing tools due to the lack of domain-specific property description and checking. Given recent advances in Large Language Models (LLMs), it is worth exploring how Generative Pre-training Transformer (GPT) could aid in detecting logicc vulnerabilities. In this paper, we propose GPTScan, the first tool combining GPT with static analysis for smart contract logic vulnerability detection. Instead of relying solely on GPT to identify vulnerabilities, which can lead to high false positives and is limited by GPT's pre-trained knowledge, we utilize GPT as a versatile code understanding tool. By breaking down each logic vulnerability type into scenarios and properties, GPTScan matches candidate vulnerabilities with GPT. To enhance accuracy, GPTScan further instructs GPT to intelligently recognize key variables and statements, which are then validated by static confirmation. Evaluation on diverse datasets with around 400 contract projects and 3K Solidity files shows that GPTScan achieves high precision (over 90%) for token contracts and acceptable precision (57.14%) for large projects like Web3Bugs. It effectively detects ground-truth logic vulnerabilities with a recall of over 70%, including 9 new vulnerabilities missed by human auditors. GPTScan is fast and cost-effective, taking an average of 14.39 seconds and 0.01 USD to scan per thousand lines of Solidity code. Moreover, static confirmation helps GPTScan reduce two-thirds of false positives.
研究の動機と目的
- ほとんどの脆弱性がロジックベースであり、パターン駆動ツールでは検出されないというギャップを埋める。
- GPT をコード理解ツールとして活用し、コードレベルのシナリオと脆弱性の属性を特定する。
- GPT ベースのマッチングと静的検証を組み合わせて候補脆弱性を検証する。
- 多様な実世界データセットで GPTScan を評価し、精度、リコール、コスト効率を評価する。
提案手法
- GPT マッチングのために、ロジック脆弱性タイプをコードレベルのシナリオと属性に分解する。
- GPT 分析前に候補関数を絞り込むための多次元フィルタリングを適用する。
- シナリオ→属性マッチングのプロンプトを用いた GPT-3.5-turbo を用いて、潜在的に脆弱な関数を識別する。
- 静的検証のために重要な変数と statements を抽出するように GPT にプロンプトする。
- データフロー追跡、値の比較チェック、順序チェック、関数呼び出し引数チェックという4つの静的分析モジュールで GPT が識別した候補を検証する。)
- table_headers:
- table_rows:
実験結果
リサーチクエスチョン
- RQ1GPT を一般的なコード理解ツールとして使用した場合、静的分析と組み合わせることでロジック脆弱性を効果的に識別できるか?
- RQ2マルチディメンショナルフィルタリングは、Solidity の大規模プロジェクト全体で検出精度を保ちつつ GPT コストを削減できるか?
- RQ3静的検証は GPT の偽陽性を減らし、精度を向上させる影響はどの程度か?
- RQ4トークン契約と大規模なマルチファイルプロジェクトにおける精度とリコールの点で、GPTScan の性能はどうか?
主な発見
- GPTScan はトークン契約(Top200 および DefiHacks データセット)で高精度(90% 以上)を達成。
- GPTScan は Web3Bugs のような大規模プロジェクトで受け入れ可能な精度(57.14%)を達成。
- 実地のロジック脆弱性はリコールが70%超で検出され、人間の監査人が報告していない9件の新しい脆弱性を含む。
- 平均スキャン時間は 14.39 秒、Solidity コードの千行あたりコストは 0.01 USD;大規模プロジェクトではコストとスキャン時間が上昇し(約0.018 USD、約20秒)。
- 静的検証により Web3Bugs データセットで元の偽陽性の 65.84% が削減された。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。