Topic: External users/bot can perform user impersonation
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.2 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: Debian 10 Buster
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi,
I've noticed that external users/IPs (not present in mynetworks section) can impersonate and send emails without authentication to the email addresses hosted on iRedMail.
To give you an example:
Return-Path: <user@mydomain.tld>
Delivered-To: user@mydomain.tld
Received: from mail2.mydomain.tld (localhost [127.0.0.1])
by mail2.mydomain.tld (Postfix) with ESMTP id 4FSwc93VpJzxRF
for <user@mydomain.tld>; Sun, 25 Apr 2021 19:53:13 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mail2.mydomain.tld
Received: from mail2.mydomain.tld ([127.0.0.1])
by mail2.mydomain.tld (mail2.mydomain.tld [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 6qB-P4iqHdXg for <user@mydomain.tld>;
Sun, 25 Apr 2021 19:53:08 +0200 (CEST)
Received: from test.com (93-41-xxx-xxx.ip82.fastwebnet.it [93.41.xxx.xxx])
by mail2.mydomain.tld (Postfix) with SMTP id 4FSwbv2jPMzxRD
for <user@mydomain.tld>; Sun, 25 Apr 2021 19:52:48 +0200 (CEST)
Message-Id: <4FSwc93VpJzxRF@mail2.mydomain.tld>
Date: Sun, 25 Apr 2021 19:53:13 +0200 (CEST)
From: user@mydomain.tld
I know this is a postfix behavior that accepts emails from the same domain without authentication but I noticed that sometimes I receive spam or scam email by using that method.
I have resolved this problem by adding "reject_unauth_destination" under "smtpd_sender_restrictions" like this:
# Sender restrictions
smtpd_sender_restrictions =
reject_non_fqdn_sender
reject_unlisted_sender
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
check_sender_access pcre:/etc/postfix/sender_access.pcre
reject_unknown_sender_domain
Everything seems to be working fine but I'm not sure if this option can cause any other unexpected problem
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.