Post
Topic
Board Services
Re: Hack my site, receive bitcoins
by
johnnyfla123
on 19/06/2013, 18:31:35 UTC
I will give it a try later today.. Sure it was done through the form and not through FTP?
Nearly positive. I was told by the hacker it was done through the login form. First he modified the login page, then probably grabbed my SQL login through a similar manner.
Or... that's just a red herring. I highly doubt a SQL exploit can modify web pages.
I never said it was an SQLi. I just know it used the login form that uses an SQL database, and he just managed to grab my SQL info for other purposes after breaking my form.
do you have brute force protection as well? because someone can just run bruteforce until it pops a correct user and pass.
That isn't the issue here.


derp sorry. to me it sounds like sql injection just put this at the header of every page and that will reject those requests and log their ip and the string they tried to use. Also are you running this website from home using apache?

Code:




$ip $_SERVER['REMOTE_ADDR'];
$time date("l dS of F Y h:i:s A");
$script $_SERVER[PATH_TRANSLATED];
$fp fopen ("[WEB]SQL_Injection.txt""a+");
$sql_inject_1 = array(";","'","%",'"'); #Whoth need replace
$sql_inject_2 = array("""","","""); #To wont replace
$GET_KEY array_keys($_GET); #array keys from $_GET
$POST_KEY array_keys($_POST); #array keys from $_POST
$COOKIE_KEY array_keys($_COOKIE); #array keys from $_COOKIE
/*begin clear $_GET */
for($i=0;$i<count($GET_KEY);$i++)
{
$real_get[$i] = $_GET[$GET_KEY[$i]];
$_GET[$GET_KEY[$i]] = str_replace($sql_inject_1$sql_inject_2HtmlSpecialChars($_GET[$GET_KEY[$i]]));
if(
$real_get[$i] != $_GET[$GET_KEY[$i]])
{
fwrite ($fp"IP: $ip\r\n");
fwrite ($fp"Method: GET\r\n");
fwrite ($fp"Value: $real_get[$i]\r\n");
fwrite ($fp"Script: $script\r\n");
fwrite ($fp"Time: $time\r\n");
fwrite ($fp"==================================\r\n");
}
}
/*end clear $_GET */
/*begin clear $_POST */
for($i=0;$i<count($POST_KEY);$i++)
{
$real_post[$i] = $_POST[$POST_KEY[$i]];
$_POST[$POST_KEY[$i]] = str_replace($sql_inject_1$sql_inject_2HtmlSpecialChars($_POST[$POST_KEY[$i]]));
if(
$real_post[$i] != $_POST[$POST_KEY[$i]])
{
fwrite ($fp"IP: $ip\r\n");
fwrite ($fp"Method: POST\r\n");
fwrite ($fp"Value: $real_post[$i]\r\n");
fwrite ($fp"Script: $script\r\n");
fwrite ($fp"Time: $time\r\n");
fwrite ($fp"==================================\r\n");
}
}
/*end clear $_POST */
/*begin clear $_COOKIE */
for($i=0;$i<count($COOKIE_KEY);$i++)
{
$real_cookie[$i] = $_COOKIE[$COOKIE_KEY[$i]];
$_COOKIE[$COOKIE_KEY[$i]] = str_replace($sql_inject_1$sql_inject_2HtmlSpecialChars($_COOKIE[$COOKIE_KEY[$i]]));
if(
$real_cookie[$i] != $_COOKIE[$COOKIE_KEY[$i]])
{
fwrite ($fp"IP: $ip\r\n");
fwrite ($fp"Method: COOKIE\r\n");
fwrite ($fp"Value: $real_cookie[$i]\r\n");
fwrite ($fp"Script: $script\r\n");
fwrite ($fp"Time: $time\r\n");
fwrite ($fp"==================================\r\n");
}
}

/*end clear $_COOKIE */
fclose ($fp);
?>


The server is a professional setup that my friend owns (he hosts many sites). I'd normally have logs of what strings were used but not in this case. I'll add this for the future, thanks.

Still searching for the actual exploit. The hacker claimed it was relatively simple to execute but I can't imagine how he manage to modify the page permanently unless he had a way to escape and execute his own PHP.

their may be a exploit in the apache server that hosts the site. in regular apache that isn't modified it would take someone a few seconds to gain access and deface a site or have access to all the files. You might be able ot find how he did it be googling something to do with apache and defacing sites/ gaining access to db's