Skip to content

Mailcow allows sender spoofing #5898

Description

@func0der

Contribution guidelines

I've found a bug and checked that ...

  • ... I understand that not following the below instructions will result in immediate closure and/or deletion of my issue.
  • ... I have understood that this bug report is dedicated for bugs, and not for support-related inquiries.
  • ... I have understood that answers are voluntary and community-driven, and not commercial support.
  • ... I have verified that my issue has not been already answered in the past. I also checked previous issues.

Description

You can spoof an email from an external server from an existing mail to an existing mailbox.

I guess this is because of missing `reject_sender_login_mismatch` `smtpd_sender_restrictions` settings, which would ensure that you can not send emails for existing email address without a valid SASL authentication.

Logs:

postfix-mailcow-1  | Jun  7 00:11:23 b1179c11bf27 postfix/postscreen[357]: CONNECT from [1.1.1.1]:48322 to [172.22.1.253]:25
postfix-mailcow-1  | Jun  7 00:11:23 b1179c11bf27 whitelist_forwardinghosts: Look up 1.1.1.1 on whitelist, result 200 DUNNO
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/postscreen[357]: PASS OLD [1.1.1.1]:48322
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: connect from mail.someexternalmailserver.de[1.1.1.1]
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: discarding EHLO keywords: CHUNKING
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: TLS SNI mail.mymailserver.com from mail.someexternalmailserver.de[1.1.1.1] not matched, using default chain
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: Anonymous TLS connection established from mail.someexternalmailserver.de[1.1.1.1]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: discarding EHLO keywords: CHUNKING
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/smtpd[376]: 785EB12860F9: client=mail.someexternalmailserver.de[1.1.1.1]
postfix-mailcow-1  | Jun  7 00:11:24 b1179c11bf27 postfix/cleanup[380]: 785EB12860F9: message-id=<FrYevkvBIDY4x4sA1zUJrldclkk9cIYU78mjR3d8Es@mail.someexternalmailserver.de>
postfix-mailcow-1  | Jun  7 00:11:25 b1179c11bf27 postfix/qmgr[353]: 785EB12860F9: from=<user1@mymailserver.com>, size=773, nrcpt=1 (queue active)
postfix-mailcow-1  | Jun  7 00:11:26 b1179c11bf27 postfix/smtpd[376]: disconnect from mail.someexternalmailserver.de[1.1.1.1] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
postfix-mailcow-1  | Jun  7 00:11:26 b1179c11bf27 postfix/lmtp[381]: 785EB12860F9: to=<user2@mymailserver.com>, relay=dovecot[xxx]:24, delay=1.6, delays=1.5/0.01/0/0.07, dsn=2.0.0, status=sent (250 2.0.0 <user2@mymailserver.com> CBhyOw00YmbzxQAAWves7g Saved)
postfix-mailcow-1  | Jun  7 00:11:26 b1179c11bf27 postfix/qmgr[353]: 785EB12860F9: removed

Steps to reproduce:

1. Setup mailcow instance
2. Configure domain.com
3. create mailbox user1@
4. create mailbox user2@
5. Connect from an external server via telnet or whatever
6. Mail From: user1@domain.com
7. RCPT TO: user2@domain.com

Which branch are you using?

master

Which architecture are you using?

x86

Operating System:

Docker

Server/VM specifications:

unrelated

Is Apparmor, SELinux or similar active?

no

Virtualization technology:

Docker version:

26.0.1

docker-compose version or docker compose version:

2.26.1

mailcow version:

2024-04-1-g468e9a47

Reverse proxy:

nginx

Logs of git diff:

-

Logs of iptables -L -vn:

-

Logs of ip6tables -L -vn:

-

Logs of iptables -L -vn -t nat:

-

Logs of ip6tables -L -vn -t nat:

-

DNS check:

-

Metadata

Metadata

Assignees

No one assigned

    Labels

    incompleteneed-infoneeds to provide more info about the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions