Lucene search
+L

Mail relaying (thorough test)

🗓️ 03 Nov 2005 00:00:00Reported by Copyright (C) 2003 Michel ArboiType 
openvas
 openvas
🔗 plugins.openvas.org👁 227 Views

Mail relaying vulnerability testin

Related
Code
ReporterTitlePublishedViews
Family
cnvd
CNVD
cPanel input validation error (CNVD-2019-26362)
1 Aug 201900:00
cnvd
cve
CVE
CVE-1999-0512
4 Feb 200005:00
cve
cve
CVE
CVE-2003-0285
14 May 200304:00
cve
cve
CVE
CVE-2003-0316
17 May 200304:00
cve
cve
CVE
CVE-2019-14403
30 Jul 201914:10
cve
cvelist
Cvelist
CVE-1999-0512
4 Feb 200005:00
cvelist
cvelist
Cvelist
CVE-2003-0285
14 May 200304:00
cvelist
cvelist
Cvelist
CVE-2003-0316
17 May 200304:00
cvelist
cvelist
Cvelist
CVE-2019-14403
30 Jul 201914:10
cvelist
euvd
EUVD
EUVD-1999-0510
7 Oct 202500:30
euvd
Rows per page
# SPDX-FileCopyrightText: 2003 Michel Arboi
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.11852");
  script_version("2023-11-03T16:10:08+0000");
  script_tag(name:"last_modification", value:"2023-11-03 16:10:08 +0000 (Fri, 03 Nov 2023)");
  script_tag(name:"creation_date", value:"2005-11-03 14:08:04 +0100 (Thu, 03 Nov 2005)");
  script_tag(name:"cvss_base", value:"10.0");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_tag(name:"severity_vector", value:"CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N");
  script_tag(name:"severity_origin", value:"NVD");
  script_tag(name:"severity_date", value:"2019-07-30 20:58:00 +0000 (Tue, 30 Jul 2019)");
  script_cve_id("CVE-1999-0512", "CVE-2002-1278", "CVE-2003-0285", "CVE-2003-0316", "CVE-2005-0431",
                "CVE-2005-2857", "CVE-2006-0977", "CVE-2019-14403");
  script_name("Mail relaying (thorough test)");
  script_category(ACT_GATHER_INFO);
  script_copyright("Copyright (C) 2003 Michel Arboi");
  script_family("SMTP problems");
  script_dependencies("smtpserver_detect.nasl", "check_smtp_helo.nasl", "smtp_relay.nasl", "smtp_settings.nasl", "global_settings.nasl");
  script_require_ports("Services/smtp", 25, 465, 587);
  script_mandatory_keys("smtp/banner/available", "keys/is_public_addr");

  script_tag(name:"summary", value:"The remote SMTP server appears to be insufficiently protected
  against mail relaying.");

  script_tag(name:"vuldetect", value:"Sends multiple crafted SMTP requests and checks the responses.

  Note:

  This VT is only reporting a vulnerability if the target system / service is accessible from a
  public WAN (Internet) / public LAN.

  A configuration option 'Network type' to define if a scanned network should be seen as a public
  LAN can be found in the preferences of the following VT:

  Global variable settings (OID: 1.3.6.1.4.1.25623.1.0.12288)");

  script_tag(name:"impact", value:"This means that spammers might be able to use your mail server to
  send their mails to the world.");

  script_tag(name:"solution", value:"Upgrade your software or improve the configuration so that your
  SMTP server cannot be used as a relay any more.");

  script_tag(name:"qod_type", value:"remote_active");
  script_tag(name:"solution_type", value:"VendorFix");

  exit(0);
}

include("smtp_func.inc");
include("misc_func.inc");
include("port_service_func.inc");
include("network_func.inc");

if(!is_public_addr())
  exit(0);

port = smtp_get_port(default:25);

# No use to try "advanced" tests if it is a wide open relay
if(get_kb_item("smtp/" + port + "/spam"))
  exit(0);

if(get_kb_item("smtp/" + port + "/qmail/detected"))
  exit(0);

if(smtp_get_is_marked_wrapped(port:port))
  exit(0);

helo_name = smtp_get_helo_from_kb(port:port);
soc = smtp_open(port:port, data:helo_name, send_helo:TRUE, code:"250");
if(!soc)
  exit(0);

vtstrings = get_vt_strings();
domain = get_3rdparty_domain();
dest_name = get_host_name();
dest_ip = get_host_ip();

t1 = strcat('nobody@', domain);
f1 = strcat(vtstrings["lowercase"], '@', dest_name);
f2 = strcat(vtstrings["lowercase"], '@[', dest_ip, ']');

i = 0;
from_l[i] = strcat("nobody@", domain);
to_l[i] = t1;
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", rand_str(), ".", domain);
to_l[i] = t1;
i++;
from_l[i] = vtstrings["lowercase"] + "@localhost";
to_l[i] = t1;
i++;
from_l[i] = vtstrings["lowercase"];
to_l[i] = t1;
i++;
from_l[i] = "";
to_l[i] = t1;
i++;
from_l[i] = "";
to_l[i] = t1;
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", dest_name);
to_l[i] = t1;
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@[", dest_ip, "]");
to_l[i] = t1;
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", dest_name);
to_l[i] = strcat("nobody%", domain, "@", dest_name);
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", dest_name);
to_l[i] = strcat("nobody%", domain, "@[", dest_ip, "]");
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", dest_name);
to_l[i] = strcat('nobody@', domain, '@', dest_name);
i++;
from_l[i] = strcat(vtstrings["lowercase"], "@", dest_name);
to_l[i] = strcat('"nobody@', domain, '"@[', dest_ip, ']');
i++;
from_l[i] = f1;
to_l[i] = strcat('nobody@', domain, '@[', dest_ip, ']');
i++;
from_l[i] = f2;
to_l[i] = strcat('@', dest_name, ':nobody@', domain);
i++;
from_l[i] = f1;
to_l[i] = strcat('@[', dest_ip, ']:nobody@', domain);
i++;
from_l[i] = f1;
to_l[i] = strcat(domain, '!nobody@[', dest_ip, ']');
i++;
from_l[i] = strcat('postmaster@', dest_name);
to_l[i] = t1;
i++;

for(i = 0; soc && (from_l[i] || to_l[i]); i++) {

  mf = strcat('MAIL FROM: <', from_l[i], '>\r\n');
  send(socket:soc, data:mf);
  l = smtp_recv_line(socket:soc);
  if(! l || l =~ '^5[0-9]{2}') {
    smtp_close(socket:soc, check_data:l);
    soc = smtp_open(port:port, data:helo_name, send_helo:TRUE, code:"250");
  } else {
    mfres = l;
    rt = strcat('RCPT TO: <', to_l[i], '>\r\n');
    send(socket:soc, data:rt);
    l = smtp_recv_line(socket:soc, code:"2[0-9]{2}");
    if(l) {
      rtres = l;
      data = string("data\r\n");
      send(socket:soc, data:data);
      l = smtp_recv_line(socket:soc, code:"3[0-9]{2}");
      if(l) {
        datares = l;
        dc = string(vtstrings["default"], "-Relay-Test\r\n.\r\n");
        send(socket:soc, data:dc);
        l = smtp_recv_line(socket:soc, code:"250");
        if(l) {
          rep  = 'Request: ' + chomp( mf );
          rep += '\nAnswer:  ' + chomp( mfres );
          rep += '\nRequest: ' + chomp( rt );
          rep += '\nAnswer:  ' + chomp( rtres );
          rep += '\nRequest: ' + chomp( data );
          rep += '\nAnswer:  ' + chomp( datares );
          rep += '\nRequest: ' + chomp( dc );
          rep += '\nAnswer:  ' + chomp( l );
          smtp_close(socket:soc, check_data:l);
          break;
        }
      }
    }

    smtp_close(socket:soc, check_data:l);
    soc = smtp_open(port:port, data:helo_name, send_helo:TRUE, code:"250");
  }
}

if(rep) {
  report = 'The scanner was able to relay mail by sending the following sequences:\n\n' + rep;
  security_message(port:port, data:report);
  exit(0);
}

exit(99);

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

03 Nov 2023 00:00Current
4.6Medium risk
Vulners AI Score4.6
CVSS 210
CVSS 34.3
EPSS0.12035
227