Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEIeg-0006B9-31 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Feb 2021 21:22:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEIeb-0001rW-53 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Feb 2021 21:22:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEIea-0001rP-Ua for pgsql-hackers@lists.postgresql.org; Mon, 22 Feb 2021 21:22:04 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEIeY-0005L5-7T for pgsql-hackers@lists.postgresql.org; Mon, 22 Feb 2021 21:22:03 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 236F85C01A5; Mon, 22 Feb 2021 16:22:01 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 22 Feb 2021 16:22:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=Ki+y/FzaqroaEl1t4dBd06r2mMq +wZraeWOyEblpGMw=; b=GUUG03Na4wjIYBuvpyGy13Ll59DkDc2GZ6EfCOhgsnu Zd1WMx2rjjguLNGjpu/irtGGQZs01KfPYD2KeIgFtR0HrNkNliCLa1hcZlbUq2M2 jmD6ZrlSqJ09sY8OfTgta10Cqvn3ct5ayv1EqIPzhpWTVGNemT/fYkrnEFec1EEi AMsZ2iTD3FbH0Yc/1q4H24XeiCEKy9gy8CFxgh43oA+tg1dO30uHr5bGg3YsnCdD pqSxfyMZnsg8WqBDqO2zllC2GHXcxy/q6+7kxWQmkXQhLlySb9Wn+o8GZ76TDNnc zpfsYT++mrmpOL7z7Jkb7+vlQtbv6P6bfx7DDcHPT1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Ki+y/F zaqroaEl1t4dBd06r2mMq+wZraeWOyEblpGMw=; b=mN0B5WK0wUiJEIwZIaEeO7 /JbxdghjOgw8+v+DNHnhuVr8oRALWBuSJZzschzRWw4X5dorHmwNOsaB2U4wom6i wR5oteEfRUOiaFQbNXHVNgpvloAIiVhGycZMN7oTGKM2g53NeKW8tXvT996tS07a 6JaeYccUT1PgKxlgSMn6zjJ143MHqijz7NfMujlpzBQXZszaKGyM2OBuzt25E80y +Ph+BgX5CxLC4Lq3MOeIrhr8UAn+Oeu79l6ZP8ofS8WV2OJksRl6ikaaoyaUkBqA XfwovlG7hyBH/M9njyMlkU47B8vPQ89wEfOXya79GjJKxa7oS54vAD8kdDycUaEA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkeefgddugeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucfkphepieejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id 7DF161080059; Mon, 22 Feb 2021 16:21:59 -0500 (EST) Date: Mon, 22 Feb 2021 13:21:58 -0800 From: Andres Freund To: Tom Lane Cc: Robert Haas , Daniil Zakhlystov , Konstantin Knizhnik , Justin Pryzby , Andrey Borodin , PostgreSQL Hackers Subject: Re: libpq compression Message-ID: <20210222212158.42e2wazztunkie3n@alap3.anarazel.de> References: <6811D196-E2FB-40CC-B1C9-F19427FBF675@yandex-team.ru> <470E411E-681D-46A2-A1E9-6DE11B5F59F3@yandex-team.ru> <3676BA4F-ED2B-470C-9892-007C943BB1D2@yandex-team.ru> <3604970.1614026670@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3604970.1614026670@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2021-02-22 15:44:30 -0500, Tom Lane wrote: > Robert Haas writes: > > So at the end of the day I'm not really quite sure what is best here. > > I agree with all of Craig's points about the advantages of > > packet-level compression, so I'd really prefer to make that approach > > work if we can. However, it also seems to me that there's room to be > > fairly concerned about what these test results are showing. > > BTW ... in view of the nearby thread about permanently disabling > OpenSSL's compression option, I wonder whether we really ought to be > in a hurry to put back compression underneath that. While this area > is out of my wheelhouse, my understanding of the problem with OpenSSL > is that the packet length changes due to compression can provide > enough information to an attacker to break the encryption. It seems > to me that do-it-ourselves compression would most likely create an > equivalent vulnerability. My understanding is that one can infer compressed content only when an attacker can control a part of the *same* encrypted & compressed message that the desired-to-be-inferred data is in. That is possible for browsers, because in many cases e.g. a cookie containing a session identifier will be sent to a server even when the request is issued from some other website (e.g. by injecting lots "images" on a page, to get around the same origin policy). That other website doesn't normally have access to the cookies. But with compression it can make guesses at the cookie value (think adding "Cookie: a" somewhere in the request, then trying "Cookie: b", ...) and if the length is shorter than in other cases the guess was right. There's not really something equivalent in the postgres case. The attacker needs to be able to influence the content in a lot of repeated encrypted packets between client/server that are otherwise unchanged (or predictable). It's possible that you can come up with something contorted if the attacker controls the data the client requests, but I don't think it's a comparable risk. Not a cryptographer by any means though. I think the majority of the cases where one would want to use libpq compression are pretty much unaffected by such attacks, even on a theoretical level. And for the remainder I suspect that we'd already be vulnerable, due to to wal_compression. Greetings, Andres Freund