arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.04941cs.DBcs.CR
收藏

利用上下文敏感实例化与多计划执行检测 DBMS 缺陷

Detecting DBMS Bugs with Context-Sensitive Instantiation and Multi-Plan Execution

Jiaqi Li, Ke Wang, Yaoguang Chen, Yajin Zhou, Lei Wu, Jiashui Wang

AI总结:

本文提出 Kangaroo,通过上下文敏感实例化生成有效 SQL,并利用多计划执行比对结果发现 DBMS 逻辑缺陷,在 SQLite、PostgreSQL 和 MySQL 中检出 50 个新缺陷。

摘要:

DBMS 缺陷可能导致严重后果,引发严峻的安全与隐私问题。本文致力于检测 DBMS 中的内存缺陷和逻辑缺陷,旨在解决两个固有挑战:如何在测试用例中生成语义正确的 SQL 查询,以及如何提出有效的 oracle 来捕获逻辑缺陷。为此,我们的系统提出了两项关键技术。第一项关键技术称为上下文敏感实例化,它考虑所有静态语义要求(包括但不限于现有系统使用的标识符类型),以生成语义有效的 SQL 查询。第二项关键技术称为多计划执行,可有效捕获逻辑缺陷。给定一个测试用例,多计划执行让 DBMS 执行所有查询计划,而不是默认的最优计划,并比较结果。如果在所执行查询计划的执行结果之间发现差异,就检测到一个逻辑缺陷。我们实现了名为 Kangaroo 的原型系统,并将其应用于三个广泛使用且经过充分测试的 DBMS,包括 SQLite、PostgreSQL 和 MySQL。我们的系统成功检测到 50 个新缺陷。与最先进系统的比较表明,我们的系统在生成的语义有效 SQL 查询数量、测试期间探索的代码路径以及检测到的缺陷方面均优于它们。

英文摘要:

DBMS bugs can cause serious consequences, posing severe security and privacy concerns. This paper works towards the detection of memory bugs and logic bugs in DBMSs, and aims to solve the two innate challenges, including how to generate semantically correct SQL queries in a test case, and how to propose effective oracles to capture logic bugs. To this end, our system proposes two key techniques. The first key technique is called context-sensitive instantiation, which considers all static semantic requirements (including but not limited to the identifier type used by existing systems) to generate semantically valid SQL queries. The second key technique is called multi-plan execution, which can effectively capture logic bugs. Given a test case, multi-plan execution makes the DBMS execute all query plans instead of the default optimal one, and compares the results. A logic bug is detected if a difference is found among the execution results of the executed query plans. We have implemented a prototype system called Kangaroo and applied it to three widely used and well-tested DBMSs, including SQLite, PostgreSQL, and MySQL. Our system successfully detected 50 new bugs. The comparison between our system with the state-of-the-art systems shows that our system outperforms them in terms of the number of generated semantically valid SQL queries, the explored code paths during testing, and the detected bugs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑