🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug#1152994: rspamd: out-of-bounds read with ed25519 DKIM signature and over-long bh= tag

#3203
From: Paul Menzel
Date: Wed, 04 Nov 2026 08:30
50 lines
3677 bytes
Package: rspamd
Version: 3.12.1-1
Severity: important
Tags: security upstream fixed-upstream
Control: fixed -1 4.1.5-1
X-Debbugs-Cc: team@security.debian.org

AI disclaimer: Drafted with claude-opus-5.5 from the upstream commits 
and the Debian source of rspamd 3.12.1-1, and reviewed by me.

Dear Debian folks,


rspamd 3.12.1 checks the length of the DKIM body hash (bh=) only for RSA 
and ECDSA signatures, not for ed25519-sha256. In src/libserver/dkim.c, 
rspamd_create_dkim_context() (lines 1195-1225 in 3.12.1) has no case for 
DKIM_SIGN_EDDSASHA256, so ctx->bhlen is whatever the base64 value of bh= 
decodes to. rspamd_dkim_check() then passes this length to memcmp() 
against fixed-size digest buffers (lines 2746, 2766, 2785, 2795 and 
2801), before the key type is checked at all.

An attacker who controls any domain and a DKIM key record for it can 
send a mail with an ed25519 DKIM signature and an over-long bh=. rspamd 
then reads past the stack and heap buffers. The upstream commit says 
that the over-read scales with the header size and can walk off the 
stack, i.e. crash the worker. Any rspamd verifying DKIM on inbound mail 
(the default) is affected; the mail sender needs no account on the host.

Upstream fixed it in 4.1.3:

   commit e27c9fb6666f40116accca3e34c27c7fe04d4507
   [CritFix] dkim: bound bh= length before body hash comparison
  
https://github.com/rspamd/rspamd/commit/e27c9fb6666f40116accca3e34c27c7fe04d4507

The patch applies to 3.12.1 with reduced context (git apply -C1; one 
file, 18 insertions). unstable and testing (4.1.5-1) contain the fix; 
trixie does not. I found no CVE ID for this issue.

Could you please apply the fix to trixie through a stable update, or 
coordinate a DSA with the security team?

I did not reproduce the crash on a running system. The analysis is based 
on the upstream commit and the Debian source of 3.12.1-1 (whose three 
patches do not touch dkim.c).


Kind regards,

Paul
Technical Details
Message-ID: <NVExz-9LwY-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Paul Menzel <pmenzel@molgen.mpg.de>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1152994: rspamd: out-of-bounds read with ed25519 DKIM signature and over-long bh= tag
Date: Wed, 04 Nov 2026 09:30:01 +0100
Message-ID: <NVExz-9LwY-3@gated-at.bofh.it>
X-Original-To: submit@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Wed Nov  4 08:23:10 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Paul Menzel <pmenzel@molgen.mpg.de>, 1152994@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team@security.debian.org, sbadia@debian.org
X-Debian-Pr-Message: report 1152994
X-Debian-Pr-Package: rspamd
X-Debian-Pr-Keywords: fixed-upstream security upstream
X-Debian-Pr-Source: rspamd
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2000567
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 50
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Wed, 4 Nov 2026 09:19:40 +0100
X-Original-Message-ID: <97798bc8-a923-4e8c-ac71-dffc4d859a9c@molgen.mpg.de>