Skip to main content
QUICK REVIEW

[논문 리뷰] Do you still need a manual smart contract audit?

Isaac David, Liyi Zhou|arXiv (Cornell University)|2023. 06. 21.
Internet Traffic Analysis and Secure E-voting인용 수 19
한 줄 요약

이 논문은 52개의 취약한 DeFi 스마트 컨트랙트에 대한 자동 보안 감사를 위해 GPT-4-32k와 Claude-v1.3-100k를 평가하고, 40%의 취약점 포착 비율과 다수의 오탐을 발견했습니다; 변이(mutational) 테스트를 통해 최대 약 78.8%의 진양성(true positives)이 도출되어 LLM이 수동 감사의 보조는 가능하나 대체는 불가함을 시사합니다.

ABSTRACT

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이 탐지할 수 있는 취약점 유형을 식별하고 알려진 공격에 대한 정확도를 측정.
  • 맥락 길이, 온도(temperature), 프롬팅이 LLM 성능에 미치는 영향 분석.
  • 삽입된 취약점을 포함한 새로 생성된 안전한 계약에 대한 변이 테스트를 통해 강건성 평가.

제안 방법

  • GPT-4-32k와 Claude-v1.3-100k API를 사용하여 52개의 취약한 DeFi 컨트랙트에 걸친 38개 취약점 유형에 대한 단일 실행 이진 분류를 수행한다.
  • 스마트 컨트랙트 원본 코드를 컨텍스트로 제공하고 각 취약점 유형에 대해 예/아니오로 답하도록 모델에 프롬트를 제시한다.
  • 결과를 집계하여 진양성, 오탐, 진음성, 거짓부정을 계산한다.
  • 5개의 새로 생성된 안전한 컨트랙트에 2개 또는 15개의 취약점을 삽입하고 이진 및 비이진 프롬프트로 재평가하는 변이 테스트를 수행한다.
  • 맥락 길이(토큰 한도)와 온도가 모델 성능에 미치는 영향을 조사한다.
  • 프롬프트와 결과를 보여주는 두 가지 사고 과정(chain-of-thought) 추론 사례 연구를 제공한다.

실험 결과

연구 질문

  • RQ1GPT-4-32k 및 Claude-v1.3-100k가 DeFi 스마트 컨트랙트의 취약점 유형을 신뢰성 있게 식별할 수 있는가?
  • RQ2알려진 취약한 계약에서 LLM의 포착률은 어느 정도이며 오탐은 얼마나 발생하는가?
  • RQ3맥락 길이와 온도가 스마트 컨트랙트 감사에서 LLM 성능에 어떤 영향을 미치는가?
  • RQ4변이 테스트가 보지 못한 취약점에 대한 LLM 기반 감사의 강건성을 드러내는가?

주요 결과

  • 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였습니다.
  • 다섯 개의 합성 컨트랙트에서의 변이 테스트는 특정 조건에서 GPT-4-32k의 진양성 최대 78.8%를 나타냈습니다.
  • 비이진 프롬프트가 일반적으로 이진 프롬프트보다 더 높은 진양성률을 보였으며, 더 풍부한 응답이 취약점 발견에 도움이 될 수 있음을 시사합니다.
  • 더 긴 맥락 길이는 성능을 감소시키는 경향이 있었고, Claude는 더 긴 맥락에서 상대적으로 더 나은 진양성을 보였습니다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.