vendor:
NET::Ftp
by:
Anonymous
8,8
CVSS
HIGH
Command Execution
78
CWE
Product Name: NET::Ftp
Affected Version From: N/A
Affected Version To: N/A
Patch Exists: NO
Related CWE: N/A
CPE: N/A
Metasploit:
N/A
Other Scripts:
N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References:
N/A
Nuclei Metadata: N/A
Platforms Tested: Ruby
2020
NET::Ftp Command Execution Vulnerability
The vulnerability lies in the `gettextfile(remotefile, localfile = File.basename(remotefile))` method. When looking at the source code, you'll note that the `localfile` value will trigger command execution if the value is `| os command`. In general use, most users would likely provide their own localfile value and would not rely on the default of `File.basename(remotefile)`; however, in some situations, such as listing and downloading all files in a FTP share, the remotefile value would be controlled by the remote host and could thus be manipulated into causing RCE.
Mitigation:
It would probably be best to not use `open` in NET::Ftp, but rather something like `File.opne` which would be more secure.