Hi,

On 4/19/26 12:43, David Prévot wrote:
[…]
   [x] attach debdiff against the package in (old)stable

For real this time…

Cheers,

taffit
diff -Nru php-phpseclib-2.0.48/debian/changelog php-phpseclib-2.0.48/debian/changelog
--- php-phpseclib-2.0.48/debian/changelog	2026-03-24 08:44:18.000000000 +0100
+++ php-phpseclib-2.0.48/debian/changelog	2026-04-19 11:33:48.000000000 +0200
@@ -1,3 +1,10 @@
+php-phpseclib (2.0.48-3+deb13u2) trixie; urgency=medium
+
+  * SSH2: use constant time string comparison in get_binary_packet()
+    [CVE-2026-40194]
+
+ -- David Prévot <[email protected]>  Sun, 19 Apr 2026 11:33:48 +0200
+
 php-phpseclib (2.0.48-3+deb13u1) trixie-security; urgency=medium
 
   * Track trixie branch
diff -Nru php-phpseclib-2.0.48/debian/patches/0013-SSH2-use-constant-time-string-comparison-in-get_bina.patch php-phpseclib-2.0.48/debian/patches/0013-SSH2-use-constant-time-string-comparison-in-get_bina.patch
--- php-phpseclib-2.0.48/debian/patches/0013-SSH2-use-constant-time-string-comparison-in-get_bina.patch	1970-01-01 01:00:00.000000000 +0100
+++ php-phpseclib-2.0.48/debian/patches/0013-SSH2-use-constant-time-string-comparison-in-get_bina.patch	2026-04-19 11:33:23.000000000 +0200
@@ -0,0 +1,58 @@
+From: terrafrost <[email protected]>
+Date: Thu, 9 Apr 2026 18:14:19 -0500
+Subject: SSH2: use constant time string comparison in get_binary_packet():
+
+Origin: upstream, https://github.com/phpseclib/phpseclib/commit/ffe48b6b1b1af6963327f0a5330e3aa004a194ac
+Bug: https://github.com/phpseclib/phpseclib/security/advisories/GHSA-r854-jrxh-36qx
+Bug-Debian: https://security-tracker.debian.org/tracker/CVE-2026-40194
+---
+ phpseclib/Net/SSH2.php | 31 ++++++++++++++++++++++++++++++-
+ 1 file changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php
+index 3583f86..33d6787 100644
+--- a/phpseclib/Net/SSH2.php
++++ b/phpseclib/Net/SSH2.php
+@@ -3787,7 +3787,7 @@ class SSH2
+                 $this->bitmap = 0;
+                 user_error('Error reading socket');
+                 return false;
+-            } elseif ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) {
++            } elseif (!$this->_equals($hmac, $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding)))) {
+                 user_error('Invalid HMAC');
+                 return false;
+             }
+@@ -5681,4 +5681,33 @@ class SSH2
+     {
+         $this->doKeyReexchangeAfterXBytes = $bytes;
+     }
++
++    /**
++     * Constant time equality testing
++     *
++     * Pretty much copy / pasted from Crypt/RSA.php
++     *
++     * @access private
++     * @param string $x
++     * @param string $y
++     * @return bool
++     */
++    function _equals($x, $y)
++    {
++        if (function_exists('hash_equals')) {
++            return hash_equals($x, $y);
++        }
++
++        if (strlen($x) != strlen($y)) {
++            return false;
++        }
++
++        $result = "\0";
++        $x^= $y;
++        for ($i = 0; $i < strlen($x); $i++) {
++            $result|= $x[$i];
++        }
++
++        return $result === "\0";
++    }
+ }
diff -Nru php-phpseclib-2.0.48/debian/patches/series php-phpseclib-2.0.48/debian/patches/series
--- php-phpseclib-2.0.48/debian/patches/series	2026-03-24 08:44:18.000000000 +0100
+++ php-phpseclib-2.0.48/debian/patches/series	2026-04-19 11:33:23.000000000 +0200
@@ -10,3 +10,4 @@
 0010-Group-nophpunit11-for-tests-failing-with-PHPUnit-11.patch
 0011-Modernize-PHPUnit-syntax.patch
 0012-make-unpadding-constant-time.patch
+0013-SSH2-use-constant-time-string-comparison-in-get_bina.patch

Reply via email to