Vulnerabilities > CVE-2007-6454 - Improper Restriction of Operations Within the Bounds of A Memory Buffer vulnerability in Peercast 0.1211/0.1212/0.1215

047910
CVSS 10.0 - CRITICAL
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
network
low complexity
peercast
CWE-119
critical
nessus
exploit available

Summary

Heap-based buffer overflow in the handshakeHTTP function in servhs.cpp in PeerCast 0.1217 and earlier, and SVN 344 and earlier, allows remote attackers to cause a denial of service and possibly execute arbitrary code via a long SOURCE request.

Vulnerable Configurations

Part Description Count
Application
Peercast
4

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Overflow Buffers
    Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an attacker. As a consequence, an attacker is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the attackers' choice.
  • Client-side Injection-induced Buffer Overflow
    This type of attack exploits a buffer overflow vulnerability in targeted client software through injection of malicious content from a custom-built hostile service.
  • Filter Failure through Buffer Overflow
    In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. the user input is let into the system unfiltered).
  • MIME Conversion
    An attacker exploits a weakness in the MIME conversion routine to cause a buffer overflow and gain control over the mail server machine. The MIME system is designed to allow various different information formats to be interpreted and sent via e-mail. Attack points exist when data are converted to MIME compatible format and back.

Exploit-Db

descriptionPeerCast 0.12 HandshakeHTTP Multiple Buffer Overflow Vulnerabilities. CVE-2007-6454. Dos exploit for linux platform
idEDB-ID:30894
last seen2016-02-03
modified2007-12-17
published2007-12-17
reporterLuigi Auriemma
sourcehttps://www.exploit-db.com/download/30894/
titlePeerCast 0.12 HandshakeHTTP Multiple Buffer Overflow Vulnerabilities

Nessus

  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_31435FBCAE7311DCA5F9001A4D49522B.NASL
    descriptionLuigi Auriemma reports that peercast is vulnerable to a buffer overflow which could lead to a DoS or potentially remote code execution : The handshakeHTTP function which handles all the requests received by the other clients is vulnerable to a heap overflow which allows an attacker to fill the loginPassword and loginMount buffers located in the Servent class with how much data he wants.
    last seen2020-06-01
    modified2020-06-02
    plugin id29770
    published2007-12-24
    reporterThis script is Copyright (C) 2007-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/29770
    titleFreeBSD : peercast -- buffer overflow vulnerability (31435fbc-ae73-11dc-a5f9-001a4d49522b)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from the FreeBSD VuXML database :
    #
    # Copyright 2003-2018 Jacques Vidrine and contributors
    #
    # Redistribution and use in source (VuXML) and 'compiled' forms (SGML,
    # HTML, PDF, PostScript, RTF and so forth) with or without modification,
    # are permitted provided that the following conditions are met:
    # 1. Redistributions of source code (VuXML) must retain the above
    #    copyright notice, this list of conditions and the following
    #    disclaimer as the first lines of this file unmodified.
    # 2. Redistributions in compiled form (transformed to other DTDs,
    #    published online in any format, converted to PDF, PostScript,
    #    RTF and other formats) must reproduce the above copyright
    #    notice, this list of conditions and the following disclaimer
    #    in the documentation and/or other materials provided with the
    #    distribution.
    # 
    # THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
    # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
    # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION,
    # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(29770);
      script_version("1.14");
      script_cvs_date("Date: 2019/08/02 13:32:38");
    
      script_cve_id("CVE-2007-6454");
      script_xref(name:"Secunia", value:"28120");
    
      script_name(english:"FreeBSD : peercast -- buffer overflow vulnerability (31435fbc-ae73-11dc-a5f9-001a4d49522b)");
      script_summary(english:"Checks for updated package in pkg_info output");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote FreeBSD host is missing a security-related update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "Luigi Auriemma reports that peercast is vulnerable to a buffer
    overflow which could lead to a DoS or potentially remote code
    execution :
    
    The handshakeHTTP function which handles all the requests received by
    the other clients is vulnerable to a heap overflow which allows an
    attacker to fill the loginPassword and loginMount buffers located in
    the Servent class with how much data he wants."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"http://aluigi.altervista.org/adv/peercasthof-adv.txt"
      );
      # https://vuxml.freebsd.org/freebsd/31435fbc-ae73-11dc-a5f9-001a4d49522b.html
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?27266621"
      );
      script_set_attribute(attribute:"solution", value:"Update the affected package.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      script_cwe_id(119);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:peercast");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2007/12/17");
      script_set_attribute(attribute:"patch_publication_date", value:"2007/12/19");
      script_set_attribute(attribute:"plugin_publication_date", value:"2007/12/24");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2007-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"FreeBSD Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/FreeBSD/release", "Host/FreeBSD/pkg_info");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("freebsd_package.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/FreeBSD/release")) audit(AUDIT_OS_NOT, "FreeBSD");
    if (!get_kb_item("Host/FreeBSD/pkg_info")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    
    if (pkg_test(save_report:TRUE, pkg:"peercast<0.1218")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:pkg_report_get());
      else security_hole(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-200801-22.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-200801-22 (PeerCast: Buffer overflow) Luigi Auriemma reported a heap-based buffer overflow within the
    last seen2020-06-01
    modified2020-06-02
    plugin id30139
    published2008-02-01
    reporterThis script is Copyright (C) 2008-2019 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/30139
    titleGLSA-200801-22 : PeerCast: Buffer overflow
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from Gentoo Linux Security Advisory GLSA 200801-22.
    #
    # The advisory text is Copyright (C) 2001-2015 Gentoo Foundation, Inc.
    # and licensed under the Creative Commons - Attribution / Share Alike 
    # license. See http://creativecommons.org/licenses/by-sa/3.0/
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(30139);
      script_version("1.13");
      script_cvs_date("Date: 2019/08/02 13:32:44");
    
      script_cve_id("CVE-2007-6454");
      script_xref(name:"GLSA", value:"200801-22");
    
      script_name(english:"GLSA-200801-22 : PeerCast: Buffer overflow");
      script_summary(english:"Checks for updated package(s) in /var/db/pkg");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:
    "The remote Gentoo host is missing one or more security-related
    patches."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "The remote host is affected by the vulnerability described in GLSA-200801-22
    (PeerCast: Buffer overflow)
    
        Luigi Auriemma reported a heap-based buffer overflow within the
        'handshakeHTTP()' function when processing HTTP requests.
      
    Impact :
    
        A remote attacker could send a specially crafted request to the
        vulnerable server, possibly resulting in the remote execution of
        arbitrary code with the privileges of the user running the PeerCast
        server, usually 'nobody'.
      
    Workaround :
    
        There is no known workaround at this time."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://security.gentoo.org/glsa/200801-22"
      );
      script_set_attribute(
        attribute:"solution", 
        value:
    "All PeerCast users should upgrade to the latest version:
        # emerge --sync
        # emerge --ask --oneshot --verbose '>=media-sound/peercast-0.1218'"
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      script_cwe_id(119);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:gentoo:linux:peercast");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:gentoo:linux");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2008/01/30");
      script_set_attribute(attribute:"plugin_publication_date", value:"2008/02/01");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2008-2019 Tenable Network Security, Inc.");
      script_family(english:"Gentoo Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/Gentoo/release", "Host/Gentoo/qpkg-list");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("global_settings.inc");
    include("qpkg.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/Gentoo/release")) audit(AUDIT_OS_NOT, "Gentoo");
    if (!get_kb_item("Host/Gentoo/qpkg-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    
    if (qpkg_check(package:"media-sound/peercast", unaffected:make_list("ge 0.1218"), vulnerable:make_list("lt 0.1218"))) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:qpkg_report_get());
      else security_hole(0);
      exit(0);
    }
    else
    {
      tested = qpkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "PeerCast");
    }
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-1441.NASL
    descriptionLuigi Auriemma discovered that PeerCast, a P2P audio and video streaming server, is vulnerable to a heap overflow in the HTTP server code, which allows remote attackers to cause a denial of service and possibly execute arbitrary code via a long SOURCE request.
    last seen2020-06-01
    modified2020-06-02
    plugin id29808
    published2007-12-31
    reporterThis script is Copyright (C) 2007-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/29808
    titleDebian DSA-1441-1 : peercast - buffer overflow
    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-1441. The text 
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(29808);
      script_version("1.14");
      script_cvs_date("Date: 2019/08/02 13:32:20");
    
      script_cve_id("CVE-2007-6454");
      script_xref(name:"DSA", value:"1441");
    
      script_name(english:"Debian DSA-1441-1 : peercast - buffer overflow");
      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:
    "Luigi Auriemma discovered that PeerCast, a P2P audio and video
    streaming server, is vulnerable to a heap overflow in the HTTP server
    code, which allows remote attackers to cause a denial of service and
    possibly execute arbitrary code via a long SOURCE request."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457300"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.debian.org/security/2007/dsa-1441"
      );
      script_set_attribute(
        attribute:"solution", 
        value:
    "Upgrade the peercast packages.
    
    The old stable distribution (sarge) does not contain peercast.
    
    For the stable distribution (etch), this problem has been fixed in
    version 0.1217.toots.20060314-1etch0."
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      script_cwe_id(119);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:peercast");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:4.0");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2007/12/28");
      script_set_attribute(attribute:"plugin_publication_date", value:"2007/12/31");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2007-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:"libpeercast0", reference:"0.1217.toots.20060314-1etch0")) flag++;
    if (deb_check(release:"4.0", prefix:"libpeercast0-dev", reference:"0.1217.toots.20060314-1etch0")) flag++;
    if (deb_check(release:"4.0", prefix:"peercast", reference:"0.1217.toots.20060314-1etch0")) flag++;
    if (deb_check(release:"4.0", prefix:"peercast-handlers", reference:"0.1217.toots.20060314-1etch0")) flag++;
    if (deb_check(release:"4.0", prefix:"peercast-servent", reference:"0.1217.toots.20060314-1etch0")) 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");
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-1583.NASL
    descriptionSeveral remote vulnerabilities have been discovered in GNOME PeerCast, the GNOME interface to PeerCast, a P2P audio and video streaming server. The Common Vulnerabilities and Exposures project identifies the following problems : - CVE-2007-6454 Luigi Auriemma discovered that PeerCast is vulnerable to a heap overflow in the HTTP server code, which allows remote attackers to cause a denial of service and possibly execute arbitrary code via a long SOURCE request. - CVE-2008-2040 Nico Golde discovered that PeerCast, a P2P audio and video streaming server, is vulnerable to a buffer overflow in the HTTP Basic Authentication code, allowing a remote attacker to crash PeerCast or execute arbitrary code.
    last seen2020-06-01
    modified2020-06-02
    plugin id32405
    published2008-05-22
    reporterThis script is Copyright (C) 2008-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/32405
    titleDebian DSA-1583-1 : gnome-peercast - buffer overflow
    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-1583. The text 
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(32405);
      script_version("1.13");
      script_cvs_date("Date: 2019/08/02 13:32:21");
    
      script_cve_id("CVE-2007-6454", "CVE-2008-2040");
      script_xref(name:"DSA", value:"1583");
    
      script_name(english:"Debian DSA-1583-1 : gnome-peercast - buffer overflow");
      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:
    "Several remote vulnerabilities have been discovered in GNOME PeerCast,
    the GNOME interface to PeerCast, a P2P audio and video streaming
    server. The Common Vulnerabilities and Exposures project identifies
    the following problems :
    
      - CVE-2007-6454
        Luigi Auriemma discovered that PeerCast is vulnerable to
        a heap overflow in the HTTP server code, which allows
        remote attackers to cause a denial of service and
        possibly execute arbitrary code via a long SOURCE
        request.
    
      - CVE-2008-2040
        Nico Golde discovered that PeerCast, a P2P audio and
        video streaming server, is vulnerable to a buffer
        overflow in the HTTP Basic Authentication code, allowing
        a remote attacker to crash PeerCast or execute arbitrary
        code."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466539"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://security-tracker.debian.org/tracker/CVE-2007-6454"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://security-tracker.debian.org/tracker/CVE-2008-2040"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.debian.org/security/2008/dsa-1583"
      );
      script_set_attribute(
        attribute:"solution", 
        value:
    "Upgrade the gnome-peercast package.
    
    For the stable distribution (etch), these problems have been fixed in
    version 0.5.4-1.1etch0.
    
    gnome-peercast has been removed from the unstable distribution (sid)."
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      script_cwe_id(119);
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:gnome-peercast");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:4.0");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2008/05/20");
      script_set_attribute(attribute:"plugin_publication_date", value:"2008/05/22");
      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:"gnome-peercast", reference:"0.5.4-1.1etch0")) 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");
    
  • NASL familyPeer-To-Peer File Sharing
    NASL idPEERCAST_01218.NASL
    descriptionThe version of PeerCast installed on the remote host fails to check the length of user-supplied data in its
    last seen2020-06-01
    modified2020-06-02
    plugin id29726
    published2007-12-18
    reporterThis script is Copyright (C) 2007-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/29726
    titlePeerCast servhs.cpp handshakeHTTP Function SOURCE Request Remote Overflow
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    
    include("compat.inc");
    
    if (description)
    {
      script_id(29726);
      script_version("1.14");
    
      script_cve_id("CVE-2007-6454");
      script_bugtraq_id(26899);
    
      script_name(english:"PeerCast servhs.cpp handshakeHTTP Function SOURCE Request Remote Overflow");
      script_summary(english:"Checks for overflow in PeerCast web server");
     
     script_set_attribute(attribute:"synopsis", value:
    "The remote web server is affected by a buffer overflow vulnerability." );
     script_set_attribute(attribute:"description", value:
    "The version of PeerCast installed on the remote host fails to check
    the length of user-supplied data in its 'handshakeHTTP' function in
    'servhs.cpp' before copying it to the 'loginPassword' and 'loginMount'
    heap-based buffers.  An unauthenticated attacker can leverage this
    issue to crash the affected application or execute arbitrary code on
    the remote host, subject to the privileges under which PeerCast
    operates." );
     script_set_attribute(attribute:"see_also", value:"https://www.securityfocus.com/archive/1/485199/30/0/threaded" );
     script_set_attribute(attribute:"solution", value:
    "Upgrade to PeerCast version 0.1218 or later." );
     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:POC/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(119);
    
    
     script_set_attribute(attribute:"plugin_publication_date", value: "2007/12/18");
     script_cvs_date("Date: 2018/11/15 20:50:24");
    script_set_attribute(attribute:"plugin_type", value:"remote");
    script_set_attribute(attribute:"cpe", value:"cpe:/a:peercast:peercast");
    script_end_attributes();
    
    
      script_category(ACT_MIXED_ATTACK);
      script_family(english:"Peer-To-Peer File Sharing");
      script_copyright(english:"This script is Copyright (C) 2007-2018 Tenable Network Security, Inc.");
      script_dependencies("peercast_installed.nasl");
      script_require_keys("PeerCast/installed");
      script_require_ports("Services/www", 7144, 7145);
    
      exit(0);
    }
    
    
    if (!get_kb_item("PeerCast/installed")) exit(0);
    
    include("global_settings.inc");
    include("misc_func.inc");
    include("http.inc");
    
    
    list = get_kb_list("PeerCast/*/version");
    if (isnull(list)) exit(0);
    
    foreach key (keys(list))
    {
      port = key - "PeerCast/" - "/version";
      ver = list[key];
    
      if (get_port_state(port))
      {
        # If safe checks are enabled...
        if (safe_checks())
        {
          # Check the version.
          vuln = FALSE;
    
          if (ver =~ "^[0-9]\.[0-9]+$")
          {
            iver = split(ver, sep:'.', keep:FALSE);
            for (i=0; i<max_index(iver); i++)
              iver[i] = int(iver[i]);
    
            if (iver[0] == 0 && iver[1] < 1218) vuln = TRUE;
          }
          else if (report_paranoia > 1) vuln = TRUE;
    
          if (vuln)
          {
           report = string(
              "According to its Server response header, the version of PeerCast on the\n",
              "remote host is :\n",
              "\n",
              "  ", ver, "\n"
            );
            security_hole(port:port, extra:report);
            break;
          }
        }
        # Otherwise...
        else
        {
          # Make sure the server's up.
          if (http_is_dead(port:port)) exit(1);
    
          # Try to crash it.
          req = string("SOURCE ", crap(data:"A", length:165), "\r\n\r\n");
          r = http_send_recv_buf(port:port, data: req);
    
          # There's a problem if the server's down.
          if (http_is_dead(port:port))
          {
            security_hole(port);
            exit(0);
          }
        }
      }
    }