一句话:提出用强化学习引导提示选择,让LLM生成用例对数据库连接器进行动态差分测试,以发现不一致与漏洞。
数据库连接器是应用与DBMS交互的关键组件,但其安全漏洞常被忽视:漏洞行为模式细微、实现不规范,现有fuzzing和LLM方法因缺乏领域知识难以覆盖接口与内部逻辑。本文提出基于LLM并由强化学习引导的测试用例生成方法:先用参数化模板构造包含领域知识的提示,LLM据此生成测试用例,再在多个连接器间进行动态差分测试;整个流程迭代执行,RL根据前几轮的行为反馈选择最优提示,以最大化发现不一致的效率。作者在MySQL Connector/J和OceanBase Connector/J上初步评估,报告16个bug,其中10个被官方确认,其余被承认为不安全实现。
Database connectors are critical components that enable applications to interact with database management systems (DBMS) but their security vulnerabilities are often neglected. Unlike traditional software defects, connector vulnerabilities exhibit subtle behavioral patterns and are inherently challenging to detect. Moreover, non-standardized implementation of connectors leaves potential risks (i.e., unsafe implementations) but is more elusive. As a result, existing fuzzing methods are ineffective in finding such vulnerabilities. Even large language model (LLM)-based methods are still incapable of generating test cases that can invoke all the interface and internal logic of database connectors due to a lack of domain knowledge.In this paper, we propose a new LLM-based test case generation method guided by reinforcement learning (RL) for database connector testing. Specifically, to equip the LLM with sufficient and appropriate domain knowledge, a parameterized template is composed for prompt construction. The LLM then generates test cases instructed by the constructed prompts, which are dynamically evaluated through differential testing across multiple connectors. The testing process is carried out iteratively, where RL is adopted to select the optimal prompt in each round based on behavioral feedback from the previous rounds, to maximize the efficiency of discovering inconsistencies. Finally, we implement and evaluate the aforementioned methodology on two widely used JDBC connectors, namely MySQL Connector/J and OceanBase Connector/J. In the preliminary results, we have reported 16 bugs, among which 10 are officially confirmed, and the rest are acknowledged as unsafe implementations.
DOI 原文 ·
@inproceedings{paperbot9445,
title = {LLM-based Dynamic Differential Testing for Database Connectors with Reinforcement Learning-Guided Prompt Selection},
author = {Ce Lyu and Yanhao Wang and Jie Liang and Minghao Zhao},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00322}
}