Skip to main content
Vulnerability Database/CVE-2026-87690

CVE-2026-87690: Metasploit Framework Path Traversal

CVE-2026-87690 is a path traversal flaw in Metasploit Framework's ios_image_gather module allowing malicious iOS devices to write arbitrary files and execute code on pentester workstations. This article covers technical details, attack vectors, and fixes.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-87690 Overview

CVE-2026-87690 is a relative path traversal vulnerability [CWE-22] in the Metasploit Framework post module post/apple_ios/gather/ios_image_gather. The module interpolates file names from a Meterpreter directory listing — data controlled by the remote iOS device — directly into the local destination path passed to client.fs.file.download_file() without sanitization. A hostile or tampered iOS device can supply listing entries like ../../msfconsole.rc to escape the intended loot directory and write arbitrary files on the operator's workstation. Because ~/.msf4/msfconsole.rc executes automatically at every msfconsole launch, the write converts into persistent code execution as the operator.

Critical Impact

An attacker-controlled iOS device can achieve arbitrary file write and persistent code execution as the pentester running Metasploit, frequently as root.

Affected Products

  • Metasploit Framework versions prior to 6.5.5
  • post/apple_ios/gather/ios_image_gather post module
  • lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb stdapi file sink

Discovery Timeline

  • 2026-10-12 - CVE-2026-87690 published to NVD
  • 2026-10-16 - Last updated in NVD database

Technical Details for CVE-2026-87690

Vulnerability Analysis

The ios_image_gather post module enumerates image files on a connected iOS device via Meterpreter's directory listing, then downloads each entry into ~/.msf4/loot/<random>/. The module constructs the local path by concatenating the loot directory with the raw file name returned by the device. Because client.fs.file.download_file() writes to whatever path the caller supplies, a listing entry containing ../ sequences traverses outside the loot directory. The attacker-controlled device returns a file name such as ../../msfconsole.rc, which resolves to ~/.msf4/msfconsole.rc.

The written msfconsole.rc is a resource script that msfconsole executes at startup through lib/msf/ui/console/driver.rb:196. Resource scripts can load or require additional Ruby files, so a second write delivers a Ruby plugin whose top-level code runs on require. The result is persistent code execution and an interactive shell as the operator at the next console launch.

Root Cause

The post module omits the separator scrub applied upstream in the recursive downloader at stdapi/fs/dir.rb. Listing entries are trusted as safe path components. No call to File.basename or equivalent sanitization is performed before concatenation.

Attack Vector

Exploitation requires an operator to run the ios_image_gather module against a hostile or tampered iOS device. The device returns crafted file names in response to Meterpreter directory listing requests. User interaction is required, but no privileges on the operator workstation are needed beyond those obtained through the subsequent msfconsole.rc execution.

Detection Methods for CVE-2026-87690

Indicators of Compromise

  • Unexpected modifications to ~/.msf4/msfconsole.rc outside of operator-initiated changes.
  • New or modified Ruby files under ~/.msf4/ or ~/.msf4/plugins/ that were not installed by the operator.
  • Loot directory listings containing entries with .. path components or embedded separators.
  • Outbound connections or shell processes spawned by msfconsole immediately on launch.

Detection Strategies

  • Monitor file integrity on ~/.msf4/msfconsole.rc and the ~/.msf4/plugins/ directory on pentester workstations.
  • Alert on process execution chains where msfconsole or ruby spawns reverse shells, network listeners, or privilege-elevation utilities at startup.
  • Review Metasploit framework logs for runs of post/apple_ios/gather/ios_image_gather against untrusted sessions.

Monitoring Recommendations

  • Enable endpoint telemetry on operator workstations that routinely run offensive tooling.
  • Capture command-line arguments and parent-child process relationships for ruby and msfconsole invocations.
  • Baseline the contents of ~/.msf4/ and alert on drift to catch overwrites of resource files or plugin additions.

How to Mitigate CVE-2026-87690

Immediate Actions Required

  • Upgrade the Metasploit Framework to release 6.5.5 or later, which applies the separator scrub to listing entries before building the local path.
  • Audit ~/.msf4/msfconsole.rc and ~/.msf4/plugins/ on workstations that have run ios_image_gather against untrusted devices.
  • Avoid running Metasploit as root; operate under a dedicated unprivileged account where feasible.
  • Treat Meterpreter sessions to attacker-reachable devices as untrusted inputs when selecting post modules.

Patch Information

The fix is included in Metasploit Framework Release 6.5.5 and merged via Metasploit Pull Request #21880. The patch applies the same separator scrub used in stdapi/fs/dir.rb (or File.basename) to listing entries before constructing the local destination path. See the Rapid7 Metasploit Wrap-Up for release context.

Workarounds

  • Do not run post/apple_ios/gather/ios_image_gather against sessions whose device integrity is uncertain.
  • Run msfconsole inside an ephemeral container or VM so that writes to ~/.msf4/ do not persist across engagements.
  • Review and remove unexpected content from ~/.msf4/msfconsole.rc before each console launch.
bash
# Upgrade Metasploit Framework to the patched release
git -C /path/to/metasploit-framework fetch --tags
git -C /path/to/metasploit-framework checkout 6.5.5
bundle install

# Verify msfconsole.rc has not been tampered with
sha256sum ~/.msf4/msfconsole.rc
ls -la ~/.msf4/plugins/

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.