2025-08-24 12:29:35 +05:30
id : smtp-open-relay
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
info :
name : Linux SMTP Open Relay Misconfigured
author : songyaeji
severity : high
description : |
Sendmail and Postfix were checked for proper restrictions against unauthorized relay attempts. Improper configurations allowed attackers to abuse the server for spam or denial-of-service (DoS) attacks.
reference :
- https://isms.kisa.or.kr
2025-08-28 23:41:32 +05:30
tags : linux,local,kisa,audit,compliance
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
self-contained : true
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
code :
- engine :
- bash
source : |
if ps -ef | grep -v grep | grep -q sendmail; then
if grep -q 'R\$.\* \$#error \$@ 5.7.1 \$ : "550 Relaying denied" ' /etc/mail/sendmail.cf 2>/dev/null \
|| (test -f /etc/mail/access.db && echo "[INFO] Sendmail access.db exists (relay likely restricted)"); then
echo "[SAFE] Sendmail relay restriction is configured."
2025-08-23 01:58:14 +05:30
else
2025-08-24 12:29:35 +05:30
echo "[VULNERABLE] Sendmail relay restriction is missing."
2025-08-23 01:58:14 +05:30
fi
2025-08-24 12:29:35 +05:30
else
echo "[INFO] Sendmail is not active."
fi
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
- engine :
- bash
source : |
if systemctl is-active postfix | grep -q running; then
mynetworks=$(grep -E '^\s*mynetworks\s*=' /etc/postfix/main.cf 2>/dev/null)
relay_restrict=$(grep -E '^\s*smtpd_relay_restrictions\s*=.*permit_mynetworks' /etc/postfix/main.cf 2>/dev/null)
reject_unauth=$(grep -E '^\s*smtpd_relay_restrictions\s*=.*reject_unauth_destination' /etc/postfix/main.cf 2>/dev/null)
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
if [[ -z "$mynetworks" || -z "$relay_restrict" || -z "$reject_unauth" ]]; then
echo "[VULNERABLE] Postfix relay restrictions are missing or misconfigured."
2025-08-23 01:58:14 +05:30
else
2025-08-24 12:29:35 +05:30
echo "[SAFE] Postfix relay restrictions are properly configured."
2025-08-23 01:58:14 +05:30
fi
2025-08-24 12:29:35 +05:30
else
echo "[INFO] Postfix is not active."
fi
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
matchers :
- type : word
name : sendmail
part : code_1_response
words :
- "[VULNERABLE]"
2025-08-23 01:58:14 +05:30
2025-08-24 12:29:35 +05:30
- type : word
name : postfix
part : code_2_response
words :
2025-08-24 07:05:38 +00:00
- "[VULNERABLE]"
2025-08-29 10:06:03 +00:00
# digest: 490a00463044022007bbf2c607700ae13d4c405a692792e71588ae5ba345fdaf3607a3857d7407c6022078e9830186951fe00d87c820cb91bd2cde6a00a10675cdf22267e85a4a5ccf60:922c64590222798bb761d5b6d8e72950