A small library that lets LLM-driven agents call off-the-shelf pentest tools (nmap, nuclei, metasploit, curl) via the MCP RPC style.

October 4, 20256 min

Overview

Decision SnapshotNeeds Validation

Working proof-of-concept with concrete demos. Results come from two sandbox CVEs and a small set of models, so real-world reliability and safety controls need more evaluation.

Citations0

Evidence Strength0.50

Confidence0.70

Risk Signals8

Trust Signals

Findings with numeric evidence: 3/3

Findings with evidence refs: 3/3

Results with explicit delta: 0/4

Reproducibility

Status: Partial assets available

Open source: Partial

At A Glance

Cost impact: 50%

Production readiness: 40%

Novelty: 60%

Authors

Zachary Ezetta, Wu-chang Feng

Links

Abstract / PDF / Code

Why It Matters For Business

Automates routine pentest steps and lets teams swap in better models or updated tools without changing agent code. That can speed internal red‑team work and reproduce attacks for testing. However, exploitation reliability depends on the model and legal safeguards are essential.

Who Should Care

Summary TLDR

PentestMCP is a set of MCP (Model-Context-Protocol) servers that expose common penetration‑testing tools as RPC-style functions. The paper shows agents using these servers to automatically scan, find, and exploit two well-known vulnerabilities (CVE-2017-5638 and CVE-2017-0144) in sandboxed labs. Success depends strongly on the language model used.

Problem Statement

Security teams and researchers want agents to run real pentest tools without baking those tools into agent code. Existing agentic systems often mix tools into the agent, making updates hard. PentestMCP decouples tools (as networked RPC servers) so agents can call standard pentest functionality at run-time.

Main Contribution

A working PentestMCP library that implements four MCP servers (nmap, curl, nuclei, metasploit) to expose scanning, enumeration, vuln scanning, and exploitation as callable tools.

End-to-end agent demonstrations that use these MCP servers to identify and exploit two historical vulnerabilities in sandboxed environments (Apache Struts CVE-2017-5638 and SMB EternalBlue CVE-2017-0144).

Key Findings

PentestMCP exposes four core pentest servers (nmap, curl, nuclei, metasploit).

Numbers4 servers listed (Table 12)

Practical UsePlugging PentestMCP into an agent gives immediate access to standard pentest operations without shipping tool binaries into the agent code.

Evidence RefTable 1, Table 2

For CVE-2017-5638 the agent identified the vuln in 4/4 model runs and exploited it in 2/4 runs on the evaluated setup.

NumbersIdentified 4/4, Exploited 2/4 (Table 9)

Practical UseDetection is reliable on this example, but successful exploitation needs a capable model; test multiple models before trusting automation for exploitation tasks.

Evidence RefTable 9

Results

MetricValueBaselineDeltaSplit / DatasetEvidenceEvidence Ref
CVE-2017-5638 identification rate4/4 models identifiedCVE-2017-5638 runAll listed models correctly detected the Struts vuln in the sandboxTable 9
CVE-2017-5638 exploitation rate2/4 models exploited (o3, gemini)CVE-2017-5638 runo3-2025-04-16 and gemini-2.5 succeeded; gpt-4o and grok failedTable 9

What To Try In 7 Days

Clone the PentestMCP GitHub repo and run the demo in a sandbox lab (TryHackMe or local VMs).

Wire PentestMCP to a simple agent (FastAgent example) and run a scan→vuln-scan workflow.

Compare 2–3 LLMs: check 'identified' vs 'exploited' and log tool calls and token cost.

Agent Features

Planning
iterative step planning (scan → scan/detail → exploit → post-exploit)
Tool Use
nmapnucleimetasploitcurl
Frameworks
FastAgent
Is Agentic

Yes

Architectures
MCP (Model-Context-Protocol) RPC pattern
Collaboration
multi-function agent workflows (playbook-driven)

Reproducibility

Code AvailableYes
Data AvailableNo
Open Source StatusPartial
LicenseUnknown

Risks & Boundaries

Limitations

Evaluation limited to two historical CVEs in sandbox environments; no large-scale benchmark.

Small model pool; reported success rates may not generalize to other targets or models.

When Not To Use

Do not run PentestMCP against production or external networks without explicit legal permission.

Not a turnkey replacement for experienced pentesters: model failures and misconfigurations can cause incorrect or unsafe actions.

Failure Modes

Model selects an incorrect payload architecture (e.g., aarch64 payload for x64 host) causing exploit failure (Table 9).

Agent fails to populate required module options in an exploit call, producing input validation errors (Table 7).

Core Entities

Models

gpt-4o-2024-08-06o3-2025-04-16grok-4-0709gemini-2.5-flash-preview-05-20Claude Opus 4OpenAI GPT 5

Metrics

identified (yes/no)exploited (yes/no)tool callstokens

Context Entities

Datasets

TryHackMe Blue (sandbox)