Commit 841df40946 for perl
commit 841df40946d4e19ac7e935e22e31fa04f77898a5
Author: Steve Hay <steve.m.hay@googlemail.com>
Date: Sat Nov 21 14:09:04 2026 +0000
Update libnet from 3.16 to 3.17
diff --git a/MANIFEST b/MANIFEST
index 48d6ed39f9..61b8fceaa6 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1591,6 +1591,7 @@ cpan/libnet/t/netrc.t libnet
cpan/libnet/t/nntp.t libnet
cpan/libnet/t/nntp_ipv6.t Test file related to libnet
cpan/libnet/t/nntp_ssl.t Test file related to libnet
+cpan/libnet/t/pasv_address_validation.t Test file related to libnet
cpan/libnet/t/pop3_ipv6.t Test file related to libnet
cpan/libnet/t/pop3_ssl.t Test file related to libnet
cpan/libnet/t/require.t libnet
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index d96deceb2a..45046307e8 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -745,8 +745,7 @@ our %Modules = (
},
'libnet' => {
- 'DISTRIBUTION' => 'SHAY/libnet-3.16.tar.gz',
- 'SYNCINFO' => 'eric on Wed Oct 28 16:25:04 2026',
+ 'DISTRIBUTION' => 'SHAY/libnet-3.17.tar.gz',
'MAIN_MODULE' => 'Net::Cmd',
'FILES' => q[cpan/libnet],
'EXCLUDED' => [
diff --git a/cpan/libnet/Makefile.PL b/cpan/libnet/Makefile.PL
index f4cbf9a9bb..95b518fce8 100644
--- a/cpan/libnet/Makefile.PL
+++ b/cpan/libnet/Makefile.PL
@@ -66,7 +66,7 @@ MAIN: {
ABSTRACT => 'Collection of network protocol modules',
AUTHOR => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>',
LICENSE => 'perl_5',
- VERSION => '3.16',
+ VERSION => '3.17',
META_MERGE => {
'meta-spec' => {
diff --git a/cpan/libnet/lib/Net/Cmd.pm b/cpan/libnet/lib/Net/Cmd.pm
index 7f8fdbe094..aa859ecab7 100644
--- a/cpan/libnet/lib/Net/Cmd.pm
+++ b/cpan/libnet/lib/Net/Cmd.pm
@@ -26,7 +26,7 @@ BEGIN {
}
}
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our @ISA = qw(Exporter);
our @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
@@ -1002,11 +1002,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/Config.pm b/cpan/libnet/lib/Net/Config.pm
index 4cb61d62fc..78adf1f243 100644
--- a/cpan/libnet/lib/Net/Config.pm
+++ b/cpan/libnet/lib/Net/Config.pm
@@ -18,7 +18,7 @@ use Socket qw(inet_aton inet_ntoa);
our @EXPORT = qw(%NetConfig);
our @ISA = qw(Net::LocalCfg Exporter);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our($CONFIGURE, $LIBNET_CFG);
@@ -368,11 +368,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/Domain.pm b/cpan/libnet/lib/Net/Domain.pm
index fc28b5b9ca..9049f0a4e7 100644
--- a/cpan/libnet/lib/Net/Domain.pm
+++ b/cpan/libnet/lib/Net/Domain.pm
@@ -19,7 +19,7 @@ use Net::Config;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
my ($host, $domain, $fqdn) = (undef, undef, undef);
@@ -395,11 +395,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/FTP.pm b/cpan/libnet/lib/Net/FTP.pm
index b5ff197f38..3451431660 100644
--- a/cpan/libnet/lib/Net/FTP.pm
+++ b/cpan/libnet/lib/Net/FTP.pm
@@ -1,7 +1,7 @@
# Net::FTP.pm
#
# Copyright (C) 1995-2004 Graham Barr. All rights reserved.
-# Copyright (C) 2013-2017, 2020, 2022 Steve Hay. All rights reserved.
+# Copyright (C) 2013-2017, 2020, 2022, 2026 Steve Hay. All rights reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
# Public License or the Artistic License, as specified in the F<LICENCE> file.
@@ -23,7 +23,7 @@ use Net::Config;
use Socket;
use Time::Local;
-our $VERSION = '3.16';
+our $VERSION = '3.17';
our $IOCLASS;
my $family_key;
@@ -938,8 +938,7 @@ sub pasv {
if ( $ftp->_PASV &&
$ftp->message =~ m{(\d+,\d+,\d+,\d+),(\d+),(\d+)} ) {
my $port = 256 * $2 + $3;
- ( my $ip = $1 ) =~s{,}{.}g;
- return ${*$ftp}{net_ftp_pasv} = [ $ip,$port ];
+ return ${*$ftp}{net_ftp_pasv} = [ $ftp->peerhost, $port ];
}
return;
}
@@ -2014,7 +2013,7 @@ libnet as of version 1.22_02.
Copyright (C) 1995-2004 Graham Barr. All rights reserved.
-Copyright (C) 2013-2017, 2020, 2022 Steve Hay. All rights reserved.
+Copyright (C) 2013-2017, 2020, 2022, 2026 Steve Hay. All rights reserved.
=head1 LICENCE
@@ -2024,11 +2023,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/FTP/A.pm b/cpan/libnet/lib/Net/FTP/A.pm
index b10af0d05a..24e94bda71 100644
--- a/cpan/libnet/lib/Net/FTP/A.pm
+++ b/cpan/libnet/lib/Net/FTP/A.pm
@@ -13,7 +13,7 @@ use Carp;
use Net::FTP::dataconn;
our @ISA = qw(Net::FTP::dataconn);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our $buf;
diff --git a/cpan/libnet/lib/Net/FTP/E.pm b/cpan/libnet/lib/Net/FTP/E.pm
index 44c0848b4d..f9d28ce613 100644
--- a/cpan/libnet/lib/Net/FTP/E.pm
+++ b/cpan/libnet/lib/Net/FTP/E.pm
@@ -8,6 +8,6 @@ use warnings;
use Net::FTP::I;
our @ISA = qw(Net::FTP::I);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
1;
diff --git a/cpan/libnet/lib/Net/FTP/I.pm b/cpan/libnet/lib/Net/FTP/I.pm
index e06cef09cf..53a2e4ea50 100644
--- a/cpan/libnet/lib/Net/FTP/I.pm
+++ b/cpan/libnet/lib/Net/FTP/I.pm
@@ -13,7 +13,7 @@ use Carp;
use Net::FTP::dataconn;
our @ISA = qw(Net::FTP::dataconn);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our $buf;
diff --git a/cpan/libnet/lib/Net/FTP/L.pm b/cpan/libnet/lib/Net/FTP/L.pm
index d030abd8c3..d1a47870a7 100644
--- a/cpan/libnet/lib/Net/FTP/L.pm
+++ b/cpan/libnet/lib/Net/FTP/L.pm
@@ -8,6 +8,6 @@ use warnings;
use Net::FTP::I;
our @ISA = qw(Net::FTP::I);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
1;
diff --git a/cpan/libnet/lib/Net/FTP/dataconn.pm b/cpan/libnet/lib/Net/FTP/dataconn.pm
index 2510670623..c80ee89005 100644
--- a/cpan/libnet/lib/Net/FTP/dataconn.pm
+++ b/cpan/libnet/lib/Net/FTP/dataconn.pm
@@ -13,7 +13,7 @@ use Carp;
use Errno;
use Net::Cmd;
-our $VERSION = '3.16';
+our $VERSION = '3.17';
$Net::FTP::IOCLASS or die "please load Net::FTP before Net::FTP::dataconn";
our @ISA = $Net::FTP::IOCLASS;
@@ -224,11 +224,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/NNTP.pm b/cpan/libnet/lib/Net/NNTP.pm
index 36618f9c2b..d6b08067b5 100644
--- a/cpan/libnet/lib/Net/NNTP.pm
+++ b/cpan/libnet/lib/Net/NNTP.pm
@@ -19,7 +19,7 @@ use Net::Cmd;
use Net::Config;
use Time::Local;
-our $VERSION = "3.16";
+our $VERSION = "3.17";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -1308,11 +1308,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/Netrc.pm b/cpan/libnet/lib/Net/Netrc.pm
index f1e95d85c7..7aed8e74e9 100644
--- a/cpan/libnet/lib/Net/Netrc.pm
+++ b/cpan/libnet/lib/Net/Netrc.pm
@@ -16,7 +16,7 @@ use warnings;
use Carp;
use FileHandle;
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our $TESTING;
@@ -353,11 +353,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/POP3.pm b/cpan/libnet/lib/Net/POP3.pm
index 2994833f84..2484cdce45 100644
--- a/cpan/libnet/lib/Net/POP3.pm
+++ b/cpan/libnet/lib/Net/POP3.pm
@@ -18,7 +18,7 @@ use IO::Socket;
use Net::Cmd;
use Net::Config;
-our $VERSION = "3.16";
+our $VERSION = "3.17";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -869,11 +869,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/SMTP.pm b/cpan/libnet/lib/Net/SMTP.pm
index 0701793bb8..9abd20e9a6 100644
--- a/cpan/libnet/lib/Net/SMTP.pm
+++ b/cpan/libnet/lib/Net/SMTP.pm
@@ -19,7 +19,7 @@ use Net::Cmd;
use Net::Config;
use Socket;
-our $VERSION = "3.16";
+our $VERSION = "3.17";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -1052,11 +1052,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/lib/Net/Time.pm b/cpan/libnet/lib/Net/Time.pm
index f75a2987d0..b49137ba6f 100644
--- a/cpan/libnet/lib/Net/Time.pm
+++ b/cpan/libnet/lib/Net/Time.pm
@@ -22,7 +22,7 @@ use Net::Config;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(inet_time inet_daytime);
-our $VERSION = "3.16";
+our $VERSION = "3.17";
our $TIMEOUT = 120;
@@ -190,11 +190,11 @@ License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
-Version 3.16
+Version 3.17
=head1 DATE
-24 Oct 2026
+21 Nov 2026
=head1 HISTORY
diff --git a/cpan/libnet/t/pasv_address_validation.t b/cpan/libnet/t/pasv_address_validation.t
new file mode 100644
index 0000000000..0e9abd2af1
--- /dev/null
+++ b/cpan/libnet/t/pasv_address_validation.t
@@ -0,0 +1,231 @@
+#!perl
+#===============================================================================
+#
+# t/pasv_address_validation.t
+#
+# DESCRIPTION
+# Regression test for CVE-2026-40558: Net::FTP::pasv() previously used the
+# IP address returned in the server's 227 reply to open the data connection,
+# allowing a malicious server to redirect the data channel to an arbitrary
+# third-party host.
+#
+# The fix makes pasv() ignore the IP in the 227 reply and always store the
+# control connection's peer address instead (matching the behaviour that
+# epsv() already had).
+#
+# Two scenarios are tested:
+#
+# 1. CVE regression - server sends a 227 reply containing a decoy IP
+# (127.0.0.2). pasv() must store the control-connection host
+# (127.0.0.1), not the decoy.
+#
+# 2. Sanity check - server sends a 227 reply with the correct IP
+# (127.0.0.1). pasv() must still store peerhost (127.0.0.1) and
+# return a defined value so normal passive transfers continue to work.
+#
+# COPYRIGHT
+# Copyright (C) 2026 Steve Hay. All rights reserved.
+#
+# LICENCE
+# This script is free software; you can redistribute it and/or modify it under
+# the same terms as Perl itself, i.e. under the terms of either the GNU
+# General Public License or the Artistic License, as specified in the LICENCE
+# file.
+#
+#===============================================================================
+
+use 5.008001;
+
+use strict;
+use warnings;
+
+use Config qw();
+use IO::Socket::INET qw();
+use Test::More;
+
+BEGIN {
+ if (!eval { require Socket }) {
+ plan skip_all => "no Socket";
+ }
+ elsif (ord('A') == 193 && !eval { require Convert::EBCDIC }) {
+ plan skip_all => "EBCDIC but no Convert::EBCDIC";
+ }
+}
+
+use Net::FTP;
+
+plan skip_all => "fork not supported on this platform"
+ unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+ (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+ $Config::Config{useithreads} and
+ $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+
+# Test 1 requires 127.0.0.2 to be routable (most Linux systems have the full
+# 127/8 block; some minimal containers do not).
+{
+ my $probe = IO::Socket::INET->new(
+ Listen => 1,
+ LocalAddr => '127.0.0.2',
+ LocalPort => 0,
+ Proto => 'tcp',
+ Timeout => 2,
+ );
+ plan skip_all => "127.0.0.2 not available on this host" unless $probe;
+ close $probe;
+}
+
+plan tests => 4;
+
+#===============================================================================
+# SUBROUTINES
+#===============================================================================
+
+#-------------------------------------------------------------------------------
+# pasv_reply($ip, $port) - build the parenthesised token of a 227 reply.
+#-------------------------------------------------------------------------------
+
+sub pasv_reply {
+ my ($ip, $port) = @_;
+ my $ip_part = join(',', split(/\./, $ip));
+ return sprintf('(%s,%d,%d)', $ip_part, int($port / 256), $port % 256);
+}
+
+#-------------------------------------------------------------------------------
+# mock_server($ctrl_sock, $pasv_ip, $pasv_port)
+#
+# Fork a child that accepts one control connection and responds to the minimal
+# FTP commands Net::FTP sends before PASV (the 220 greeting, then SYST / TYPE
+# as needed), and to PASV itself with a 227 reply containing $pasv_ip and
+# $pasv_port. Sends 221 on QUIT. Returns the child PID.
+#-------------------------------------------------------------------------------
+
+sub mock_server {
+ my ($ctrl_sock, $pasv_ip, $pasv_port) = @_;
+
+ defined(my $pid = fork()) or die "fork: $!";
+ unless ($pid) {
+ # Child: serve exactly one client.
+ my $conn = $ctrl_sock->accept or exit 1;
+ print $conn "220 mock FTP server ready\r\n";
+ while (my $line = <$conn>) {
+ $line =~ s/\r?\n$//;
+ if ($line =~ /^USER/i) {
+ print $conn "230 logged in\r\n"
+ }
+ elsif ($line =~ /^SYST/i) {
+ print $conn "215 UNIX Type: L8\r\n"
+ }
+ elsif ($line =~ /^TYPE/i) {
+ print $conn "200 type set\r\n"
+ }
+ elsif ($line =~ /^PASV/i) {
+ my $token = pasv_reply($pasv_ip, $pasv_port);
+ print $conn "227 Entering Passive Mode $token\r\n";
+ }
+ elsif ($line =~ /^QUIT/i) {
+ print $conn "221 goodbye\r\n";
+ last;
+ }
+ else {
+ print $conn "200 ok\r\n"
+ }
+ }
+ $conn->close;
+ exit 0;
+ }
+
+ return $pid;
+}
+
+#===============================================================================
+# MAIN PROGRAM
+#===============================================================================
+
+#-------------------------------------------------------------------------------
+# Test 1 - CVE-2026-40558 regression
+#
+# The server advertises 127.0.0.2 in its 227 reply. After the fix, pasv()
+# must store 127.0.0.1 (the control-connection peer) rather than 127.0.0.2.
+#-------------------------------------------------------------------------------
+{
+ my $ctrl = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => '127.0.0.1',
+ LocalPort => 0,
+ Proto => 'tcp',
+ ) or die "control listener: $!";
+
+ # The decoy port just needs to be a valid port number; nothing listens there
+ # for this test because we only inspect what pasv() stores, not the
+ # subsequent data connection.
+ my $decoy_port = 65432;
+
+ my $pid = mock_server($ctrl, '127.0.0.2', $decoy_port);
+
+ my $ftp = Net::FTP->new('127.0.0.1',
+ Port => $ctrl->sockport,
+ Timeout => 5,
+ );
+
+ SKIP: {
+ skip "could not connect to mock control server", 2 unless $ftp;
+
+ $ftp->login('anonymous');
+
+ my $pasv = $ftp->pasv;
+
+ ok(defined $pasv,
+ 'CVE test: pasv() returns defined even when 227 contains a decoy IP');
+
+ is($pasv->[0], '127.0.0.1',
+ 'CVE test: pasv() stores peerhost (127.0.0.1), not the decoy IP from the 227 reply (127.0.0.2)');
+
+ $ftp->quit;
+ }
+
+ waitpid($pid, 0);
+}
+
+#-------------------------------------------------------------------------------
+# Test 2 - sanity check
+#
+# The server sends a well-formed 227 reply whose IP happens to match the
+# control-connection host (127.0.0.1). pasv() must still return a defined
+# value and store 127.0.0.1 so that normal passive-mode transfers continue to
+# work after the fix.
+#-------------------------------------------------------------------------------
+{
+ my $ctrl = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => '127.0.0.1',
+ LocalPort => 0,
+ Proto => 'tcp',
+ ) or die "control listener: $!";
+
+ my $pid = mock_server($ctrl, '127.0.0.1', 65433);
+
+ my $ftp = Net::FTP->new('127.0.0.1',
+ Port => $ctrl->sockport,
+ Timeout => 5,
+ );
+
+ SKIP: {
+ skip "could not connect to mock control server", 2 unless $ftp;
+
+ $ftp->login('anonymous');
+
+ my $pasv = $ftp->pasv;
+
+ ok(defined $pasv,
+ 'sanity: pasv() returns defined when 227 IP matches control host');
+
+ is($pasv->[0], '127.0.0.1',
+ 'sanity: pasv() stores peerhost (127.0.0.1) for a well-behaved 227 reply');
+
+ $ftp->quit;
+ }
+
+ waitpid($pid, 0);
+}
+
+#===============================================================================