Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

ext/ftp: cryptic error on servers that don't support TLS session resumption on data connection

Fechada
#23,619 4 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
52/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
c
Domínio
networking, security

Direção de pesquisa

Comece em ext/ftp, no caminho de conexão de dados de ftp_nlist e na falha de data_accept que relata o erro da sessão TLS. Reproduza o problema com o exemplo do PHP 8.5.9 e inspecione como o aviso é formado; o trabalho estará concluído quando os usuários receberem uma explicação clara de que a retomada da sessão TLS não é compatível, sem continuar silenciosamente de forma insegura.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Bug Extension: ftp Status: Verified
Description

The following code:

<?php
$conn_id = ftp_ssl_connect($url);
$login_result = ftp_login($conn_id, $un, $pw);
ftp_set_option($conn_id, FTP_USEPASVADDRESS, false);
ftp_pasv($conn_id, true);

if (!$login_result) {
    die("can't login\n");
}
else{
    echo "logged in success\n";
    $buff = ftp_nlist($conn_id,'outbound');
    var_dump($buff);
}

Resulted in this output:

logged in success
Warning: ftp_nlist: data_accept: failed to retrieve the existing SSL session

But I expected this output instead:

logged in success
[nlist output]

TLS session resumption on the data connection is required for it to be secure. GH-12851 fixed that. However, some servers don't seem to support TLS session resumption. In this case, PHP seems to fail with a cryptic-to-the-user error message. However, other FTP clients like i.e. FileZilla will prompt the user with a message like:

This server does not support TLS session resumption on the data connection.
TLS session resumption on the data connection is an important security feature to protect against data connection stealing attacks.
If you continue, transferred files may be intercepted or their contents replaced by an attacker.

I don't know if we want to support opting out of the behaviour (and certainly not continue insecurely silently), but we should definitely provide a better warning here, so users know what's wrong and what to blame.

A user reached out to me for support because this was "working" in PHP 8.1 (insecurely. probably) but stopped working when they upgraded to PHP 8.5, and thought it was a PHP issue. They did try it under 8.2.12 (last version XAMPP shipped) and that worked, and that was prior to when that PR was merged. I'm asking the user to bisect 8.2.13 vs. 8.2.14 to confirm.

As for the problematic FTP server in question, it seems to be Axway SecureTransport as installed by a large logistics company. A little hard to test for ourselves, and a little hard to get them to fix it. I don't know if we can force i.e. vsftpd to disallow session resumption to test it.

PHP Version
PHP 8.5.9
Operating System

Windows Server 2019

Linguagem predominante
C
Estrelas
40.4k
Forks
8.2k
Merge médio
2d 3h
PRs com merge (30d)
151

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de php/php-src

Todas as issues de php/php-src

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.