CVE-2026-5463: Verified Repro With Script Download
CVE-2026-5463: pymetasploit3 command injection
CVE-2026-5463 is verified against DanMcInerney/pymetasploit3 · PyPI. Affected versions: <= 1.0.6. Vulnerability class: Command Injection. This high reproduction includes runnable sandbox proof, artifacts, and a plain-text agent view under REPRO-2026-00130.
What Is CVE-2026-5463?
CVE-2026-5463 (CWE-77) is a critical severity command injection vulnerability in pymetasploit3, a Python Metasploit RPC library, versions 1.0.6 and earlier. Pruva reproduced it (reproduction REPRO-2026-00130).
CVE-2026-5463 Severity & CVSS Score
CVE-2026-5463 is rated high severity, with a CVSS base score of 8.6 out of 10.
High — serious impact or readily exploitable. Prioritize remediation.
Affected DanMcInerney/pymetasploit3 Versions
DanMcInerney/pymetasploit3 · PyPI versions <= 1.0.6 are affected.
How to Reproduce CVE-2026-5463
pruva-verify REPRO-2026-00130 curl -O https://pruva.dev/api/v1/reproductions/REPRO-2026-00130/artifacts/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh Proof of Reproduction for CVE-2026-5463
Reproduced by Pruva's autonomous agents — 238 tool calls over 36 min. Full root-cause analysis and the complete transcript are below.
How the agent worked
Root Cause and Exploit Chain for CVE-2026-5463
Summary
CVE-2026-5463 is a critical command injection vulnerability in pymetasploit3 version 1.0.6 and earlier. The vulnerability exists in the MsfConsole.run_module_with_output() function in pymetasploit3/msfrpc.py at line 2299. When constructing Metasploit console commands, the function directly interpolates user-controlled option values without sanitizing newline characters. An attacker can inject newlines into module options like RHOSTS (e.g., '192.168.1.1\nworkspace -a pwned\n'), which breaks the intended command structure and causes the Metasploit console to execute additional, arbitrary commands beyond the intended set command. This results in authenticated command injection within the Metasploit framework context.
Impact
- Product: pymetasploit3 (Python Metasploit RPC library)
- Affected Versions: 1.0.6 and earlier (PyPI latest is currently 1.0.6)
- Risk Level: CRITICAL (CVSS 4.0: 9.3, CVSS 3.1: 8.6)
- CWE: CWE-77 (Command Injection)
- Consequences:
- Arbitrary command execution within Metasploit console context
- Workspace manipulation (create/delete workspaces containing sensitive data)
- Resource file injection (loading arbitrary Metasploit resource scripts)
- Session manipulation and potential lateral movement
- Full compromise of Metasploit server and connected sessions
Root Cause
The vulnerability is located in pymetasploit3/msfrpc.py in the MsfConsole.run_module_with_output() method at line 2299:
for k in opts.keys():
options_str += 'set {} {}\n'.format(k, opts[k]) # VULNERABLE
Technical Explanation:
- The
run_module_with_output()function builds a command string to send to the Metasploit RPC daemon - It iterates over module options (
optsdictionary) and appends each as asetcommand followed by a newline (\n) - User-controlled values (like
RHOSTS) are directly interpolated into the command string using.format(k, opts[k]) - No sanitization is performed on newlines, semicolons, or other special characters in option values
- When a value contains
\n, it terminates thesetcommand early and the text after the newline becomes a new, separate Metasploit console command
Example Exploit Flow:
Input: opts['RHOSTS'] = '192.168.1.1\nworkspace -a pwned\n'
Generated command string:
use exploit/unix/ftp/vsftpd_234_backdoor
set RHOSTS 192.168.1.1
workspace -a pwned
set RPORT 21
set TARGET 0
run -z
Metasploit console interprets this as:
use exploit/unix/ftp/vsftpd_234_backdoor(valid)set RHOSTS 192.168.1.1(valid - sets RHOSTS to just the IP)workspace -a pwned(INJECTED COMMAND - creates new workspace)set RPORT 21(valid)set TARGET 0(valid)run -z(valid)
The injected workspace -a pwned command executes with the same privileges as the Metasploit RPC session, allowing workspace manipulation and other malicious actions.
Reproduction Steps
Reference Script:
repro/reproduction_steps.shScript Description:
- Installs pymetasploit3 v1.0.6 from the local repository
- Executes
reproduction_steps.pywhich:- Verifies the vulnerable code exists in the library
- Simulates authentication via
MsfRpcCliententrypoint - Creates an
MsfConsoleinstance (authenticated context) - Calls the real
run_module_with_output()method with:- Benign input:
RHOSTS='192.168.1.1'(control test) - Malicious input:
RHOSTS='192.168.1.1\nworkspace -a pwned\n'(exploit)
- Benign input:
- Captures the actual command string sent to the console
- Analyzes the command structure to detect injected commands
- Tests multiple payload variations
Expected Evidence:
- Command string with 8 lines (instead of expected 7)
- Line 3 contains:
workspace -a pwned_workspace(the injected command) injection_test_results.jsonwithvulnerability_confirmed: truecaptured_console_command.txtshowing line-by-line analysisruntime_manifest.jsonwithtarget_path_reached: true
Evidence
Log Files:
repro/logs/reproduction_output.log- Full execution outputrepro/logs/auth_test_results.json- Authentication test resultsrepro/logs/injection_test_results.json- Command injection test evidencerepro/logs/captured_console_command.txt- Raw captured command stringrepro/logs/attack_chain.json- Multiple payload variation testsrepro/logs/reproduction_result.json- Final test resultsrepro/runtime_manifest.json- Runtime attestation
Key Evidence Excerpts:
From injection_test_results.json:
{
"payload": {
"RHOSTS": "192.168.1.1\nworkspace -a pwned_workspace\n"
},
"captured_command": "use exploit/unix/ftp/vsftpd_234_backdoor\nset RHOSTS 192.168.1.1\nworkspace -a pwned_workspace\n\nset RPORT 21\nset TARGET 0\nrun -z",
"injected_commands_found": ["workspace -a pwned_workspace"],
"vulnerability_confirmed": true
}
From execution output:
[!] INJECTED COMMAND at line 3: workspace -a pwned_workspace
======================================================================
VULNERABILITY EXPLOITED!
======================================================================
Environment:
- Python 3.12
- pymetasploit3==1.0.6 (from local git repository)
- Mock RPC backend simulating Metasploit RPC responses
- Tested on Ubuntu (GitHub Codespaces environment)
Recommendations / Next Steps
Suggested Fix
Implement input sanitization in the run_module_with_output() method to strip newline characters from option values:
# Before (vulnerable):
for k in opts.keys():
options_str += 'set {} {}\n'.format(k, opts[k])
# After (patched):
def sanitize_value(value):
if value is None:
return value
# Remove newlines that could break command structure
return str(value).replace('\n', '').replace('\r', '')
for k in opts.keys():
safe_value = sanitize_value(opts[k])
options_str += 'set {} {}\n'.format(k, safe_value)
Alternative fix: Use proper command serialization or parameter binding instead of string concatenation.
Upgrade Guidance
- Immediate: Review all code using
pymetasploit3==1.0.6for this vulnerability - Short-term: Apply the fix locally or wait for version 1.0.7+ release
- Long-term: Ensure option values from untrusted sources are validated before passing to pymetasploit3
Testing Recommendations
- Add unit tests for
run_module_with_output()with malicious inputs - Implement input validation at the application layer before passing to pymetasploit3
- Consider using allowlists for expected option value patterns
- Monitor for unusual Metasploit console commands in RPC logs
Additional Notes
Idempotency
The reproduction script is idempotent - it can be run multiple times with consistent results. Each run generates fresh mock tokens and console IDs.
Edge Cases and Limitations
Tested Payloads:
192.168.1.1\nworkspace -a pwned\n- Creates workspace192.168.1.1\nresource /tmp/backdoor.rc\n- Loads resource file192.168.1.1\nworkspace -a a\nworkspace -d a\n- Multi-command chain
Limitations:
- The reproduction uses a mock RPC backend rather than a live Metasploit instance
- While the mock accurately captures command strings, the actual Metasploit console behavior would need a real
msfrpcdservice to fully validate - The vulnerability requires authenticated access to the Metasploit RPC service (pre-auth to post-auth flow demonstrated)
Mitigation Factors:
- Requires authentication to Metasploit RPC service
- Impact limited to Metasploit console commands (not OS-level command execution)
- Attacker must have valid RPC credentials to reach the vulnerable code path
CVE-2026-5463 Reproduction Transcript
The agent's step-by-step process — every tool call, every handoff, the moment the exploit fired.
Full session Replay every step — scrub the timeline or play it back.
cd /data/pruva/runs/7e0c8944-db93-47a1-b397-0bcb07546fb9 && git clone https://github.com/DanMcInerney/pymetasploit3.gitCloning into 'pymetasploit3'...
Artifacts and Evidence for CVE-2026-5463
Scripts, logs, diffs, and output captured during the reproduction.
No artifacts available
How to Fix CVE-2026-5463
FAQ: CVE-2026-5463
How does the CVE-2026-5463 command injection attack work?
How severe is CVE-2026-5463?
How can I reproduce CVE-2026-5463?
References for CVE-2026-5463
Authoritative sources for CVE-2026-5463 — official vulnerability databases and the upstream advisory. Pruva's reproduction verifies the issue firsthand; these are the primary records to corroborate it.