pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
To: Marko Kreen <markokr@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Postgres-Bugs <pgsql-bugs@postgresql.org>
Subject: Re: pgcrypto decrypt_iv() issue
Date: Fri, 27 Jan 2012 19:10:20 +0100
Message-ID: <4F22E88C.1050507@kaltenbrunner.cc> (raw)
In-Reply-To: <CACMqXCLZ-Vj-=AzEhrrG-FsvtaF_ou0aCXh_V+XKnz=pCvaEsw@mail.gmail.com>
References: <4F1DB7BF.60304@kaltenbrunner.cc>
	<4F1F23E8.80100@kaltenbrunner.cc>
	<23889.1327646231@sss.pgh.pa.us>
	<20120127152056.GA4107@gmail.com>
	<4F22E028.8040708@kaltenbrunner.cc>
	<CACMqXCLEYQ-TLeew4+8VvKOCjAgk_nvFkY7rrDaauJzuQEYR8w@mail.gmail.com>
	<CABUevEwb=nAGJLgmVppADj3N9p6e2sFs7guZSanWThFWwFr7kA@mail.gmail.com>
	<CACMqXCLZ-Vj-=AzEhrrG-FsvtaF_ou0aCXh_V+XKnz=pCvaEsw@mail.gmail.com>

On 01/27/2012 07:06 PM, Marko Kreen wrote:
> On Fri, Jan 27, 2012 at 8:00 PM, Magnus Hagander <magnus@hagander.net> wrote:
>> On Fri, Jan 27, 2012 at 18:54, Marko Kreen <markokr@gmail.com> wrote:
>>> On Fri, Jan 27, 2012 at 7:34 PM, Stefan Kaltenbrunner
>>> <stefan@kaltenbrunner.cc> wrote:
>>>> On 01/27/2012 04:20 PM, Marko Kreen wrote:
>>>>> On Fri, Jan 27, 2012 at 01:37:11AM -0500, Tom Lane wrote:
>>>>> Yeah, it should be fixed.  But note that "random data" is part of
>>>>> decrypt() spec - the validation it can do is a joke.
>>>>>
>>>>> Its more important to do proper checks in encrypt() to avoid invalid
>>>>> stored data, but there the recommended modes (CBC, CFB) can work
>>>>> with any length data, so even there the impact is low.
>>>>
>>>> I agree - but in my case the input to those functions is actually coming
>>>> from external untrusted systems - so if the data is (completely) invalid
>>>> really want to get a proper error message instead of random memory content.
>>>
>>> You *will* get random memory content.  If your app is exploitable with
>>> invalid data, you *will* get exploited.  The decrypt() checks are
>>> more for developer convenience than anything more serious.
>>
>> Hold on. I hope there's some misunderstanding here.
>>
>> I hope you are you saying that feeding random data to the decrypt
>> functions should be expected to return random data out of previously
>> free()d areas? Surely you're not?
>>
>> Obviouly, if you send in invalid data or an invalid key, it will
>> decrypt into incorrect data, that goes without saying. But it should
>> still be the same block size and not contain random unrelated memory
>> blocks, shouldn' it?
> 
> Yes, it should not contain unrelated data.

hmm - see the last example I had in my original report - not sure i
consider the path to pgcrypto.so "related" data and I most definitly do
not expect to get that back from sending invalid data to the database...


Stefan



view thread (13+ messages)  latest in thread

Message-ID: <4F22E88C.1050507@kaltenbrunner.cc>
Permalink:  ../4F22E88C.1050507@kaltenbrunner.cc/
Also on:    postgresql.org/message-id/4F22E88C.1050507@kaltenbrunner.cc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: stefan@kaltenbrunner.cc, markokr@gmail.com, magnus@hagander.net, tgl@sss.pgh.pa.us
  Subject: Re: pgcrypto decrypt_iv() issue
  In-Reply-To: <4F22E88C.1050507@kaltenbrunner.cc>
  References: <4F1DB7BF.60304@kaltenbrunner.cc> <4F1F23E8.80100@kaltenbrunner.cc> <23889.1327646231@sss.pgh.pa.us> <20120127152056.GA4107@gmail.com> <4F22E028.8040708@kaltenbrunner.cc> <CACMqXCLEYQ-TLeew4+8VvKOCjAgk_nvFkY7rrDaauJzuQEYR8w@mail.gmail.com> <CABUevEwb=nAGJLgmVppADj3N9p6e2sFs7guZSanWThFWwFr7kA@mail.gmail.com> <CACMqXCLZ-Vj-=AzEhrrG-FsvtaF_ou0aCXh_V+XKnz=pCvaEsw@mail.gmail.com> <4F22E88C.1050507@kaltenbrunner.cc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox