[Paper Review] How well does LLM generate security tests?
The study uses ChatGPT-4.0 to generate proof-of-concept security tests for apps with vulnerable libraries, showing 24 exploitable tests across 55 tasks and outperforming SIEGE and TRANSFER.
Developers often build software on top of third-party libraries (Libs) to improve programmer productivity and software quality. The libraries may contain vulnerabilities exploitable by hackers to attack the applications (Apps) built on top of them. People refer to such attacks as supply chain attacks, the documented number of which has increased 742% in 2022. People created tools to mitigate such attacks, by scanning the library dependencies of Apps, identifying the usage of vulnerable library versions, and suggesting secure alternatives to vulnerable dependencies. However, recent studies show that many developers do not trust the reports by these tools; they ask for code or evidence to demonstrate how library vulnerabilities lead to security exploits, in order to assess vulnerability severity and modification necessity. Unfortunately, manually crafting demos of application-specific attacks is challenging and time-consuming, and there is insufficient tool support to automate that procedure. In this study, we used ChatGPT-4.0 to generate security tests, and to demonstrate how vulnerable library dependencies facilitate the supply chain attacks to given Apps. We explored various prompt styles/templates, and found that ChatGPT-4.0 generated tests for all 55 Apps, demonstrating 24 attacks successfully. It outperformed two state-of-the-art security test generators -- TRANSFER and SIEGE -- by generating a lot more tests and achieving more exploits. ChatGPT-4.0 worked better when prompts described more on the vulnerabilities, possible exploits, and code context. Our research will shed light on new research in security test generation. The generated tests will help developers create secure by design and secure by default software.
Motivation & Objective
- Motivate mitigation of supply chain attacks by demonstrating how vulnerabilities in libraries propagate to dependent apps.
- Evaluate whether large language models can generate executable security tests that illustrate exploit paths.
- Compare LLM-generated tests to state-of-the-art test generators to assess effectiveness and practicality.
Proposed method
- Construct a dataset of 55 4 App-Lib pairs where Apps depend on vulnerable library versions.
- Design multiple prompts to ChatGPT (default and variants) to generate security tests that mimic exemplar exploits.
- Phase-wise evaluation: integrate generated tests into Apps, compile, and run tests to validate behavior and exploits.
- Use three metrics (App-Lib test applicability, test compilability, and actual vulnerability exploitation) to assess outcomes.
- Compare results of ChatGPT with two tools, SIEGE and TRANSFER, on the same dataset.
- Analyze success/failure factors and identify information elements in prompts that most influence results.

Experimental results
Research questions
- RQ1RQ1: How effectively does ChatGPT generate security tests for Apps with vulnerable Libs?
- RQ2RQ2: How does the prompt design (information included) affect ChatGPTs performance in test generation?
- RQ3RQ3: How does ChatGPTs performance compare to existing security-test-generation tools (SIEGE, TRANSFER)?
Key findings
- ChatGPT generated tests for all 55 prompts; 26 were compilable and runnable, and 14 became compilable after minor fixes, totaling 40 compilable tests.
- 24 of the compilable tests successfully exploited the known vulnerabilities, demonstrating proof-of-concept exploits.
- ChatGPT outperformed TRANSFER (exploiting 4 vulnerabilities) and SIEGE (exploiting none) on the dataset of 55 apps.
- Without the vulnerability-specific test from the Lib, none of the generated tests could exploit the vulnerability, highlighting the importance of detailed vulnerability context in prompts.
- Prompts containing more descriptive information about vulnerabilities, exploits, and code context improved performance, with the vulnerability test element being particularly crucial.
- Some generated tests did not compile (15 of 55), often due to tooling mocks or missing/incorrect program entities, indicating limitations in automatic test synthesis.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.