Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-87690-POC-Metasploit-Dir-Traverse-to-RCE — Proof-of-concept hostile Meterpreter agent and writeup for CVE-2026-87690, a path traversal in Metasploit's ios_image_gather module leading to operator-level RCE. | Kitploit
Tools/GitHubGitHub/h00die/cve-2026-87690-poc-metasploit-dir-traverse-to-rce
Privilege EscalationPersistence MechanismsVulnerability AnalysisExploitationReverse EngineeringPenetration TestingPapers & ResearchRed Teaming
Share
GitHub
h00die/cve-2026-87690-poc-metasploit-dir-traverse-to-rce

CVE-2026-87690-POC-Metasploit-Dir-Traverse-to-RCE

Proof-of-concept hostile Meterpreter agent and writeup for CVE-2026-87690, a path traversal in Metasploit's ios_image_gather module leading to operator-level RCE.

View Repository
141 month agoNot yet reviewed

CVE-2026-87690

Path traversal (CWE-22) in Metasploit Framework's post/apple_ios/gather/ios_image_gather post-exploitation module: a hostile or tampered "iOS device" (any Meterpreter session whose agent controls its own protocol responses) achieves an arbitrary file write on the pentester's workstation, which chains to persistent code execution as the operator on the next msfconsole launch.

CVECVE-2026-87690
WeaknessCWE-22 (Relative Path Traversal)
Affected productMetasploit Framework, module post/apple_ios/gather/ios_image_gather
ImpactArbitrary file write as the operator -> persistent code execution and an interactive shell as the operator (frequently root) on the pentester's workstation
Fixrapid7/metasploit-framework#21880 (merged into master on 2026-09-14; any framework release built after that date contains the fix)

Vulnerability

Metasploit's post/apple_ios/gather/ios_image_gather module interpolates file names from a Meterpreter directory listing - data fully controlled by a hostile or tampered "iOS device" - directly into the local destination path passed to client.fs.file.download_file() with no sanitization, and the underlying stdapi sink (lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb, FileUtils.mkdir_p + File.new(dest,'wb')) writes wherever that path points.

A listing entry such as ../../msfconsole.rc therefore escapes the intended ~/.msf4/loot/<random> directory and overwrites ~/.msf4/msfconsole.rc, a resource file that every msfconsole invocation automatically executes at startup (lib/msf/ui/console/driver.rb:196).

A device under attacker control that lures an operator into running this gather module achieves arbitrary file write as the operator, which - because the written msfconsole.rc loads a second written file (a Ruby plugin whose top-level code runs on require) - yields persistent code execution and an interactive shell as the operator (frequently root) on the pentester's workstation on the next console launch.

The same traversal was already fixed upstream in the recursive downloader (stdapi/fs/dir.rb:291-296 scrubs separators), confirming this module's omission was an oversight; the fix is to apply the identical scrub (or File.basename) to listing entries before building the local path.

Verified end-to-end against an unmodified framework checkout: a hostile Meterpreter agent serving the crafted listing caused the unmodified module to write the plugin and rc, and a subsequent msfconsole -q connected a reverse shell executing commands as the operator.

Fix

Fixed upstream in rapid7/metasploit-framework#21880: the module was rewritten to use read_file + store_loot instead of download_file into a local path built from listing entries, and to skip ./.. directory entries. It also adds a MAX_FILE_SIZE cap (10 MB) before reading. The PR carries the rn-fix release-notes label; check the framework release notes for the first weekly release containing it.

Proof of Concept

FilePurpose
ios_hostile_agent.pyThe exploit: a minimal, dependency-free hostile Meterpreter agent (the "iOS device") that serves a crafted directory listing and file contents, then catches the resulting shell.
ios_poc_run.rcmsfconsole resource script that drives the unmodified framework through the vulnerable module.

ios_hostile_agent.py IS the malicious device: a pure-Python speaker of just enough of the Meterpreter TLV protocol (XOR'd 32-byte header, staged-payload stage skip) to pass as a session. When the module lists the photo directory, the agent returns three entries:

  1. IMG_0001.jpg - a benign cover image (24 bytes).
  2. ../../poc_shell_plugin.rb - a Ruby plugin whose top-level code spawns a reverse-shell thread back to the agent.
  3. ../../msfconsole.rc - a single line: load ~/.msf4/poc_shell_plugin.rb.

The real, unmodified module downloads each "image" into ~/.msf4/loot/<random6>/; the ../ entries escape it, so the plugin lands at ~/.msf4/poc_shell_plugin.rb and the rc at ~/.msf4/msfconsole.rc. The latter auto-executes at every msfconsole start, so the next console the operator opens (any console, in any terminal) loads the plugin, its top-level Ruby runs, and a shell connects back to the agent's catcher (default port 4466).

Notes:

  • Any Meterpreter session type works as the hostile device: TLV command IDs are platform-independent, and the module proceeds despite its own "incompatible session platform" warnings (visible in the sample run below).
  • enumextcmd is deliberately answered empty - a non-empty extension list trips msf's skip_loading guard and stdapi never loads.
  • Loopback-only demo (LHOST 127.0.0.1).

Running the exploit

Requirements: a metasploit-framework checkout (pre-fix, i.e. built before 2026-09-14), Python 3 (stdlib only), two terminals.

Terminal 1 (attacker - the hostile "iOS device"):

$ python3 ios_hostile_agent.py

Terminal 2 (victim - the metasploit operator, from the framework directory):

$ ./msfconsole -q -r /path/to/ios_poc_run.rc

The rc starts a handler, waits for the agent, runs the gather module, and exits. Once the agent reports PAYLOAD DEPLOYED, any new msfconsole the operator starts fires the payload and the shell arrives at the agent's catcher:

$ ./msfconsole -q

Cleanup

The run leaves a live persistence stub on the operator's box (~/.msf4/msfconsole.rc + ~/.msf4/poc_shell_plugin.rb). Remove it when done testing:

$ python3 ios_hostile_agent.py --cleanup

Sample run

Captured 2026-08-27 against an unmodified framework checkout on loopback.

Terminal 1 (attacker):

$ python3 ios_hostile_agent.py

[agent] shell catcher listening on 0.0.0.0:4466 (fires when the operator starts any new msfconsole)
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    1.1k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    624
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    412
  • 4

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    333
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    328
  • 6

    Aliens_eye

    arxhr007/aliens_eye

    AI powered OSINT engine to discover and map 7,700+ social media identities across the web

    280

Explore all tools

Browse our collection of tools

View all tools →