Bug 7764

Summary: TxRep doesn't use SPF correctly
Product: Spamassassin Reporter: RW <rwmaillists>
Component: LibrariesAssignee: SpamAssassin Developer Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: giovanni, mnalis-sabug, paul.stead, sidney
Priority: P2    
Version: SVN Trunk (Latest Devel Version)   
Target Milestone: 4.0.1   
Hardware: All   
OS: All   
Whiteboard:

Description RW 2019-10-24 17:45:42 UTC
In TxRep.pm

1332 	  if ($signedby) {
1333 	    $ip       = undef;
1334 	    $domain   = $signedby;
1335 	  } elsif ($pms->{spf_pass} && $self->{conf}->{txrep_spf}) {
1336 	    $ip       = undef;
1337 	    $signedby = 'spf';
1338 	  }


IMO $signedby should only be set to 'spf' if there's also relaxed alignment between $from and the envelope sender. Otherwise it's very easy to spoof, it can even happen automatically with forwarding.

Setting $signedby to the sender domain or $from to the sender address are superficially appealing, but don't help under forwarding.
Comment 1 Paul Stead 2022-04-11 12:55:52 UTC
Hiya - 

Is this fixed by setting signedby to $pms->{spf_sender} (or extracting the domain from spf_sender)?

Something like 

1335 	  } elsif ($pms->{spf_pass} && $self->{conf}->{txrep_spf}) {
 	    $ip       = undef;

 	    my $spf_domain = $pms->{spf_sender};
 	    $spf_domain =~ s/^.+@//;
 	    $signedby   = 'spf-'.$spf_domain;

does this have the intended consequence for making this key less spoofable? I feel like I'm missing a scenario, but I've run it through a few times.

Paul
Comment 2 Paul Stead 2022-04-11 13:20:55 UTC
Doh, sorry - I don't think this variable actually exists upon testing! But would be easy enough to add to the output from Plugin/SPF? Rather than looking up the SPF authed domain ourselves in TxRep
Comment 3 Giovanni Bechis 2023-05-02 08:36:47 UTC
Actually spf_sender is available now.
Implemented in r1909557.