CodeHacker: Automated Test Case Generation for Detecting Vulnerabilities in Competitive Programming Solutions

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Shi, Jingwei, Yin, Xinxiang, Huang, Jing, Zhao, Jinman, Tao, Shengyu
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917290313777152
author Shi, Jingwei
Yin, Xinxiang
Huang, Jing
Zhao, Jinman
Tao, Shengyu
author_facet Shi, Jingwei
Yin, Xinxiang
Huang, Jing
Zhao, Jinman
Tao, Shengyu
contents The evaluation of Large Language Models (LLMs) for code generation relies heavily on the quality and robustness of test cases. However, existing benchmarks often lack coverage for subtle corner cases, allowing incorrect solutions to pass. To bridge this gap, we propose CodeHacker, an automated agent framework dedicated to generating targeted adversarial test cases that expose latent vulnerabilities in program submissions. Mimicking the hack mechanism in competitive programming, CodeHacker employs a multi-strategy approach, including stress testing, anti-hash attacks, and logic-specific targeting to break specific code submissions. To ensure the validity and reliability of these attacks, we introduce a Calibration Phase, where the agent iteratively refines its own Validator and Checker via self-generated adversarial probes before evaluating contestant code.Experiments demonstrate that CodeHacker significantly improves the True Negative Rate (TNR) of existing datasets, effectively filtering out incorrect solutions that were previously accepted. Furthermore, generated adversarial cases prove to be superior training data, boosting the performance of RL-trained models on benchmarks like LiveCodeBench.
format Preprint
id arxiv_https___arxiv_org_abs_2602_20213
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle CodeHacker: Automated Test Case Generation for Detecting Vulnerabilities in Competitive Programming Solutions
Shi, Jingwei
Yin, Xinxiang
Huang, Jing
Zhao, Jinman
Tao, Shengyu
Software Engineering
Artificial Intelligence
Cryptography and Security
The evaluation of Large Language Models (LLMs) for code generation relies heavily on the quality and robustness of test cases. However, existing benchmarks often lack coverage for subtle corner cases, allowing incorrect solutions to pass. To bridge this gap, we propose CodeHacker, an automated agent framework dedicated to generating targeted adversarial test cases that expose latent vulnerabilities in program submissions. Mimicking the hack mechanism in competitive programming, CodeHacker employs a multi-strategy approach, including stress testing, anti-hash attacks, and logic-specific targeting to break specific code submissions. To ensure the validity and reliability of these attacks, we introduce a Calibration Phase, where the agent iteratively refines its own Validator and Checker via self-generated adversarial probes before evaluating contestant code.Experiments demonstrate that CodeHacker significantly improves the True Negative Rate (TNR) of existing datasets, effectively filtering out incorrect solutions that were previously accepted. Furthermore, generated adversarial cases prove to be superior training data, boosting the performance of RL-trained models on benchmarks like LiveCodeBench.
title CodeHacker: Automated Test Case Generation for Detecting Vulnerabilities in Competitive Programming Solutions
topic Software Engineering
Artificial Intelligence
Cryptography and Security
url https://arxiv.org/abs/2602.20213