Jump to content

[SOLVED] Security question


Cardale

Recommended Posts

What line did it occur on, and what is that line?

 

 

A fairly common way for an attack to try to gain a full system path through an error message is to use a GET/POST/Cookie key of name[] to try to cause your script to error.

 

 

For example:

 

<?php

 

$name = (isset($_GET['name'])) ? $_GET['name'] : '';

$name = trim($name);

 

?>

 

Would give an error if someone went to script.php?name[]=blah

 

Since that would set $name to an array and then pass it to trim(), which does not accept an array.

I don't allow any get methods other than logging out at the moment.

 

This is what my error log reads

582 Time: 15 Nov 09 - 6:12:39 PM (PST) 
583 File: /var/www/root.php 
584 Line: 240 
585 Code: E_NOTICE 
586 Message: Array to string conversion 
587 IP: took it out
################################################## 

 

That line is the line that strips slashes.

if (get_magic_quotes_gpc()){  
$_GET = array_map('stripslashes', $_GET);  
$_POST = array_map('stripslashes', $_POST);  
$_COOKIE = array_map('stripslashes', $_COOKIE);  
}

Either $_GET, $_POST or $_COOKIE contains an array. Probably someone who tried to do stuff like ?foo[]=bar or whatever to see if he could generate an error.

 

See this:

php > var_dump(array_map('stripslashes', array(array())));

Notice: Array to string conversion in php shell code on line 1

Call Stack:
   60.0963     115064   1. {main}() php shell code:0
   60.0964     116000   2. array_map() php shell code:1

array(1) {
  [0]=>
  string(5) "Array"
}

So in this case the error that was triggered was done by a user attempting to inject code, or create an error.  What was this user trying to accomplish exactly?  Thanks for the information thus far by the way.

 

Most of the time it is just people probing seeing if they can get something to work to exploit your code, what they were trying to accomplish we have no clue...you will have to track down the user by the IP and ask them in person or lookup adding an array to get data and see what type of exploits come out of it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.