MAM-PT: A Memory-Augmented Middleware for Enhancing Automated Penetration Testing
Abstract
LLM-based penetration-testing agents execute multi-step security tasks through tool use and environment feedback, but flat interaction histories can become noisy, unstructured, and difficult to reuse in subsequent decisions. To address this problem, we propose MAM-PT, a memory-augmented middleware that organizes agent execution histories into three functional memory modules: Working Memory (WM), Semantic Memory (SM), and Failure Episodic Memory (EM). MAM-PT operates through a four-stage loop that routes environment feedback into the memory modules, aggregates task-relevant items into a memory bundle, conditionally injects the bundle into the prompt, and filters LLM-proposed actions through a gated action-selection mechanism before execution. Experiments on a 15-target subset of AutoPenBench show that MAM-PT reduces repeated failed actions, achieves a lower time-to-flag on jointly solved tasks, and maintains competitive task-level success. These results indicate that structured memory management can improve the execution efficiency of LLM-based penetration-testing agents without introducing additional exploit knowledge.