diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-08 15:26:32 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-08 15:26:32 +0200 |
| commit | 4d65c2de0a64a663de4458f5cfdc6c59dac31ec6 (patch) | |
| tree | c2f7c2da4b439c5b64fbed29e9fa0171dfa6a094 /tests/fixtures/simple.eml | |
| parent | 294009014d74a883112f13dbf48b7403ca79b012 (diff) | |
| download | abusectl-4d65c2de0a64a663de4458f5cfdc6c59dac31ec6.tar.gz abusectl-4d65c2de0a64a663de4458f5cfdc6c59dac31ec6.zip | |
fix: prefer the observed address over an attacker's HELO literal
_extract_ip returned the FIRST bracketed IP in a Received header value.
Postfix (and others) write the client's own HELO/EHLO argument first
and the address it actually observed on the connection second:
Received: from [198.51.100.7] (unknown [203.0.113.99]) by mx...
The first bracket is entirely attacker-chosen; a client can HELO with
any literal it likes. sending_ip() returned 198.51.100.7, reporting
whoever the attacker named rather than 203.0.113.99, the address the
accepting server itself wrote. This needs no forged extra hop, only a
client that HELOs with an address literal, and the module's own
docstring already stated the intended answer ("the bracketed literal
after the connecting hostname") without the code implementing it.
_extract_ip now collects every bracketed, ipaddress-valid literal with
its position and, when there is more than one, prefers the last one
appearing before " by " (the accepting server's own clause, and the
one closest to it). A header with a single bracketed IP or no " by "
token keeps the previous single-candidate behaviour, so simple.eml
(203.0.113.42) and forged-chain.eml (203.0.113.99, item 3's own
mutation-checked test) are unaffected.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KphFXTc2QajxXsHWyvGJ4R
Diffstat (limited to 'tests/fixtures/simple.eml')
0 files changed, 0 insertions, 0 deletions
