Skip to main navigation Skip to search Skip to main content

Finding Correctness Bugs in eBPF Verifier with Structured and Sanitized Program

  • Hao Sun
  • , Yiru Xu
  • , Jianzhong Liu
  • , Yuheng Shen
  • , Nan Guan
  • , Yu Jiang*
  • *Corresponding author for this work

Research output: Chapters, Conference Papers, Creative and Literary WorksRGC 32 - Refereed conference paper (with host publication)peer-review

Abstract

eBPF is an inspiring technique in Linux that allows user space processes to extend the kernel by dynamically injecting programs. However, it poses security issues, since the untrusted user code is now executed in the kernel space. eBPF utilizes a verifier to validate the safety of the provided programs, thus its correctness is of paramount importance as attackers may exploit vulnerabilities within it to inject malicious programs. Bug-finding tools like kernel fuzzers currently can detect memory bugs in eBPF system calls, but they experience difficulties in finding correctness bugs in the verifier, e.g., incorrect validations that allow the loading of unsafe programs. Because, unlike detecting memory bugs, where sanitizers can capture such errors once observed, automatically uncovering correctness bugs is very difficult, without an effective test oracle that determines if the verifier behaves correctly for given programs.
In this paper, we propose an effective approach to automatically detect the verifier's correctness bugs. Our core observation is that since the verifier aims to ensure that eBPF programs do not affect the security of the kernel, any illegal behaviors in verified programs are indicators of correctness bugs in the verifier. Indeed, we can convert the detection of logical errors in the verifier to traditional bug finding in eBPF programs. Based on such insight, we devise two indicators for correctness bugs and propose corresponding sanitation mechanisms to capture them, both of which naturally form an effective test oracle. We implemented our idea in a tool, namely BVF, which generates structured eBPF programs to pass the verifier, and subsequently, it finds correctness bugs by detecting runtime errors in verified programs with the indicators. Experiments show that although the verifier has received extensive scrutiny and has been intensively tested by tools like Syzkaller and Buzzer, BVF still found 11 previously unknown vulnerabilities in eBPF, of which six are correctness bugs of critical severity in the verifier.
© 2024 ACM.
Original languageEnglish
Title of host publicationEuroSys '24: Proceedings of the Nineteenth European Conference on Computer Systems
PublisherAssociation for Computing Machinery
Pages689-703
ISBN (Print)9798400704376
DOIs
Publication statusPublished - Apr 2024
Event19th European Conference on Computer Systems (EuroSys 2024) - Royal Olympic Hotel, Athens, Greece
Duration: 22 Apr 202425 Apr 2024

Publication series

NameEuroSys - Proceedings of the European Conference on Computer Systems

Conference

Conference19th European Conference on Computer Systems (EuroSys 2024)
PlaceGreece
CityAthens
Period22/04/2425/04/24

Bibliographical note

Full text of this publication does not contain sufficient affiliation information. With consent from the author(s) concerned, the Research Unit(s) information for this record is based on the existing academic department affiliation of the author(s).

Research Keywords

  • eBPF Verifier
  • OS Kernel
  • Testing

Fingerprint

Dive into the research topics of 'Finding Correctness Bugs in eBPF Verifier with Structured and Sanitized Program'. Together they form a unique fingerprint.

Cite this