| 1 |
#!/usr/bin/env perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use FTPTest; |
| 7 |
|
| 8 |
# This test checks whether Wget *does not* fall back from passive mode to |
| 9 |
# active mode using a PORT command. Wget <= 1.16.3 made a fallback exposing |
| 10 |
# the client's real IP address to the remote FTP server. |
| 11 |
# |
| 12 |
# This behavior circumvents expected privacy when using a proxy / proxy network (e.g. Tor). |
| 13 |
# |
| 14 |
# Wget >= 1.16.4 does it right. This test checks it. |
| 15 |
|
| 16 |
############################################################################### |
| 17 |
|
| 18 |
# From bug report 10.08.2015 from [email protected] |
| 19 |
my $afile = <<EOF; |
| 20 |
FTP PORT command code in v1.16.3? |
| 21 |
|
| 22 |
In the past it could be possible for a site over http connection to |
| 23 |
redirect wget to FPT using FTP PORT command so the site gets the real IP |
| 24 |
of the computer even when wget proxy command is in use I believe: |
| 25 |
https://lists.torproject.org/pipermail/tor-talk/2012-April/024040.html |
| 26 |
|
| 27 |
Is that code still present in wget v1.16.3? It was present in v1.13.4. |
| 28 |
EOF |
| 29 |
|
| 30 |
$afile =~ s/\n/\r\n/g; |
| 31 |
|
| 32 |
|
| 33 |
# code, msg, headers, content |
| 34 |
my %urls = ( |
| 35 |
'/afile.txt' => { |
| 36 |
content => $afile, |
| 37 |
}, |
| 38 |
); |
| 39 |
|
| 40 |
my $cmdline = $WgetTest::WGETPATH . " -S ftp://localhost:{{port}}/afile.txt"; |
| 41 |
|
| 42 |
my $expected_error_code = 8; |
| 43 |
|
| 44 |
my %expected_downloaded_files = (); |
| 45 |
|
| 46 |
############################################################################### |
| 47 |
|
| 48 |
my $the_test = FTPTest->new ( |
| 49 |
server_behavior => {pasv_not_supported => 1}, |
| 50 |
input => \%urls, |
| 51 |
cmdline => $cmdline, |
| 52 |
errcode => $expected_error_code, |
| 53 |
output => \%expected_downloaded_files); |
| 54 |
exit $the_test->run(); |
| 55 |
|
| 56 |
# vim: et ts=4 sw=4 |