Cardale Posted November 16, 2009 Share Posted November 16, 2009 I had an error in my log saying "Array to string conversion" is this a potentially dangerous error? Could this be someone trying to do something. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/ Share on other sites More sharing options...
mikesta707 Posted November 16, 2009 Share Posted November 16, 2009 I'm pretty sure that happens when you are trying to use arrays as strings, such as $array = array(stuff); echo $array; without seeing the code that the error occurred on I can't be much help though Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958206 Share on other sites More sharing options...
Cardale Posted November 16, 2009 Author Share Posted November 16, 2009 I have tried to reproduce the error, but it occurred on a different user and was reported through my log. So far I don't see any error. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958207 Share on other sites More sharing options...
corbin Posted November 16, 2009 Share Posted November 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958211 Share on other sites More sharing options...
Cardale Posted November 16, 2009 Author Share Posted November 16, 2009 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); } Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958295 Share on other sites More sharing options...
Daniel0 Posted November 16, 2009 Share Posted November 16, 2009 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" } Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958312 Share on other sites More sharing options...
Cardale Posted November 16, 2009 Author Share Posted November 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958716 Share on other sites More sharing options...
premiso Posted November 16, 2009 Share Posted November 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958718 Share on other sites More sharing options...
Daniel0 Posted November 16, 2009 Share Posted November 16, 2009 I can't answer that as that person wasn't me, but I would guess trying to provoke an error to see if he could get information about how the site works. Quote Link to comment https://forums.phpfreaks.com/topic/181675-solved-security-question/#findComment-958719 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.