Re: Security Issue
| From: | Michael Shadle | Date: | Mon, 07 Jun 2010 18:00:19 +0000 |
| Subject: | Re: Security Issue | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-305902@lists.php.net to get a copy of this message | ||
I disagree and this kind of approach could be appropriate if you walk your input globals and apply some sanity checks and appropriate filtering you could fix the issue.
On Jun 7, 2010, at 10:52 AM, Igor Escobar <titiolinkin@gmail.com> wrote:
I think we're getting off topic here folks... Regards, Igor Escobar Systems Analyst & Interface Designer + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar (twitter) On Mon, Jun 7, 2010 at 2:51 PM, Ashley Sheridan <ash@ashleysheridan.co.ukwrote: On Mon, 2010-06-07 at 10:48 -0700, Michael Shadle wrote:Oh yeah. I do more than just intval() I make sure they didn't feed me anything BUT numeric text first. I do sanity check before type forcing :) I use garbage in garbage out. So I take what is given to me and yes I escape if before the db of course as well, and then encode on output. On Jun 7, 2010, at 10:45 AM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote:On Mon, 2010-06-07 at 10:38 -0700, Michael Shadle wrote:htmlspecialchars() is really only good for user input that you are outputting to the browser. For inserting data into a database, use mysql_real_escape_string(). I find it's good to think carefully about what sort of data I expect and sanitise it accordingly. If I want a numerical value, I use intval($_GET['var']) or floatval(). For things like small text box elements, regex's work wellThis was my fear. Regards, Igor Escobar Systems Analyst & Interface Designer + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar (twitter) On Mon, Jun 7, 2010 at 10:05 AM, Peter LindIt's not that bad. Use filter functions and sanity checks for input. Use htmlspecialchars() basically on output. That should take care of basically everything. On Jun 7, 2010, at 6:16 AM, Igor Escobar <titiolinkin@gmail.com> wrote:wrote:<peter.e.lind@gmail.com>wrote:On 7 June 2010 14:54, Igor Escobar <titiolinkin@gmail.com>that IHi Folks! The portal for which I work is suffering constant attackssystem,feelthatis PHP Injection. Somehow the hacker is getting to change the cache files that our system generates. Concatenating the HTML file with another that have an iframe to a malicious JAR file. Do you have any suggestions to prevent this action? The hacker has no access to our filethathe is imputing the code through some security hole. The problem isattacks.estructuretheportalis very big and has lots and lots partners hosted on ourstructure. We are failing to identify the focus of thiseverythinfrom theAny ideas?Check all user input + upload: make sure that whatever comesuser is validated. Then check all output: make sure thatthere'soutput is escaped properly. Yes, it's an enormous task, butno way around it. Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 </hype>dependingon the data. For data from select lists of checkboxes, make surethevalue given is within a list of pre-determined values you have. Basically, nothing from the user should be trusted at all, ever. As soon as you let go of that trust in the good honesty of people you'll do fine ;) Thanks, Ash http://www.ashleysheridan.co.uk Why waste time validating an integer value when intval() will do that for you? Thanks, Ash http://www.ashleysheridan.co.uk