Example-Based Vulnerability Detection and Repair in Java Code
Example-Based Vulnerability Detection and Repair in Java Code
复制标题
DOI:
10.1145/3524610.3527895
复制
发表时间:
2022-03
期刊:
影响因子:
--
通讯作者:
Y. Zhang;Ya Xiao;Md Mahir Asef Kabir;D. Yao;Na Meng
中科院分区:
文献类型:
--
作者:
Y. Zhang;Ya Xiao;Md Mahir Asef Kabir;D. Yao;Na Meng
The Java libraries JCA and JSSE offer cryptographic APIs to facilitate secure coding. When developers misuse some of the APIs, their code becomes vulnerable to cyber-attacks. To eliminate such vulnerabilities, people built tools to detect security-API misuses via pattern matching. However, most tools do not (1) fix misuses or (2) allow users to extend tools' pattern sets. To overcome both limitations, we created Seader-an example-based approach to detect and repair security-API misuses. Given an exemplar $\langle\text{insecure, secure}\rangle$ code pair, Seader compares the snippets to infer any API-misuse template and corresponding fixing edit. Based on the inferred info, given a program, Seader performs inter-procedural static analysis to search for security-API misuses and to propose customized fixes. For evaluation, we applied Seader to 28 $\langle\text{insecure, secure}\rangle$ code pairs; Seader successfully inferred 21 unique API-misuse templates and related fixes. With these $\langle\text{vulnerability, fix}\rangle$ patterns, we applied Seader to a program benchmark that has 86 known vulnerabilities. Seader detected vulnerabilities with 95% precision, 72% recall, and 82% F-score. We also applied Seader to 100 open-source projects and manually checked 77 suggested repairs; 76 of the repairs were correct. Seader can help developers correctly use security APIs.