Skip to main navigation Skip to search Skip to main content

Understanding and Detecting SQL Function Bugs Using Simple Boundary Arguments to Trigger Hundreds of DBMS Bugs

  • Jingzhou Fu
  • , Jie Liang*
  • , Zhiyong Wu
  • , Yanyang Zhao
  • , Shanshan Li
  • , Yu Jiang*
  • *Corresponding author for this work
  • Tsinghua University
  • National University of Defense Technology

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution › peer-review

Abstract

Built-in SQL functions are crucial in Database Management Systems (DBMSs), supporting various operations and computations across multiple data types. They are essential for querying, data transformation, and aggregation. Despite their importance, the bugs in SQL functions have caused widespread problems in the real world, from system failures to arbitrary code execution. However, the understanding of the bug characteristics is limited. More importantly, conventional function testing methods struggle to generate semantically correct SQL test cases, while DBMS testing efforts are hard to measure built-in SQL functions. This paper presents a comprehensive study of 318 built-in SQL function bugs, shedding light on their characteristics and root causes. Our investigation reveals that 87.4% of these bugs were caused by improper handling of boundary values of arguments. The boundary values of arguments come from three sources: literal values, type castings, and nested functions. By studying the bugs from three sources, we summarized 10 SQL patterns of bug-inducing queries. Moreover, we designed Soft, a testing tool based on the patterns to test seven widely used DBMSs, including PostgreSQL, MySQL, and ClickHouse. Soft discovered and confirmed 132 previously unknown SQL function bugs. The DBMS vendors took these bugs seriously and fixed 97 bugs in three days. For example, the CTO of ClickHouse commented on one bug: “We must fix it immediately or get rid of this function.”

Original languageEnglish
Title of host publicationEuroSys 2025 - Proceedings of the 2025 20th European Conference on Computer Systems
PublisherAssociation for Computing Machinery, Inc
Pages1061-1076
Number of pages16
ISBN (Electronic)9798400711961
DOIs
StatePublished - 30 Mar 2025
Externally publishedYes
Event20th European Conference on Computer Systems, EuroSys 2025, co-located 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS 2025 - Rotterdam, Netherlands
Duration: 30 Mar 2025 → 3 Apr 2025

Publication series

NameEuroSys 2025 - Proceedings of the 2025 20th European Conference on Computer Systems

Conference

Conference20th European Conference on Computer Systems, EuroSys 2025, co-located 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS 2025
Country/TerritoryNetherlands
CityRotterdam
Period30/03/25 → 3/04/25

Keywords

  • DBMS
  • SQL Function
  • Vulnerability Detection

Fingerprint

Dive into the research topics of 'Understanding and Detecting SQL Function Bugs Using Simple Boundary Arguments to Trigger Hundreds of DBMS Bugs'. Together they form a unique fingerprint.

Cite this