Skip to content

meterpreter edit truncates file before editing (data loss) — Metasploit 6.4.91-dev (apt) #20574

@tithobeelzbub

Description

@tithobeelzbub

Summary

Running meterpreter's edit <file> truncates the target file immediately (contents removed) before the editor is shown. If the editor or session fails, the original file is lost.

Steps to reproduce

  1. Get a meterpreter session (e.g., linux/x64).
  2. Ensure /tmp/testfile.txt contains data:
    echo "ORIGINAL" > /tmp/testfile.txt
  3. In the meterpreter session: edit /tmp/testfile.txt
  4. Observe the file is emptied immediately.

Expected

edit should open the existing file for editing without truncating it first (or use a temp file + atomic replace).

Actual

File is truncated as soon as edit is invoked.

Environment

  • Metasploit: 6.4.91-dev (installed via apt)
  • Kernel: Linux 6.8.0-84-generic
  • Payload/session: meterpreter (specify arch if relevant)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions