[論文レビュー] Do you still need a manual smart contract audit?
本論文はGPT-4-32kとClaude-v1.3-100kを用いた52件の脆弱なDeFiスマートコントラクトの自動セキュリティ監査を評価し、40%の脆弱性ヒット率と多くの偽陽性を発見。変異テストにより最大約78.8%の真陽性が得られ、LLMは支援にはなるが手動監査を置き換えるには至らないことを示している。
We investigate the feasibility of employing large language models (LLMs) for conducting the security audit of smart contracts, a traditionally time-consuming and costly process. Our research focuses on the optimization of prompt engineering for enhanced security analysis, and we evaluate the performance and accuracy of LLMs using a benchmark dataset comprising 52 Decentralized Finance (DeFi) smart contracts that have previously been compromised. Our findings reveal that, when applied to vulnerable contracts, both GPT-4 and Claude models correctly identify the vulnerability type in 40% of the cases. However, these models also demonstrate a high false positive rate, necessitating continued involvement from manual auditors. The LLMs tested outperform a random model by 20% in terms of F1-score. To ensure the integrity of our study, we conduct mutation testing on five newly developed and ostensibly secure smart contracts, into which we manually insert two and 15 vulnerabilities each. This testing yielded a remarkable best-case 78.7% true positive rate for the GPT-4-32k model. We tested both, asking the models to perform a binary classification on whether a contract is vulnerable, and a non-binary prompt. We also examined the influence of model temperature variations and context length on the LLM's performance. Despite the potential for many further enhancements, this work lays the groundwork for a more efficient and economical approach to smart contract security audits.
研究の動機と目的
- スマートコントラクトのセキュリティ監査における大規模言語モデル(LLMs)の利用可能性を評価する。
- LLMsが検出可能な脆弱性タイプを特定し、既知の攻撃に対する精度を測定する。
- 文脈長、温度、プロンプトの影響がLLMの性能に及ぼす影響を分析する。
- 挿入された脆弱性を含む新たに作成した安全なコントラクトを用いた変異テストで頑健性を評価する。
提案手法
- GPT-4-32kとClaude-v1.3-100kのAPIを用いて、52の脆弱なDeFiコントラクトに対して38の脆弱性タイプの単一ショット二値分類を実行する。
- スマートコントラクトのソースコードを文脈として提供し、各脆弱性タイプについてYES/NOで回答するようモデルにプロンプトする。
- 結果を集計して真陽性、偽陽性、真陰性、偽陰性を算出する。
- 新たに作成した安全なコントラクト5件に2つまたは15の脆弱性を挿入し、バイナリとノンバイナリのプロンプトで再評価することで変異テストを実施する。
- 文脈長(トークン制限)と温度がモデルの性能に与える影響を調べる。
- プロンプトと結果を示す2つの思考過程の事例研究を提供する。
実験結果
リサーチクエスチョン
- RQ1GPT-4-32kとClaude-v1.3-100kはDeFiスマートコントラクトの脆弱性タイプを信頼性高く識別できるか。
- RQ2既知の脆弱なコントラクトにおけるLLMのヒット率はどれくらいで、偽陽性はどれだけ出るか。
- RQ3文脈長と温度がスマートコントラクト監査におけるLLMの性能にどう影響するか。
- RQ4変異テストは見ぬ脆弱性に対するLLMベース監査の頑健性を明らかにするか。
主な発見
| モデル | 真陽性 | 真陰性 | 偽陽性 | 偽陰性 |
|---|---|---|---|---|
| claude-v1.3-100k | 26 | 1290 | 578 | 47 |
| gpt-4-32k | 32 | 1128 | 740 | 41 |
| random | 36.54 | 960.62 | 962.42 | 39.21 |
- LLMsは52のDeFi攻撃における脆弱性タイプの40%を識別した。
- 全体で1318の偽陽性があり、依然として大量の手動検証が必要であることを示している。
- 組み合わせた場合、GPT-4-32kとClaude-v1.3-100kは脆弱性タイプのヒット率を58/146(40%)とし、GPT-4-32kの平均F1スコアは0.077、Claude-100kは0.076だった。
- 5つの合成コントラクトでの変異テストは、特定の条件下でGPT-4-32kに対して最大78.8%の真陽性をもたらした。
- 非バイナリプロンプトは一般にバイナリプロンプトより真陽性率が高くなる傾向があり、より豊富な回答が脆弱性発見を支援できることを示唆している。
- より長い文脈長は性能を低下させる傾向があり、 Claudeは長い文脈で比較的良好な真陽性を示した。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。