LogicEval: A Systematic Framework for Evaluating Automated Repair Techniques for Logical Vulnerabilities in Real-World Software
Organizations: The Pennsylvania State University
Abstract
Logical vulnerabilities in software stem from flaws in program logic rather than memory safety, which can lead to critical security failures. Although existing automated program repair techniques primarily focus on repairing memory corruption vulnerabilities, they struggle with logical vulnerabilities because of their limited semantic understanding of the vulnerable code and its expected behavior. On the other hand, recent successes of large language models (LLMs) in understanding and repairing code are promising. However, no framework currently exists to analyze the capabilities and limitations of such techniques for logical vulnerabilities. We aim to systematically evaluate both traditional and LLM based repair approaches for addressing real world logical vulnerabilities. To facilitate our assessment, we created the first ever dataset, LogicDS, comprising 122 logical vulnerabilities that reflect tangible security impact. We also developed a systematic framework, LogicEval, to evaluate patches for logical vulnerabilities. Evaluations suggest that compilation and testing failures are primarily driven by prompt sensitivity, loss of code context, and difficulty in patch localization.
Figures & tables
| Dataset | Tool | C | T | CSL | CSQ | JL | JQ |
| Real | VRPilot | 0.82 | 0.08 | 0.65 | 0.66 | 0.02 | 0.07 |
| Synthetic | SimFix | 0.01 | 0.00 | 0.62 | 0.64 | 0.01 | 0.00 |
| KNOD | 0.35 | 0.00 | 0.64 | 0.65 | 0.02 | 0.00 | |
| VRPilot | 0.56 | 0.09 | 0.65 | 0.65 | 0.15 | 0.03 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P1 | 0.50 | 0.06 | 0.81 | 0.76 | 0.10 | 0.35 | 0.66 | 0.04 | 0.81 | 0.73 | 0.60 | 0.53 | 0.58 | 0.07 | 0.77 | 0.77 | 0.79 | 0.32 |
| P2 | 0.48 | 0.07 | 0.81 | 0.76 | 0.13 | 0.33 | 0.70 | 0.04 | 0.81 | 0.74 | 0.54 | 0.54 | – | – | – | – | – | – |
| P3 | 0.54 | 0.06 | 0.81 | 0.77 | 0.13 | 0.36 | 0.64 | 0.04 | 0.80 | 0.74 | 0.54 | 0.52 | – | – | – | – | – | – |
| P4 | 0.50 | 0.06 | 0.81 | 0.75 | 0.11 | 0.49 | 0.66 | 0.04 | 0.80 | 0.70 | 0.49 | 0.51 | 0.66 | 0.07 | 0.79 | 0.79 | 0.64 | 0.41 |
| P5 | 0.53 | 0.03 | 0.82 | 0.77 | 0.13 | 0.44 | 0.57 | 0.03 | 0.80 | 0.74 | 0.51 | 0.46 | 0.68 | 0.08 | 0.77 | 0.77 | 0.66 | 0.28 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P9 | 0.53 | 0.07 | 0.82 | 0.76 | 0.08 | 0.41 | 0.60 | 0.07 | 0.81 | 0.74 | 0.54 | 0.49 | 0.64 | 0.14 | 0.78 | 0.78 | 0.70 | 0.31 |
| P10 | 0.55 | 0.07 | 0.78 | 0.76 | 0.02 | 0.34 | 0.65 | 0.08 | 0.80 | 0.74 | 0.54 | 0.58 | 0.71 | 0.16 | 0.75 | 0.75 | 0.61 | 0.36 |
| P11 | 0.49 | 0.06 | 0.81 | 0.76 | 0.10 | 0.43 | 0.62 | 0.11 | 0.82 | 0.75 | 0.49 | 0.49 | 0.68 | 0.14 | 0.77 | 0.77 | 0.72 | 0.36 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P12 | 0.66 | 0.04 | 0.67 | 0.63 | 0.02 | 0.10 | 0.75 | 0.05 | 0.62 | 0.61 | 0.11 | 0.13 | 0.60 | 0.07 | 0.64 | 0.64 | 0.20 | 0.07 |
| P13 | 0.55 | 0.03 | 0.81 | 0.76 | 0.11 | 0.41 | 0.60 | 0.04 | 0.80 | 0.73 | 0.59 | 0.48 | 0.64 | 0.14 | 0.77 | 0.77 | 0.70 | 0.38 |
| P14 | 0.49 | 0.00 | 0.81 | 0.78 | 0.18 | 0.51 | 0.55 | 0.00 | 0.80 | 0.74 | 0.69 | 0.64 | 0.51 | 0.09 | 0.78 | 0.77 | 0.72 | 0.39 |
| P15 | 0.62 | 0.07 | 0.81 | 0.77 | 0.46 | 0.72 | 0.70 | 0.08 | 0.81 | 0.75 | 0.79 | 0.77 | 0.55 | 0.13 | 0.76 | 0.76 | 0.84 | 0.57 |
| P16 | 0.63 | 0.00 | 0.77 | 0.74 | 0.33 | 0.70 | 0.63 | 0.00 | 0.74 | 0.72 | 0.67 | 0.67 | 0.51 | 0.08 | 0.72 | 0.71 | 0.72 | 0.44 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P17 | 0.51 | 0.03 | 0.56 | 0.52 | 0.02 | 0.07 | 0.38 | 0.00 | 0.60 | 0.58 | 0.02 | 0.08 | 0.30 | 0.03 | 0.56 | 0.55 | 0.02 | 0.00 |
| P18 | 0.43 | 0.00 | 0.63 | 0.59 | 0.00 | 0.07 | 0.38 | 0.00 | 0.60 | 0.57 | 0.05 | 0.07 | 0.23 | 0.05 | 0.61 | 0.61 | 0.05 | 0.02 |
| P19 | 0.43 | 0.00 | 0.62 | 0.59 | 0.03 | 0.08 | 0.38 | 0.00 | 0.61 | 0.60 | 0.05 | 0.10 | 0.17 | 0.00 | 0.61 | 0.60 | 0.10 | 0.02 |
| P20 | 0.42 | 0.00 | 0.70 | 0.66 | 0.07 | 0.16 | 0.38 | 0.00 | 0.64 | 0.63 | 0.28 | 0.20 | 0.30 | 0.00 | 0.69 | 0.70 | 0.34 | 0.05 |
| P21 | 0.36 | 0.00 | 0.80 | 0.75 | 0.10 | 0.48 | 0.38 | 0.00 | 0.74 | 0.69 | 0.67 | 0.64 | 0.21 | 0.00 | 0.75 | 0.75 | 0.75 | 0.23 |
| Metric | Precision | Recall | F1 Score | Accuracy |
| Compilation | 0.424 | 0.6 | 0.497 | 0.571 |
| J-Qwen | 0.773 | 0.667 | 0.716 | 0.8 |
| J-OpenAI | 0.5 | 0.721 | 0.59 | 0.701 |
| J-LLaMA | 0.547 | 0.839 | 0.662 | 0.677 |
| CodeEmbed 70th (0.944) | 0.47 | 0.508 | 0.488 | 0.622 |
| CodeEmbed 90th (0.981) | 0.615 | 0.262 | 0.368 | 0.68 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Category | Optimal Scenario (When it Works) | Adaptable for Logical Vulnerability Repair | Limitations When Applying for Logical Vulnerabilities |
| Template guided | When the vulnerability fix follows a template/pattern | No | Logical vulnerabilities does not follow any general fix pattern. |
| Constraint based | When the vulnerability can be fixed through enforcing constraints easily extractable from source code | Yes, but difficult | Constraint extraction for logical vulnerabilities struggle with path explosion in large codebases and often lacks the necessary specifications or testcases to derive required constraints. |
| Search based | When the vulnerability can be fixed by reusing or slightly adapting a similar code segment elsewhere in the source project | Yes, but achieves poor performance | Usually logical vulnerabilities cannot be fixed by reusing existing code, as each one has distinct expected behavior and requires its own custom logic. |
| Deep learning based | When the vulnerability fix follows a pattern learnable by deep learning models | Yes, but achieves poor performance | Usually logical vulnerabilities do not follow such recognizable pattern |
| Input | Mandatory | Example |
| Vulnerable Source Code | ✔ | Commit (2019a) which is the parent commit of the fix in (2019c) |
| Fixed Source Code | ✔ | Commit (2019c) available in national vulnerability database (2019f) |
| Vulnerability Description | ✔ | CVE description for CVE-2019-1543 found in (2019f) |
| Behavioral Specification | ✘ | Extracted from RFC 7539 [ 72 ] Section 2.8 |
| Context Lines | ✘ | Lines 21-31 and 140-147 in in (2019a) |
| Repair Description | ✘ | A text description generated by observing the fixed source code (2019c) . |
| ID | Description |
| P1-P3 | Temperature set to 0.2, 0.5, and 0.9, respectively |
| P4 | Task-oriented prompt |
| P5 | Zero-shot prompt (same as P1 ) |
| P6 | Few-shot prompt including an example real-world vulnerability description, and vulnerable and fixed blocks |
| P7 | Chain-of-thought prompting, first prompt obtains a repair suggestion , which is placed in the second prompt that asks for patch |
| P8 | Same as P7 , but is not added to the second prompt |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P1 | 0.27 | 0.05 | 0.81 | 0.76 | 0.12 | 0.42 | 0.17 | 0.07 | 0.80 | 0.76 | 0.48 | 0.50 | 0.32 | 0.13 | 0.78 | 0.76 | 0.68 | 0.34 |
| P2 | 0.25 | 0.05 | 0.80 | 0.75 | 0.12 | 0.44 | 0.19 | 0.08 | 0.79 | 0.74 | 0.47 | 0.51 | – | – | – | – | – | – |
| P3 | 0.17 | 0.03 | 0.79 | 0.75 | 0.08 | 0.38 | 0.15 | 0.08 | 0.78 | 0.74 | 0.47 | 0.49 | – | – | – | – | – | – |
| P4 | 0.23 | 0.07 | 0.81 | 0.74 | 0.08 | 0.42 | 0.25 | 0.10 | 0.77 | 0.71 | 0.49 | 0.54 | 0.32 | 0.13 | 0.80 | 0.78 | 0.67 | 0.30 |
| P5 | 0.27 | 0.05 | 0.82 | 0.75 | 0.08 | 0.45 | 0.17 | 0.10 | 0.80 | 0.73 | 0.57 | 0.48 | 0.32 | 0.12 | 0.77 | 0.76 | 0.62 | 0.28 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P9 | 0.23 | 0.05 | 0.81 | 0.75 | 0.10 | 0.38 | 0.20 | 0.07 | 0.81 | 0.75 | 0.50 | 0.55 | 0.30 | 0.12 | 0.78 | 0.76 | 0.63 | 0.27 |
| P10 | 0.40 | 0.07 | 0.76 | 0.75 | 0.08 | 0.35 | 0.40 | 0.17 | 0.78 | 0.73 | 0.45 | 0.52 | 0.48 | 0.22 | 0.76 | 0.74 | 0.72 | 0.30 |
| P11 | 0.23 | 0.08 | 0.80 | 0.76 | 0.07 | 0.42 | 0.30 | 0.13 | 0.80 | 0.75 | 0.48 | 0.53 | 0.43 | 0.18 | 0.76 | 0.75 | 0.72 | 0.30 |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P12 | 0.48 | 0.02 | 0.65 | 0.62 | 0.00 | 0.03 | 0.47 | 0.00 | 0.59 | 0.57 | 0.05 | 0.03 | 0.42 | 0.05 | 0.61 | 0.60 | 0.13 | 0.00 |
| P13 | 0.22 | 0.07 | 0.81 | 0.75 | 0.08 | 0.37 | 0.18 | 0.05 | 0.81 | 0.75 | 0.48 | 0.48 | 0.32 | 0.12 | 0.77 | 0.75 | 0.63 | 0.25 |
| P14 | 0.12 | 0.05 | 0.77 | 0.78 | 0.17 | 0.52 | 0.13 | 0.05 | 0.80 | 0.76 | 0.68 | 0.65 | 0.17 | 0.07 | 0.78 | 0.76 | 0.75 | 0.30 |
| P15 | 0.43 | 0.33 | 0.79 | 0.82 | 0.72 | 0.97 | 0.58 | 0.53 | 0.80 | 0.78 | 0.97 | 0.98 | 0.38 | 0.32 | 0.77 | 0.75 | 0.95 | 0.73 |
| P16 | 0.42 | 0.28 | 0.77 | 0.82 | 0.79 | 0.93 | 0.53 | 0.49 | 0.77 | 0.79 | 0.93 | 1.00 | 0.33 | 0.26 | 0.75 | 0.73 | 0.95 | 0.63 |
| ID | Claim | C (McNemar) | CS (Wilcoxon p, Cliff , Mean Diff., CI) | J (McNemar) |
| 1 | P1 and P2 show similar results | 86/219 vs 85/219 ( =1.0000, OR=1.14) | 0.7801 vs 0.7740; =0.1516 ( ns ); =+0.080; =+0.0061 [-0.0018, +0.0140] | 169/438 vs 175/438 ( =0.5446, OR=0.84) |
| 2 | P1 and P4 show similar results | 136/332 vs 141/332 ( =0.5114, OR=0.76) | 0.7753 vs 0.7696; =0.1634 ( ns ); =+0.062; =+0.0057 [-0.0028, +0.0141] | 289/664 vs 283/664 ( =0.6137, OR=1.13) |
| 3 | P5 shows better C , CS , J than P7 | 139/339 vs 114/339 ( =0.0015, OR=2.47) | 0.7757 vs 0.7420; ( sig ); =+0.537; =+0.0337 [+0.0260, +0.0413] | 300/726 vs 285/726 ( =0.2513, OR=1.22) |
| 4 | P8 shows more C but less CS , J than P7 | 196/339 vs 114/339 ( , OR=5.56) | 0.6344 vs 0.7420; ( sig ); =-0.884; =-0.1076 [-0.1218, -0.0939] | 54/726 vs 285/726 ( , OR=0.08) |
| 5a | P12 has higher C but lower CS , J than P13 | 189/339 vs 138/339 ( , OR=3.12) | 0.6206 vs 0.7731; ( sig ); =-0.967; =-0.1525 [-0.1662, -0.1389] | 53/726 vs 301/726 ( , OR=0.04) |
| 5b | P12 has higher C but lower CS , J than P14 | 189/339 vs 107/339 ( , OR=6.47) | 0.6206 vs 0.7769; ( sig ); =-0.950; =-0.1564 [-0.1715, -0.1411] | 53/726 vs 375/726 ( , OR=0.04) |
| Llama-3.1 | Qwen-2.5 | OpenAI-o3-mini | ||||||||||||||||
| P | C | T | CSQ | CSO | JQ | JO | C | T | CSL | CSO | JL | JO | C | T | CSL | CSQ | JL | JQ |
| P17 | 0.18 | 0.00 | 0.58 | 0.55 | 0.00 | 0.02 | 0.00 | 0.00 | 0.59 | 0.57 | 0.05 | 0.07 | 0.18 | 0.02 | 0.58 | 0.57 | 0.02 | 0.00 |
| P18 | 0.10 | 0.00 | 0.62 | 0.61 | 0.00 | 0.05 | 0.00 | 0.00 | 0.60 | 0.57 | 0.03 | 0.05 | 0.08 | 0.00 | 0.59 | 0.58 | 0.07 | 0.03 |
| P19 | 0.18 | 0.00 | 0.60 | 0.61 | 0.00 | 0.03 | 0.00 | 0.00 | 0.62 | 0.61 | 0.07 | 0.08 | 0.10 | 0.02 | 0.60 | 0.59 | 0.08 | 0.02 |
| P20 | 0.10 | 0.00 | 0.69 | 0.66 | 0.07 | 0.25 | 0.02 | 0.00 | 0.65 | 0.62 | 0.18 | 0.25 | 0.08 | 0.02 | 0.68 | 0.68 | 0.38 | 0.13 |
| P21 | 0.07 | 0.02 | 0.77 | 0.74 | 0.18 | 0.42 | 0.00 | 0.00 | 0.74 | 0.70 | 0.60 | 0.57 | 0.07 | 0.00 | 0.76 | 0.75 | 0.73 | 0.23 |
Automated Program Repair
Automated program repair develops methods that locate software faults and produce validated fixes with limited human effort.
See all 158 papers