Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Security-Basics
[Top] [All Lists]

Re: PHP filter function against SQL injections

Subject: Re: PHP filter function against SQL injections
Date: Fri, 09 Feb 2007 09:39:28 -0600
jeffrey rivero wrote:
sure you can then you would get an cast exception
but you would have to know what you looking for ?

Please show me some code that, when casting something to an integer, yields a cast exception. I doubt you could. PHP is a loosely typed language, after all.


In fact, here are some tests of my own:

<?php
error_reporting(E_ALL);
echo intval(array(5,2));
?>

That yields no exceptions and outputs a 1. Whether or not it you believe it ought to output a 1 or not is also beside the point - the point is that it *does* cast to an integer.

Here's another test.

<?php
error_reporting(E_ALL);
echo intval("zzz");
?>

That yields 0.  To understand why, read this:

http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion

We don't have to test any other types because, unless you're doing something like unserialize, you're not going to be able to get those types via GET / POST / COOKIE. Everything returned via any of those is either a string or an array. I'd post more code demonstrating this, but this email is long enough.

<Prev in Thread] Current Thread [Next in Thread>