Vulnerabilities > CVE-2007-4542 - Cross-Site Scripting vulnerability in University of Minnesota Mapserver

047910
CVSS 4.3 - MEDIUM
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
NONE
Integrity impact
PARTIAL
Availability impact
NONE

Summary

Multiple cross-site scripting (XSS) vulnerabilities in MapServer before 4.10.3 allow remote attackers to inject arbitrary web script or HTML via unspecified vectors involving the (1) processLine function in maptemplate.c and the (2) writeError function in mapserv.c in the mapserv CGI program.

Vulnerable Configurations

Part Description Count
Application
University_Of_Minnesota
1

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Cross Site Scripting through Log Files
    An attacker may leverage a system weakness where logs are susceptible to log injection to insert scripts into the system's logs. If these logs are later viewed by an administrator through a thin administrative interface and the log data is not properly HTML encoded before being written to the page, the attackers' scripts stored in the log will be executed in the administrative interface with potentially serious consequences. This attack pattern is really a combination of two other attack patterns: log injection and stored cross site scripting.
  • Embedding Scripts in Non-Script Elements
    This attack is a form of Cross-Site Scripting (XSS) where malicious scripts are embedded in elements that are not expected to host scripts such as image tags (<img>), comments in XML documents (< !-CDATA->), etc. These tags may not be subject to the same input validation, output validation, and other content filtering and checking routines, so this can create an opportunity for an attacker to tunnel through the application's elements and launch a XSS attack through other elements. As with all remote attacks, it is important to differentiate the ability to launch an attack (such as probing an internal network for unpatched servers) and the ability of the remote attacker to collect and interpret the output of said attack.
  • Embedding Scripts within Scripts
    An attack of this type exploits a programs' vulnerabilities that are brought on by allowing remote hosts to execute scripts. The attacker leverages this capability to execute scripts to execute his/her own script by embedding it within other scripts that the target software is likely to execute. The attacker must have the ability to inject script into script that is likely to be executed. If this is done, then the attacker can potentially launch a variety of probes and attacks against the web server's local environment, in many cases the so-called DMZ, back end resources the web server can communicate with, and other hosts. With the proliferation of intermediaries, such as Web App Firewalls, network devices, and even printers having JVMs and Web servers, there are many locales where an attacker can inject malicious scripts. Since this attack pattern defines scripts within scripts, there are likely privileges to execute said attack on the host. Of course, these attacks are not solely limited to the server side, client side scripts like Ajax and client side JavaScript can contain malicious scripts as well. In general all that is required is for there to be sufficient privileges to execute a script, but not protected against writing.
  • Cross-Site Scripting in Error Pages
    An attacker distributes a link (or possibly some other query structure) with a request to a third party web server that is malformed and also contains a block of exploit code in order to have the exploit become live code in the resulting error page. When the third party web server receives the crafted request and notes the error it then creates an error message that echoes the malformed message, including the exploit. Doing this converts the exploit portion of the message into to valid language elements that are executed by the viewing browser. When a victim executes the query provided by the attacker the infected error message error message is returned including the exploit code which then runs in the victim's browser. XSS can result in execution of code as well as data leakage (e.g. session cookies can be sent to the attacker). This type of attack is especially dangerous since the exploit appears to come from the third party web server, who the victim may trust and hence be more vulnerable to deception.
  • Cross-Site Scripting Using Alternate Syntax
    The attacker uses alternate forms of keywords or commands that result in the same action as the primary form but which may not be caught by filters. For example, many keywords are processed in a case insensitive manner. If the site's web filtering algorithm does not convert all tags into a consistent case before the comparison with forbidden keywords it is possible to bypass filters (e.g., incomplete black lists) by using an alternate case structure. For example, the "script" tag using the alternate forms of "Script" or "ScRiPt" may bypass filters where "script" is the only form tested. Other variants using different syntax representations are also possible as well as using pollution meta-characters or entities that are eventually ignored by the rendering engine. The attack can result in the execution of otherwise prohibited functionality.

Nessus

  • NASL familyCGI abuses
    NASL idMAPSERVER_MULTIPLE.NASL
    descriptionThe remote host is running MapServer, an open source internet map server. The installed version of MapServer is affected by multiple cross-site scripting vulnerabilities and to a buffer overflow vulnerability. To exploit those flaws an attacker needs to send specially crafted requests to the mapserv CGI. By exploiting the buffer overflow vulnerability, an attacker would be able to execute code on the remote host with the privileges of the web server.
    last seen2020-06-01
    modified2020-06-02
    plugin id26010
    published2007-09-10
    reporterThis script is Copyright (C) 2007-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/26010
    titleMapServer Multiple Remote Vulnerabilities
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
     script_id(26010);
     script_version("1.18");
     script_cvs_date("Date: 2018/06/13 18:56:28");
    
     script_cve_id("CVE-2007-4542", "CVE-2007-4629");
     script_bugtraq_id(25582);
    
     script_name(english:"MapServer Multiple Remote Vulnerabilities");
     script_summary(english:"Checks for multiple vulnerabilities in MapServer < 4.10.3");
    
     script_set_attribute(attribute:"synopsis", value:
    "The remote web server contains CGI scripts that are prone to arbitrary
    remote command execution and cross-site scripting attacks.");
     script_set_attribute(attribute:"description", value:
    "The remote host is running MapServer, an open source internet map
    server.
    
    The installed version of MapServer is affected by multiple cross-site
    scripting vulnerabilities and to a buffer overflow vulnerability.  To
    exploit those flaws an attacker needs to send specially crafted
    requests to the mapserv CGI.
    
    By exploiting the buffer overflow vulnerability, an attacker would be
    able to execute code on the remote host with the privileges of the web
    server.");
     script_set_attribute(attribute:"solution", value:"Upgrade to MapServer 4.10.3.");
     script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
     script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
     script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
     script_set_attribute(attribute:"exploit_available", value:"true");
     script_cwe_id(79);
    
     script_set_attribute(attribute:"plugin_publication_date", value:"2007/09/10");
    
     script_set_attribute(attribute:"potential_vulnerability", value:"true");
     script_set_attribute(attribute:"plugin_type", value:"remote");
     script_end_attributes();
    
     script_category(ACT_GATHER_INFO);
     script_family(english:"CGI abuses");
    
     script_copyright(english:"This script is Copyright (C) 2007-2018 Tenable Network Security, Inc.");
    
     script_dependencies("mapserver_detect.nasl");
     script_require_ports("Services/www", 80);
     script_require_keys("www/mapserver", "Settings/ParanoidReport");
     exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("http.inc");
    include("misc_func.inc");
    include("webapp_func.inc");
    
    if (report_paranoia < 2) audit(AUDIT_PARANOID);
    
    app_name = "MapServer";
    port = get_http_port(default:80);
    install = get_install_from_kb(appname:'mapserver', port:port, exit_on_fail:TRUE);
    version = install['ver'];
    url = build_url(port:port, qs:install['dir']);
    
    # Determine fixed version from branch.
    if (version =~ "^[0-4]($|[-\.])") fix = "4.10.3";
    else audit(AUDIT_WEB_APP_NOT_AFFECTED, app_name, url, version);
    
    if (ver_compare(app:'asterisk', ver:version, fix:fix) == -1 )
    {
      if(report_verbosity > 0)
      {
        report =
          '\n  URL           : ' + url +
          '\n  Version       : ' + version +
          '\n  Fixed version : ' + fix +
          '\n';
        security_hole(port:port,extra:report);
      }
      else security_hole(port);
      set_kb_item(name: 'www/'+port+'/XSS', value: TRUE);
      exit(0);
    }
    else audit(AUDIT_WEB_APP_NOT_AFFECTED, app_name, url, version);
    
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2007-2018.NASL
    description - Thu Aug 30 2007 Oliver Falk <oliver at linux-kernel.at> 4.10.3-2 - Add fix to include libmapserver (in some places), instead of libmap, that doesn
    last seen2020-06-01
    modified2020-06-02
    plugin id27745
    published2007-11-06
    reporterThis script is Copyright (C) 2007-2019 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/27745
    titleFedora 7 : mapserver-4.10.3-2.fc7 (2007-2018)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from Fedora Security Advisory 2007-2018.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(27745);
      script_version ("1.13");
      script_cvs_date("Date: 2019/08/02 13:32:25");
    
      script_cve_id("CVE-2007-4542", "CVE-2007-4629");
      script_xref(name:"FEDORA", value:"2007-2018");
    
      script_name(english:"Fedora 7 : mapserver-4.10.3-2.fc7 (2007-2018)");
      script_summary(english:"Checks rpm output for the updated packages.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Fedora host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "  - Thu Aug 30 2007 Oliver Falk <oliver at linux-kernel.at>
        4.10.3-2
    
        - Add fix to include libmapserver (in some places),
          instead of libmap, that doesn't exist (anymore)
    
      - Thu Aug 30 2007 Oliver Falk <oliver at linux-kernel.at>
        4.10.3-1
    
        - Update to fix bz#256561, CVE-2007-4542
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the Fedora security advisory. Tenable
    has attempted to automatically clean and format it as much as possible
    without introducing additional issues."
      );
      # https://lists.fedoraproject.org/pipermail/package-announce/2007-September/003615.html
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?a30944b3"
      );
      script_set_attribute(attribute:"solution", value:"Update the affected packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_cwe_id(79);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:mapserver");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:mapserver-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:mapserver-java");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:mapserver-perl");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:mapserver-python");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:php-mapserver");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:fedoraproject:fedora:7");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2007/09/04");
      script_set_attribute(attribute:"plugin_publication_date", value:"2007/11/06");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2007-2019 Tenable Network Security, Inc.");
      script_family(english:"Fedora Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/RedHat/release", "Host/RedHat/rpm-list");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    release = get_kb_item("Host/RedHat/release");
    if (isnull(release) || "Fedora" >!< release) audit(AUDIT_OS_NOT, "Fedora");
    os_ver = eregmatch(pattern: "Fedora.*release ([0-9]+)", string:release);
    if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Fedora");
    os_ver = os_ver[1];
    if (! ereg(pattern:"^7([^0-9]|$)", string:os_ver)) audit(AUDIT_OS_NOT, "Fedora 7.x", "Fedora " + os_ver);
    
    if (!get_kb_item("Host/RedHat/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "Fedora", cpu);
    
    flag = 0;
    if (rpm_check(release:"FC7", reference:"mapserver-4.10.3-2.fc7")) flag++;
    if (rpm_check(release:"FC7", reference:"mapserver-debuginfo-4.10.3-2.fc7")) flag++;
    if (rpm_check(release:"FC7", reference:"mapserver-java-4.10.3-2.fc7")) flag++;
    if (rpm_check(release:"FC7", reference:"mapserver-perl-4.10.3-2.fc7")) flag++;
    if (rpm_check(release:"FC7", reference:"mapserver-python-4.10.3-2.fc7")) flag++;
    if (rpm_check(release:"FC7", reference:"php-mapserver-4.10.3-2.fc7")) flag++;
    
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get());
      else security_hole(0);
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "mapserver / mapserver-debuginfo / mapserver-java / mapserver-perl / etc");
    }
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-1539.NASL
    descriptionChris Schmidt and Daniel Morissette discovered two vulnerabilities in mapserver, a development environment for spatial and mapping applications. The Common Vulnerabilities and Exposures project identifies the following two problems : - CVE-2007-4542 Lack of input sanitizing and output escaping in the CGI mapserver
    last seen2020-06-01
    modified2020-06-02
    plugin id31809
    published2008-04-11
    reporterThis script is Copyright (C) 2008-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/31809
    titleDebian DSA-1539-1 : mapserver - several vulnerabilities
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from Debian Security Advisory DSA-1539. The text 
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(31809);
      script_version("1.13");
      script_cvs_date("Date: 2019/08/02 13:32:21");
    
      script_cve_id("CVE-2007-4542", "CVE-2007-4629");
      script_xref(name:"DSA", value:"1539");
    
      script_name(english:"Debian DSA-1539-1 : mapserver - several vulnerabilities");
      script_summary(english:"Checks dpkg output for the updated package");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Debian host is missing a security-related update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "Chris Schmidt and Daniel Morissette discovered two vulnerabilities in
    mapserver, a development environment for spatial and mapping
    applications. The Common Vulnerabilities and Exposures project
    identifies the following two problems :
    
      - CVE-2007-4542
        Lack of input sanitizing and output escaping in the CGI
        mapserver's template handling and error reporting
        routines leads to cross-site scripting vulnerabilities.
    
      - CVE-2007-4629
        Missing bounds checking in mapserver's template handling
        leads to a stack-based buffer overrun vulnerability,
        allowing a remote attacker to execute arbitrary code
        with the privileges of the CGI or httpd user."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://security-tracker.debian.org/tracker/CVE-2007-4542"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://security-tracker.debian.org/tracker/CVE-2007-4629"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.debian.org/security/2008/dsa-1539"
      );
      script_set_attribute(
        attribute:"solution", 
        value:
    "Upgrade the mapserver (4.10.0-5.1+etch2) package.
    
    For the stable distribution (etch), these problems have been fixed in
    version 4.10.0-5.1+etch2."
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_cwe_id(79);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:mapserver");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:4.0");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2008/04/04");
      script_set_attribute(attribute:"plugin_publication_date", value:"2008/04/11");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2008-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Debian Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/Debian/release", "Host/Debian/dpkg-l");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("debian_package.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/Debian/release")) audit(AUDIT_OS_NOT, "Debian");
    if (!get_kb_item("Host/Debian/dpkg-l")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    if (deb_check(release:"4.0", prefix:"cgi-mapserver", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"mapserver-bin", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"mapserver-doc", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"perl-mapscript", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"php4-mapscript", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"php5-mapscript", reference:"4.10.0-5.1+etch2")) flag++;
    if (deb_check(release:"4.0", prefix:"python-mapscript", reference:"4.10.0-5.1+etch2")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:deb_report_get());
      else security_hole(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    

Seebug

bulletinFamilyexploit
descriptionBUGTRAQ ID: 25582 CVE(CAN) ID: CVE-2007-4542,CVE-2007-4629 MapServer是一个开源的开发环境,是基于CGI的通过万维网来传输动态GIS与图像的应用程序。 MapServer处理用户数据时存在多个安全漏洞,远程攻击者可能利用此漏洞导致缓冲区溢出或跨站脚本执行。 MapServer的maptemplate.c文件中的processLine()函数及mapserv.c文件中的writeError()函数没有正确验证某些参数便返回给了用户,这允许远程攻击者通过跨站脚本攻击注入并执行任意HTML和脚本代码。 MapServer的maptemplate.c文件中的processLine()函数还存在栈溢出漏洞。如果用户受骗打开的地图文件中层、组或元数据项的名称超过了5120字节的话,就可能触发这个溢出,导致拒绝服务或执行任意指令。 University of Minnesota MapServer 4.10.2 目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载: <a href="http://download.osgeo.org/mapserver/mapserver-4.10.3.tar.gz" target="_blank">http://download.osgeo.org/mapserver/mapserver-4.10.3.tar.gz</a>
idSSV:2202
last seen2017-11-19
modified2007-09-11
published2007-09-11
reporterRoot
titleMapServer远程栈溢出及跨站脚本漏洞