Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Why inject when it already sucks? :-)

 
   Database Forums (Home) -> Ingres RSS
Next:  website developers requirements  
Author Message
Roy Hann

External


Since: Sep 12, 2006
Posts: 44



(Msg. 1) Posted: Mon Mar 28, 2011 3:25 pm
Post subject: Why inject when it already sucks? :-)
Archived from groups: comp>databases>ingres (more info?)

Here's a chuckle:
http://blog.sucuri.net/2011/03/mysql-com-compromised.html

Happily it is harder to mount an injection attack on Ingres because the
server doesn't process statement introducers (Wink or comment introducers
(--) in most contexts.

--
Roy

UK Ingres User Association Conference 2011 will be on Tuesday June 7 2011.
Register at http://www.regonline.co.uk/ukiua2011

 >> Stay informed about: Why inject when it already sucks? :-) 
Back to top
Login to vote
Roy Hann

External


Since: Sep 12, 2006
Posts: 44



(Msg. 2) Posted: Mon Mar 28, 2011 3:25 pm
Post subject: Re: Why inject when it already sucks? :-) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Roy Hann wrote:

> Here's a chuckle:
> http://blog.sucuri.net/2011/03/mysql-com-compromised.html
>
> Happily it is harder to mount an injection attack on Ingres because the
> server doesn't process statement introducers (Wink or comment introducers
> (--) in most contexts.

For those of you reading this via the Ingres Forums, that baffling bit
with a smiley in the middle was typed as a semi-colon in parentheses,
which it very unhelpfully converted.

Shared meaning. Who needs it?

--
Roy

UK Ingres User Association Conference 2011 will be on Tuesday June 7 2011.
Register at http://www.regonline.co.uk/ukiua2011

 >> Stay informed about: Why inject when it already sucks? :-) 
Back to top
Login to vote
Mike Leo

External


Since: Mar 28, 2011
Posts: 1



(Msg. 3) Posted: Mon Mar 28, 2011 3:25 pm
Post subject: Re: [Info-Ingres] Why inject when it already sucks? :-) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mar 28, 2011, at 1:47 PM, Roy Hann wrote:

> Roy Hann wrote:
>
>> Here's a chuckle:
>> http://blog.sucuri.net/2011/03/mysql-com-compromised.html
>>
>> Happily it is harder to mount an injection attack on Ingres because the
>> server doesn't process statement introducers (Wink or comment introducers
>> (--) in most contexts.
>
> For those of you reading this via the Ingres Forums, that baffling bit
> with a smiley in the middle was typed as a semi-colon in parentheses,
> which it very unhelpfully converted.
>
> Shared meaning. Who needs it?
>
> --
> Roy

ROTFL
 >> Stay informed about: Why inject when it already sucks? :-) 
Back to top
Login to vote
Leandro Pinto Fava1

External


Since: Sep 09, 2004
Posts: 3



(Msg. 4) Posted: Mon Mar 28, 2011 4:25 pm
Post subject: Re: [Info-Ingres] Why inject when it already sucks? :-) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,

May I report a true story here? Sad

In the past (1999-2000?) we suffered an attack of SQL Injection on one of our web application. The app was made using Ingres-ICE and the database was Ingres II (I dont need tell you that we dont use Ingres ICE anymore, grrrr).

The attack was "half" well succeeded. We discovered immediatally when the system started report to us about an infinity of lock timeout messages raised in errlog. The attacker get some info from our database, but not so much in special.

Well, we needed to stop that app ASAP until a new one was developed or an workaround were made. The new app should be developed using another tool/technology, because the way we made that app with Ingres-ICE (using Report Writer to generate pages) didnt had a good solution in a few time.

So, before the new app were developed, we could make an workaround (in a few hours after the occurrence) using some "non conventional" methods. Something like a "man-in-the-midle" solution to detect such attacks and prevent them.

Thats all folks!! Smile

Leandro Fava
Setor de Informática - UNISC


-----Original Message-----
From: info-ingres-bounces RemoveThis @kettleriverconsulting.com [mailto:info-ingres-bounces@kettleriverconsulting.com] On Behalf Of Roy Hann
Sent: segunda-feira, 28 de março de 2011 15:34
To: info-ingres RemoveThis @kettleriverconsulting.com
Subject: [Info-Ingres] Why inject when it already sucks? Smile

Here's a chuckle:
http://blog.sucuri.net/2011/03/mysql-com-compromised.html

Happily it is harder to mount an injection attack on Ingres because the
server doesn't process statement introducers (Wink or comment introducers
(--) in most contexts.

--
Roy

UK Ingres User Association Conference 2011 will be on Tuesday June 7 2011.
Register at http://www.regonline.co.uk/ukiua2011


_______________________________________________
Info-Ingres mailing list
Info-Ingres RemoveThis @kettleriverconsulting.com
http://ext-cando.kettleriverconsulting.com/mailman/listinfo/info-ingres
 >> Stay informed about: Why inject when it already sucks? :-) 
Back to top
Login to vote
Chris

External


Since: Jan 25, 2010
Posts: 3



(Msg. 5) Posted: Tue Mar 29, 2011 8:46 am
Post subject: Re: Why inject when it already sucks? :-) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mar 28, 12:52 pm, "Leandro Pinto Fava" wrote:
> In the past (1999-2000?) we suffered an attack of SQL Injection on one
> of our web application. The app was made using Ingres-ICE and the
> database was Ingres II (I dont need tell you that we dont use Ingres
> ICE anymore, grrrr).
>
> The attack was "half" well succeeded. We discovered immediatally when
> the system started report to us about an infinity of lock timeout
> messages raised in errlog. The attacker get some info from our
> database, but not so much in special.
>
> Well, we needed to stop that app ASAP until a new one was developed or
> an workaround were made. The new app should be developed using another
> tool/technology, because the way we made that app with Ingres-ICE
> (using Report Writer to generate pages) didnt had a good solution in a
> few time.
>
> So, before the new app were developed, we could make an workaround (in
> a few hours after the occurrence) using some "non conventional"
> methods. Something like a "man-in-the-midle" solution to detect such
> attacks and prevent them.


It would be interesting to learn more specifics about the attack, and
the application in question. The more we share about these things the
better we can protect our data/applications.

Every SQL injection attack I've seen has *always* boiled down to code
like this:

sprintf(sql_str, "SELECT ...... %s .....", a, b, c....);
execute_sql(sql_str);

or

sql_str = "SELECT ......'" +a+"' %s ....."
etc.

There are usually 1 or 2 reasons for code like this:

1) inexperience with SQL injections attacks and protecting against
them. These days there are a number of articles on the subject (this
was not the case in 2000, I'm not sure I saw an article before 2000)
but I still see a lot of new SQL/database users who have not had
formal training taking this approach. Generating SQL queries is
attractive and easy to understand.

2) Lack of support for bind parameters. Clearly this is NOT an issue
for Ingres, all Ingres drivers use real bind parameters if the
application requests them. For some DBMS vendors they added bind
parameter support later in life and/or the underlying driver ended up
doing the "sprintf" like above even if the application did "the right
thing".

If you use bind parameters with Ingres you will not suffer from an SQL
injection causing unexpected query results, for example an INSERT
ending up doing a drop table, obligatory http://xkcd.com/327/
reference Wink

Bind parameters prevent the injection of SQL queries into the expected
SQL.

I.e. if you have user input for queries my recommendation is always
use bind parameters, Python example:

instead of:

# bad!
sql_query = "SELECT email_addr from my_table where user_id = '%s'"
% user_id
c.execute(sql_query)

do:
# better
sql_query = "SELECT email_addr from my_table where user_id = ?"
bind_params = (user_id, )
c.execute(sql_query, bind_params)

As well as avoiding injection, this tends to perform better. Ingres
will cache queries with bind param markers. It is also easier to write
code using bind parameters.

If an application has a genuine need to create SQL queries on the fly,
it is still possible (and recommended) to use bind parameters when
dealing with user input.

There is a lot more to application/DBMS security than just using bind
parameters but it is the first thing to do. User input should always
be sanitized, the nice thing about using bind parameters is that
Ingres does the SQL query text protection piece for you.

Chris
 >> Stay informed about: Why inject when it already sucks? :-) 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Process hanging on Endselect - We have a process which needs to produce an average figure over the last 16 qualifying weeks. The way it currently works is to select the rows from the two relevant tables ordered by date descending, then in a select loop check if the week qualifies and...

E_DM9063_LK_TABLE_MAXLOCKS - We have a weekly job that takes a COPY.OUT from the "Live" database and then does a COPY.IN to a development database in a separate installation. I've noticed that in one instance, the ERRLOG is getting a number of messages of the general form...

Help fo vnode - I am going to use the ingres replication. For that I have set vnodes using "netutil". I have configured all the things for replication on my local database using repmgr. Now I want to move the Configuration to the Remote Server database. When I...

Help for starting the replication server - I have configured the database for replication using repmgr command I also started the replication server. It is started and its status is active. But there are one error message comming which is related to the authorization of the remote database. Using...

[Info-ingres] vnode puzzle - Hi Dudes, I have a 2.6 installation with several vnodes defined pointing to other installations. All of which test perfectly well using netutil test mode. But when I try to use a simple sql vnode::dbname connection I get the following: sql rat::iidbd...
   Database Forums (Home) -> Ingres All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]