CIPHER: Cybersecurity Intelligent Penetration-Testing Helper for Ethical Researcher

Derry Pratama, Naufal Suryanto, Andro Aprila Adiputra, Thi-Thu-Huong Le, Ahmada Yusril Kadiptya, Muhammad Iqbal, Howon Kim

Abstract

Penetration testing (pentesting) requires a sophisticated blend of technical knowledge and intuitive reasoning to navigate complex, multi-stage security environments. While large language models (LLMs) show promise in technical domains, general-purpose models often struggle with safety-alignment refusals and the specific chained reasoning required for offensive security. This paper introduces CIPHER, a 7B-parameter model fine-tuned using a novel "FARR Flow" (Findings, Action, Reasoning, Results) data augmentation technique. Despite its smaller scale, CIPHER outperforms models ten times its size, including Llama 3 70B, in predicting accurate next steps for complex exploits.

1. Introduction

Ethical hacking is a high-stakes "cat-and-mouse" game where the primary challenge is often determining the most effective next step when standard tools fail or vulnerabilities are non-obvious. Beginners in the field frequently encounter a "reasoning wall"—the inability to link a minor discovery, such as a specific open port, to a sophisticated privilege escalation path.

General-purpose LLMs like GPT-4 or Llama 3 face two primary hurdles in this domain. First, Safety Alignment often causes these models to refuse legitimate requests from ethical researchers due to broad "anti-hacking" filters. Second, Reasoning Gaps prevent these models from maintaining the long-term context and specialized logic required for multi-stage engagements. CIPHER was developed to address these gaps by focusing on the underlying reasoning chains used by expert human hackers.

2. Methodology

CIPHER is built upon a multi-stage development pipeline designed to instill expert-level cybersecurity intuition into a compact 7B-parameter architecture.

2.1 Model Architecture and Training

The system utilizes Mistral 7B v0.3 as its base. The training process involved two primary phases:

  1. Supervised Fine-Tuning (SFT): The model was trained on a mixture of general conversational data (OpenHermes 2.5) and a specialized domain-specific dataset.
  2. Direct Preference Optimization (DPO): This phase aligned the model’s responses with expert-level reasoning, ensuring that the output prioritizes the most effective and logical pentesting actions.

2.2 FARR Flow Augmentation

The core innovation of this research is the FARR Flow technique. The authors curated over 300 high-quality pentesting "write-ups" (detailed logs of successful machine compromises). Using GPT-4, these unstructured logs were restructured into a standardized format:

  • Findings: The specific data or vulnerabilities discovered.
  • Action: The command or tool executed.
  • Reasoning: The expert logic justifying why that specific action was chosen.
  • Results: The outcome of the action and its implications for the next step.

2.3 Inference and RAG

To mitigate hallucinations and ensure command accuracy, CIPHER employs a Retrieval-Augmented Generation (RAG) system. At inference, the model queries a FAISS vector database containing up-to-date documentation for essential tools like Nmap and Metasploit, as well as community-standard "cheatsheets" (e.g., HackTricks, GTFOBins).

3. Evaluation and Results

The authors introduced a new automated benchmark based on 35 unseen Hack The Box (HTB) machines, consisting of 2,124 formulated questions designed to test "next-step" prediction in live scenarios.

3.1 Performance vs. Scale

CIPHER demonstrates that domain specificity can compensate for raw parameter count. In the FARR Flow reasoning test, CIPHER DPO 7B achieved an average score of 52.59, surpassing much larger models such as Llama 3 70B (52.07) and Qwen 1.5 72B (49.82).

3.2 Difficulty Scaling

The model's superiority is most evident in high-difficulty scenarios. On "Insane" difficulty HTB machines, where multi-step logic is mandatory, CIPHER maintained a score of 50.96, while Llama 3 70B’s performance dropped to 48.74. This suggests that the FARR Flow training successfully captured the complex reasoning chains necessary for advanced exploitation.

3.3 MITRE ATT&CK Proficiency

CIPHER showed significantly higher proficiency in suggesting offensive techniques within categories like Persistence and Privilege Escalation. Unlike general models, CIPHER’s fine-tuning allows it to provide actionable offensive guidance to ethical researchers without being hindered by overly restrictive safety filters.

4. Discussion and Limitations

While CIPHER excels at suggesting the next logical step, it currently faces challenges in troubleshooting. When a suggested command fails due to environment-specific variables, the model tends to suggest an entirely different tool rather than debugging the syntax of the initial command. Additionally, while RAG reduces hallucinations, they are not entirely eliminated.

Due to the dual-use nature of this technology, the authors have opted not to release the weights of CIPHER publicly. However, the FARR Flow augmentation methodology and the evaluation framework are being released to assist the community in developing more robust and safer cybersecurity benchmarks.

5. Conclusion

CIPHER proves that a 7B-parameter model, when trained on structured expert reasoning, can rival and exceed the performance of the world's leading open-weight models in the specialized domain of penetration testing. By focusing on the "Reasoning" component of the FARR Flow, CIPHER provides more than just commands; it provides the expert-like guidance necessary for the next generation of ethical researchers.

Summary updated

Abstract

Penetration testing, a critical component of cybersecurity, typically requires extensive time and effort to find vulnerabilities. Beginners in this field often benefit from collaborative approaches with the community or experts. To address this, we develop Cybersecurity Intelligent Penetration-testing Helper for Ethical Researchers (CIPHER), a large language model specifically trained to assist in penetration testing tasks as a chatbot. Unlike software development, penetration testing involves domain-specific knowledge that is not widely documented or easily accessible, necessitating a specialized training approach for AI language models. CIPHER was trained using over 300 high-quality write-ups of vulnerable machines, hacking techniques, and documentation of open-source penetration testing tools augmented in an expert response structure. Additionally, we introduced the Findings, Action, Reasoning, and Results (FARR) Flow augmentation, a novel method to augment penetration testing write-ups to establish a fully automated pentesting simulation benchmark tailored for large language models. This approach fills a significant gap in traditional cybersecurity Q&A benchmarks and provides a realistic and rigorous standard for evaluating LLM's technical knowledge, reasoning capabilities, and practical utility in dynamic penetration testing scenarios. In our assessments, CIPHER achieved the best overall performance in providing accurate suggestion responses compared to other open-source penetration testing models of similar size and even larger state-of-the-art models like Llama 3 70B and Qwen1.5 72B Chat, particularly on insane difficulty machine setups. This demonstrates that the current capabilities of general large language models (LLMs) are insufficient for effectively guiding users through the penetration testing process. We also discuss the potential for improvement through scaling and the development of better benchmarks using FARR Flow augmentation results.
BibTeX
@inproceedings{pratama2024cipher,
  author = {Derry Pratama and Naufal Suryanto and Andro Aprila Adiputra and Thi-Thu-Huong Le and Ahmada Yusril Kadiptya and Muhammad Iqbal and Howon Kim},
  title = {{CIPHER: Cybersecurity Intelligent Penetration-Testing Helper for Ethical Researcher}},
  booktitle = {Sensors},
  year = {2024},
  doi = {10.3390/s24216878},
}
Figure