Jump to content

Recommended Posts

Posted

This came up in my current project, so I thought I would share.

<?php
function rawshell($cmd) {
 $t = time()."txt";
 $cmds = explode(";",$cmd);
 $out = '';
 foreach($cmds as $c) {
exec($c." &> ".$t);
$out .= file_get_contents($t);
 }
 exec("rm -f ".$t);
 return $out;
}
echo rawshell("ls -al; whoami");

 

What this will do is give you the output you would get as if you had done it via ssh.

 

**NOTE: THIS WILL NOT WORK ON SITES HOSTED HERE AS EXEC AND THE LIKE ARE DISABLED FOR SECURITY PURPOSES!**

  • 2 weeks later...
Posted

You are incorrect.

if you want security you can change the PATH var with env to not include other binaries, and you can also chroot it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...