🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #4637

Bug#1153803: roundcube: Security updates 1.6.21 and 1.7.6 released

#4637
From: Guilhem Moulin
Date: Sun, 15 Nov 2026 19:30
2632 lines
105048 bytes
--54JYiXzif/0fipGo
Content-Type: multipart/mixed; boundary="+m9kMpH6LsWoJXXB"
Content-Disposition: inline

--+m9kMpH6LsWoJXXB
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

On Thu, 12 Nov 2026 at 08:53:25 +0100, Salvatore Bonaccorso wrote:
> https://roundcube.net/news/2026/11/09/security-updates-1.6.21-and-1.7.6
> reports new security releases for roundcube:
> [=E2=80=A6]

Here is a tested debdiff for these issues.  As for the previous uploads, I
suggest to follow 1.6.x (upstream's current LTS release) for trixie-securit=
y.
The upstream diff [0] is targeted anyway.  Debusine result:
https://debusine.debian.net/debian/developers/work-request/1623116/

I reported the issue with `long2ip()` on 32-bits platforms to upstream by m=
ail,
along with d/p/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch=
 .

> The following comes earlier:
>
> | WARNING: The 1.6 branch is four years old. Please, plan your upgrade
> | to 1.7 soon. Backporting security patches became increasingly time
> | consuming, annoying and error prone. 1.6 will be discontinued rather
> | soon.
>
> Means probably for Debian trixie we are on our own for backporting
> fixes unless it is realistic to switch to another branch within a
> release.

Ack, it was the same with 1.4 and I think it'll be doable despite of surge =
is
security issues.  1.7 has a different build systems and dependencies which =
are
not in trixie, so I don't think upgrading to 1.7 in trixie is doable.  I sh=
ould,
however, finish to work to put it into forky ASAP.

Cheers,
--=20
Guilhem.

[0] https://github.com/roundcube/roundcubemail/compare/1.6.20...1.6.21

--+m9kMpH6LsWoJXXB
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=roundcube.debdiff
Content-Transfer-Encoding: quoted-printable

diffstat for roundcube-1.6.20+dfsg roundcube-1.6.21+dfsg

 CHANGELOG.md                                                              =
  |   20 +
 config/defaults.inc.php                                                   =
  |    4=20
 debian/changelog                                                          =
  |   95 ++++--
 debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch       =
  |  118 ++++++--
 debian/patches/Fix-FTBFS-with-phpunit-11.patch                            =
  |  144 +++++-----
 debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patc=
h |   35 ++
 debian/patches/default-charset-utf8.patch                                 =
  |    4=20
 debian/patches/dont-force-set-session.gc_probability=3D1.patch            =
    |    2=20
 debian/patches/series                                                     =
  |    1=20
 debian/patches/use-enchant.patch                                          =
  |    4=20
 plugins/managesieve/Changelog                                             =
  |    3=20
 plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php                  =
  |    2=20
 plugins/managesieve/lib/Roundcube/rcube_sieve_script.php                  =
  |   41 +-
 program/actions/mail/folder_expunge.php                                   =
  |    5=20
 program/actions/mail/folder_purge.php                                     =
  |   18 -
 program/actions/mail/sendmdn.php                                          =
  |    9=20
 program/actions/utils/spell.php                                           =
  |    7=20
 program/actions/utils/spell_html.php                                      =
  |    8=20
 program/include/rcmail.php                                                =
  |   19 +
 program/include/rcmail_action.php                                         =
  |    2=20
 program/include/rcmail_attachment_handler.php                             =
  |   30 --
 program/include/rcmail_sendmail.php                                       =
  |   18 -
 program/lib/Roundcube/rcube.php                                           =
  |    2=20
 program/lib/Roundcube/rcube_image.php                                     =
  |   18 +
 program/lib/Roundcube/rcube_imap_generic.php                              =
  |  103 ++++---
 program/lib/Roundcube/rcube_message.php                                   =
  |    3=20
 program/lib/Roundcube/rcube_session.php                                   =
  |    3=20
 program/lib/Roundcube/rcube_utils.php                                     =
  |  118 ++++++--
 public_html/plugins/managesieve/Changelog                                 =
  |    3=20
 public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php      =
  |    2=20
 public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php      =
  |   41 +-
 tests/Actions/Mail/FolderExpunge.php                                      =
  |   21 +
 tests/Actions/Mail/FolderPurge.php                                        =
  |   19 +
 tests/Framework/Session.php                                               =
  |    4=20
 tests/Framework/Utils.php                                                 =
  |   14=20
 tests/Rcmail/Rcmail.php                                                   =
  |    4=20
 tests/Rcmail/Sendmail.php                                                 =
  |   38 ++
 37 files changed, 719 insertions(+), 263 deletions(-)

diff -Nru roundcube-1.6.20+dfsg/CHANGELOG.md roundcube-1.6.21+dfsg/CHANGELO=
G.md
--- roundcube-1.6.20+dfsg/CHANGELOG.md	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/CHANGELOG.md	2026-11-09 12:53:01.000000000 +0100
@@ -2,6 +2,26 @@
=20
 ## Unreleased
=20
+- Security: Fix open redirect via IMAP error recovery on attachment get
+- Security: Fix so Received: header includes only trusted hostname and for=
warded IP from a trusted proxy
+- Security: Fix bug where some managesieve destructive actions could have =
been triggered cross-site via GET
+- Security: Fix Sieve script injection via a rule operator
+- Security: Fix Sieve script injection via set/include modifiers
+- Security: Fix bug where resolve_url() ignored trusted host setting
+- Security: Fix mail header injection via a MDN subject
+- Security: Fix HTTP request injection via the spellcheck ATD backend
+- Security: Fix IMAP command injection via CRLF in _uid parameter with mes=
sages_cache enabled
+- Security: Fix SSRF in CSS proxy via incomplete is_local_url() nip.io/ssl=
ip.io bypass
+- Security: Fix CSRF validation bypass for file-only POST requests
+- Security: Fix `disabled_actions` restriction bypass by writing '_' inste=
ad of '-' in the action name
+- Security: Fix CSRF validation bypass for mail purge/expunge commands
+- Security: Fix passing potentally unsafe attachment content into ImageMag=
ick on image type conversion
+- Security: Fix Unbounded CPU loop/DoS in rcube_session::unserialize() via=
 a negative length token
+- Security: Fix SSRF filter (is_local_url()) bypass via 6to4 (2002::/16) a=
ddresses
+- Security: Fix so IMAP host input is validated more strictly
+
+## Release 1.6.20
+
 - Security: Fix IMAP command injection via CRLF in `_uid` parameter of mai=
l/headers and mail/viewsource action
 - Security: Fix bug where an alias login wasn't qualified by IMAP host
 - Security: Add a size limit to the CSS proxy content processing
diff -Nru roundcube-1.6.20+dfsg/config/defaults.inc.php roundcube-1.6.21+df=
sg/config/defaults.inc.php
--- roundcube-1.6.20+dfsg/config/defaults.inc.php	2026-10-19 08:49:43.00000=
0000 +0200
+++ roundcube-1.6.21+dfsg/config/defaults.inc.php	2026-11-09 12:53:01.00000=
0000 +0100
@@ -728,7 +728,9 @@
 // paths are relative to the Roundcube root folder
 $config['generic_message_footer_html'] =3D '';
=20
-// add a received header to outgoing mails containing the creators IP and =
hostname
+// Add a Received: header to outgoing mails containing the creators IP and=
 hostname.
+// For security, only trusted hosts are used. It is recommended to use 'pr=
oxy_whitelist'
+// and 'trusted_host_patterns' to control this.
 $config['http_received_header'] =3D false;
=20
 // Whether or not to encrypt the IP address and the host name
diff -Nru roundcube-1.6.20+dfsg/debian/changelog roundcube-1.6.21+dfsg/debi=
an/changelog
--- roundcube-1.6.20+dfsg/debian/changelog	2026-10-20 07:00:29.000000000 +0=
200
+++ roundcube-1.6.21+dfsg/debian/changelog	2026-11-15 19:45:19.000000000 +0=
100
@@ -1,37 +1,74 @@
+roundcube (1.6.21+dfsg-0+deb13u1) trixie-security; urgency=3Dhigh
+
+  * New upstream security and bugfix release (closes: #1153803).
+    + Fix open redirect via IMAP error recovery on attachment get.
+    + Fix so Received: header includes only trusted hostname and forwarded=
 IP
+      from a trusted proxy.
+    + Fix bug where some managesieve destructive actions could have been
+      triggered cross-site via GET.
+    + Fix Sieve script injection via a rule operator.
+    + Fix Sieve script injection via set/include modifiers.
+    + Fix bug where resolve_url() ignored trusted host setting.
+    + Fix mail header injection via a MDN subject.
+    + Fix HTTP request injection via the spellcheck ATD backend.
+    + Fix CVE-2026-126813: IMAP command injection via CRLF in _uid paramet=
er
+      with messages_cache enabled.
+    + Fix SSRF in CSS proxy via incomplete is_local_url() nip.io/sslip.io
+      bypass.
+    + Fix CSRF validation bypass for file-only POST requests.
+    + Fix disabled_actions restriction bypass by writing =E2=80=98_=E2=80=
=99 instead of =E2=80=98-=E2=80=98 in
+      the action name.
+    + Fix CSRF validation bypass for mail purge/expunge commands.
+    + Fix passing potentially unsafe attachment content into ImageMagick on
+      image type conversion.
+    + Fix Unbounded CPU loop/DoS in rcube_session::unserialize() via a
+      negative length token.
+    + Fix SSRF filter (is_local_url()) bypass via 6to4 (2002::/16) address=
es.
+    + Fix so IMAP host input is validated more strictly.
+  * Refresh d/patches.
+  * Fix `self::xip_ip()` on 32-bits platforms.
+
+ -- Guilhem Moulin <guilhem@debian.org>  Sun, 15 Nov 2026 19:45:19 +0100
+
 roundcube (1.6.20+dfsg-0+deb13u1) trixie-security; urgency=3Dhigh
=20
   * New upstream security and bugfix release (closes: #1151279).
     + Fix CVE-2026-113386: IMAP command injection via CRLF in `_uid` param=
eter
       of mail/headers and mail/viewsource action.
-    + Fix bug where an alias login wasn't qualified by IMAP host.
-    + Add a size limit to the CSS proxy content processing.
-    + Fix SSRF filter (`is_local_url()`) bypass via NAT64 64:ff9b::/96.
-    + Fix remote content blocking bypass via SVG SMIL `by` attribute.
-    + Fix remote content blocking bypass via CSS escapes in FuncIRI attrib=
utes
-      (again).
-    + Fix passing potentially unsafe attachment content into ImageMagick on
-      image resize.
-    + Fix mail header injection via the From display-name in the Bounce (r=
esend)
-      action.
-    + Fix mail header injection via References/In-Reply-To/Message-ID/From
-      parameters.
-    + Fix object injection primitive in rcube_session::unserialize() via
-      =E2=80=9C!=E2=80=9D-prefixed session keys.
-    + Fix ImageMagick resource limits bypass by GD fallback during thumbna=
il
-      generation.
-    + Fix CSS scoping bypass in HTML messages using at-rules.
-    + Fix bug where deprecated action aliases bypassed `disabled_actions`
-      setting.
-    + Fix IMAP command injection via CRLF in `_flag` parameter of mail/mark
-      action.
-    + Fix CSRF validation bypass in the mark-as-junk action.
-    + Fix XSS issue in handling of password driver error responses.
-    + Fix mail header injection via subject of a message forwarded as
-      attachment.
-    + Fix mail header injection via media type in an inline image data URI.
-    + Fix bug where Password Modoboa driver could change password for anot=
her
-      account.
-    + Fix unsafe use of a login name in SquirrelMail import file path.
+    + Fix CVE-2026-114732: bug where an alias login wasn't qualified by IM=
AP host.
+    + Fix CVE-2026-114731: Unbounded CSS proxy content processing.
+    + Fix CVE-2026-114730: SSRF filter (`is_local_url()`) bypass via NAT64
+      64:ff9b::/96.
+    + Fix CVE-2026-114729: Remote content blocking bypass via SVG SMIL `by`
+      attribute.
+    + Fix CVE-2026-114728: Remote content blocking bypass via CSS escapes =
in
+      FuncIRI attributes (again).
+    + Fix CVE-2026-114727: Passing potentially unsafe attachment content i=
nto
+      ImageMagick on image resize.
+    + Fix CVE-2026-114726: Mail header injection via the From display-name=
 in
+      the Bounce (resend) action.
+    + Fix CVE-2026-114725: Mail header injection via References/In-Reply-T=
o/
+      Message-ID/From parameters.
+    + Fix CVE-2026-114724: Object injection primitive in rcube_session::
+      unserialize() via =E2=80=9C!=E2=80=9D-prefixed session keys.
+    + Fix CVE-2026-114723: ImageMagick resource limits bypass by GD fallba=
ck
+      during thumbnail generation.
+    + Fix CVE-2026-114722: CSS scoping bypass in HTML messages using at-ru=
les.
+    + Fix CVE-2026-114721: Bug where deprecated action aliases bypassed
+      `disabled_actions` setting.
+    + Fix CVE-2026-114720: IMAP command injection via CRLF in `_flag`
+      parameter of mail/mark action.
+    + Fix CVE-2026-114719: CSRF validation bypass in the mark-as-junk acti=
on.
+    + Fix CVE-2026-114718: XSS issue in handling of password driver error
+      responses.
+    + Fix CVE-2026-114717: Mail header injection via subject of a message
+      forwarded as attachment.
+    + Fix CVE-2026-114716: Mail header injection via media type in an inli=
ne
+      image data URI.
+    + Fix CVE-2026-114715: Bug where Password Modoboa driver could change
+      password for another account.
+    + Fix CVE-2026-114714: Unsafe use of a login name in SquirrelMail impo=
rt
+      file path.
   * Refresh d/patches.
=20
  -- Guilhem Moulin <guilhem@debian.org>  Tue, 20 Oct 2026 07:00:29 +0200
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Avoid-dependency-on-new-pack=
age-mlocati-ip-lib.patch roundcube-1.6.21+dfsg/debian/patches/Avoid-depende=
ncy-on-new-package-mlocati-ip-lib.patch
--- roundcube-1.6.20+dfsg/debian/patches/Avoid-dependency-on-new-package-ml=
ocati-ip-lib.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/Avoid-dependency-on-new-package-ml=
ocati-ip-lib.patch	2026-11-15 19:45:19.000000000 +0100
@@ -11,9 +11,9 @@
 Forwarded: not-needed
 ---
  composer.json-dist                    |   3 +-
- program/lib/Roundcube/rcube_utils.php | 169 ++++++++++++++++++++++++++++-=
-----
- tests/Framework/Utils.php             |  85 +++++++++++++++++
- 3 files changed, 228 insertions(+), 29 deletions(-)
+ program/lib/Roundcube/rcube_utils.php | 217 ++++++++++++++++++++++++-----=
-----
+ tests/Framework/Utils.php             |  88 ++++++++++++++
+ 3 files changed, 242 insertions(+), 66 deletions(-)
=20
 diff --git a/composer.json-dist b/composer.json-dist
 index 1807004..ca3de26 100644
@@ -30,19 +30,20 @@
      "require-dev": {
          "phpunit/phpunit": "^9"
 diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube=
/rcube_utils.php
-index 270a14f..94f0fc4 100644
+index 936de2e..d5aa80d 100644
 --- a/program/lib/Roundcube/rcube_utils.php
 +++ b/program/lib/Roundcube/rcube_utils.php
-@@ -1,8 +1,5 @@
+@@ -1,9 +1,5 @@
  <?php
 =20
+-use IPLib\Address\AddressInterface;
 -use IPLib\Factory;
 -use IPLib\ParseStringFlag;
 -
  /*
   +-----------------------------------------------------------------------+
   | This file is part of the Roundcube Webmail client                     |
-@@ -422,6 +419,116 @@ class rcube_utils
+@@ -423,6 +419,116 @@ class rcube_utils
          return asciiwords($str, true, '_');
      }
 =20
@@ -159,7 +160,7 @@
      /**
       * Check if an URL point to a local network location.
       *
-@@ -434,11 +541,6 @@ class rcube_utils
+@@ -435,43 +541,60 @@ class rcube_utils
          $host =3D parse_url($url, \PHP_URL_HOST);
 =20
          if (is_string($host)) {
@@ -170,9 +171,8 @@
 -
              $host =3D trim($host, '[].');
 =20
-             if (preg_match('/([0-9a-f.-]+)\.(nip|sslip)\.io$/i', $host, $=
matches)) {
-@@ -452,29 +554,42 @@ class rcube_utils
-                 }
+             if ($xip =3D self::xip_ip($host)) {
+                 $host =3D $xip;
              }
 =20
 +            if (strpos($host, ':') !=3D=3D false && ($n =3D strpos($host,=
 '%')) > 0) {
@@ -209,12 +209,19 @@
 +                    ['100.64.0.0',  '100.127.255.255'], // RFC6598: Share=
d Address Space (carrier-grade NAT)
                  ];
 +                if (defined('AF_INET6')) {
++                    $nets4 =3D $nets;
 +                    /* IPv4-compatible and IPv4-mapped IPv6 addresses (RF=
C4291 2.5.5) */
 +                    foreach (['::', '::ffff:'] as $prefix) {
-+                        foreach ($nets as [$range_start, $range_end]) {
++                        foreach ($nets4 as [$range_start, $range_end]) {
 +                            $nets[] =3D [ $prefix . $range_start, $prefix=
 . $range_end ];
 +                        }
 +                    }
++                    /* 6to4 (2002::/16) */
++                    foreach ($nets4 as [$range_start, $range_end]) {
++                        $range_start =3D "\x20\x02" . @inet_pton($range_s=
tart) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
++                        $range_end   =3D "\x20\x02" . @inet_pton($range_e=
nd)   . "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" ;
++                        $nets[] =3D [ @inet_ntop($range_start), @inet_nto=
p($range_end) ];
++                    }
 +                    $nets[] =3D ['::1',    '::1'];
 +                    $nets[] =3D ['::',    '::'];
 +                    $nets[] =3D ['fc00::', 'fdff:ffff:ffff:ffff:ffff:ffff=
:ffff:ffff'];
@@ -223,21 +230,77 @@
 +                    $nets[] =3D ['64:ff9b:1::', '64:ff9b:1:ffff:ffff:ffff=
:ffff:ffff']; // (RFC 8215 local-use NAT64)
 +                }
 =20
--                foreach ($nets as $net) {
--                    $range =3D Factory::parseRangeString($net);
--                    if ($range->contains($address)) {
+-                // Extract embedded IPv4 address
+-                if ($address instanceof \IPLib\Address\IPv6 && ($embedded=
 =3D $address->toIPv4())) {
+-                    $address =3D $embedded;
 +                foreach ($nets as [$range_start, $range_end]) {
 +                    $range_start =3D @inet_pton($range_start);
 +                    $range_end   =3D @inet_pton($range_end);
 +                    if (strcmp($range_start, $address) <=3D 0 && strcmp($=
range_end, $address) >=3D 0) {
-                         return true;
-                     }
++                        return true;
++                    }
                  }
+=20
+-                return self::is_ip_in_range($address, $nets);
++                return false;
+             }
+=20
+             // FIXME: Should we accept any non-fqdn hostnames?
+@@ -482,38 +605,6 @@ class rcube_utils
+         return false;
+     }
+=20
+-    /**
+-     * Check if an IP address matches an entry in the given whitelist.
+-     * Entries may be exact IP addresses or CIDR ranges (e.g. '10.0.0.0/8=
', 'fc00::/7').
+-     *
+-     * @param string|AddressInterface $ip        IP address to check
+-     * @param array                   $whitelist List of IPs or CIDR rang=
es
+-     */
+-    private static function is_ip_in_range($ip, array $whitelist): bool
+-    {
+-        if (empty($whitelist)) {
+-            return false;
+-        }
+-
+-        if ($ip instanceof AddressInterface) {
+-            $address =3D $ip;
+-            $ip =3D (string) $ip;
+-        } else {
+-            $address =3D Factory::parseAddressString($ip);
+-        }
+-
+-        foreach ($whitelist as $entry) {
+-            if ($entry =3D=3D=3D $ip) {
+-                return true;
+-            }
+-            if ($address && ($range =3D Factory::parseRangeString($entry)=
) && $range->contains($address)) {
+-                return true;
+-            }
+-        }
+-
+-        return false;
+-    }
+-
+     /**
+      * Extract IP address from a nip.io/sslip.io-style fqdn
+      *
+@@ -564,9 +655,7 @@ class rcube_utils
+         // IPv6 hex
+         $ipv6REHex =3D '/(^|\.)([[:xdigit:]]{32})($|\.)/';
+         if (preg_match($ipv6REHex, $host, $m)) {
+-            $words =3D str_split($m[2], 2);
+-            $words =3D array_map('hex2bin', $words);
+-            return (string) \IPLib\Address\IPv6::fromWords($words);
++            return implode(':', str_split($m[2], 4));
+         }
+=20
+         return null;
 diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
-index 4325b0b..5769772 100644
+index d3208a0..ba7cda6 100644
 --- a/tests/Framework/Utils.php
 +++ b/tests/Framework/Utils.php
-@@ -588,6 +588,86 @@ class Framework_Utils extends TestCase
+@@ -590,6 +590,86 @@ class Framework_Utils extends TestCase
          }
      }
 =20
@@ -324,7 +387,7 @@
      /**
       * Test is_local_url()
       *
-@@ -607,12 +687,17 @@ class Framework_Utils extends TestCase
+@@ -609,12 +689,17 @@ class Framework_Utils extends TestCase
          return [
              // Local hosts
              ['https://127.0.0.1', true],
@@ -342,3 +405,20 @@
              ['//127.0.0.1', true],
              ['http://localhost', true],
              ['http://localhost.localdomain', true],
+@@ -637,6 +722,8 @@ class Framework_Utils extends TestCase
+             ['http://x.0a000001.nip.io/', true],
+             ['http://x.c0a80101.nip.io/', true],
+             ['http://x.a9fea9fe.nip.io/', true],
++            ['http://x.00000000000000000000000000000001.nip.io/', true],
++            ['http://x.fe80123456789abcdef0123456789abc.nip.io/', true],
+             ['http://x.0-0-0-0-0-0-0-0-1.sslip.io/', true],
+             ['http://0-0-0-0-0-0-0-0-1.sslip.io/', true],
+             ['http://metadata.google.internal', true],
+@@ -662,6 +749,7 @@ class Framework_Utils extends TestCase
+             ['http://20.0.0.1.nip.io.', false],
+             ['http://www-20-0-0-1.nip.io', false],
+             ['http://40b01609.nip.io/', false],
++            ['http://x.fed0123456789abcdef0123456789abc.nip.io/', false],
+         ];
+     }
+=20
diff -Nru roundcube-1.6.20+dfsg/debian/patches/default-charset-utf8.patch r=
oundcube-1.6.21+dfsg/debian/patches/default-charset-utf8.patch
--- roundcube-1.6.20+dfsg/debian/patches/default-charset-utf8.patch	2026-10=
-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/default-charset-utf8.patch	2026-11=
-15 19:45:19.000000000 +0100
@@ -8,10 +8,10 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
=20
 diff --git a/config/defaults.inc.php b/config/defaults.inc.php
-index 6e80aa9..36a5731 100644
+index 12d7287..05e4337 100644
 --- a/config/defaults.inc.php
 +++ b/config/defaults.inc.php
-@@ -1267,7 +1267,7 @@ $config['collected_senders'] =3D true;
+@@ -1269,7 +1269,7 @@ $config['collected_senders'] =3D true;
  // ----------------------------------
 =20
  // Use this charset as fallback for message decoding
diff -Nru roundcube-1.6.20+dfsg/debian/patches/dont-force-set-session.gc_pr=
obability=3D1.patch roundcube-1.6.21+dfsg/debian/patches/dont-force-set-ses=
sion.gc_probability=3D1.patch
--- roundcube-1.6.20+dfsg/debian/patches/dont-force-set-session.gc_probabil=
ity=3D1.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/dont-force-set-session.gc_probabil=
ity=3D1.patch	2026-11-15 19:45:19.000000000 +0100
@@ -18,7 +18,7 @@
  1 file changed, 7 deletions(-)
=20
 diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube=
=2Ephp
-index fd278b1..27ac7d3 100644
+index 85877ac..a0736c3 100644
 --- a/program/lib/Roundcube/rcube.php
 +++ b/program/lib/Roundcube/rcube.php
 @@ -450,7 +450,6 @@ class rcube
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.pa=
tch roundcube-1.6.21+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch
--- roundcube-1.6.20+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch	20=
26-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch	20=
26-11-15 19:45:19.000000000 +0100
@@ -41,7 +41,7 @@
  plugins/managesieve/tests/Forward.php              |  16 +-
  plugins/managesieve/tests/Managesieve.php          |  14 +-
  plugins/managesieve/tests/Script.php               |  17 +-
- plugins/managesieve/tests/Vacation.php             |  21 ++-
+ plugins/managesieve/tests/Vacation.php             |  21 +-
  plugins/markasjunk/tests/Markasjunk.php            |  22 ++-
  plugins/new_user_dialog/tests/NewUserDialog.php    |  14 +-
  .../new_user_identity/tests/NewUserIdentity.php    |  14 +-
@@ -76,9 +76,9 @@
  tests/Actions/Contacts/Qrcode.php                  |  17 +-
  tests/Actions/Contacts/Save.php                    |  27 +--
  tests/Actions/Contacts/Search.php                  |  18 +-
- tests/Actions/Contacts/SearchCreate.php            |  21 ++-
- tests/Actions/Contacts/SearchDelete.php            |  21 ++-
- tests/Actions/Contacts/Show.php                    |  21 ++-
+ tests/Actions/Contacts/SearchCreate.php            |  21 +-
+ tests/Actions/Contacts/SearchDelete.php            |  21 +-
+ tests/Actions/Contacts/Show.php                    |  21 +-
  tests/Actions/Contacts/Undo.php                    |  15 +-
  tests/Actions/Contacts/UploadPhoto.php             |  19 +-
  tests/Actions/Login/Oauth.php                      |  14 +-
@@ -93,13 +93,13 @@
  tests/Actions/Mail/Compose.php                     |  22 ++-
  tests/Actions/Mail/Copy.php                        |  25 +--
  tests/Actions/Mail/Delete.php                      |  10 +-
- tests/Actions/Mail/FolderExpunge.php               |  33 ++--
- tests/Actions/Mail/FolderPurge.php                 |  10 +-
+ tests/Actions/Mail/FolderExpunge.php               |  37 ++--
+ tests/Actions/Mail/FolderPurge.php                 |  11 +-
  tests/Actions/Mail/Get.php                         |  10 +-
  tests/Actions/Mail/Getunread.php                   |  10 +-
  tests/Actions/Mail/GroupExpand.php                 |  10 +-
  tests/Actions/Mail/Headers.php                     |  10 +-
- tests/Actions/Mail/Index.php                       | 106 ++++++-----
+ tests/Actions/Mail/Index.php                       | 106 +++++-----
  tests/Actions/Mail/List.php                        |  10 +-
  tests/Actions/Mail/ListContacts.php                |  10 +-
  tests/Actions/Mail/Mark.php                        |  10 +-
@@ -149,7 +149,7 @@
  tests/ExitException.php                            |   6 +-
  tests/Framework/Addressbook.php                    |  40 ++--
  tests/Framework/Addresses.php                      |  16 +-
- tests/Framework/BaseReplacer.php                   |  21 ++-
+ tests/Framework/BaseReplacer.php                   |  21 +-
  tests/Framework/Bootstrap.php                      |   8 +-
  tests/Framework/Browser.php                        |  34 ++--
  tests/Framework/Cache.php                          |  18 +-
@@ -201,9 +201,9 @@
  tests/Framework/Text2Html.php                      |  22 ++-
  tests/Framework/TnefDecoder.php                    |  18 +-
  tests/Framework/User.php                           |  30 +--
- tests/Framework/Utils.php                          | 209 +++++++++++-----=
-----
+ tests/Framework/Utils.php                          | 213 +++++++++++-----=
-----
  tests/Framework/VCard.php                          |  40 ++--
- tests/Framework/Washtml.php                        |  85 +++++----
+ tests/Framework/Washtml.php                        |  85 ++++----
  tests/OutputHtmlMock.php                           |   6 +-
  tests/OutputJsonMock.php                           |   6 +-
  tests/Rcmail/Action.php                            |  40 ++--
@@ -221,8 +221,8 @@
  tests/Rcmail/Utils.php                             |  22 ++-
  tests/StderrMock.php                               |  15 +-
  tests/StorageMock.php                              |   4 +-
- tests/bootstrap.php                                |  21 ++-
- 213 files changed, 2514 insertions(+), 1803 deletions(-)
+ tests/bootstrap.php                                |  21 +-
+ 213 files changed, 2519 insertions(+), 1807 deletions(-)
=20
 diff --git a/plugins/acl/tests/Acl.php b/plugins/acl/tests/Acl.php
 index 94e0bd4..0ad987f 100644
@@ -3962,7 +3962,7 @@
      }
  }
 diff --git a/tests/Actions/Mail/FolderExpunge.php b/tests/Actions/Mail/Fol=
derExpunge.php
-index 5ece885..5961527 100644
+index 01e7187..56f7194 100644
 --- a/tests/Actions/Mail/FolderExpunge.php
 +++ b/tests/Actions/Mail/FolderExpunge.php
 @@ -1,9 +1,12 @@
@@ -4061,16 +4061,28 @@
 =20
          $this->runAndAssert($action, OutputJsonMock::E_EXIT);
 =20
+@@ -111,8 +114,8 @@ class Actions_Mail_FolderExpunge extends ActionTestCase
+      */
+     public function test_run_empty_post()
+     {
+-        $action =3D new rcmail_action_mail_folder_expunge();
+-        $output =3D $this->initOutput(rcmail_action::MODE_AJAX, 'mail', '=
expunge');
++        $action =3D new \rcmail_action_mail_folder_expunge();
++        $output =3D $this->initOutput(\rcmail_action::MODE_AJAX, 'mail', =
'expunge');
+=20
+         $this->assertTrue($action->checks());
+=20
 diff --git a/tests/Actions/Mail/FolderPurge.php b/tests/Actions/Mail/Folde=
rPurge.php
-index a0785e0..17832ea 100644
+index bcefb64..d2bf9e3 100644
 --- a/tests/Actions/Mail/FolderPurge.php
 +++ b/tests/Actions/Mail/FolderPurge.php
-@@ -1,9 +1,11 @@
+@@ -1,9 +1,12 @@
  <?php
 =20
 +namespace Roundcube\Tests\Actions\Mail;
 +
 +use Roundcube\Tests\ActionTestCase;
++use Roundcube\Tests\OutputJsonMock;
 +
  /**
   * Test class to test rcmail_action_mail_folder_purge
@@ -4079,17 +4091,17 @@
   */
  class Actions_Mail_FolderPurge extends ActionTestCase
  {
-@@ -12,8 +14,8 @@ class Actions_Mail_FolderPurge extends ActionTestCase
+@@ -12,8 +15,8 @@ class Actions_Mail_FolderPurge extends ActionTestCase
       */
-     function test_class()
+     public function test_run_empty_post()
      {
--        $object =3D new rcmail_action_mail_folder_purge;
-+        $object =3D new \rcmail_action_mail_folder_purge();
+-        $action =3D new rcmail_action_mail_folder_purge();
+-        $output =3D $this->initOutput(rcmail_action::MODE_AJAX, 'mail', '=
purge');
++        $action =3D new \rcmail_action_mail_folder_purge();
++        $output =3D $this->initOutput(\rcmail_action::MODE_AJAX, 'mail', =
'purge');
+=20
+         $this->assertTrue($action->checks());
 =20
--        $this->assertInstanceOf('rcmail_action', $object);
-+        $this->assertInstanceOf(\rcmail_action::class, $object);
-     }
- }
 diff --git a/tests/Actions/Mail/Get.php b/tests/Actions/Mail/Get.php
 index d32bd75..f0e9060 100644
 --- a/tests/Actions/Mail/Get.php
@@ -9341,7 +9353,7 @@
          $this->assertSame(true, $object->is_empty(), "Object is empty");
          $this->assertSame(false, $object->is_error(), "Object is error");
 diff --git a/tests/Framework/Session.php b/tests/Framework/Session.php
-index 6df2d4e..f1392f4 100644
+index 4d4003e..2aecb80 100644
 --- a/tests/Framework/Session.php
 +++ b/tests/Framework/Session.php
 @@ -1,26 +1,28 @@
@@ -10052,7 +10064,7 @@
          $idents =3D $user->list_identities();
 =20
 diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
-index 08d0880..4325b0b 100644
+index 6285052..d3208a0 100644
 --- a/tests/Framework/Utils.php
 +++ b/tests/Framework/Utils.php
 @@ -1,11 +1,15 @@
@@ -10387,11 +10399,13 @@
      }
 =20
      /**
-@@ -547,18 +557,18 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -547,20 +557,20 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       */
      function test_is_simple_string()
      {
 -        $this->assertTrue(rcube_utils::is_simple_string('some-thing.123_'=
));
+-        $this->assertTrue(rcube_utils::is_simple_string('AAAA.BBBB-cccc_d=
dd'));
+-        $this->assertFalse(rcube_utils::is_simple_string("test\n"));
 -        $this->assertFalse(rcube_utils::is_simple_string(''));
 -        $this->assertFalse(rcube_utils::is_simple_string(' '));
 -        $this->assertFalse(rcube_utils::is_simple_string('some=E2=80=93th=
ing'));
@@ -10401,9 +10415,11 @@
 -        $this->assertFalse(rcube_utils::is_simple_string('%20'));
 -        $this->assertFalse(rcube_utils::is_simple_string('\0000'));
 -        $this->assertFalse(rcube_utils::is_simple_string(1));
--        $this->assertFalse(rcube_utils::is_simple_string(new stdClass()));
+-        $this->assertFalse(rcube_utils::is_simple_string(new \stdClass())=
);
 -        $this->assertFalse(rcube_utils::is_simple_string(null));
 +        $this->assertTrue(\rcube_utils::is_simple_string('some-thing.123_=
'));
++        $this->assertTrue(\rcube_utils::is_simple_string('AAAA.BBBB-cccc_=
ddd'));
++        $this->assertFalse(\rcube_utils::is_simple_string("test\n"));
 +        $this->assertFalse(\rcube_utils::is_simple_string(''));
 +        $this->assertFalse(\rcube_utils::is_simple_string(' '));
 +        $this->assertFalse(\rcube_utils::is_simple_string('some=E2=80=93t=
hing'));
@@ -10418,7 +10434,7 @@
      }
 =20
      /**
-@@ -573,7 +583,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -575,7 +585,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $v) {
@@ -10427,7 +10443,7 @@
              $this->assertSame($v[2], $result);
          }
      }
-@@ -668,7 +678,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -680,7 +690,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $datetime =3D> $ts) {
@@ -10436,7 +10452,7 @@
              $this->assertSame($ts, $result, "Error parsing date: $datetim=
e");
          }
      }
-@@ -695,7 +705,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -707,7 +717,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $datetime =3D> $ts) {
@@ -10445,7 +10461,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d') : f=
alse, "Error parsing date: $datetime");
          }
 =20
-@@ -705,7 +715,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -717,7 +727,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $datetime =3D> $ts) {
@@ -10454,7 +10470,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s=
') : false, "Error parsing date: $datetime");
          }
 =20
-@@ -714,7 +724,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -726,7 +736,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $datetime =3D> $ts) {
@@ -10463,7 +10479,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s=
 O') : false, "Error parsing date: $datetime");
          }
      }
-@@ -724,17 +734,17 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -736,17 +746,17 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       */
      function test_anytodatetime_timezone()
      {
@@ -10484,7 +10500,7 @@
              if ($result) $result->setTimezone($tz);  // move to target ti=
mezone for comparison
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i')=
 : false, "Error parsing date: $datetime");
          }
-@@ -753,7 +763,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -765,7 +775,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $data) {
@@ -10493,7 +10509,7 @@
              $this->assertSame($data[2], $result, "Error formatting date: =
" . $data[0]);
          }
      }
-@@ -772,7 +782,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -784,7 +794,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $input =3D> $output) {
@@ -10502,7 +10518,7 @@
              $this->assertSame($output, $result);
          }
      }
-@@ -797,7 +807,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -809,7 +819,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $input =3D> $output) {
@@ -10511,7 +10527,7 @@
              $this->assertSame($output, $result, "Error normalizing '$inpu=
t'");
          }
      }
-@@ -820,7 +830,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -832,7 +842,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          ];
 =20
          foreach ($test as $idx =3D> $params) {
@@ -10520,7 +10536,7 @@
              $this->assertSame($params[2], $result, "words_match() at inde=
x $idx");
          }
      }
-@@ -846,7 +856,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
+@@ -858,7 +868,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCa=
se
          }
 =20
          foreach ($test as $input =3D> $output) {
@@ -10529,7 +10545,7 @@
              $this->assertSame($output, $result);
          }
      }
-@@ -856,17 +866,17 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -868,17 +878,17 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       */
      function test_random_bytes()
      {
@@ -10553,7 +10569,7 @@
      {
 =20
          /*
-@@ -903,9 +913,10 @@ class Framework_Utils extends PHPUnit\Framework\TestC=
ase
+@@ -915,9 +925,10 @@ class Framework_Utils extends PHPUnit\Framework\TestC=
ase
       * @param string $encoded Encoded email address
       * @dataProvider data_idn_convert
       */
@@ -10565,7 +10581,7 @@
      }
 =20
      /**
-@@ -915,9 +926,10 @@ class Framework_Utils extends PHPUnit\Framework\TestC=
ase
+@@ -927,9 +938,10 @@ class Framework_Utils extends PHPUnit\Framework\TestC=
ase
       * @param string $encoded Encoded email address
       * @dataProvider data_idn_convert
       */
@@ -10577,7 +10593,7 @@
      }
 =20
      /**
-@@ -925,14 +937,14 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -937,14 +949,14 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       */
      function test_idn_to_ascii_special()
      {
@@ -10595,7 +10611,7 @@
      {
          return [
              ['%z', 'hostname', 'hostname'],
-@@ -947,15 +959,16 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -959,15 +971,16 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       *
       * @dataProvider data_parse_host
       */
@@ -10614,7 +10630,7 @@
      {
          return [
              [['hostname', null, null], ['hostname', null, null]],
-@@ -978,15 +991,16 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -990,15 +1003,16 @@ class Framework_Utils extends PHPUnit\Framework\Tes=
tCase
       *
       * @dataProvider data_parse_host_uri
       */
@@ -10633,7 +10649,7 @@
          return [
              ['both',    'Fwd: Re: Test subject both', 'Test subject both'=
],
              ['both',    'Re: Fwd: Test subject both', 'Test subject both'=
],
-@@ -1004,8 +1018,9 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
+@@ -1016,8 +1030,9 @@ class Framework_Utils extends PHPUnit\Framework\Test=
Case
       *=20
       * @dataProvider data_remove_subject_prefix
       */
@@ -10644,7 +10660,7 @@
      }
 =20
      /**
-@@ -1013,13 +1028,13 @@ class Framework_Utils extends PHPUnit\Framework\Te=
stCase
+@@ -1025,13 +1040,13 @@ class Framework_Utils extends PHPUnit\Framework\Te=
stCase
       */
      function test_server_name()
      {
@@ -10661,7 +10677,7 @@
      }
 =20
      /**
-@@ -1029,31 +1044,31 @@ class Framework_Utils extends PHPUnit\Framework\Te=
stCase
+@@ -1041,31 +1056,31 @@ class Framework_Utils extends PHPUnit\Framework\Te=
stCase
      {
          $_SERVER['test'] =3D 'test.com';
 =20
@@ -11876,7 +11892,7 @@
          $commands->setAccessible(true);
 =20
 diff --git a/tests/Rcmail/Rcmail.php b/tests/Rcmail/Rcmail.php
-index 4a16b38..c655336 100644
+index 889a785..60baf9c 100644
 --- a/tests/Rcmail/Rcmail.php
 +++ b/tests/Rcmail/Rcmail.php
 @@ -1,9 +1,14 @@
@@ -11956,9 +11972,9 @@
      {
 -        $rcmail =3D rcmail::get_instance();
 +        $rcmail =3D \rcmail::get_instance();
+         $rcmail->config->set('trusted_host_patterns', []);
 =20
          $this->assertEquals(
-             '/sub/?_task=3Dcli&_action=3Dtest',
 @@ -210,9 +215,9 @@ class Rcmail_Rcmail extends ActionTestCase
      {
          self::initDB('contacts');
@@ -12050,7 +12066,7 @@
          $result =3D $mail->headers();
 =20
 diff --git a/tests/Rcmail/Sendmail.php b/tests/Rcmail/Sendmail.php
-index a29fcf2..7b61e95 100644
+index 31e1c2e..b921ab5 100644
 --- a/tests/Rcmail/Sendmail.php
 +++ b/tests/Rcmail/Sendmail.php
 @@ -1,11 +1,14 @@
@@ -12080,7 +12096,7 @@
          $headers =3D $sendmail->headers_input();
 =20
          $this->assertSame('Test1 Test2 Test3', $headers['Subject']);
-@@ -74,10 +77,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -110,10 +113,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
          self::initDB('identities');
          self::initUser();
 =20
@@ -12093,7 +12109,7 @@
 =20
          $result =3D $sendmail->get_identity($identity['identity_id']);
 =20
-@@ -115,7 +118,7 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -151,7 +154,7 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      /**
       * Data for test_convert()
       */
@@ -12102,7 +12118,7 @@
      {
          return [
              [
-@@ -174,9 +177,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -210,9 +213,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      /**
       * @dataProvider data_email_input_format
       */
@@ -12114,7 +12130,7 @@
          $sendmail->options['charset'] =3D $charset;
 =20
          $this->assertEquals($output, $sendmail->email_input_format($input=
));
-@@ -196,24 +200,24 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -232,24 +236,24 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      function test_draftinfo_encode_and_decode()
      {
          $input  =3D ['test' =3D> 'test'];
@@ -12147,7 +12163,7 @@
      }
 =20
      /**
-@@ -221,14 +225,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -257,14 +261,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_headers_output()
      {
@@ -12165,7 +12181,7 @@
          $sendmail->options['charset'] =3D RCUBE_CHARSET;
          $sendmail->options['message'] =3D $message;
 =20
-@@ -247,10 +251,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -283,10 +287,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_reply_subject()
      {
@@ -12180,7 +12196,7 @@
      }
 =20
      /**
-@@ -258,9 +262,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -294,9 +298,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_compose_subject()
      {
@@ -12192,7 +12208,7 @@
 =20
          $_POST =3D ['_subject' =3D> 'test'];
 =20
-@@ -274,9 +278,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -310,9 +314,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_mdn_checkbox()
      {
@@ -12204,7 +12220,7 @@
 =20
          $result =3D $sendmail->mdn_checkbox([]);
 =20
-@@ -288,9 +292,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -324,9 +328,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_dsn_checkbox()
      {
@@ -12216,7 +12232,7 @@
 =20
          $result =3D $sendmail->dsn_checkbox([]);
 =20
-@@ -302,9 +306,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -338,9 +342,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_priority_selector()
      {
@@ -12228,7 +12244,7 @@
 =20
          $result =3D $sendmail->priority_selector([]);
 =20
-@@ -324,14 +328,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -360,14 +364,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_identity_select()
      {
@@ -12246,7 +12262,7 @@
          $this->assertSame(null, $result);
 =20
          $identities =3D [
-@@ -367,26 +371,26 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -403,26 +407,26 @@ class Rcmail_RcmailSendmail extends ActionTestCase
          $message->headers->to =3D 'ident2@domain.tld';
          $message->headers->from =3D 'from@other.domain.tld';
 =20
@@ -12277,7 +12293,7 @@
          $this->assertSame($identities[2], $result);
      }
 =20
-@@ -413,15 +417,15 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -449,15 +453,15 @@ class Rcmail_RcmailSendmail extends ActionTestCase
              ],
          ];
 =20
@@ -12297,7 +12313,7 @@
 =20
          $this->assertSame($identities[1], $res);
      }
-@@ -454,23 +458,23 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -490,23 +494,23 @@ class Rcmail_RcmailSendmail extends ActionTestCase
              ],
          ];
 =20
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-pa=
rsing-on-32-bits-platforms.patch roundcube-1.6.21+dfsg/debian/patches/Fix-I=
Pv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch
--- roundcube-1.6.20+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-=
on-32-bits-platforms.patch	1970-01-01 01:00:00.000000000 +0100
+++ roundcube-1.6.21+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-=
on-32-bits-platforms.patch	2026-11-15 19:45:19.000000000 +0100
@@ -0,0 +1,35 @@
+From: Guilhem Moulin <guilhem@debian.org>
+Date: Sat, 14 Nov 2026 18:11:34 +0100
+Subject: Fix IPv4 hex nip.io-style parsing on 32-bits platforms.
+
+long2ip() fails on 32-bits platforms when the the input long exceeds
+2=C2=B3=C2=B9-1, for instance for 0xC0A80001 (the hexadecimal representati=
on of
+IPv4 address 192.168.0.1).
+
+    PHP Fatal error:  Uncaught TypeError: long2ip(): Argument #1 ($ip) mus=
t be of type int, string given
+
+Forwarded: msgid=3D<avd1UFgGIccNlYYd@fripost.org>
+---
+ program/lib/Roundcube/rcube_utils.php | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube=
/rcube_utils.php
+index d5aa80d..27329a5 100644
+--- a/program/lib/Roundcube/rcube_utils.php
++++ b/program/lib/Roundcube/rcube_utils.php
+@@ -631,7 +631,14 @@ class rcube_utils
+         // IPv4 hex
+         $ipv4REHex =3D '/(^|[.-])([[:xdigit:]]{8})($|[.-])/';
+         if (preg_match($ipv4REHex, $host, $m)) {
+-            return long2ip(base_convert($m[2], 16, 10));
++            $hi =3D hexdec(substr($m[2], 0, -4));
++            $li =3D hexdec(substr($m[2], -4));
++            $address =3D "\x00\x00\x00\x00";
++            $address[0] =3D chr( intdiv($hi, 1 << 8) );
++            $address[1] =3D chr( $hi % (1 << 8) );
++            $address[2] =3D chr( intdiv($li, 1 << 8) );
++            $address[3] =3D chr( $li % (1 << 8) );
++            return @inet_ntop($address);
+         }
+=20
+         // IPv6 dash-separated
diff -Nru roundcube-1.6.20+dfsg/debian/patches/series roundcube-1.6.21+dfsg=
/debian/patches/series
--- roundcube-1.6.20+dfsg/debian/patches/series	2026-10-20 07:00:29.0000000=
00 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/series	2026-11-15 19:45:19.0000000=
00 +0100
@@ -21,3 +21,4 @@
 Fix-FTBFS-with-phpunit-11.patch
 Fix-flaky-test.patch
 Avoid-dependency-on-new-package-mlocati-ip-lib.patch
+Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch
diff -Nru roundcube-1.6.20+dfsg/debian/patches/use-enchant.patch roundcube-=
1.6.21+dfsg/debian/patches/use-enchant.patch
--- roundcube-1.6.20+dfsg/debian/patches/use-enchant.patch	2026-10-20 07:00=
:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/use-enchant.patch	2026-11-15 19:45=
:19.000000000 +0100
@@ -10,10 +10,10 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
=20
 diff --git a/config/defaults.inc.php b/config/defaults.inc.php
-index 285a62c..6e80aa9 100644
+index 111ab15..12d7287 100644
 --- a/config/defaults.inc.php
 +++ b/config/defaults.inc.php
-@@ -948,7 +948,8 @@ $config['spellcheck_dictionary'] =3D false;
+@@ -950,7 +950,8 @@ $config['spellcheck_dictionary'] =3D false;
  // Since Google shut down their public spell checking service, the defaul=
t settings
  // connect to https://spell.roundcube.net which is a hosted service provi=
ded by Roundcube.
  // You can connect to any other googie-compliant service by setting 'spel=
lcheck_uri' accordingly.
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/Changelog roundcube-1.6=
=2E21+dfsg/plugins/managesieve/Changelog
--- roundcube-1.6.20+dfsg/plugins/managesieve/Changelog	2026-10-19 08:49:43=
=2E000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/Changelog	2026-11-09 12:53:01=
=2E000000000 +0100
@@ -8,6 +8,9 @@
 - Fix infinite loop when parsing a malformed script (#9562)
 - Fix current script state after initial scripts creation in managesieve_k=
olab_master mode
 - Fix match-type selector (remove unsupported options) in delete header ac=
tion (#9610)
+- Fix bug where some managesieve destructive actions could have been trigg=
ered cross-site via GET
+- Fix Sieve script injection via a rule operator
+- Fix Sieve script injection via set/include modifiers
=20
 * version 9.4 [2021-06-06]
 -----------------------------------------------------------
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sie=
ve_engine.php roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube=
_sieve_engine.php
--- roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_eng=
ine.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_eng=
ine.php	2026-11-09 12:53:01.000000000 +0100
@@ -279,7 +279,7 @@
=20
         // Handle user requests
         if ($action =3D rcube_utils::get_input_string('_act', rcube_utils:=
:INPUT_GPC)) {
-            $fid =3D (int) rcube_utils::get_input_value('_fid', rcube_util=
s::INPUT_POST);
+            $fid =3D rcube_utils::get_input_string('_fid', rcube_utils::IN=
PUT_POST);
=20
             if ($action =3D=3D 'delete' && !$error) {
                 if (!in_array('delete_filter', $this->disabled_actions)) {
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sie=
ve_script.php roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube=
_sieve_script.php
--- roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_scr=
ipt.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_scr=
ipt.php	2026-11-09 12:53:01.000000000 +0100
@@ -22,7 +22,10 @@
=20
 class rcube_sieve_script
 {
-    public $content =3D [];      // script rules array
+    public const SET_OPTIONS =3D ['lower', 'upper', 'lowerfirst', 'upperfi=
rst', 'quotewildcard', 'length', 'encodeurl'];
+    public const INCLUDE_OPTIONS =3D ['once', 'optional', 'global', 'perso=
nal'];
+
+    public $content =3D []; // script rules array
=20
     private $vars      =3D [];   // "global" variables
     private $prefix    =3D '';   // script header (comments)
@@ -480,19 +483,13 @@
=20
                     case 'include':
                         array_push($exts, 'include');
-                        $action_script .=3D 'include ';
-                        foreach (array_diff(array_keys($action), ['target'=
, 'type']) as $opt) {
-                            $action_script .=3D ":$opt ";
-                        }
+                        $action_script .=3D 'include ' . $this->bool_optio=
ns($action, self::INCLUDE_OPTIONS);
                         $action_script .=3D self::escape_string($action['t=
arget']);
                         break;
=20
                     case 'set':
                         array_push($exts, 'variables');
-                        $action_script .=3D 'set ';
-                        foreach (array_diff(array_keys($action), ['name', =
'value', 'type']) as $opt) {
-                            $action_script .=3D ":$opt ";
-                        }
+                        $action_script .=3D 'set ' . $this->bool_options($=
action, self::SET_OPTIONS);
                         $action_script .=3D self::escape_string($action['n=
ame']) . ' ' . self::escape_string($action['value']);
                         break;
=20
@@ -969,7 +966,6 @@
                 $action  =3D ['type' =3D> $token, 'target' =3D> array_pop(=
$tokens)];
                 $args    =3D ['copy'];
                 $action +=3D $this->action_arguments($tokens, $args);
-
                 $result[] =3D $action;
                 break;
=20
@@ -978,7 +974,6 @@
                 $args    =3D ['mime'];
                 $vargs   =3D ['seconds', 'days', 'addresses', 'subject', '=
handle', 'from'];
                 $action +=3D $this->action_arguments($tokens, $args, $varg=
s);
-
                 $result[] =3D $action;
                 break;
=20
@@ -1007,16 +1002,14 @@
=20
             case 'include':
                 $action  =3D ['type' =3D> 'include', 'target' =3D> array_p=
op($tokens)];
-                $args    =3D ['once', 'optional', 'global', 'personal'];
-                $action +=3D $this->action_arguments($tokens, $args);
+                $action +=3D $this->action_arguments($tokens, self::INCLUD=
E_OPTIONS);
=20
                 $result[] =3D $action;
                 break;
=20
             case 'set':
                 $action  =3D ['type' =3D> 'set', 'value' =3D> array_pop($t=
okens), 'name' =3D> array_pop($tokens)];
-                $args    =3D ['lower', 'upper', 'lowerfirst', 'upperfirst'=
, 'quotewildcard', 'length'];
-                $action +=3D $this->action_arguments($tokens, $args);
+                $action +=3D $this->action_arguments($tokens, self::SET_OP=
TIONS);
=20
                 $result[] =3D $action;
                 break;
@@ -1139,7 +1132,7 @@
      */
     private function add_operator($test, &$out, &$exts)
     {
-        if (empty($test['type'])) {
+        if (empty($test['type']) || !preg_match('/^[a-z-]+$/', $test['type=
'])) {
             return;
         }
=20
@@ -1161,6 +1154,22 @@
     }
=20
     /**
+     * Create command options string
+     */
+    private function bool_options($options, $keys)
+    {
+        $out =3D '';
+
+        foreach ($keys as $opt) {
+            if (isset($options[$opt])) {
+                $out .=3D ":{$opt} ";
+            }
+        }
+
+        return $out;
+    }
+
+    /**
      * Extract test tokens
      */
     private function test_tokens(&$tokens)
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/folder_expunge.php rou=
ndcube-1.6.21+dfsg/program/actions/mail/folder_expunge.php
--- roundcube-1.6.20+dfsg/program/actions/mail/folder_expunge.php	2026-10-1=
9 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/folder_expunge.php	2026-11-0=
9 12:53:01.000000000 +0100
@@ -32,6 +32,11 @@
         $rcmail =3D rcmail::get_instance();
         $mbox   =3D rcube_utils::get_input_string('_mbox', rcube_utils::IN=
PUT_POST, true);
=20
+        if ($mbox =3D=3D=3D '') {
+            $rcmail->output->show_message('internalerror', 'error');
+            $rcmail->output->send();
+        }
+
         $success =3D $rcmail->storage->expunge_folder($mbox);
=20
         // reload message list if current mailbox
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/folder_purge.php round=
cube-1.6.21+dfsg/program/actions/mail/folder_purge.php
--- roundcube-1.6.20+dfsg/program/actions/mail/folder_purge.php	2026-10-19 =
08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/folder_purge.php	2026-11-09 =
12:53:01.000000000 +0100
@@ -29,11 +29,19 @@
      */
     public function run($args =3D [])
     {
-        $rcmail       =3D rcmail::get_instance();
-        $storage      =3D $rcmail->get_storage();
-        $delimiter    =3D $storage->get_hierarchy_delimiter();
-        $mbox         =3D rcube_utils::get_input_string('_mbox', rcube_uti=
ls::INPUT_POST, true);
-        $trash_mbox   =3D $rcmail->config->get('trash_mbox');
+        $rcmail =3D rcmail::get_instance();
+        $mbox =3D rcube_utils::get_input_string('_mbox', rcube_utils::INPU=
T_POST, true);
+
+        if ($mbox =3D=3D=3D '') {
+            $rcmail->output->show_message('internalerror', 'error');
+            $rcmail->output->send();
+        }
+
+        $storage =3D $rcmail->get_storage();
+        $delimiter =3D $storage->get_hierarchy_delimiter();
+        $trash_mbox =3D (string) $rcmail->config->get('trash_mbox');
+        $junk_mbox =3D (string) $rcmail->config->get('junk_mbox');
+        $delete_junk =3D $rcmail->config->get('delete_junk');
         $trash_regexp =3D '/^' . preg_quote($trash_mbox . $delimiter, '/')=
 . '/';
=20
         // we should only be purging trash (or their subfolders)
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/sendmdn.php roundcube-=
1.6.21+dfsg/program/actions/mail/sendmdn.php
--- roundcube-1.6.20+dfsg/program/actions/mail/sendmdn.php	2026-10-19 08:49=
:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/sendmdn.php	2026-11-09 12:53=
:01.000000000 +0100
@@ -121,7 +121,14 @@
                 $report .=3D "Reporting-UA: $agent\r\n";
             }
=20
-            $to   =3D rcube_mime::decode_mime_string($message->headers->to=
, $charset);
+            // For security reasons do not allow new-line characters in he=
aders
+            foreach ($headers as $idx =3D> $value) {
+                if (is_string($value)) {
+                    $headers[$idx] =3D trim(preg_replace('/[\r\n\t\s]+/', =
' ', $value));
+                }
+            }
+
+            $to =3D rcube_mime::decode_mime_string($message->headers->to, =
$charset);
             $date =3D $rcmail->format_date($message->headers->date, $rcmai=
l->config->get('date_long'));
             $body =3D $rcmail->gettext("yourmessage") . "\r\n\r\n" .
                 "\t" . $rcmail->gettext("to") . ": {$to}\r\n" .
diff -Nru roundcube-1.6.20+dfsg/program/actions/utils/spell_html.php roundc=
ube-1.6.21+dfsg/program/actions/utils/spell_html.php
--- roundcube-1.6.20+dfsg/program/actions/utils/spell_html.php	2026-10-19 0=
8:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/utils/spell_html.php	2026-11-09 1=
2:53:01.000000000 +0100
@@ -32,6 +32,14 @@
         $rcmail =3D rcmail::get_instance();
         $method =3D rcube_utils::get_input_string('method', rcube_utils::I=
NPUT_POST);
         $lang   =3D rcube_utils::get_input_string('lang', rcube_utils::INP=
UT_POST);
+
+        if (!rcube_utils::is_simple_string($lang)) {
+            rcube::raise_error('Spellcheck error: Invalid language code', =
true);
+
+            echo json_encode(['error' =3D> $rcmail->gettext('internalerror=
')]);
+            exit;
+        }
+
         $result =3D [];
=20
         $spellchecker =3D new rcube_spellchecker($lang);
diff -Nru roundcube-1.6.20+dfsg/program/actions/utils/spell.php roundcube-1=
=2E6.21+dfsg/program/actions/utils/spell.php
--- roundcube-1.6.20+dfsg/program/actions/utils/spell.php	2026-10-19 08:49:=
43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/utils/spell.php	2026-11-09 12:53:=
01.000000000 +0100
@@ -31,6 +31,13 @@
     {
         // read input
         $lang =3D rcube_utils::get_input_string('lang', rcube_utils::INPUT=
_GET);
+
+        if (!rcube_utils::is_simple_string($lang)) {
+            rcube::raise_error('Spellcheck error: Invalid language code', =
true);
+            http_response_code(500);
+            exit;
+        }
+
         $data =3D file_get_contents('php://input');
=20
         $learn_word =3D strpos($data, '<learnword>');
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_action.php roundcube=
-1.6.21+dfsg/program/include/rcmail_action.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_action.php	2026-10-19 08:4=
9:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_action.php	2026-11-09 12:5=
3:01.000000000 +0100
@@ -894,7 +894,7 @@
                 if ($uid =3D=3D '*') {
                     $result[$mbox] =3D $uid;
                 }
-                else if (preg_match('/^[0-9:.]+$/', $uid)) {
+                elseif (preg_match('/^[0-9:.]+\z/', $uid)) {
                     $result[$mbox][] =3D $uid;
                 }
             }
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_attachment_handler.p=
hp roundcube-1.6.21+dfsg/program/include/rcmail_attachment_handler.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_attachment_handler.php	202=
6-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_attachment_handler.php	202=
6-11-09 12:53:01.000000000 +0100
@@ -343,34 +343,24 @@
      */
     public static function check_storage_status()
     {
-        $error =3D rcmail::get_instance()->storage->get_error_code();
+        $rcmail =3D rcmail::get_instance();
+        $error =3D $rcmail->storage->get_error_code();
=20
         // Check if we have a connection error
         if ($error =3D=3D rcube_imap_generic::ERROR_BAD) {
             ob_end_clean();
=20
-            // Get action is often executed simultaneously.
-            // Some servers have MAXPERIP or other limits.
-            // To workaround this we'll wait for some time
-            // and try again (once).
-            // Note: Random sleep interval is used to minimize concurrency
-            // in getting message parts
+            // Get action is often executed simultaneously. Some servers h=
ave MAXPERIP or other limits.
+            // To workaround this we'll wait for some time and try again (=
once).
=20
-            if (!isset($_GET['_redirected'])) {
-                usleep(rand(10, 30) * 100000); // 1-3 sec.
-                header('Location: ' . $_SERVER['REQUEST_URI'] . '&_redirec=
ted=3D1');
-            }
-            else {
-                rcube::raise_error([
-                        'code' =3D> 500, 'file' =3D> __FILE__, 'line' =3D>=
 __LINE__,
-                        'message' =3D> 'Unable to get/display message part=
=2E IMAP connection error'
-                    ],
-                    true, true
-                );
+            if (!empty($_GET['_redirected'])) {
+                $rcmail->raise_error('Unable to get/display message part. =
IMAP connection error', true, true);
             }
=20
-            // Don't kill session, just quit (#1486995)
-            exit;
+            // Note: Random sleep interval is used to minimize concurrency=
 in getting message parts
+            usleep(rand(10, 30) * 100000); // 1-3 sec.
+            parse_str($_SERVER['QUERY_STRING'], $req);
+            $rcmail->output->redirect($req + ['_redirected' =3D> '1']);
         }
     }
=20
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail.php roundcube-1.6.21=
+dfsg/program/include/rcmail.php
--- roundcube-1.6.20+dfsg/program/include/rcmail.php	2026-10-19 08:49:43.00=
0000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail.php	2026-11-09 12:53:01.00=
0000000 +0100
@@ -244,8 +244,7 @@
         $task =3D $task =3D=3D 'addressbook' ? 'contacts' : $task;
=20
         // check access to disabled actions
-        $disabled_actions =3D (array) $this->config->get('disabled_actions=
');
-        if (in_array($task . '.' . ($this->action ?: 'index'), $disabled_a=
ctions)) {
+        if ($this->is_action_disabled($task, $this->action ?: 'index')) {
             self::raise_error(['code' =3D> 404, 'message' =3D> 'Action dis=
abled'], true, true);
         }
=20
@@ -256,7 +255,7 @@
=20
             // check access to disabled actions (resolve an alias)
             if ($this->action && !empty($task_handler::$aliases[$this->act=
ion])) {
-                if (in_array($task . '.' . $task_handler::$aliases[$this->=
action], $disabled_actions)) {
+                if ($this->is_action_disabled($task, $task_handler::$alias=
es[$this->action])) {
                     self::raise_error(['code' =3D> 404, 'message' =3D> 'Ac=
tion disabled'], true, true);
                 }
             }
@@ -318,6 +317,17 @@
     }
=20
     /**
+     * Check if the action is disabled
+     */
+    public function is_action_disabled(string $task, string $action)
+    {
+        $disabled_actions =3D (array) $this->config->get('disabled_actions=
');
+
+        return in_array($task . '.' . str_replace('_', '-', $action), $dis=
abled_actions)
+            || in_array($task . '.' . str_replace('-', '_', $action), $dis=
abled_actions);
+    }
+
+    /**
      * Return instance of the internal address book class
      *
      * @param string $id        Address book identifier. It accepts also s=
pecial values:
@@ -1010,6 +1020,9 @@
         }
         else if (empty($default_host)) {
             $host =3D rcube_utils::get_input_string('_host', rcube_utils::=
INPUT_POST);
+            if (!preg_match('~^((imap|imaps|tls|ssl)://)?[\w.-]+(:[0-9]+)?=
\z~', $host)) {
+                $host =3D null;
+            }
         }
         else {
             $host =3D rcube_utils::parse_host($default_host);
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_sendmail.php roundcu=
be-1.6.21+dfsg/program/include/rcmail_sendmail.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_sendmail.php	2026-10-19 08=
:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_sendmail.php	2026-11-09 12=
:53:01.000000000 +0100
@@ -588,25 +588,29 @@
     public function header_received()
     {
         if ($this->rcmail->config->get('http_received_header')) {
-            $nldlm       =3D "\r\n\t";
             $http_header =3D 'from ';
+            $host =3D rcube_utils::server_name('HTTP_HOST');
+
+            // Only trusted hosts
+            if (!$this->rcmail->config->get('trusted_host_patterns')) {
+                $host =3D 'localhost';
+            }
=20
             // FROM/VIA
-            if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-                $hosts        =3D explode(',', $_SERVER['HTTP_X_FORWARDED_=
FOR'], 2);
-                $http_header .=3D $this->received_host($hosts[0]) . $nldlm=
 . ' via ';
+            if (($addr =3D rcube_utils::remote_addr()) && $addr !=3D $_SER=
VER['REMOTE_ADDR']) {
+                $http_header .=3D $this->received_host($addr) . ' via ';
             }
=20
             $http_header .=3D $this->received_host($_SERVER['REMOTE_ADDR']=
);
=20
             // BY
-            $http_header .=3D $nldlm . 'by ' . rcube_utils::server_name('H=
TTP_HOST');
+            $http_header .=3D ' by ' . $host;
=20
             // WITH
-            $http_header .=3D $nldlm . 'with HTTP (' . $_SERVER['SERVER_PR=
OTOCOL']
+            $http_header .=3D ' with HTTP (' . $_SERVER['SERVER_PROTOCOL']
                 . ' ' . $_SERVER['REQUEST_METHOD'] . '); ' . date('r');
=20
-            return wordwrap($http_header, 69, $nldlm);
+            return wordwrap($http_header, 69, "\r\n\t");
         }
     }
=20
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_image.php round=
cube-1.6.21+dfsg/program/lib/Roundcube/rcube_image.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_image.php	2026-10-19 =
08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_image.php	2026-11-09 =
12:53:01.000000000 +0100
@@ -318,6 +318,14 @@
         $rcube   =3D rcube::get_instance();
         $convert =3D self::getCommand('im_convert_path');
=20
+        $props =3D $this->props();
+
+        // Note: We don't support types like svg or eps for security reaso=
ns
+        $valid_types =3D 'bmp,gif,ico,jp2,jpg,jpeg,png,png8,png24,png32,ti=
f,tiff,webp';
+        if (!in_array($props['type'] ?? '', explode(',', $valid_types))) {
+            return false;
+        }
+
         if (!$filename) {
             $filename =3D $this->image_file;
=20
@@ -362,8 +370,6 @@
         }
=20
         // use GD extension (TIFF isn't supported)
-        $props =3D $this->props();
-
         // do we have enough memory? (#1489937)
         if (!$this->mem_check($props)) {
             return false;
@@ -413,6 +419,14 @@
     public static function is_convertable($mimetype =3D null)
     {
         $rcube =3D rcube::get_instance();
+        $mimetype =3D preg_replace('|^image/|i', '', $mimetype);
+        $mimetype =3D strtoupper($mimetype);
+        $mimetype =3D strtr($mimetype, ['PS' =3D> 'EPS', 'EPT' =3D> 'EPS']=
);
+
+        // For security reasons we do not support SVG and EPS
+        if ($mimetype =3D=3D 'EPS' || $mimetype =3D=3D 'SVG') {
+            return false;
+        }
=20
         // @TODO: check if specified mimetype is really supported
         return class_exists('Imagick', false) || self::getCommand('im_conv=
ert_path');
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_imap_generic.ph=
p roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_imap_generic.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_imap_generic.php	2026=
-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_imap_generic.php	2026=
-11-09 12:53:01.000000000 +0100
@@ -139,51 +139,54 @@
             return false;
         }
=20
-        if ($endln) {
-            $string .=3D "\r\n";
-        }
-
         $res =3D 0;
-        if ($parts =3D preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG=
_SPLIT_DELIM_CAPTURE)) {
-            for ($i =3D 0, $cnt =3D count($parts); $i < $cnt; $i++) {
-                if ($i + 1 < $cnt && preg_match('/^\{([0-9]+)\}\r\n$/', $p=
arts[$i+1], $matches)) {
-                    // LITERAL+/LITERAL- support
-                    $literal_plus =3D false;
-                    if (
-                        !empty($this->prefs['literal+'])
-                        || (!empty($this->prefs['literal-']) && $matches[1=
] <=3D 4096)
-                    ) {
-                        $parts[$i+1] =3D sprintf("{%d+}\r\n", $matches[1]);
-                        $literal_plus =3D true;
-                    }
+        $position =3D 0;
+        $len =3D 0;
=20
-                    $bytes =3D $this->putLine($parts[$i].$parts[$i+1], fal=
se, $anonymized);
-                    if ($bytes =3D=3D=3D false) {
-                        return false;
-                    }
+        while (preg_match('/\{([0-9]+)\}\r\n/m', $string, $matches, \PREG_=
OFFSET_CAPTURE, $position + $len) =3D=3D=3D 1) {
+            $match =3D $matches[0][0]; // the whole match
+            $match_position =3D $matches[0][1]; // position of the match
+            $match_len =3D strlen($match); // length of the whole match
+            $len =3D (int) $matches[1][0]; // length of the next literal
=20
-                    $res +=3D $bytes;
+            // LITERAL+/LITERAL- support
+            $literal_plus =3D !empty($this->prefs['literal+']) || (!empty(=
$this->prefs['literal-']) && $len <=3D 4096);
=20
-                    // don't wait if server supports LITERAL+ capability
-                    if (!$literal_plus) {
-                        $line =3D $this->readLine(1000);
-                        // handle error in command
-                        if (!isset($line[0]) || $line[0] !=3D '+') {
-                            return false;
-                        }
-                    }
+            if ($literal_plus) {
+                $match =3D str_replace('}', '+}', $match);
+            }
=20
-                    $i++;
-                }
-                else {
-                    $bytes =3D $this->putLine($parts[$i], false, $anonymiz=
ed);
-                    if ($bytes =3D=3D=3D false) {
-                        return false;
-                    }
+            $line =3D substr($string, $position, $match_position - $positi=
on) . $match;
+
+            $bytes =3D $this->putLine($line, false, $anonymized);
+            if ($bytes =3D=3D=3D false) {
+                return false;
+            }
+
+            $res +=3D $bytes;
=20
-                    $res +=3D $bytes;
+            if (!$literal_plus) {
+                $line =3D $this->readLine(1000);
+                // handle error in command
+                if (!isset($line[0]) || $line[0] !=3D '+') {
+                    return false;
                 }
             }
+
+            $position =3D $match_position + $match_len;
+        }
+
+        if ($endln) {
+            $string .=3D "\r\n";
+        }
+
+        if ($position < strlen($string)) {
+            $bytes =3D $this->putLine($position ? substr($string, $positio=
n) : $string, false, $anonymized);
+            if ($bytes =3D=3D=3D false) {
+                return false;
+            }
+
+            $res +=3D $bytes;
         }
=20
         return $res;
@@ -1927,10 +1930,9 @@
         }
=20
         $encoding =3D $encoding ? trim($encoding) : 'US-ASCII';
-        $criteria =3D $criteria ? 'ALL ' . trim($criteria) : 'ALL';
=20
         list($code, $response) =3D $this->execute($return_uid ? 'UID SORT'=
 : 'SORT',
-            ["($field)", $encoding, $criteria]);
+            ["({$field})", $encoding, $criteria ?: 'ALL']);
=20
         if ($code !=3D self::ERROR_OK) {
             $response =3D null;
@@ -1965,10 +1967,9 @@
=20
         $encoding  =3D $encoding ? trim($encoding) : 'US-ASCII';
         $algorithm =3D $algorithm ? trim($algorithm) : 'REFERENCES';
-        $criteria  =3D $criteria ? 'ALL '.trim($criteria) : 'ALL';
=20
         list($code, $response) =3D $this->execute($return_uid ? 'UID THREA=
D' : 'THREAD',
-            [$algorithm, $encoding, $criteria]);
+            [$algorithm, $encoding, $criteria ?: 'ALL']);
=20
         if ($code !=3D self::ERROR_OK) {
             $response =3D null;
@@ -2007,7 +2008,6 @@
         }
=20
         $esearch  =3D empty($items) ? false : $this->getCapability('ESEARC=
H');
-        $criteria =3D trim($criteria);
         $params   =3D '';
=20
         // RFC4731: ESEARCH
@@ -2082,7 +2082,7 @@
                 return false;
             }
         }
-        else if (empty($message_set)) {
+        elseif (empty($message_set) || preg_match('/[^0-9:,*]/', (string) =
$message_set)) {
             return false;
         }
         else if (strpos($message_set, ':')) {
@@ -2829,6 +2829,10 @@
      */
     public function fetchMIMEHeaders($mailbox, $uid, $parts, $mime =3D tru=
e)
     {
+        if (preg_match('/[^0-9:,*]/', (string) $uid)) {
+            return false;
+        }
+
         if (!$this->select($mailbox)) {
             return false;
         }
@@ -2840,7 +2844,8 @@
=20
         // format request
         foreach ($parts as $part) {
-            $peeks[] =3D "BODY.PEEK[$part.$type]";
+            $part =3D preg_replace('/[\r\n]+/', ' ', (string) $part); // s=
anitize input
+            $peeks[] =3D "BODY.PEEK[{$part}.{$type}]";
         }
=20
         $request =3D "$key UID FETCH $uid (" . implode(' ', $peeks) . ')';
@@ -2885,12 +2890,20 @@
     public function handlePartBody($mailbox, $id, $is_uid =3D false, $part=
 =3D '', $encoding =3D null, $print =3D null,
         $file =3D null, $formatted =3D false, $max_bytes =3D 0)
     {
+        if (preg_match('/[^0-9:,*]/', (string) $id)) {
+            return false;
+        }
+
         if (!$this->select($mailbox)) {
             return false;
         }
=20
         $binary    =3D true;
         $initiated =3D false;
+        $result =3D false;
+        $found =3D false;
+        $mode =3D 0;
+        $part =3D preg_replace('/[\r\n]+/', ' ', (string) $part); // sanit=
ize input
=20
         do {
             if (!$initiated) {
@@ -2912,7 +2925,7 @@
                 }
=20
                 // Use BINARY extension when possible (and safe)
-                $binary     =3D $binary && $mode && preg_match('/^[0-9.]+$=
/', (string) $part) && $this->hasCapability('BINARY');
+                $binary     =3D $binary && $mode && preg_match('/^[0-9.]+$=
/', $part) && $this->hasCapability('BINARY');
                 $fetch_mode =3D $binary ? 'BINARY' : 'BODY';
                 $partial    =3D $max_bytes ? sprintf('<0.%d>', $max_bytes)=
 : '';
=20
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_message.php rou=
ndcube-1.6.21+dfsg/program/lib/Roundcube/rcube_message.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_message.php	2026-10-1=
9 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_message.php	2026-11-0=
9 12:53:01.000000000 +0100
@@ -82,6 +82,9 @@
      */
     function __construct($uid, $folder =3D null, $is_safe =3D false)
     {
+        // Sanitize the input for security
+        $uid =3D preg_replace('/[\r\n]+/', ' ', (string) $uid);
+
         // decode combined UID-folder identifier
         if (preg_match('/^[0-9.]+-.+/', $uid)) {
             list($uid, $folder) =3D explode('-', $uid, 2);
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube.php roundcube-1=
=2E6.21+dfsg/program/lib/Roundcube/rcube.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube.php	2026-10-19 08:49:=
43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube.php	2026-11-09 12:53:=
01.000000000 +0100
@@ -1052,7 +1052,7 @@
         }
=20
         // skip empty requests
-        if (($mode =3D=3D rcube_utils::INPUT_POST && empty($_POST))
+        if (($mode =3D=3D rcube_utils::INPUT_POST && empty($_POST) && empt=
y($_FILES))
             || ($mode =3D=3D rcube_utils::INPUT_GET && empty($_GET))
         ) {
             return true;
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_session.php rou=
ndcube-1.6.21+dfsg/program/lib/Roundcube/rcube_session.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_session.php	2026-10-1=
9 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_session.php	2026-11-0=
9 12:53:01.000000000 +0100
@@ -562,6 +562,9 @@
                         for ($length=3D''; ($q < $endptr) && ($str[$q] !=
=3D ':'); $q++) {
                             $length .=3D $str[$q];
                         }
+                        if (((int) $length) < 0) {
+                            throw new \Exception('Invalid session data');
+                        }
                         $q+=3D2;
                         $q+=3D (int)$length + 2;
                         $serialized .=3D substr($str, $p, $q - $p);
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_utils.php round=
cube-1.6.21+dfsg/program/lib/Roundcube/rcube_utils.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_utils.php	2026-10-19 =
08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_utils.php	2026-11-09 =
12:53:01.000000000 +0100
@@ -1,5 +1,6 @@
 <?php
=20
+use IPLib\Address\AddressInterface;
 use IPLib\Factory;
 use IPLib\ParseStringFlag;
=20
@@ -301,7 +302,7 @@
      */
     public static function is_simple_string($input)
     {
-        return is_string($input) && !!preg_match('/^[\w.-]+$/i', $input);
+        return is_string($input) && strlen($input) && !preg_match('/[^\w.-=
]/i', $input);
     }
=20
     /**
@@ -441,15 +442,8 @@
=20
             $host =3D trim($host, '[].');
=20
-            if (preg_match('/([0-9a-f.-]+)\.(nip|sslip)\.io$/i', $host, $m=
atches)) {
-                $host =3D $matches[1];
-                if (preg_match('/([0-9]{1,3}([.-][0-9]{1,3}){3})$/', $host=
, $m)) {
-                    $host =3D str_replace('-', '.', $m[1]); // IPv4
-                } elseif (preg_match('/^([0-9a-f]{8})$/i', $host, $m)) {
-                    $host =3D long2ip(base_convert($m[1], 16, 10)); // Hex=
adecimal
-                } else {
-                    $host =3D str_replace('-', ':', $host); // IPv6
-                }
+            if ($xip =3D self::xip_ip($host)) {
+                $host =3D $xip;
             }
=20
             // TODO: This is pretty fast, but a single message can contain=
 multiple links
@@ -472,14 +466,12 @@
                     '64:ff9b:1::/48'  // (RFC 8215 local-use NAT64)=20
                 ];
=20
-                foreach ($nets as $net) {
-                    $range =3D Factory::parseRangeString($net);
-                    if ($range->contains($address)) {
-                        return true;
-                    }
+                // Extract embedded IPv4 address
+                if ($address instanceof \IPLib\Address\IPv6 && ($embedded =
=3D $address->toIPv4())) {
+                    $address =3D $embedded;
                 }
=20
-                return false;
+                return self::is_ip_in_range($address, $nets);
             }
=20
             // FIXME: Should we accept any non-fqdn hostnames?
@@ -491,6 +483,96 @@
     }
=20
     /**
+     * Check if an IP address matches an entry in the given whitelist.
+     * Entries may be exact IP addresses or CIDR ranges (e.g. '10.0.0.0/8'=
, 'fc00::/7').
+     *
+     * @param string|AddressInterface $ip        IP address to check
+     * @param array                   $whitelist List of IPs or CIDR ranges
+     */
+    private static function is_ip_in_range($ip, array $whitelist): bool
+    {
+        if (empty($whitelist)) {
+            return false;
+        }
+
+        if ($ip instanceof AddressInterface) {
+            $address =3D $ip;
+            $ip =3D (string) $ip;
+        } else {
+            $address =3D Factory::parseAddressString($ip);
+        }
+
+        foreach ($whitelist as $entry) {
+            if ($entry =3D=3D=3D $ip) {
+                return true;
+            }
+            if ($address && ($range =3D Factory::parseRangeString($entry))=
 && $range->contains($address)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Extract IP address from a nip.io/sslip.io-style fqdn
+     *
+     * @return ?string IP address if found
+     */
+    private static function xip_ip(string $host)
+    {
+        if (!preg_match('/\.(backname\.io|fdns\.uk|ipq\.co|nip\.io|sslip\.=
io|traefik\.me)$/i', $host)) {
+            return null;
+        }
+
+        // IPv4 dash-separated
+        $ipv4REDashes =3D '/(^|[.-])(((25[0-5]|(2[0-4]|1\d|[1-9])?\d)\-){3=
}(25[0-5]|(2[0-4]|1\d|[1-9])?\d))($|[.-])/';
+        if (preg_match($ipv4REDashes, $host, $m)) {
+            return str_replace('-', '.', $m[2]);
+        }
+
+        // IPv4 dot-separated
+        $ipv4REDots =3D '/(^|[.-])(((25[0-5]|(2[0-4]|1\d|[1-9])?\d)\.){3}(=
25[0-5]|(2[0-4]|1\d|[1-9])?\d))($|[.-])/';
+        if (preg_match($ipv4REDots, $host, $m)) {
+            return str_replace('-', '.', $m[2]);
+        }
+
+        // IPv4 hex
+        $ipv4REHex =3D '/(^|[.-])([[:xdigit:]]{8})($|[.-])/';
+        if (preg_match($ipv4REHex, $host, $m)) {
+            return long2ip(base_convert($m[2], 16, 10));
+        }
+
+        // IPv6 dash-separated
+        $ipv6RE =3D '/(^|[.-])(([[:xdigit:]]{1,4}-){7}[[:xdigit:]]{1,4}|([=
[:xdigit:]]{1,4}-){1,7}-'
+            . '|([[:xdigit:]]{1,4}-){1,6}-[[:xdigit:]]{1,4}|([[:xdigit:]]{=
1,4}-){1,5}(-[[:xdigit:]]{1,4}){1,2}'
+            . '|([[:xdigit:]]{1,4}-){1,4}(-[[:xdigit:]]{1,4}){1,3}|([[:xdi=
git:]]{1,4}-){1,3}(-[[:xdigit:]]{1,4}){1,4}'
+            . '|([[:xdigit:]]{1,4}-){1,2}(-[[:xdigit:]]{1,4}){1,5}|[[:xdig=
it:]]{1,4}-((-[[:xdigit:]]{1,4}){1,6})'
+            . '|-((-[[:xdigit:]]{1,4}){1,7}|-)|fe80-(-[[:xdigit:]]{0,4}){0=
,4}%[\da-zA-Z]+'
+            . '|--(ffff(-0{1,4})?-)?((25[0-5]|(2[0-4]|1?\d)?\d)\.){3}(25[0=
-5]|(2[0-4]|1?\d)?\d)'
+            . '|([[:xdigit:]]{1,4}-){1,4}-((25[0-5]|(2[0-4]|1?\d)?\d)\.){3=
}(25[0-5]|(2[0-4]|1?\d)?\d))($|[.-])/';
+        if (preg_match($ipv6RE, $host, $m)) {
+            return str_replace('-', ':', $m[2]);
+        }
+
+        // IPv6 dot-separated (backname.io)
+        $ipv6REDots =3D '/(^|\.)(([[:xdigit:]]{1,4}\.){7}[[:xdigit:]]{1,4}=
)($|\.)/';
+        if (preg_match($ipv6REDots, $host, $m)) {
+            return str_replace('.', ':', $m[2]);
+        }
+
+        // IPv6 hex
+        $ipv6REHex =3D '/(^|\.)([[:xdigit:]]{32})($|\.)/';
+        if (preg_match($ipv6REHex, $host, $m)) {
+            $words =3D str_split($m[2], 2);
+            $words =3D array_map('hex2bin', $words);
+            return (string) \IPLib\Address\IPv6::fromWords($words);
+        }
+
+        return null;
+    }
+
+    /**
      * Replace all css definitions with #container [def]
      * and remove css-inlined scripting, make position style safe
      *
@@ -1643,8 +1725,8 @@
                 $default_port =3D 443;
             }
=20
-            $host =3D $_SERVER['HTTP_HOST'] ?? '';
-            $port =3D $_SERVER['SERVER_PORT'] ?? 0;
+            $host =3D self::server_name('HTTP_HOST', false);
+            $port =3D parse_url($host, \PHP_URL_PORT);
=20
             $prefix =3D $schema . '://' . preg_replace('/:\d+$/', '', $hos=
t);
             if ($port && $port !=3D $default_port && $port !=3D 80) {
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/Changelog r=
oundcube-1.6.21+dfsg/public_html/plugins/managesieve/Changelog
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/Changelog	2026-10=
-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/Changelog	2026-11=
-09 12:53:01.000000000 +0100
@@ -8,6 +8,9 @@
 - Fix infinite loop when parsing a malformed script (#9562)
 - Fix current script state after initial scripts creation in managesieve_k=
olab_master mode
 - Fix match-type selector (remove unsupported options) in delete header ac=
tion (#9610)
+- Fix bug where some managesieve destructive actions could have been trigg=
ered cross-site via GET
+- Fix Sieve script injection via a rule operator
+- Fix Sieve script injection via set/include modifiers
=20
 * version 9.4 [2021-06-06]
 -----------------------------------------------------------
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcu=
be/rcube_sieve_engine.php roundcube-1.6.21+dfsg/public_html/plugins/manages=
ieve/lib/Roundcube/rcube_sieve_engine.php
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcu=
be_sieve_engine.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcu=
be_sieve_engine.php	2026-11-09 12:53:01.000000000 +0100
@@ -279,7 +279,7 @@
=20
         // Handle user requests
         if ($action =3D rcube_utils::get_input_string('_act', rcube_utils:=
:INPUT_GPC)) {
-            $fid =3D (int) rcube_utils::get_input_value('_fid', rcube_util=
s::INPUT_POST);
+            $fid =3D rcube_utils::get_input_string('_fid', rcube_utils::IN=
PUT_POST);
=20
             if ($action =3D=3D 'delete' && !$error) {
                 if (!in_array('delete_filter', $this->disabled_actions)) {
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcu=
be/rcube_sieve_script.php roundcube-1.6.21+dfsg/public_html/plugins/manages=
ieve/lib/Roundcube/rcube_sieve_script.php
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcu=
be_sieve_script.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcu=
be_sieve_script.php	2026-11-09 12:53:01.000000000 +0100
@@ -22,7 +22,10 @@
=20
 class rcube_sieve_script
 {
-    public $content =3D [];      // script rules array
+    public const SET_OPTIONS =3D ['lower', 'upper', 'lowerfirst', 'upperfi=
rst', 'quotewildcard', 'length', 'encodeurl'];
+    public const INCLUDE_OPTIONS =3D ['once', 'optional', 'global', 'perso=
nal'];
+
+    public $content =3D []; // script rules array
=20
     private $vars      =3D [];   // "global" variables
     private $prefix    =3D '';   // script header (comments)
@@ -480,19 +483,13 @@
=20
                     case 'include':
                         array_push($exts, 'include');
-                        $action_script .=3D 'include ';
-                        foreach (array_diff(array_keys($action), ['target'=
, 'type']) as $opt) {
-                            $action_script .=3D ":$opt ";
-                        }
+                        $action_script .=3D 'include ' . $this->bool_optio=
ns($action, self::INCLUDE_OPTIONS);
                         $action_script .=3D self::escape_string($action['t=
arget']);
                         break;
=20
                     case 'set':
                         array_push($exts, 'variables');
-                        $action_script .=3D 'set ';
-                        foreach (array_diff(array_keys($action), ['name', =
'value', 'type']) as $opt) {
-                            $action_script .=3D ":$opt ";
-                        }
+                        $action_script .=3D 'set ' . $this->bool_options($=
action, self::SET_OPTIONS);
                         $action_script .=3D self::escape_string($action['n=
ame']) . ' ' . self::escape_string($action['value']);
                         break;
=20
@@ -969,7 +966,6 @@
                 $action  =3D ['type' =3D> $token, 'target' =3D> array_pop(=
$tokens)];
                 $args    =3D ['copy'];
                 $action +=3D $this->action_arguments($tokens, $args);
-
                 $result[] =3D $action;
                 break;
=20
@@ -978,7 +974,6 @@
                 $args    =3D ['mime'];
                 $vargs   =3D ['seconds', 'days', 'addresses', 'subject', '=
handle', 'from'];
                 $action +=3D $this->action_arguments($tokens, $args, $varg=
s);
-
                 $result[] =3D $action;
                 break;
=20
@@ -1007,16 +1002,14 @@
=20
             case 'include':
                 $action  =3D ['type' =3D> 'include', 'target' =3D> array_p=
op($tokens)];
-                $args    =3D ['once', 'optional', 'global', 'personal'];
-                $action +=3D $this->action_arguments($tokens, $args);
+                $action +=3D $this->action_arguments($tokens, self::INCLUD=
E_OPTIONS);
=20
                 $result[] =3D $action;
                 break;
=20
             case 'set':
                 $action  =3D ['type' =3D> 'set', 'value' =3D> array_pop($t=
okens), 'name' =3D> array_pop($tokens)];
-                $args    =3D ['lower', 'upper', 'lowerfirst', 'upperfirst'=
, 'quotewildcard', 'length'];
-                $action +=3D $this->action_arguments($tokens, $args);
+                $action +=3D $this->action_arguments($tokens, self::SET_OP=
TIONS);
=20
                 $result[] =3D $action;
                 break;
@@ -1139,7 +1132,7 @@
      */
     private function add_operator($test, &$out, &$exts)
     {
-        if (empty($test['type'])) {
+        if (empty($test['type']) || !preg_match('/^[a-z-]+$/', $test['type=
'])) {
             return;
         }
=20
@@ -1161,6 +1154,22 @@
     }
=20
     /**
+     * Create command options string
+     */
+    private function bool_options($options, $keys)
+    {
+        $out =3D '';
+
+        foreach ($keys as $opt) {
+            if (isset($options[$opt])) {
+                $out .=3D ":{$opt} ";
+            }
+        }
+
+        return $out;
+    }
+
+    /**
      * Extract test tokens
      */
     private function test_tokens(&$tokens)
diff -Nru roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderExpunge.php roundc=
ube-1.6.21+dfsg/tests/Actions/Mail/FolderExpunge.php
--- roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderExpunge.php	2026-10-19 0=
8:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderExpunge.php	2026-11-09 1=
2:53:01.000000000 +0100
@@ -105,4 +105,25 @@
         $this->assertSame('expunge', $result['action']);
         $this->assertSame('this.display_message("Unable to perform operati=
on. Folder is read-only.","error",0);', trim($result['exec']));
     }
+
+    /**
+     * Test security check (folder is required)
+     */
+    public function test_run_empty_post()
+    {
+        $action =3D new rcmail_action_mail_folder_expunge();
+        $output =3D $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'e=
xpunge');
+
+        $this->assertTrue($action->checks());
+
+        $_POST =3D [];
+
+        $this->runAndAssert($action, OutputJsonMock::E_EXIT);
+
+        $result =3D $output->getOutput();
+
+        $this->assertContains('Content-Type: application/json; charset=3DU=
TF-8', $output->headers);
+        $this->assertSame('expunge', $result['action']);
+        $this->assertStringContainsString('this.display_message("An intern=
al error occurred', $result['exec']);
+    }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderPurge.php roundcub=
e-1.6.21+dfsg/tests/Actions/Mail/FolderPurge.php
--- roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderPurge.php	2026-10-19 08:=
49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderPurge.php	2026-11-09 12:=
53:01.000000000 +0100
@@ -8,12 +8,23 @@
 class Actions_Mail_FolderPurge extends ActionTestCase
 {
     /**
-     * Class constructor
+     * Test security check (folder is required)
      */
-    function test_class()
+    public function test_run_empty_post()
     {
-        $object =3D new rcmail_action_mail_folder_purge;
+        $action =3D new rcmail_action_mail_folder_purge();
+        $output =3D $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'p=
urge');
=20
-        $this->assertInstanceOf('rcmail_action', $object);
+        $this->assertTrue($action->checks());
+
+        $_POST =3D [];
+
+        $this->runAndAssert($action, OutputJsonMock::E_EXIT);
+
+        $result =3D $output->getOutput();
+
+        $this->assertContains('Content-Type: application/json; charset=3DU=
TF-8', $output->headers);
+        $this->assertSame('purge', $result['action']);
+        $this->assertStringContainsString('this.display_message("An intern=
al error occurred', $result['exec']);
     }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Framework/Session.php roundcube-1.6.2=
1+dfsg/tests/Framework/Session.php
--- roundcube-1.6.20+dfsg/tests/Framework/Session.php	2026-10-19 08:49:43.0=
00000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Framework/Session.php	2026-11-09 12:53:01.0=
00000000 +0100
@@ -42,5 +42,9 @@
             ['ok' =3D> true, 'name' =3D> 'me', 'int' =3D> 34],
             $session->unserialize('ok|b:1;name|s:2:"me";int|i:34;')
         );
+
+        // Infinit loop fix
+        $this->expectException(\Exception::class);
+        $this->assertSame([], $session->unserialize('k1|s:-100:"x";'));
     }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Framework/Utils.php roundcube-1.6.21+=
dfsg/tests/Framework/Utils.php
--- roundcube-1.6.20+dfsg/tests/Framework/Utils.php	2026-10-19 08:49:43.000=
000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Framework/Utils.php	2026-11-09 12:53:01.000=
000000 +0100
@@ -548,6 +548,8 @@
     function test_is_simple_string()
     {
         $this->assertTrue(rcube_utils::is_simple_string('some-thing.123_')=
);
+        $this->assertTrue(rcube_utils::is_simple_string('AAAA.BBBB-cccc_dd=
d'));
+        $this->assertFalse(rcube_utils::is_simple_string("test\n"));
         $this->assertFalse(rcube_utils::is_simple_string(''));
         $this->assertFalse(rcube_utils::is_simple_string(' '));
         $this->assertFalse(rcube_utils::is_simple_string('some=E2=80=93thi=
ng'));
@@ -557,7 +559,7 @@
         $this->assertFalse(rcube_utils::is_simple_string('%20'));
         $this->assertFalse(rcube_utils::is_simple_string('\0000'));
         $this->assertFalse(rcube_utils::is_simple_string(1));
-        $this->assertFalse(rcube_utils::is_simple_string(new stdClass()));
+        $this->assertFalse(rcube_utils::is_simple_string(new \stdClass()));
         $this->assertFalse(rcube_utils::is_simple_string(null));
     }
=20
@@ -619,6 +621,14 @@
             ['http://127-0-0-1.nip.io', true],
             ['http://127-0-0-1.nip.io.', true],
             ['http://7F000001.nip.io/', true],
+            ['http://127.0.0.1.2.nip.io', true], // 127.0.0.1
+            ['http://0.0.0.0.0.ffff.7f00.1.backname.io', true],
+            ['http://x.127.0.0.1.nip.io', true],
+            ['http://x.0a000001.nip.io/', true],
+            ['http://x.c0a80101.nip.io/', true],
+            ['http://x.a9fea9fe.nip.io/', true],
+            ['http://x.0-0-0-0-0-0-0-0-1.sslip.io/', true],
+            ['http://0-0-0-0-0-0-0-0-1.sslip.io/', true],
             ['http://metadata.google.internal', true],
             ['http://127.0.0.1.sslip.io/', true],
             ['http://[0:0:0:0:0:ffff:127.0.0.1]/', true],
@@ -633,6 +643,8 @@
             ['http://[64:ff9b:1::]/', true],
             ['http://[64:ff9b::a9fe:a9fe]/', true],
             ['http://[64:ff9b::7f00:1]/', true],
+            ['http://[2002:a9fe:a9fe::]/', true],
+            ['http://[2002:7f00:1::]/', true],
             // Non-local hosts
             ['http://[2001:470::76:0:0:0:2]', false],
             ['http://domain.tld', false],
diff -Nru roundcube-1.6.20+dfsg/tests/Rcmail/Rcmail.php roundcube-1.6.21+df=
sg/tests/Rcmail/Rcmail.php
--- roundcube-1.6.20+dfsg/tests/Rcmail/Rcmail.php	2026-10-19 08:49:43.00000=
0000 +0200
+++ roundcube-1.6.21+dfsg/tests/Rcmail/Rcmail.php	2026-11-09 12:53:01.00000=
0000 +0100
@@ -125,6 +125,7 @@
     function test_url()
     {
         $rcmail =3D rcmail::get_instance();
+        $rcmail->config->set('trusted_host_patterns', []);
=20
         $this->assertEquals(
             '/sub/?_task=3Dcli&_action=3Dtest',
@@ -187,9 +188,8 @@
         $rcmail->config->set('request_path', null);
=20
         $_SERVER['HTTPS'] =3D false;
-        $_SERVER['SERVER_PORT'] =3D '8080';
         $this->assertEquals(
-            'http://mail.example.org:8080/?_task=3Dcli&_action=3Dtest&_mod=
e=3DABS',
+            'http://mail.example.org/?_task=3Dcli&_action=3Dtest&_mode=3DA=
BS',
             $rcmail->url(['_action' =3D> 'test', '_mode' =3D> 'ABS'], true=
, true),
             "Full URL with port"
         );
diff -Nru roundcube-1.6.20+dfsg/tests/Rcmail/Sendmail.php roundcube-1.6.21+=
dfsg/tests/Rcmail/Sendmail.php
--- roundcube-1.6.20+dfsg/tests/Rcmail/Sendmail.php	2026-10-19 08:49:43.000=
000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Rcmail/Sendmail.php	2026-11-09 12:53:01.000=
000000 +0100
@@ -63,7 +63,43 @@
      */
     function test_header_received()
     {
-        $this->markTestIncomplete();
+        $_SERVER['REMOTE_ADDR'] =3D '1.2.3.4';
+        $_SERVER['HTTP_X_FORWARDED_FOR'] =3D '203.0.113.5';
+        $_SERVER['HTTP_X_REAL_IP'] =3D '';
+        $_SERVER['SERVER_PROTOCOL'] =3D 'HTTP/1.0';
+        $_SERVER['REQUEST_METHOD'] =3D 'GET';
+
+        $sendmail =3D new \rcmail_sendmail();
+        $config =3D \rcmail::get_instance()->config;
+
+        $config->set('http_received_header', false);
+        $config->set('http_received_header_encrypt', false);
+        $config->set('proxy_whitelist', []);
+
+        // Disabled option
+        $header =3D $sendmail->header_received();
+        $this->assertNull($header);
+
+        // Enabled option
+        $config->set('http_received_header', true);
+        $this->assertStringStartsWith(
+            'from [1.2.3.4] by localhost with HTTP (HTTP/1.0 GET);',
+            $sendmail->header_received()
+        );
+
+        // With whitelisted proxy
+        $config->set('proxy_whitelist', ['1.2.3.4']);
+        $this->assertStringStartsWith(
+            "from [203.0.113.5] via [1.2.3.4] by localhost with HTTP (HTTP=
/1.0\r\n\tGET);",
+            $sendmail->header_received()
+        );
+
+        // Encrypted
+        $config->set('http_received_header_encrypt', true);
+        $this->assertMatchesRegularExpression(
+            '|^from [0-9a-zA-Z=3D/+]+ via [0-9a-zA-Z=3D/+]+ by\r\n\tlocalh=
ost with HTTP|',
+            $sendmail->header_received()
+        );
     }
=20
     /**

--+m9kMpH6LsWoJXXB--

--54JYiXzif/0fipGo
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERpy6p3b9sfzUdbME05pJnDwhpVIFAmr6BSMACgkQ05pJnDwh
pVId8BAAwjd9rv2sJUuLuZiP7ZG2bFNPq04a3Q+zEGfKlf73LAxgTMtmuJ5SpFZO
mD0IEIAiV4KPFphhltUIaKGaCNt6d9c4lXh36l1Gq/T4vbrExnoKs/ul7UyIi6DF
HsWB4xDPMMqGivlqJx9oDVWUD4+5J2NO1EN2y4iWGpVNHYVlluA7+Fzu5rZoW4Rt
tKRjUNscU4KsH6Lw91/qe+gzBXMieMiZi9M2vkh33eKuryadGnsUxXeyeA5KTuvr
hLuKTR8jMm9Gakfb5xEUhC80ijF8vBjhibrhN5keyEUz4YWqtK0v45T3E6gHynAi
Dn5d/11i4JJ3MSmZ746na0jgKvGKdY83IGQ6f9G4E7kseK8lNFrL9h2vmtHoHIMv
/na3G/+NmbWphbMPyZOvxjVRqKyj//Azdv1KMdQGu++9j1tb3lTsJ9zvCfCLG1KC
tmzZvYNReyyoDLTHpaA/Gh6mVm41Gqac1hKes4gbP4/Vg06pmJgXTrCZYIDT8LLV
f5qd4kiXfHQKZPZehwkPgxiqNFnbchd5uWeyq6VNoUtpAWNZ3ldMobufTZYjcBPa
YjYcpHdvW+wIMqgxF+oy7c5HSH4hYXoNWRByQ+x/adpWuNoksTl7eEZlEXQRzWZm
ZbA/eX8eMRd1Jhj5dKN/o+LqqcnweLZsWPCTa0EoH+a3TQ9bSu8=
=QiP9
-----END PGP SIGNATURE-----

--54JYiXzif/0fipGo--
Technical Details
Message-ID: <NZO5j-c6j2-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
References: <NYxSW-boav-1@gated-at.bofh.it> <NYxSW-boav-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Guilhem Moulin <guilhem@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153803: roundcube: Security updates 1.6.21 and 1.7.6 released
Date: Sun, 15 Nov 2026 20:30:01 +0100
Message-ID: <NZO5j-c6j2-1@gated-at.bofh.it>
References: <NYxSW-boav-1@gated-at.bofh.it> <NYxSW-boav-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Nov 15 19:22:26 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: 4.642
Reply-To: Guilhem Moulin <guilhem@debian.org>, 1153803@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: pkg-roundcube-maintainers@alioth-lists.debian.net
X-Debian-Pr-Message: followup 1153803
X-Debian-Pr-Package: src:roundcube
X-Debian-Pr-Keywords: security upstream
X-Debian-Pr-Source: roundcube
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="54JYiXzif/0fipGo"
Content-Disposition: inline
X-Debian-User: guilhem
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2002812
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 2632
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: 1153803@bugs.debian.org
X-Original-Date: Sun, 15 Nov 2026 20:16:53 +0100
X-Original-Message-ID: <avoFIoAP6MufdDSx@debian.org>
X-Original-References: <179447000577.2730750.271924779323991176.reportbug@elende.valinor.li> <179447000577.2730750.271924779323991176.reportbug@elende.valinor.li>