Vulnerability in the Exim4 configuration

Dear Team,

After deploying a VPS with HestiaCP, I identified a significant volume of spam messages being accepted by the SMTP server.

While analyzing the logs and Exim configuration, I verified that port 25 is correctly configured to prevent open relay to external domains. However, I observed that unauthenticated SMTP connections from external IP addresses are able to submit messages addressed to local domains hosted on the server.

The observed scenario was as follows:

  • The sender connected to port 25 without authentication.
  • The messages were addressed to accounts belonging to local domains hosted on the server.
  • Exim accepted the messages because they were not being relayed to external domains.
  • In the absence of additional restrictions, delivery to local recipients was allowed.

As a result, the server accepted messages with forged sender addresses destined for local accounts, enabling abuse of the infrastructure for spam distribution.

One possible mitigation would be to optionally require authentication even for messages addressed to local domains, for example:

deny  !authenticated = *
domains = +local_domains
message = "AUTH required even for local recipients"

I understand that this behavior may be intentional and consistent with traditional SMTP operation. Nevertheless, I believe that providing such an option (or an equivalent configuration) could improve security for Internet-facing deployments and help reduce abuse on newly deployed servers.

I would appreciate the team’s feedback on this possibility and whether a change of this nature would be considered for future releases.

Kind regards,

– Original message –

Prezados,

Assim que subi minha vps com o HestiaCP ela passou a dissiminar spam. Na busca com uma IA tive esse retorno abaixo.

A porta 25 está configurada corretamente para rejeitar envio não autenticado para domínios externos (relay fechado).

 Mas em jun 5-12, o IP ainda não estava em blacklist, então:
 - O atacante conectou via SMTP na porta 25
 - Sem autenticação, enviou para seus domínios LOCAIS
 - O Exim ACEITOU porque:
   - Não é relay externo (é para seus domínios)
   - Não está em blacklist (ainda)
   - Não tem regra de autenticação obrigatória para domínios locais
 - Ou seja: a porta 25 ACEITOU envio não autenticado para seus domínios LOCAIS

 E foi isso que ele usou para o spam. O spam não saiu para Yahoo/etc como relay — ele entrou no Hestia com FROM=falso e TO=lista_de_destinatários@seudominio.

 Isso é um BUG/DESIGN do Hestia: ele confia em qualquer conexão SMTP de IPs externos que enviem email PARA seus domínios locais (sem exigir autenticação).

 Para corrigir: forçar autenticação mesmo para envios recebidos:

 deny  !authenticated = *
        domains = +local_domains
        message = "AUTH required even for local recipients"

 Isso vai FORÇAR o cliente a autenticar mesmo para enviar para contas locais. Vou propor uma mudança na ACL do Hestia pra fechar essa brecha.

Caso acreditem que valia a pena a correção.

At..

wQuick

Hi,

Please, keep in mind that this forum is English only.

If you do that, how do you plan to receive mails from other servers?