KaliBench: A Fine-Grained Benchmark for Kali Linux Cybersecurity Tool UsageKaliBench: A Fine-Grained Benchmark for Cybersecurity Tool Use on Kali Linux with Runtime-Free Verifiable Rewards
KaliBench evaluates open-source models translating security intent into Kali CLI: without hints, the highest Exact Correct is 41.3% (GLM-5.2); SFT+GRPO raises the 8B's three-mode average Total Score to 79.2%.
- Existing evaluations measure safety knowledge or end-to-end agent tasks, not directly whether a model can generate executable CLI for real Kali tools. Command lines are strict about syntax, flag binding, and argument order; small errors can invalidate execution.
- KaliBench uses manual-constrained generation, LLM validation, sandbox execution, and human review to obtain 8504 query-command pairs and 1642 tools. Evaluation is divided into Unrestricted, Restricted, and Hinted tiers, and uses alias-aware component scoring as a run-free verifiable reward.
- Among 24 open-source configurations, the highest Exact Correct without tool hints is GLM-5.2 at 41.3%. Optional arguments are the main bottleneck; providing documentation raises the average Exact Correct from 22.3% to 73.1%. SFT+GRPO brings the 8B's average Total Score to 79.2%, close to the 685B's 80.2%.
- The authors note that the benchmark is single-turn command generation with data grounded in documentation, manuals become outdated with versions, and validation and alias extraction remain incomplete. The evaluation set has 5000 items and the training set 3504; proprietary models are only reported on Unrestricted.
- Evaluated models
- Llama3.1-Instruct 8BQwen3 8BQwen3 8B thinkingMistral-Small-3.2 24BGemma-3-it 27BGPT-OSS 20BGPT-OSS 120BLLaMA-3.3-Instruct 70BQwen2.5-Instruct 72BQwen3-Coder-Next 80BDeepSeek-V3.2 685BGLM-5.2 753BFoundation-Sec-Instruct 8BFoundation-Sec-Reasoning 8BLlama-Primus-Base 8B
- Benchmarks
- KaliBench
- Metrics
- Exact CorrectTool AccuracyOptional-Argument F1Positional-Argument F1Total Score
KaliBench is a fine-grained benchmark and dataset for natural-language-to-CLI translation for Kali Linux, containing 8,504 query-command pairs covering 1,642 tools, 23 capability dimensions, and 5 security phases. Across three evaluation modes and 24 general-purpose and security-specialized open-weight model configurations, no open-weight model exceeds 42% exact command accuracy in the unrestricted setting. Supervised fine-tuning and reinforcement learning based on KaliBench's verifiable rewards can significantly improve an 8B model, bringing its performance close to a 685B MoE model.
Related events and news
1 events · 0 news mentions
- This event's paper
KaliBench:Kali Linux 工具调用基准
Paper analysis
What problem does this paper attempt to solve?
Existing evaluations do not directly measure whether models can translate security requests into executable Kali CLI commands.
Existing evaluations do not directly measure whether models can translate natural language security requests into precise, executable Kali Linux CLI commands.
- Scenario: The authors state that LLMs have entered security workflows such as interactive assistants and autonomous agents, and Kali Linux provides over 2000 pre-installed security tool packages. Analysts must translate high-level goals into precise commands for tools like Nmap, Metasploit, and Volatility; argument order, flag spelling, alias misuse, or wrong tool selection can invalidate execution.
- Existing gaps: Knowledge benchmarks (multiple choice, structured Q&A) test conceptual understanding; end-to-end tasks like CyBench, NYU-CTF Bench, and DefenderBench mix planning, environment interaction, observation interpretation, tool invocation, and error correction, making it hard to attribute failures to a single component. Function-calling benchmarks assume tools are explicitly given via JSON schema or API, while stuffing hundreds of CLI schemas into prompts is impractical in deployment.
- Core observation: Security tool invocation is actually schema-free NL-to-CLI: the model must infer tools and arguments itself and generate executable commands conforming to UNIX shell conventions, rather than filling in structured fields.
- This paper proposes: The authors propose KaliBench, a fine-grained benchmark and dataset for Kali Linux, containing 8504 query-command pairs, 1642 tools, 23 capability dimensions, and 5 security phases. It uses manual-constrained generation, deterministic normalization, and alias-aware evaluation, and provides verifiable rewards computable without running commands, for SFT and RLVR. The authors state that to their knowledge, this is the first benchmark evaluating security tool invocation in a schema-free CLI setting.
What related research exists?
Knowledge QA and end-to-end CTF do not individually measure schema-free CLI command generation.
Knowledge benchmarks measure concepts, end-to-end benchmarks measure entire workflows, and function-calling benchmarks assume explicit schemas.
General and security knowledge evaluations
- MMLU, HELM: The former measures general knowledge, the latter unifies multiple benchmarks into a common framework; the authors state they do not cover operational constraints in the security domain.
- SecEval, CyberMetric, CyberBench, SECURE, CS-Eval, SecBench, CTI-Bench: Use multiple-choice, true/false, short-answer, or other classification questions covering software and network security, cryptography, industrial control, and threat intelligence. The authors state they mainly measure knowledge recall and static reasoning, not concrete operational behavior.
End-to-end agent evaluations
- CyBench, NYU-CTF Bench: End-to-end security evaluation in CTF challenges.
- DefenderBench: Studies language agents with both defensive and offensive workflows in an enterprise-style environment. The authors state that end-to-end scores depend simultaneously on planning, environment interaction, observation interpretation, tool invocation, and error correction, making attribution difficult.
Function-calling benchmarks
- BFCL, ToolSandbox, StableToolBench, HammerBench: Cover single-turn, multi-turn, conversational, and agent settings, emphasizing schema-defined APIs and deterministic verification. The authors state they assume tools and arguments are given by explicit schemas, do not consider cases where tools must be inferred from shared CLIs, and do not provide fine-grained, alias-aware command correctness evaluation.
Baseline methods and benchmarks
- Experimental baselines are 14 general-purpose open-source models and 7 safety-oriented open-source models, plus three variants retrained on KaliBench; the main table compares on the self-built KaliBench (5000 evaluation items). Proprietary baselines are GPT-5.6-Sol, Claude Opus 5, and OpenAI Codex driven by GPT-5.5 with xhigh reasoning. The training base is RedSage-Ins (8B), with methods LoRA SFT, GRPO, and GRPO after SFT.
The authors position KaliBench as complementary to the above work: it measures command generation alone and separately evaluates tool selection, optional arguments, and positional arguments; and state that, to their knowledge, no benchmark directly evaluates natural-language-to-CLI translation for real security tools under schema-free conditions.
How does the paper address this problem?
Manual-constrained generation with three-stage validation, then alias-aware component scores as run-free rewards.
KaliBench maps an analyst's natural language request to an executable Kali command and decomposes the command into tool name, optional arguments, and positional arguments for component-wise scoring and execution-free training.
Data generation
- Corpus: Official documentation curated from the Kali Linux repository, structured Markdown for 2372 tools, including long and short options and aliases, with capability dimensions annotated using metapackage categories.
- Generation: For each tool, use Qwen3-Max to generate 10–13 natural language query–command pairs, annotated with tool name, alias-aware flag–value optional arguments, and positional arguments. This stage yields 27.7K pairs covering all documented tools.
- Classification: By the 23 functional dimensions of kali-tools, and inspired by the Lockheed Martin Cyber Kill Chain, grouped into five phases: Reconnaissance & Initial Access, Vulnerability Analysis, Exploitation & Payload Delivery, Post-Exploitation & Lateral Movement, Defensive Analysis & Reporting. Cross-phase capabilities are assigned only one primary role.
Validation, cleaning, and splitting
- LLM-as-Verifier: Give the query, generated_command, and tool_manuscript to an LLM to check that flags and arguments are all documented and that the command implements the query using only supported functionality. The first pass filters out 53.8%; 413 tools (17.4%) have no qualifying samples, so iterative regeneration and re-validation are performed. This yields 14.5K pairs, a 47.65% removal relative to the initial data. The prompt is in Appendix C.2.
- Terminal validation: Execute in a Docker sandbox with Kali-linux-everything, recording stdout, stderr, exit code, and timeout. Since arguments are synthetic, rule-based filtering based on execution logs removes hallucinated tools or illegal arguments not caught by the LLM, filtering out 11.95% of samples that passed LLM validation. Details in Appendix E.
- Human-in-the-loop: In the Hinted setting, analyze samples where the strongest model still fails; an AI agent (OpenAI Codex, GPT-5.4 Thinking) first gives a preliminary judgment against the query, generated command, ground-truth command, and documentation, then a human verifies ambiguities and labeling errors. An additional 4.9% are judged invalid, including malformed options, missing parameters explicitly required by the query, and flag effects or operand positions not matching the request. Cases in Appendix F.
- Deduplication and splitting: Use SemHash to embed [query, tool_name, ground_truth_command] and perform approximate nearest neighbor clustering; pairs with cosine similarity above 0.90 are grouped, keeping one representative sample per group. Final 8.5K pairs (30.7% of the original 27.7K), covering 1642 tools (69.2%). The evaluation set has 5000 entries covering all 1642 tools; the training set has 3504 entries covering 962 tools.
Evaluation protocol
- Three information levels: Unrestricted gives only the natural language query; Restricted additionally gives 20 randomly sampled candidate tool names including the correct tool; Hinted additionally gives official documentation for these candidate tools, approximating schema-style function calling. Prompt templates in Appendix C.3.
- Parsing: Use Python shlex for lexical analysis following UNIX shell conventions, without executing model output. Optional arguments start with -- or -, can appear in any order, and allow aliases; positional arguments are values only and have fixed order.
- Metrics: Tool Accuracy is selecting the correct tool; Optional-Argument F1 is alias-aware matching of optional flag names; Positional-Argument F1 is multiset matching of positional argument values; Total Score is the average of tool and argument scores; Exact Correct is 1 only when the tool and all arguments match the ground truth. Definitions in Appendix L.
Training protocol
- Samples: The same prompt template as in evaluation, with input as query, random candidate tool list, and tool documentation. Concatenating the three settings gives 3504×3=10512 entries.
- SFT: Target the ground-truth command, generating it conditioned on the query and optional tool information.
- RLVR: Following literature [9], require the model to first provide intermediate reasoning within think tags before outputting the command. Rewards come from component metrics: tool name, positional arguments, alias-aware optional arguments, plus an exact command match reward and a format reward. Ground truth has been sandbox-verified at construction time, so rewards do not require executing model output. Optimization uses GRPO. The backbone is the best-performing 8B safety-oriented model RedSage-Ins, trained with LoRA (Unsloth) for SFT, GRPO-only, and SFT-then-GRPO variants, collectively called RedSage-K.
What experiments did the paper conduct?
Without hints, open-source models achieve a maximum Exact Correct of 41.3%; with documentation, the average rises to 73.1%.
Experimental Setup
- Open-source models: 14 general-purpose models are Llama3.1-Instruct 8B, Qwen3 8B and 32B (each with thinking and non-thinking), Mistral-Small-3.2 24B, Gemma-3-it 27B, GPT-OSS 20B and 120B, LLaMA-3.3-Instruct 70B, Qwen2.5-Instruct 72B, Qwen3-Coder-Next 80B, DeepSeek-V3.2 685B, GLM-5.2 753B. 7 safety-oriented models are Foundation-Sec-Instruct 8B, Foundation-Sec-Reasoning 8B, Llama-Primus-Base and Merged 8B, Llama-Primus-Nemotron 70B, RedSage-Ins and RedSage-DPO 8B. There are also three RedSage-K variants retrained on KaliBench. The abstract states 24 configurations in total.
- Data: 5000 evaluation items covering 1642 tools; 3504 training items covering 962 tools.
- Inference: Open-source models use vLLM on multiple NVIDIA A100 GPUs; 72B and above go through the OpenRouter API. The rest come from official Hugging Face repositories with fixed inference configurations; details in Appendix G.1. Proprietary baselines are evaluated only on all 5000 Unrestricted items.
- Training: LoRA, single H200 (141GB), total batch size 32, two epochs; details in Appendix G.2.
- Metrics: Exact Correct, Tool Accuracy, Optional-Argument F1, Positional-Argument F1, Total Score, and Avg, the average of Total Score across the three modes. U / R / H correspond to Unrestricted, Restricted, Hinted.
- Scoring: Component scores are deterministically matched against ground-truth components after shlex parsing; no separate LLM is used for scoring. The paper does not report the number of repetitions.
Main Results
Table 1 reports open-source model scores in the three modes. The table below lists only Exact Correct and average Total Score; U is without tool hints.
Swipe horizontally to read the table
Model U EC R EC H EC Avg TS Foundation-Sec-Ins 8B 14.7 19.1 56.2 65.2 Qwen3 8B† 20.9 27.7 80.9 73.8 RedSage-K (SFT+GRPO) 8B 32.2 37.4 69.4 79.2 Qwen3-Coder-Next 80B 26.2 31.0 79.9 76.3 DeepSeek-V3.2 685/37B 33.0 40.2 84.5 80.2 GLM-5.2 753B 41.3 52.0 74.8 81.3 All-model average 22.3 28.3 73.1 73.6 Per Table 1. EC is Exact Correct (%), Avg TS is the average Total Score across the three modes (%). † is thinking. The table omits the remaining 18 configurations; the lowest open-source U-mode EC is Llama3.1-Ins 8B at 12.5%.
- Modes: The authors state that from U to R, average Tool Accuracy rises from 72.0% to 95.2%, but Optional F1, Positional F1, and Exact Correct rise only slightly, indicating that selecting the right tool does not guarantee correct arguments. H shows the largest gains: average Optional F1 from 45.1% to 87.8%, Positional F1 from 61.1% to 90.1%, Total Score from 59.4% to 90.8%, Exact Correct from 22.3% to 73.1%. The authors consider optional arguments the hardest, followed by positional arguments; argument construction is the main bottleneck without documentation.
- Type and scale: The authors state that safety-oriented models are not consistently better than strong general-purpose models. In the compact group, non-thinking RedSage-Ins has U/R Total Scores of 56.4% / 69.3%, higher than non-thinking Qwen3 8B's 55.5% / 68.2%; on Hinted, Qwen3 8B is 91.6%, higher than RedSage-Ins's 89.5%. Qwen3† 8B's Avg is 73.8%, higher than Gemma-3-it 27B's 71.2% and Llama-Primus-Ins 70B's 72.7%. The authors argue that performance is not determined by scale alone.
- Post-training: The three RedSage-K Avg scores are 76.9 (GRPO), 77.4 (SFT), 79.2 (SFT+GRPO). SFT+GRPO ranks third among open-source models by Avg, 1.0 point below DeepSeek-V3.2's 80.2. The contribution states that average Total Score across the three modes improves by 7.5 percentage points on the 8B. SFT's Hinted Total Score is 93.2%, higher than base RedSage-Ins's 89.5%; GRPO and SFT+GRPO Hinted Total Scores are 88.8% and 89.3%, lower than the base. The authors state that paired analysis sees argument construction errors and regression on already-solved samples, and SFT initialization mitigates this regression (Appendix I).
Proprietary Models and Scaffolding Inference
- What was tested: GPT-5.6-Sol, Claude Opus 5, and Codex with GPT-5.5, xhigh reasoning, evaluated only on the 5000 Unrestricted items. Codex is scored only on the final submitted command.
- Results: In Table 2, full 5K Exact Correct is GPT-5.6-Sol 61.68%, Codex 51.68%, Claude Opus 5 44.02%; on the answered subset, 61.83% (4988/5000), 55.77% (4633), 59.89% (3675), respectively. GLM-5.2 is 41.32% in this setting. Unanswered or blocked responses are counted as incorrect.
- Authors' interpretation: The authors state that coverage differences imply provider safety restrictions affect security-relevant usage; Claude Opus 5 answered only 73.50% of the test set. The full-set maximum is 61.68%, which the authors consider KaliBench not yet saturated. Full metrics are in Appendix M.
Dimensions, Tools, and Failure Modes
- Figure 5: The authors state that relative difficulty across 23 dimensions is broadly consistent across the three modes; gpu and crypto-stego score higher, while 802-11 and wireless have lower minima, especially in U and R. In H mode, hardware remains low. The authors state that U has the largest cross-model spread, R narrows it, and H further stabilizes it, but does not eliminate dimensional gaps. By phase, Reconnaissance and Vulnerability Analysis are more stable, while Post-Exploitation and Defensive Analysis vary more. The specific endpoints of the boxplots in Figure 5 are not listed item by item in the paper's main text.
- Spread: Cross-model range in Total Score from U to H is 21.8, 18.4, 13.7 percentage points; Exact Correct range remains 28.8, 33.8, 28.3 percentage points. The authors state that documentation brings Total Score closer, while gaps in exact command correctness remain large.
- Failures and tools: The authors categorize four types: mixing long and short options, treating positional arguments as flags or inferring nonexistent aliases, tools with only short flags being written with nonexistent long options, and singular/plural option name errors. The authors state that tools with simple invocations and clear defaults, such as truecrypt2john and jsql, are more stable, while tools with irregular options, such as nikto and hashrat, remain difficult. Appendix K gives full statistics; the authors consider tool difficulty more a matter of interface complexity than a model-specific limitation.
Other Ablations and Analyses
- Query wording (Table 3, average Total Score change across eight configurations, percentage points): Paraphrase is U +0.61, R +0.22, H −0.09; Informal is −0.55, −0.48, −0.28; Messy is −3.20, −1.40, −1.07.
- Messy, Unrestricted (Figure 8 / Appendix N): Total Score drops for every tested configuration; most by about 3 percentage points, the two most sensitive by more than 4 percentage points, and the smallest drop is 1.98 percentage points (Foundation-Sec-Rsn 8B). The authors state that this drop is not limited to a single model family.
- Data funnel (Figure 2): 27.7K generated, covering 2372 tools; after LLM verification 14.5K, 90.1% (2138) tools; executable stage marked in the figure as 12.8K, 74.0% (1756) tools; after deduplication 8.5K, 69.2% (1642) tools. Manual initial inspection states that over 50% of generated commands contain hallucinated or misspelled options.
- Complementarity of SFT and GRPO: SFT has the best Tool Accuracy in the compact group across the three modes, with the largest Hinted gains; GRPO is stronger on U/R Positional F1 and Total Score, weaker on Hinted. SFT+GRPO has the best U/R Total Score and Exact Correct in the compact group.
- Figure 1 annotations: The Exact Command Correct column in the figure is labeled Gemma-3-it 27B 71.2, RedSage-Ins 8B 71.7, GPT-OSS 120B 75.7, Qwen3-Coder-Next 76.3, RedSage-K-SFT-GRPO-8B 79.2, DeepSeek-V3.2 685B 80.2, GLM-5.2 753B 81.3; these numbers are the same as the Avg Total Score in Table 1, while the figure caption says Exact Command Correct. The Unrestricted side is additionally labeled Qwen3-Coder-Next 26.2, RedSage-K 8B 32.2, DeepSeek-V3.2 33.0, GLM-5.2 41.3, consistent with the U-mode Exact Correct in Table 1.
What are some points that can be further explored?
The authors believe it should be extended to multi-step workflows, retrieval-augmented tool use, and environment-aware evaluation.
Limitations and Future Directions Noted by the Authors
- Single-turn and documentation-grounded data: The Discussion states limitations include only single-turn command generation and reliance on documentation-grounded data. Future work should extend to multi-step workflows, retrieval-augmented tool use, and environment-aware evaluation.
- Manuals become outdated: Appendix O states ground-truth commands come from Kali manuals at build time; additions, removals, deprecations, renames, or semantic reinterpretations of flags can make some normalized commands outdated. The authors state tools often maintain backward compatibility, and the Hinted setting further insulates against this drift by explicitly providing documentation.
- Documentation inconsistency itself: Appendix O gives the example of the regtree manual giving conflicting semantics for -V (--no-values and --version), and several Impacket tools' short-option spellings differing from common conventions. The authors state fully deterministic normalization is inherently approximate when documentation diverges from observed behavior or when multiple variants coexist.
- Verification still imperfect: Appendix O states the LLM-as-Verifier is still imperfect; manual inspection of a random subset indicates residual errors are limited. The paper does not give the residual proportion for that subset.
- Incomplete alias coverage: Appendix O states alias-aware scoring relies on semi-automatically extracted alias groups and cannot cover all historical, distribution-specific, or community-adopted variants.
- Positioning: Appendix O frames KaliBench as a controlled abstraction of real CLI invocation, complementing execution-based or agent-based evaluation in operational environments.
Experimental Coverage
- Scale and split: Evaluation set 5000 items covering all 1642 tools; training set 3504 items covering 962 tools; after concatenating three prompt variants, training samples are 10512 (Section 3).
- Open-source evaluation: Table 1 lists 24 rows of configurations across general-purpose, safety-oriented, and RedSage-K, reporting Exact Correct, Tool Accuracy, Optional F1, Positional F1, and Total Score in all three modes. 72B and above go through OpenRouter, the rest use vLLM; the paper does not report the number of repetitions.
- Proprietary and scaffolding: GPT-5.6-Sol, Claude Opus 5, and Codex (GPT-5.5, xhigh) are evaluated only on the 5000 Unrestricted items; full-set Exact Correct counts unanswered as incorrect (Table 2).
- Training: Backbone is RedSage-Ins 8B, variants are SFT, GRPO, SFT+GRPO; LoRA, single H200, batch size 32, two epochs (Section 4, Appendix G.2).
- Robustness: Eight configurations report Total Score changes on Paraphrase, Informal, and Messy rewrites (Table 3); Appendix N gives per-configuration drops for Messy under Unrestricted. Dimensional analysis aggregates by 23 capability dimensions and 5 security phases (Figure 5).
Summarize the main content of the paper
KaliBench uses 8504 executable command pairs to measure schema-free Kali CLI generation and uses component scores for run-free training.
KaliBench is a natural language to CLI benchmark for Kali Linux: 8504 validated query-command pairs, 1642 tools, 23 capability dimensions, 5 security phases, with an evaluation set of 5000 items and a training set of 3504 items.
- Problem: Knowledge Q&A and end-to-end CTF do not individually answer "can the model write executable commands." The CLI has no complete schema that can be stuffed into the prompt; tool selection, flag-value binding, and argument order must all be inferred by the model itself.
- Approach: Use official manuals to constrain Qwen3-Max generation, then LLM validation, Kali Docker sandbox execution, and human-in-the-loop cleaning; SemHash deduplicates with cosine similarity 0.90. Evaluation has three tiers: query only, 20 candidate tool names, and then documentation for those tools. After shlex parsing, scoring is by tool, optional argument F1, positional argument F1, Total Score, and Exact Correct. The same set of component signals serves as rewards for SFT and GRPO, without executing model outputs.
- Open-source results: In Table 1, without hints the average Exact Correct is 22.3%, with the highest being GLM-5.2 at 41.3%; with documentation the average rises to 73.1%, with DeepSeek-V3.2 at 84.5%. From no hints to restricting candidate tools only, average Tool Accuracy rises from 72.0% to 95.2%, with smaller increases in argument scores. The authors believe optional arguments are the main bottleneck.
- Training and proprietary comparison: RedSage-Ins 8B after SFT+GRPO has an average Total Score of 79.2% across three modes, with U-mode Exact Correct at 32.2%; DeepSeek-V3.2 has an average Total Score of 80.2%. The contribution item states that this 8B's average Total Score improved by 7.5 percentage points. GRPO and SFT+GRPO Hinted Total Scores are lower than the untrained RedSage-Ins. On the full 5000 items, GPT-5.6-Sol has an Exact Correct of 61.68%, Codex 51.68%, and Claude Opus 5 44.02%, with the latter only answering 73.50%.
- Authors' conclusion: Restricting candidate tools mainly addresses "which tool to use," while documentation mainly improves "how to write the command"; failures often come from insufficient domain knowledge rather than misunderstanding intent. The authors believe KaliBench is not yet saturated and plan to move toward multi-step workflows, retrieval-augmented tool use, and environment-aware evaluation. Appendix O also notes that manuals become outdated, documentation occasionally conflicts, and both validation and alias tables are incomplete.