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

| Subject: | Re: ASP/PHP SQL Injection |
|---|---|
| Date: | Thu, 31 Aug 2006 13:46:39 -0400 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've seen the best way to counter injections (in PHP) is to use the mysql_real_escape_string (see: http://www.php.net/mysql_real_escape_string). This way, any data inserted will become a 'safe string' and therefore will not take control of your query. For an example, by using your example, a user inputs "; DROP DATABASE `test`;" as the input variable. the first semi-colon will make it attempt to query everything up until that spot (which will error), it will then run the DROP DATABASE command which might work if you have a test database (thus, destroying your database) and then finally, continuing with the code afterwards, which will error as well. Basically, protecting yourself from a SQL injection is a MUST if you accept any input! coder wrote:
Hi all,
I have been reading quite a bit into SQL injections and I just wondered if
my thinking is correct:
If one has the ASP or PHP source code for a site, they would just look for-
(written in a pseudo-ish code as I assume the same principles exist for ASP
and PHP)
$variable = get_value_from_url('variable') // ie blah.asp?variable="hello"
SQL = "SOME SQL" & $variable & "SOME MORE SQL"
or
<executing object (i.e. rs.open)> "SOME SQL" & $variable & "SOME MORE SQL"
When looking for potential SQL Injection attacks, its one of the 2 SQL lines
one would look for... is that correct? And to stop SQL Injection attacks,
one only has to "sanitise" the variable with CLng() in the case of numeric
fields and in the case of alphanumeric fields a built-in PHP/ASP/MySQL
function can be used.
Also, assuming my thinking above is correct, what does one look for when
checking for possible XSS attack?
Thanks for your input,
Davie Elliott
---------------------------------------------------------------------------
This list is sponsored by: Norwich University
EARN A MASTER OF SCIENCE IN INFORMATION ASSURANCE - ONLINE
The NSA has designated Norwich University a center of Academic Excellence
in Information Security. Our program offers unparalleled Infosec management
education and the case study affords you unmatched consulting experience.
Using interactive e-Learning technology, you can earn this esteemed degree,
without disrupting your career or home life.
http://www.msia.norwich.edu/secfocus
---------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) iD8DBQFE9yB/Cggt9XTPwUwRAifFAJ9LUEz5DY9MM3KFyKSR/hGRxh6b0gCgitO1 LjCEFRZp5B56FWJO1KMOyfw= =jYlU -----END PGP SIGNATURE----- --------------------------------------------------------------------------- This list is sponsored by: Norwich University EARN A MASTER OF SCIENCE IN INFORMATION ASSURANCE - ONLINE The NSA has designated Norwich University a center of Academic Excellence in Information Security. Our program offers unparalleled Infosec management education and the case study affords you unmatched consulting experience. Using interactive e-Learning technology, you can earn this esteemed degree, without disrupting your career or home life. http://www.msia.norwich.edu/secfocus ---------------------------------------------------------------------------
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: ASP/PHP SQL Injection, pratiksha . doshi |
|---|---|
| Next by Date: | Re: ASP/PHP SQL Injection, coder |
| Previous by Thread: | RE: ASP/PHP SQL Injection, Daniel Gargallo |
| Next by Thread: | Re: ASP/PHP SQL Injection, pratiksha . doshi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |