Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #14888, fix downloading a utf-8 directory directly #14934

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

timwr
Copy link
Contributor

@timwr timwr commented Mar 22, 2021

This change fixes a similar bug to #14888 , but this time you need to specify the directory directly
This change ensure the directory source and destination are UTF-8 encoded.

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • Get any meterpreter session (I was able to reproduce on both Android and linux/x64 (mettle))
  • Ensure you have a database connected
  • Verify the following:
meterpreter > mkdir testunicode
Creating directory: testunicode
meterpreter > cd testunicode
meterpreter > mkdir 🔥
Creating directory: 🔥
meterpreter > cd 🔥
meterpreter > edit ⚡
meterpreter > ls
Listing: /metasploit-framework/testunicode/🔥
==============================================================

Mode              Size  Type  Last modified              Name
----              ----  ----  -------------              ----
100664/rw-rw-r--  0     fil   2021-03-13 11:13:19 +0000  ⚡

meterpreter > cd ..
meterpreter > download 🔥
[*] mirroring  : ./🔥 -> /metasploit-framework/🔥
[*] downloading: ./🔥/⚡ -> /metasploit-framework/🔥/⚡
[*] download   : ./🔥/⚡ -> /metasploit-framework/🔥/⚡
[*] mirrored   : ./🔥 -> /metasploit-framework/🔥
meterpreter > exit

Before the fix:

meterpreter > mkdir testunicode
Creating directory: testunicode
meterpreter > cd testunicode
meterpreter > mkdir 🔥
Creating directory: 🔥
meterpreter > cd 🔥
meterpreter > edit ⚡
meterpreter > cd ..
meterpreter > download 🔥
[-] Error running command download: Encoding::CompatibilityError incompatible character encodings: ASCII-8BIT and UTF-8

@gwillcox-r7
Copy link
Contributor

Fix confirmed to be working, nice work @timwr, going to land this now.

@gwillcox-r7 gwillcox-r7 merged commit 26055e1 into rapid7:master Mar 23, 2021
@gwillcox-r7 gwillcox-r7 added the rn-fix release notes fix label Mar 23, 2021
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented Mar 23, 2021

Release Notes

Fixed a bug in the download command in Meterpreter, where attempts to download a directory containing UTF-8 characters would result in an error. This has been resolved by enforcing the correct encoding.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants