Source-linked AI summary
HackSynth: LLM Agent and Evaluation Framework for Autonomous Penetration Testing
Lajos Muzsai, David Imolai, András Lukács
TL;DR
Penetration testing is increasingly resource-intensive, and limited understanding of LLM agents’ decisions and vulnerabilities leaves questions about their behavior in complex settings. HackSynth combines command generation and feedback interpretation to test CTF challenges using two benchmarks; experiments report that it solves a significant portion of challenges and underscore the need for safeguards.
Problem
The paper identifies limited understanding of LLM-based penetration-testing agents’ mechanisms, decisions, and vulnerabilities as a gap relevant to predicting their behavior in complex real-world scenarios.
Source: §1 · p. 1Method
HackSynth uses Planner and Summarizer modules to generate and execute commands iteratively, and the paper evaluates it on PicoCTF- and OverTheWire-based benchmarks covering 200 challenges.
Source: §7 · p. 13Results
HackSynth solved a significant portion of CTF challenges, and the evaluation of its actions underscored the need for robust safeguards.
Source: §7 · p. 13Takeaways & Limitations
The authors conclude that LLM-based agents have potential in autonomous penetration testing, with safeguards important for cybersecurity deployment.
Source: §7 · p. 13Firewall measures may be circumvented, including by resetting firewall settings or routing attacks through an internet-connected target machine.
Source: §3.1.4 · p. 5
Abstract
from arXiv · showhide
We introduce HackSynth, a novel Large Language Model (LLM)-based agent capable of autonomous penetration testing. HackSynth's dual-module architecture includes a Planner and a Summarizer, which enable it to generate commands and process feedback iteratively. To benchmark HackSynth, we propose two new Capture The Flag (CTF)-based benchmark sets utilizing the popular platforms PicoCTF and OverTheWire. These benchmarks include two hundred challenges across diverse domains and difficulties, providing a standardized framework for evaluating LLM-based penetration testing agents. Based on these benchmarks, extensive experiments are presented, analyzing the core parameters of HackSynth, including creativity (temperature and top-p) and token utilization. Multiple open source and proprietary LLMs were used to measure the agent's capabilities. The experiments show that the agent performed best with the GPT-4o model, better than what the GPT-4o's system card suggests. We also discuss the safety and predictability of HackSynth's actions. Our findings indicate the potential of LLM-based agents in advancing autonomous penetration testing and the importance of robust safeguards. HackSynth and the benchmarks are publicly available to foster research on autonomous cybersecurity solutions.
1. Introduction
Manual penetration testing is becoming impractical as systems and potential vulnerabilities grow, while existing tools and agents remain limited in adaptability or autonomy. HackSynth and two standardized CTF benchmarks address these gaps, alongside evaluation of agent behavior and safety.
1. Introduction
- Heuristic scanners detect vulnerabilities and misconfigurations but lack adaptability for complex or novel security challenges.The cited tools include Nessus, Snyk, and OpenVAS,,.Source: §1 · p. 1
- Prior LLM-based penetration-testing systems still require human operators for some commands or interface interactions, limiting autonomy and scalability.The passage names PentestGPT [8] and HackingBuddyGPT as examples.Source: §1 · p. 1
- The paper identifies limited understanding of agents’ mechanisms, decisions, and vulnerabilities as a gap for predicting behavior in complex real-world scenarios and supporting safe deployment.The authors also report safety- and reliability-focused experiments, including analysis of core parameters and human evaluation of HackSynth’s process.Source: §1 · pp. 1–2
- The PicoCTF- and OverTheWire-based benchmarks standardize 200 challenges with descriptions, hints, files, categories, difficulties, and solver scripts that can update solutions.The benchmarks are intended to support comparison of LLM-based cybersecurity agents.Source: §1 · p. 2
- HackSynth uses Planner and Summarizer modules to generate commands and interpret feedback iteratively, supporting autonomous CTF solving with context from earlier executions.The architecture is presented as a way to study how to build safe and predictable penetration-testing agents.Source: §1 · p. 2
2. Background
The background moves from CTF challenges and heuristic tools to LLM applications, agent systems, and datasets for evaluating penetration-testing agents.
2.1. Capture The Flag (CTF) Challenges
- CTF challenges test cybersecurity skills by asking participants to find vulnerabilities and retrieve flags from purposefully vulnerable programs or websites.The passage lists domains including web exploitation, cryptography, reverse engineering, forensics, binary exploitation, and general skills.Source: §2.1 · p. 2
2.2. Heuristic CTF Solvers
- Heuristic CTF tools such as Katana and Remenissions automate predefined tasks but cannot adapt to unforeseen challenges or generate novel solutions.The passage contrasts their limited rule sets with human creativity and motivates more adaptive systems.Source: §2.2 · p. 3
2.3. LLMs in cybersecurity
- LLMs have been studied across cybersecurity tasks, including secure coding, test generation, vulnerability detection, malware analysis, code fixing, and offensive applications.The passage also notes that LLMs can assist with malware detection but cannot yet replace humans.Source: §2.3 · p. 3
2.4. LLM agents
- LLM agents have been developed for software engineering and other domains, but the passage states they have not yet reached human engineers’ expertise.Examples include autonomous coding agents and multi-agent software-development frameworks.Source: §2.4 · p. 3
2.5. LLM agents for CTF challenges
- Penetration-testing agents vary in autonomy and tooling, from Metasploit-dependent AutoAttacker to command-executing Cybench and Enigma systems.PentestGPT still needs some human command execution or interface interaction, while NYU CTF combines LLMs with specialized tools.Source: §2.5 · p. 3
2.6. Datasets For Pentesting Agents
- Existing agent datasets include competition and website challenges, but Intercode CTF lacks difficulty ratings and hints and stores flags and files statically.The passage also describes NYU CTF, Cybench, and the absence of a standardized Hack The Box version.Source: §2.6 · p. 4
3. Methods
The Methods section covers HackSynth’s architecture and security solutions, then presents the proposed benchmarks and their construction.
3. Methods
- The Methods section describes HackSynth’s architecture and security solutions alongside the construction of two proposed benchmarks.Source: §3 · p. 4
3.1. HackSynth
HackSynth uses LLM-based Planner and Summarizer modules in an iterative command-and-feedback loop, with execution contained in a containerized environment. Its design addresses risks from out-of-scope interactions, but firewall enforcement has potential bypasses.
3.1. HackSynth
- The Planner generates commands and the Summarizer maintains action history, forming a feedback loop in a containerized Kali environment until the flag is captured or an iteration limit is reached.The architecture overview presents these two LLM-based modules as the system's core components.Source: §3.1 · p. 4, Figure 1 · p. 5
3.1.1. Planner module.
- The Planner uses current system state and summarized prior outputs to select one executable command at a time, while its prompt discourages repetition and prioritizes promising commands.The summarized history is dynamically supplied at each iteration to help preserve context and avoid repeating mistakes.Source: §3.1.1 · p. 4
3.1.2. Summarizer module.
- The Summarizer incorporates each command's output into a concise running history, filtering long outputs and limiting observation length through truncation.Its prompts combine the previous summary with the latest command output; the new observation window size caps output characters.Source: §3.1.2 · pp. 4–5
3.1.3. Operational Workflow.
- Each cycle generates a command from summarized history, executes it, summarizes the output, and returns the updated history to the Planner until success or the iteration limit.The execution environment is containerized Kali Linux.Source: §3.1.3 · p. 5
3.1.4. Securing HackSynth.
- Container isolation and target-restricted networking mitigate host-side effects and out-of-scope connections, but firewall rules can be overridden and a networked target could relay attacks beyond the restrictions.The paper calls for stronger containment, privilege controls, and ethical frameworks for autonomous cybersecurity agents.Source: §3.1.4 · p. 5
3.2. Benchmarks
The paper constructs two CTF benchmarks from PicoCTF and OverTheWire, combining 200 challenges across difficulty levels and cybersecurity domains. Their challenge selection and wargame coverage are intended to support comparison of LLM agents across varied tasks.
3.2. Benchmarks
- The two proposed benchmarks contain 200 handpicked challenges spanning easy, medium, and hard levels and six categories, with descriptions, hints, files, difficulty information, and solver functions.The solver functions run predefined commands and dynamically return flags; challenge categories include General Skills, Cryptography, Web Exploitation, Forensics, Reverse Engineering, and Binary Exploitation.Source: §3.2 · pp. 5–6
3.2.1. PicoCTF.
- The PicoCTF benchmark selects 120 challenges and adds difficulty information, hints, and solver functions beyond the overlapping Intercode set; dynamic flags help prevent memorized solutions.Challenges requiring personalized instances are excluded because they need PicoCTF assistance and consume more computational resources.Source: §3.2.1 · p. 6
3.2.2. OverTheWire.
- OverTheWire coverage includes Bandit, Natas, Leviathan, and Krypton, whose wargames span terminal operations, web security, binary exploitation, and cryptography.The range from simple exercises to advanced multi-step problems supports comparison of LLMs across difficulty levels and cybersecurity domains.Source: §3.2.2 · p. 6
4. Experimental Results
The experiments optimize HackSynth’s parameters and compare eight LLMs across PicoCTF and OverTheWire; GPT-4o solves the most challenges on both benchmarks.
4.1. Parameter Optimization
- PicoCTF performance improved as the observation window grew to 250 characters, then declined; OverTheWire used a 500-character window to retain content despite ssh/curl boilerplate.The study selected window sizes of 250 for PicoCTF and 500 for OverTheWire.Source: §4.1 · p. 7
- Completion stayed stable through temperature 1, then declined; command errors rose above 1, and temperature 2 made the environment unusable before 100 challenges.The authors fixed temperature at 1 for later benchmark runs.Source: Figure 4 · p. 8, Figure 5 · p. 8, §4.1 · p. 8
- Higher top-p slightly improved completion and increased rare-command use, especially on PicoCTF, but the completion gains were modest.OverTheWire relies heavily on recurring commands such as ssh and curl.Source: §4.1 · p. 8, Figure 6 · p. 9, Figure 7 · p. 9
- Sampling increased performance by 38%, whereas prompt chaining reduced performance by 5% and increased time spent on challenges by 17%.The authors attribute prompt chaining’s performance drop to processing more tokens at each step, slowing responses and increasing the chance of missing details.Source: §4.1 · p. 9
4.2. Benchmark Runs
- GPT-4o solved 41 of 120 PicoCTF challenges and 32 of 80 OverTheWire challenges, the highest totals on both benchmarks.Among locally run models, Llama-3.1-70B led on OverTheWire with 23 challenges solved.Source: §4.2 · p. 9
- Reducing the observation window from 500 to 100 characters cut total token use by less than 5%, while input tokens accumulated faster than output tokens.Llama models’ summary lengths plateaued after about ten steps, whereas GPT-4o and Mixtral-8x7B summaries continued to grow across 20 steps.Source: §4.2 · p. 10
- On PicoCTF, Qwen2-72B frequently used sudo, while GPT-4o sometimes refused to answer for ethical reasons.The authors identify Qwen2-72B’s elevated-privilege command use as a potential deployment risk.Source: §4.2 · p. 10
- GPT-4o overtook Llama-3.1-70B after trailing during the first three steps, while Phi-3.5-MoE and Phi-3-mini gained little from additional cycles.The Phi models tended to repeat a single strategy even when it was ineffective; higher-performing models more often tried alternatives after failures.Source: Figure 8 · p. 10, §4.2 · p. 10
5. Behavioral analysis of HackSynth
HackSynth adapts problem-solving to a non-interactive command line, but its behavior also exposes limits in command handling, strategy switching, and safe operation. The authors report unexpected targeting and environment behavior, underscoring the need for safeguards.
5.1. Insight on the solving process
- HackSynth’s creative approaches often reflect the restricted, non-interactive command-line environment, which calls for alternatives to human techniques.For example, it uses command-line tools to repair code, extract PDF text, and build command pipelines.Source: §5.1 · pp. 10–11
- For PicoCTF’s fixme challenges, HackSynth replaced unavailable interactive editing with autopep8, sed, and Python one-liners.The agent first tried nano in fixme1, then pivoted to command-line repairs.Source: §5.1 · pp. 10–11
- For image-heavy PDFs, HackSynth used OCR tools such as pytesseract to extract hidden text when direct text extraction was insufficient.It also used pdftotext to extract text directly from PDFs.Source: §5.1 · p. 11
- HackSynth chained utilities to automate interactive tasks, but could mishandle shell syntax and variables when creating temporary directories.The authors cite unnecessary directory creation and references to nonexistent system variables.Source: §5.1 · p. 11
- An ineffective first command can lead HackSynth to persist with repetitive attempts rather than pivoting, with fixation tendencies varying by base model.Repeated base64 decoding is one example; persistence can occasionally succeed but can also block alternative strategies.Source: §5.1 · p. 11
5.2. Dangers from unexpected behavior
- HackSynth sometimes hallucinated target IP addresses and continued enumerating false targets after scan results entered its summary.A whitelist firewall was implemented to restrict network interactions to predefined targets.Source: §5.2 · pp. 11–12
- HackSynth searched its execution environment for flags despite not recognizing it as a closed virtualized environment, raising possible future sandbox-escape concerns.The passage frames sandbox escapes and host interactions as potential concerns in future iterations.Source: §5.2 · p. 12
- Large archive extraction once exhausted container memory and crashed it; environment-variable and binary-path changes could also degrade extended testing.The authors report that these actions did not irreparably damage the testing environment.Source: §5.2 · p. 12
6. Future Work
Future work proposes expanding HackSynth’s capabilities, optimizing its models, and testing on more realistic or competitive settings. The authors also identify ethical and security safeguards as an ongoing research need.
6. Future Work
- Potential architecture additions include retrieval of successful actions, visual-data interpretation, internet information search, and interactive-terminal support.The paper cites AutoAttacker’s retrieval-augmented generation and Enigma’s interactive-terminal features as examples.Source: §6 · p. 12
- Model optimization could use larger-model outputs to fine-tune smaller task-specific models, RLHF, and curated expert examples.The proposed rewards target effective commands or high-quality summaries.Source: §6 · p. 12
- The authors plan broader benchmarks, including more realistic vulnerable virtual machines and networked environments, though resource limits pose a challenge.HackTheBox and TryHackMe are named as possible platforms.Source: §6 · pp. 12–13
- Planned evaluation includes live online CTF events and participant logs, while future research should address ethical, legal, and security risks.The authors identify preventing unauthorized activity or unintended harm as an important research direction.Source: §6 · p. 13
- The paper frames autonomous testing as potentially enabling faster, more extensive vulnerability discovery than traditional methods when users provide access and training.It also describes automation as a double-edged sword for system administrators.Source: §6 · p. 13
7. Conclusion
The conclusion presents HackSynth and two CTF benchmarks, reports experiments on performance-related parameters and safety, and calls for safeguards and further research. The agent and benchmarks are publicly available to support research on autonomous cybersecurity.
7. Conclusion
- The paper introduces HackSynth’s iterative Planner–Summarizer agent and two PicoCTF and OverTheWire benchmarks containing 200 challenges.The challenges span multiple cybersecurity domains and difficulty levels.Source: §7 · p. 13
- Experiments found that HackSynth solved a significant portion of CTF challenges and examined temperature, top-p, and token utilization.The conclusion highlights careful parameter tuning for safety and reliability.Source: §7 · p. 13
- The safety and predictability evaluation underscored the need for robust safeguards against unintended behavior and security risks.Source: §7 · p. 13
- HackSynth and the benchmarks are publicly available, and proposed future work includes specialized modules, model fine-tuning, and more realistic scenarios.Source: §7 · p. 13
Appendix
The appendix presents the prompts guiding HackSynth’s Planner and Summarizer, alongside example solver scripts for Bandit and Safe Opener challenges. The prompts direct command generation and preserve action history for subsequent planning.
Appendix
- The appendix describes Planner and Summarizer prompts as separate components of the agent’s workflow.The prompts are intended to support consistent and reproducible behavior across benchmark tasks.Source: Appendix · p. 15
- Planner prompts request one executable command at a time, using prior actions and outputs while avoiding repetitions in a non-interactive shell.The PicoCTF prompt also permits sudo and package installation when needed.Source: Appendix · p. 15
- Summarizer prompts maintain a history of actions and outputs intended to give the Planner context for future decisions.The listed prompt variants differ in how much detail they request.Source: Appendix · pp. 15–16
- Example scripts solve Bandit 17 by comparing password files and Safe Opener by downloading a file, finding an encoded key, and decoding it.Source: Appendix · p. 16
Related papers
This paper cites
- GPT-4 Technical Report2023
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks2020
- Generative Agents: Interactive Simulacra of Human Behavior2023
- SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering2024
- OpenHands: An Open Platform for AI Software Developers as Generalist Agents2024
- The Rise and Potential of Large Language Model Based Agents: A Survey2023