Reusing open-source software (OSS) code has become standard in software development. When vulnerabilities are discovered in reused code, maintainers typically apply security patches. However, these patches often include non-vulnerability-related changes, such as code refactoring or updating a setting file. Applying a patch without distinguishing these changes can lead to unintended software malfunctions. Existing techniques do not account for non-remediation code lines in security patches. This study aims to mitigate unexpected failures caused by indiscriminate patch application. We propose a method for identifying the code lines that directly remediate vulnerabilities in security patches. By leveraging lexical preprocessing and Large Language Models (LLMs), our approach semantically classifies code lines within a security patch, distinguishing vulnerability-fixing changes from unrelated changes. In an experimental evaluation using security patches for 25 distinct vulnerability types, the proposed method achieved an F1 score of 0.88, improving 0.22 over the baseline. The results also indicate that classification accuracy decreases for vulnerability types requiring extensive modifications, such as injection and authentication vulnerabilities. Additionally, we revealed that nine out of twenty-five security patches (36% of the patch examined) contained code changes unrelated to vulnerability remediation. Furthermore, we identified key challenges and technical requirements for automating security patch analysis and provided recommendations for the platform providers and the OSS maintainers on best practices for security patches.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Towards the Identification of Vulnerability-Fixing Code Lines in OSS Security Patches Using Lexical Code Segmentation and LLMs

  • Reika Nishimura Arakawa,
  • Yo Kanemoto,
  • Mitsuaki Akiyama

摘要

Reusing open-source software (OSS) code has become standard in software development. When vulnerabilities are discovered in reused code, maintainers typically apply security patches. However, these patches often include non-vulnerability-related changes, such as code refactoring or updating a setting file. Applying a patch without distinguishing these changes can lead to unintended software malfunctions. Existing techniques do not account for non-remediation code lines in security patches. This study aims to mitigate unexpected failures caused by indiscriminate patch application. We propose a method for identifying the code lines that directly remediate vulnerabilities in security patches. By leveraging lexical preprocessing and Large Language Models (LLMs), our approach semantically classifies code lines within a security patch, distinguishing vulnerability-fixing changes from unrelated changes. In an experimental evaluation using security patches for 25 distinct vulnerability types, the proposed method achieved an F1 score of 0.88, improving 0.22 over the baseline. The results also indicate that classification accuracy decreases for vulnerability types requiring extensive modifications, such as injection and authentication vulnerabilities. Additionally, we revealed that nine out of twenty-five security patches (36% of the patch examined) contained code changes unrelated to vulnerability remediation. Furthermore, we identified key challenges and technical requirements for automating security patch analysis and provided recommendations for the platform providers and the OSS maintainers on best practices for security patches.