what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

012004.txt

012004.txt
Posted Dec 30, 2004
Authored by Stefan Esser | Site hardened-php.net

Hardened-PHP Project Security Advisory - Several vulnerabilities within PHP allow local and remote execution of arbitrary code. PHP4 versions 4.3.9 and below and PHP5 version 5.0.2 and below are affected.

tags | advisory, remote, arbitrary, local, php, vulnerability
advisories | CVE-2004-1018, CVE-2004-1019, CVE-2004-1063, CVE-2004-1064
SHA-256 | ed1ef90ff012b77b27997a86a514190dac77644dc99eaeeab47035e716b3d0cf

012004.txt

Change Mirror Download
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hardened-PHP Project
www.hardened-php.net

-= Security Advisory =-



Advisory: Multiple vulnerabilities within PHP 4/5
Release Date: 2004/12/15
Last Modified: 2004/12/15
Author: Stefan Esser [sesser@php.net]

Application: PHP4 <= 4.3.9
PHP5 <= 5.0.2
Severity: Several vulnerabilities within PHP allow
local and remote execution of arbitrary code
Risk: Critical
Vendor Status: Vendor has released bugfixed versions.
References: http://www.hardened-php.net/advisories/012004.txt


Overview:

PHP is a widely-used general-purpose scripting language that is
especially suited for Web development and can be embedded into HTML.

During the development of Hardened-PHP which adds security hardening
features to the PHP codebase, several vulnerabilities within PHP
were discovered that reach from bufferoverflows, over information
leak vulnerabilities and path truncation vulnerabilities to
safe_mode restriction bypass vulnerabilities.


Details:

[01 - pack() - integer overflow leading to heap bufferoverflow ]

Insufficient validation of the parameters passed to pack() can
lead to a heap overflow which can be used to execute arbitrary
code from within a PHP script. This enables an attacker to
bypass safe_mode restrictions and execute arbitrary code with
the permissions of the webserver. Due to the nature of this
function it is unlikely that a script accidently exposes it to
remote attackers.

[02 - unpack() - integer overflow leading to heap info leak ]

Insufficient validation of the parameters passed to unpack() can
lead to a heap information leak which can be used to retrieve
secret data from the apache process. Additionally a skilled
local attacker could use this vulnerability in combination with
01 to bypass heap canary protection systems. Similiar to 01 this
function is usually not used on user supplied data within
webapplications.

[03 - safe_mode_exec_dir bypass in multithreaded PHP ]

When safe_mode is activated within PHP, it is only allowed to
execute commands within the configured safe_mode_exec_dir.
Unfourtunately PHP does prepend a "cd [currentdir] ;" to any
executed command when a PHP is running on a multithreaded unix
webserver (f.e. some installations of Apache2). Because the name
of the current directory is prepended directly a local attacker
may bypass safe_mode_exec_dir restrictions by injecting shell-
commands into the current directory name.

[04 - safe_mode bypass through path truncation ]

The safe_mode checks silently truncated the file path at MAXPATHLEN
bytes before passing it to realpath(). In combination with certain
malfunctional implementations of realpath() f.e. within glibc this
allows crafting a filepath that pass the safe_mode check although
it points to a file that should fail the safe_mode check.

[05 - path truncation in realpath() ]

PHP uses realpath() within several places to get the real path
of files. Unfourtunately some implementations of realpath() silently
truncate overlong filenames (f.e. OpenBSD, and older NetBSD/FreeBSD)
This can lead to arbitrary file include vulnerabilities if something
like "include "modules/$userinput/config.inc.php"; is used on such
systems.

[06 - unserialize() - wrong handling of negative references ]

The variable unserializer could be fooled with negative references
to add false zvalues to hashtables. When those hashtables get
destroyed this can lead to efree()s of arbitrary memory addresses
which can result in arbitrary code execution. (Unless Hardened-PHP's
memory manager canaries are activated)

[07 - unserialize() - wrong handling of references to freed data ]

Additionally to bug 07 the previous version of the variable
unserializer allowed setting references to already freed entries in
the variable hash. A skilled attacker can exploit this to create
an universal string that will pass execution to an arbitrary
memory address when it is passed to unserialize(). For AMD64 systems
a string was developed that directly passes execution to code
contained in the string itself.

It is necessary to understand that these strings can exploit a
bunch of popular PHP applications remotely because they pass f.e.
cookie content to unserialize().

Examples of vulnerable scripts:

- phpBB2
- Invision Board
- vBulletin
- Woltlab Burning Board 2.x
- Serendipity Weblog
- phpAds(New)
- ...


Proof of Concept:

The Hardened-PHP project is not going to release exploits for any
of these vulnerabilities to the public.


CVE Information:

The Common Vulnerabilities and Exposures project (cve.mitre.org) has
assigned the name CAN-2004-1018 to issues 01, 02, the name
CAN-2004-1019 to issues 06, 07, the name CAN-2004-1063 to issue 03
and the name CAN-2004-1064 to issues 04, 05.


Recommendation:

It is strongly recommended to upgrade to the new PHP-Releases as
soon as possible, because a lot of PHP applications expose the
easy to exploit unserialize() vulnerability to remote attackers.
Additionally we always recommend to run PHP with the Hardened-PHP
patch applied.


GPG-Key:

http://www.hardened-php.net/hardened-php-signature-key.asc

pub 1024D/0A864AA1 2004-04-17 Hardened-PHP Signature Key
Key fingerprint = 066F A6D0 E57E 9936 9082 7E52 4439 14CC 0A86 4AA1


Copyright 2004 Stefan Esser. All rights reserved.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFBwDo7RDkUzAqGSqERAgVxAKC0LnTE49y5HFjeXpwXrZmAjuCL8gCgpQUl
rtmmBfJ3iv9Ksb/xtnyflD0=
=lzXX
-----END PGP SIGNATURE-----

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close