Reply to Re: no insert ...

Your name:

Reply:


Posted by Iván Sánchez Ortega on 12/18/06 15:39

Erwin Moller wrote:

> I use ADODB lib (www.phplens.com/adodb) as a databaseabstractionlayer.
> It has a funtion named qstr() that will make a string ready to use in an
> insert or update statement.

Quick reminder, guys: *ALWAYS* use these kind of functions before putting a
string into *ANY* SQL statement.

Yeah, that means that "select" statements are vulnerable to injections too.
And any other SQL statement you can think of, is too, if it includes a
user-defined string.

> if magicquotes are on if leaves the string as is.
> Otherwise it uses mysql_real_escape_string().
>
> But since mysql_real_escape_string() escapes more than addslashes(), I
> wonder if adodb is doing the right thing.
>
> addslashes works on: ", ', \, and the NULL-byte
> mysql_real_escape_string works on: \x00, \n, \r, \, ', " and \x1a.
>
> So \n, \r, \x1a are NOT escaped.
> Can any of these be used for SQL-injection?
[...]

For a SQL injection to be sucessful, the attacker must include a quote. If
you escape the quotes, you *should* be safe. Inserting a line break will
most likely stop the execution of the SQL statement.


But, in case of doubt, please use a vulnerability check suite: they'll try
every SQL injection system known. I can't recall the names of any right
now, so STFW to find 'em.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация