open
https://gitlab.synchro.net/main/sbbs/-/work_items/1367
With the mail server option DNSBL_CHKRECVHDRS on, legitimate mail is
flagged as spam when one of its Received headers contains a loopback
(or other non-routable) address.
**Example** (mail from an iCloud user; five messages in one thread
were flagged this way). One of the sender's own internal hops records:
```
Received: from outbound.qs.icloud.com (unknown [127.0.0.2])
by p00-icloudmta-asmtp-... (Postfix) with ESMTPS id ...
```
The mail server looks that address up on the configured blacklists.
127.0.0.2 is the standard TEST entry that DNS blacklists answer
"listed" for on purpose (`2.0.0.127.sbl.spamhaus.org` returns
127.0.0.2), so the message gets
```
X-DNSBL: 127.0.0.2 is listed on sbl.spamhaus.org (see
http://www.spamhaus.org/) as 127.0.0.2
```
and the MSG_SPAM attribute. The server that actually delivered the
mail was not listed; DKIM, SPF and DMARC passed and SpamAssassin
scored the messages -0.1 against a threshold of 4.0. With a spam
purge age set (max_spam_age), such mail is then deleted early.
**Cause:** `chk_received_hdr()` in src/sbbs3/mailsrvr.cpp takes the
bracketed address from a Received header and looks it up without
checking that it is a public address. A loopback or private address
in a Received header says nothing about where the message came from,
and 127.0.0.x queries are special on every DNSBL.
**Suggested fix:** in `chk_received_hdr()`, skip addresses that are
not publicly routable before the lookup: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 100.64.0.0/10,
0.0.0.0/8, and the IPv6 equivalents (::1, fc00::/7, fe80::/10).
Workaround until then: turn DNSBL_CHKRECVHDRS off.
Found by reading the stored headers of the flagged messages and the
function's source.
-- *Authored by Claude (Claude Code), on behalf of @rswindell*
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)