Vulnerabilities > CVE-2004-1020 - Remote vulnerability in PHP

047910
CVSS 5.0 - MEDIUM
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
NONE
Availability impact
NONE
network
low complexity
php
nessus
exploit available

Summary

The addslashes function in PHP 4.3.9 does not properly escape a NULL (/0) character, which may allow remote attackers to read arbitrary files in PHP applications that contain a directory traversal vulnerability in require or include statements, but are otherwise protected by the magic_quotes_gpc mechanism. NOTE: this issue was originally REJECTed by its CNA before publication, but that decision is in active dispute. This candidate may change significantly in the future as a result of further discussion.

Vulnerable Configurations

Part Description Count
Application
Php
10

Exploit-Db

descriptionPHP 4/5 addslashes() NULL Byte Bypass. CVE-2004-1020. Remote exploit for php platform
idEDB-ID:24985
last seen2016-02-03
modified2004-12-16
published2004-12-16
reporterDaniel Fabian
sourcehttps://www.exploit-db.com/download/24985/
titlePHP 4/5 addslashes NULL Byte Bypass

Nessus

  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_SECUPD2005-001.NASL
    descriptionhe remote host is missing Security Update 2005-001. This security update contains a number of fixes for the following programs : - at commands - ColorSync - libxml2 - Mail - PHP - Safari - SquirrelMail These programs have multiple vulnerabilities which may allow a remote attacker to execute arbitrary code.
    last seen2020-06-01
    modified2020-06-02
    plugin id16251
    published2005-01-26
    reporterThis script is Copyright (C) 2005-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/16251
    titleMac OS X Multiple Vulnerabilities (Security Update 2005-001)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    if ( ! defined_func("bn_random") ) exit(0);
    if ( NASL_LEVEL < 3000) exit(0);
    
    include("compat.inc");
    
    if(description)
    {
     script_id(16251);
     script_version ("1.21");
     script_cve_id("CVE-2005-0125", "CVE-2005-0126", "CVE-2004-0989", "CVE-2005-0127", "CVE-2003-0860", 
                   "CVE-2003-0863", "CVE-2004-0594", "CVE-2004-0595", "CVE-2004-1018", "CVE-2004-1019", 
                   "CVE-2004-1020", "CVE-2004-1063", "CVE-2004-1064", "CVE-2004-1065", "CVE-2004-1314", 
                   "CVE-2004-1036");
     script_bugtraq_id(12367, 12366, 12297, 11857);
    
     script_name(english:"Mac OS X Multiple Vulnerabilities (Security Update 2005-001)");
     script_summary(english:"Check for Security Update 2005-001");
    
     script_set_attribute( attribute:"synopsis", value:
    "The remote host is missing a Mac OS X update that fixes a security
    issue." );
     script_set_attribute(attribute:"description",   value:
    "he remote host is missing Security Update 2005-001. This security
    update contains a number of fixes for the following programs :
    
      - at commands
      - ColorSync
      - libxml2
      - Mail
      - PHP
      - Safari
      - SquirrelMail
    
    These programs have multiple vulnerabilities which may allow a remote
    attacker to execute arbitrary code." );
     script_set_attribute(
       attribute:"see_also",
       value:"http://support.apple.com/kb/TA22859"
     );
     script_set_attribute(
       attribute:"solution", 
       value:"Install Security Update 2005-001."
     );
     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:H/RL:OF/RC:C");
     script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
     script_set_attribute(attribute:"exploit_available", value:"true");
     script_set_attribute(attribute:"exploited_by_malware", value:"true");
     script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
     script_set_attribute(attribute:"canvas_package", value:'CANVAS');
     script_cwe_id(20);
     script_set_attribute(attribute:"plugin_publication_date", value: "2005/01/26");
     script_set_attribute(attribute:"vuln_publication_date", value: "2003/07/16");
     script_set_attribute(attribute:"patch_publication_date", value: "2005/01/26");
     script_cvs_date("Date: 2018/07/14  1:59:35");
     script_set_attribute(attribute:"plugin_type", value:"local");
     script_set_attribute(attribute:"cpe", value:"cpe:/o:apple:mac_os_x");
     script_end_attributes();
     
     script_category(ACT_GATHER_INFO);
     script_family(english:"MacOS X Local Security Checks");
    
     script_copyright(english:"This script is Copyright (C) 2005-2018 Tenable Network Security, Inc.");
    
     script_dependencies("ssh_get_info.nasl");
     script_require_keys("Host/MacOSX/packages");
     exit(0);
    }
    
    
    packages = get_kb_item("Host/MacOSX/packages");
    if ( ! packages ) exit(0);
    
    uname = get_kb_item("Host/uname");
    # MacOS X 10.2.8, 10.3.7 only
    if ( egrep(pattern:"Darwin.* (6\.8\.|7\.7\.)", string:uname) )
    {
      if ( ! egrep(pattern:"^SecUpd(Srvr)?2005-001", string:packages) ) security_hole(0);
    	else non_vuln = 1;
    }
    else if ( egrep(pattern:"Darwin.* (6\.9|[0-9][0-9]\.|7\.([8-9]\.|[0-9][0-9]\.))", string:uname) ) non_vuln = 1;
    
    if ( non_vuln )
    {
     list = make_list("CVE-2005-0125", "CVE-2005-0126", "CVE-2004-0989", "CVE-2005-0127", "CVE-2003-0860", "CVE-2003-0863", "CVE-2004-0594", "CVE-2004-0595", "CVE-2004-1018", "CVE-2004-1019", "CVE-2004-1020", "CVE-2004-1063", "CVE-2004-1064", "CVE-2004-1065", "CVE-2004-1314", "CVE-2004-1036");
     foreach cve (list) set_kb_item(name:cve, value:TRUE);
    }
    
  • NASL familyCGI abuses
    NASL idPHP45_MULTIPLE_FLAWS.NASL
    descriptionAccording to its banner, the version of PHP installed on the remote host is prior to 4.3.10 / 5.0.3. It is, therefore, affected by multiple security issues that could, under certain circumstances, allow an attacker to execute arbitrary code on the remote host, provided that the attacker can pass arbitrary data to some functions, or to bypass safe_mode.
    last seen2020-06-01
    modified2020-06-02
    plugin id15973
    published2004-12-15
    reporterThis script is Copyright (C) 2004-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/15973
    titlePHP < 4.3.10 / 5.0.3 Multiple Vulnerabilities
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    # Ref:
    #  Date: Wed, 15 Dec 2004 19:46:20 +0100
    #  From: Stefan Esser <[email protected]>
    #  To: [email protected], [email protected]
    #  Subject: Advisory 01/2004: Multiple vulnerabilities in PHP 4/5  
    #
    
    
    include("compat.inc");
    
    if(description)
    {
      script_id(15973);
      script_version("1.23");
      script_cvs_date("Date: 2018/07/24 18:56:10");
    
      script_cve_id(
        "CVE-2004-1018", 
        "CVE-2004-1019", 
        "CVE-2004-1020", 
        "CVE-2004-1063", 
        "CVE-2004-1064", 
        "CVE-2004-1065"
      );
      script_bugtraq_id(
        11964, 
        11981, 
        11992, 
        12045
      );
    
      script_name(english:"PHP < 4.3.10 / 5.0.3 Multiple Vulnerabilities");
      script_summary(english:"Checks for version of PHP");
    
      script_set_attribute(
        attribute:"synopsis",
        value:
    "The remote web server uses a version of PHP that is potentially
    affected by multiple vulnerabilities."
      );
      script_set_attribute(
        attribute:"description",
        value:
    "According to its banner, the version of PHP installed on the remote
    host is prior to 4.3.10 / 5.0.3.  It is, therefore, affected by
    multiple security issues that could, under certain circumstances,
    allow an attacker to execute arbitrary code on the remote host,
    provided that the attacker can pass arbitrary data to some
    functions, or to bypass safe_mode."
      );
      script_set_attribute(attribute:"see_also", value:"http://www.php.net/ChangeLog-5.php#5.0.3" );
      script_set_attribute(attribute:"solution", value:
    "Upgrade to PHP 5.0.3 or 4.3.10." );
      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:"No exploit is required");
      script_set_attribute(attribute:"exploit_available", value:"false");
      script_cwe_id(20);
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2004/11/23");
      script_set_attribute(attribute:"patch_publication_date", value:"2004/12/14");
      script_set_attribute(attribute:"plugin_publication_date", value:"2004/12/15");
      
      script_set_attribute(attribute:"plugin_type", value:"remote");
      script_set_attribute(attribute:"cpe",value:"cpe:/a:php:php");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"CGI abuses");
    
      script_copyright(english:"This script is Copyright (C) 2004-2018 Tenable Network Security, Inc.");
    
      script_dependencies("php_version.nasl");
      script_require_ports("Services/www", 80);
      script_require_keys("www/PHP");
      exit(0);
    }
    
    #
    # The script code starts here
    #
    include("global_settings.inc");
    include("misc_func.inc");
    include("http.inc");
    include("audit.inc");
    include("webapp_func.inc");
    
    port = get_http_port(default:80, php:TRUE);
    
    php = get_php_from_kb(
      port : port,
      exit_on_fail : TRUE
    );
    
    version = php["ver"];
    source = php["src"];
    
    backported = get_kb_item('www/php/'+port+'/'+version+'/backported');
    
    if (report_paranoia < 2 && backported)
      audit(AUDIT_BACKPORT_SERVICE, port, "PHP "+version+" install");
    
    if (version =~ "^4\.[012]\." ||
        version =~ "^4\.3\.[0-9]($|[^0-9])" ||
        version =~ "^5\.0\.[012]($|[^0-9])"
    )
    {
      if (report_verbosity > 0)
      {
        report =
          '\n  Version source     : '+source +
          '\n  Installed version  : '+version+
          '\n  Fixed version      : 4.3.10 / 5.0.3\n';
        security_hole(port:port, extra:report);
      }
      else security_hole(port);
      exit(0);
    }
    else audit(AUDIT_LISTEN_NOT_VULN, "PHP", port, version);
    
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-200412-14.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-200412-14 (PHP: Multiple vulnerabilities) Stefan Esser and Marcus Boerger reported several different issues in the unserialize() function, including serious exploitable bugs in the way it handles negative references (CAN-2004-1019). Stefan Esser also discovered that the pack() and unpack() functions are subject to integer overflows that can lead to a heap buffer overflow and a heap information leak. Finally, he found that the way multithreaded PHP handles safe_mode_exec_dir restrictions can be bypassed, and that various path truncation issues also allow to bypass path and safe_mode restrictions. Ilia Alshanetsky found a stack overflow issue in the exif_read_data() function (CAN-2004-1065). Finally, Daniel Fabian found that addslashes and magic_quotes_gpc do not properly escape null characters and that magic_quotes_gpc contains a bug that could lead to one level directory traversal. Impact : These issues could be exploited by a remote attacker to retrieve web server heap information, bypass safe_mode or path restrictions and potentially execute arbitrary code with the rights of the web server running a PHP application. Workaround : There is no known workaround at this time.
    last seen2020-06-01
    modified2020-06-02
    plugin id16001
    published2004-12-19
    reporterThis script is Copyright (C) 2004-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/16001
    titleGLSA-200412-14 : PHP: Multiple vulnerabilities
  • NASL familyMandriva Local Security Checks
    NASL idMANDRAKE_MDKSA-2004-151.NASL
    descriptionA number of vulnerabilities in PHP versions prior to 4.3.10 were discovered by Stefan Esser. Some of these vulnerabilities were not deemed to be severe enough to warrant CVE names, however the packages provided, with the exception of the Corporate Server 2.1 packages, include fixes for all of the vulnerabilities, thanks to the efforts of the OpenPKG team who extracted and backported the fixes. The vulnerabilities fixed in all provided packages include a fix for a possible information disclosure, double free, and negative reference index array underflow in deserialization code (CVE-2004-1019). As well, the exif_read_data() function suffers from an overflow on a long sectionname; this vulnerability was discovered by Ilia Alshanetsky (CVE-2004-1065). The other fixes that appear in Mandrakelinux 9.2 and newer packages include a fix for out of bounds memory write access in shmop_write() and integer overflow/underflows in the pack() and unpack() functions. The addslashes() function did not properly escape
    last seen2020-06-01
    modified2020-06-02
    plugin id15998
    published2004-12-19
    reporterThis script is Copyright (C) 2004-2019 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/15998
    titleMandrake Linux Security Advisory : php (MDKSA-2004:151)

Statements

contributorJoshua Bressers
lastmodified2007-08-26
organizationRed Hat
statementRed Hat does not consider this issue to be a security vulnerability since no trust boundary is crossed. There are no known uses of this function which could allow a remote attacker to execute arbitrary code.