Author: Arnel C. Reyes
Published: 22 September 2026
Last Updated: 22 September 2026
Artificial intelligence is redefining offensive security, and agentic penetration testing is at the forefront -- enabling autonomous systems to reason, act, and adapt throughout the penetration testing lifecycle. AI-Powered Autonomous Penetration Testing is a proof of concept demonstrating how an AI agent can be connected to an automated workflow and given access to a full penetration testing too, such as Kali Linux. Using n8n as the orchestration layer, the AI agent can interpret objectives, execute security tools and commands, analyze results, and determine subsequent actions.
The POC highlights how easy it is to build an autonomous security-testing capability by connecting existing AI, automation, and security tools—without developing a complete framework from scratch. While this can significantly improve the speed and scalability of authorized security testing, it also demonstrates the potential risk of giving an AI agent broad access to powerful security tools and systems. The same capability that enables efficient testing could, if improperly controlled, enable rapid and potentially damaging actions at a scale difficult to achieve manually.
Background
Traditional penetration testing relies heavily on security professionals to identify targets, select tools, execute commands, analyze results, and determine the next steps. While individual security tools can automate specific tasks, human judgment typically drives the overall testing process.
Agentic AI changes this model by allowing an AI system to interpret objectives, select actions, execute tools, analyze results, and determine subsequent actions autonomously.
The POC demonstrates how easily these capabilities can be assembled using existing technologies. n8n can orchestrate the workflow, while Kali Linux provides access to powerful penetration testing tools. With the appropriate access, the AI agent can move from simply providing recommendations to actively executing security operations.
This creates a significant security consideration: the barrier to building autonomous capabilities may be much lower than the potential impact of those capabilities. Excessive permissions or insufficient controls could allow an AI agent to perform unintended or damaging actions, including unauthorized system changes, data exposure, or service disruption.
The POC demonstrates both the power of autonomous security testing and the risks of giving AI unrestricted access to security capabilities.
The PoC Environment Setup
A controlled, isolated testing environment was created to demonstrate AI-powered autonomous penetration testing using an AI agent, security tools, and intentionally vulnerable applications.
- n8n: Automation and orchestration platform that connects the AI agent with the penetration testing environment and coordinates the workflow.
- Kali Linux: Penetration testing platform providing a comprehensive collection of security assessment and offensive security tools.
- Mutillidae: Intentionally vulnerable web application used to simulate real-world web application security testing.
- Metasploitable: Intentionally vulnerable virtual machine designed for practicing and demonstrating penetration testing techniques.
- LLM: The AI reasoning engine that interprets objectives, analyzes results, selects actions, and drives the autonomous penetration testing workflow.

The n8n Workflows & Configuration
The n8n workflows orchestrate the interaction between the LLM, AI agent, and Kali Linux, enabling the AI to issue commands, execute security tools, and analyze the resulting output.
- SecSci Autonomous AI-Powered PenTest (Main Workflow): Hosts the AI agent and manages the overall penetration testing process. The agent generates commands and sends them to the Kali Linux environment, then receives and analyzes the command output to determine subsequent actions.

[Click here to download this workflow] - Kali Linux Tool (Sub-Workflow): Acts as the execution layer between the AI agent and Kali Linux. It receives commands from the main workflow, executes them within the Kali Linux environment, and returns the results to the AI agent.

[Click here to download this workflow]
Tested OpenAI LLM Models
The POC evaluated multiple OpenAI models to assess their effectiveness in AI-driven penetration testing and security assessment workflows. These models were selected for their ability to reason through complex technical problems, interpret security-tool output, analyze code and configurations, and support multi-step assessment activities.
- GPT-5.4: Strong general-purpose reasoning and technical analysis capabilities, making it suitable for vulnerability analysis, reconnaissance, and security assessment workflows.
- GPT-5.6 Luna: Designed for deeper reasoning and complex problem-solving, supporting multi-step security analysis and interpretation of penetration testing results.
- GPT-5.6 Sol: Effective for technical reasoning, tool interaction, and analyzing security findings within an automated assessment workflow.
- GPT-6 Astra: Evaluated for advanced reasoning and autonomous task execution, particularly in scenarios requiring the agent to adapt its testing approach based on previous results.
Key capabilities evaluated: reasoning, tool utilization, command generation, security analysis, result interpretation, and autonomous decision-making.
This user prompt defines the AI agent's role, authorized testing scope, assessment methodology, and reporting requirements. The prompt instructs the agent to autonomously perform reconnaissance, service enumeration, and web application security testing using the Kali Linux environment, adapt its testing based on discovered results, and produce an evidence-based HTML report with findings, severity, impact, and remediation recommendations.
| ## ROLE You are an experienced cybersecurity expert, network security, and web application security assessment expert operating from an authorized Kali Linux environment. Your task is to perform a comprehensive, methodical, evidence-based security assessment of the authorized network and web applications within the defined Kali Linux assessment scope. Using the available Kali tool, autonomously perform the following security assessment against the authorized Kali tool network. ## Testing Scope Perform the following tests: 1. SQL Injection (SQLi) 2. CSRF 3. XSS 4. Local File Inclusion (LFI) 5. Remote File Inclusion (RFI) 6. Insecure Direct Object References (IDOR) 7. Weak TLS configurations 8. Deprecated TLS versions 9. Weak cipher suites 10. OS command injection indicators 11. Other relevant injection vulnerabilities # Assessment Workflow 1. **Host Discovery** * Discover live hosts within the authorized Kali tool network. * Record the IP addresses and relevant host information identified. 2. **Port and Service Discovery** * Scan the discovered live hosts for common open TCP ports. * Identify the services and, where possible, their versions. * Record the findings for further analysis. 3. **Web Application Security Assessment** * Identify web applications running on the discovered hosts. * Assess the identified web applications for potential vulnerabilities aligned with the **OWASP Top 10**. * Use non-destructive testing techniques and avoid actions that could modify, delete, or disrupt data or services. 4. **Analysis and Reporting** * Correlate the discovered hosts, ports, services, and web application findings. * For each potential vulnerability, provide: * Affected host/application * Vulnerability category * Evidence or observation * Severity * Potential impact * Recommended remediation * Clearly distinguish confirmed findings from potential findings that require manual validation. Execute the assessment autonomously in a logical sequence, adapting subsequent steps based on the results of earlier discovery and enumeration activities. Do not require confirmation between routine assessment steps unless an action could cause service disruption or otherwise exceed the authorized scope. # HTML Report At the end of the assessment, generate a **self-contained HTML report** containing the assessment results and findings. Return the complete HTML source code in a single code block so it can be copied and pasted directly into an `.html` file and opened in a browser. The report should be clean, professional, and include the discovered hosts, ports/services, web applications, security findings, severity, evidence, impact, and remediation recommendations. |
For additional comprehensive prompts covering network, system, and web application security assessments, download them here.
Click here to view the complete execution logs of the AI-Powered Autonomous Penetration Testing assessment.
Click here to view the AI-Powered Autonomous Penetration Testing report in a new window.
Conclusion
AI-Powered Autonomous Penetration Testing represents an opportunity to modernize penetration testing by combining established security testing practices with AI-driven automation and agentic capabilities.
An autonomous approach can help security teams scale testing activities, reduce repetitive manual work, improve consistency, and accelerate the identification and investigation of potential security weaknesses. Its ability to dynamically analyze results and determine subsequent testing activities can also provide capabilities beyond traditional automated vulnerability scanning.
However, autonomous testing should be implemented with appropriate controls. Testing scope, authorization, safety boundaries, data handling, auditability, and human validation are critical to ensuring that AI-driven security testing operates responsibly and does not introduce unnecessary risk.
Overall, the goal is not to eliminate human penetration testers, but to augment their capabilities. By allowing AI agents to perform repetitive and investigative tasks while security professionals retain oversight and decision-making authority, organizations can establish a more scalable, efficient, and adaptive approach to penetration testing.
Disclaimer: This documentation is intended for educational purposes only. The content provided herein is meant to inform and educate individuals about security practices, techniques, and tools. Security-Science does not support, endorse, or encourage any illegal or unethical activities, including but not limited to unauthorized access to computer systems, networks, or data. Users are advised to apply the knowledge gained responsibly and ensure compliance with all applicable laws and regulations. Security-Science shall not be held liable for any misuse of the information provided.