From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CEC99C1D for ; Thu, 23 Feb 2017 23:57:48 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9B3EA146 for ; Thu, 23 Feb 2017 23:57:47 +0000 (UTC) Received: by mail-wm0-f50.google.com with SMTP id r141so2796688wmg.1 for ; Thu, 23 Feb 2017 15:57:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to; bh=ujxr8VfX3eO0KFbo6BtxZWFpVS5BqzDkqjDL5ygYeGk=; b=Jr4PpH5LjNiVndA6nKsH80m7xBwwxLDMX7cOs4BQnTz3GVTRmUR5In5JtvC0ZSlvfC RGNP1+Wfc5o3sTiLGD6O5Y/48CfZseV6YqeYeR7sCh6sZV63uvl3eGyVY/Hgl8AqA+dJ OLPreoGHEl8Aoxvgqp9SA8z5ll5XdUBiguz9YRnpfNDFv2JtvWfOCDIEC8QDITkEGNQU t4UxxgSP60uRbhZuPjzu8TkI2DH3+7hGnJvhS5VYvLzD5qLZnW2QkMNVPO1zq+pSGA3C 8U3mICs0C2DbZiAoUSmQz3q1BEsDFEbLKkqaS7k37gqFNa0Ho9HDuhySWsKXdNv75Yh0 0eEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to; bh=ujxr8VfX3eO0KFbo6BtxZWFpVS5BqzDkqjDL5ygYeGk=; b=q2VmrgVxDp6F8f96blT14Obp64Zqp4jvbdISL0KHRX6xzKOpdCN6MeXCK35OrkfQ26 6RIAU/IEzXe5Hlc31TzjsYdFe5E89CBvN7ncLhSNTbSo5f5TnUzDDtymrSRE0BpG+gq3 R3KY8zRFmTUPYlWKYxjCVrsy35NUyvzjVLE4V/ICYoJJ9vKgzjYTIG6BYRKNMGFvnoTU +CRl5O9gnZbdjiyoOfMo1Tw7//odpv+qCtYS0s111j1B3SyBE/4vUFjdrLcageMUnZUf XGR7WamfbL8Df5G9Ol1Gz0+8wOw3PMlDLs10JuaQ7Hu9BIf0Axl1krDVx7wIA02/jyus fAcA== X-Gm-Message-State: AMke39lnARTFVhytuOAgzv1KgAkGmUtTMA/gK/euPfYJQHcvPAxgekm41UO79/EYkK+Bxw== X-Received: by 10.28.87.85 with SMTP id l82mr138234wmb.135.1487894266149; Thu, 23 Feb 2017 15:57:46 -0800 (PST) Received: from [192.168.1.10] (ANice-654-1-197-68.w86-205.abo.wanadoo.fr. [86.205.220.68]) by smtp.googlemail.com with ESMTPSA id v128sm44594wmv.2.2017.02.23.15.57.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2017 15:57:45 -0800 (PST) To: bitcoin-dev@lists.linuxfoundation.org References: <20170223181409.GA6085@savin.petertodd.org> <20170223212802.GA7608@savin.petertodd.org> From: Aymeric Vitte Message-ID: <76fa5d76-6c54-e13e-7b55-a4409ef536f5@gmail.com> Date: Fri, 24 Feb 2017 00:57:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20170223212802.GA7608@savin.petertodd.org> Content-Type: multipart/alternative; boundary="------------C9D09EED127694C30CF36C99" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Fri, 24 Feb 2017 00:04:41 +0000 Subject: Re: [bitcoin-dev] SHA1 collisions make Git vulnerable to attakcs by third-parties, not just repo maintainers X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2017 23:57:48 -0000 This is a multi-part message in MIME format. --------------C9D09EED127694C30CF36C99 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Maybe not, unlike frozen objects (certificates, etc), trees are supposed to extend Then you can perform progressive hash operations on the objects, ie instead of hashing the intermediate hash of the objects you do it continuously (ie instead of hashing the hash of hash file a + hash file b + hash file c, wait for file d and then do the same, instead hash(file a + file b + file c), when d comes compute the hash of (file a + file b + file c + file d), which implies each time to keep the intermediary hash state because you are not going to recompute everything from the beginning) I have not worked on this since some time, so that's just thoughts, but maybe it can render things much more difficult than computing two files until the same hash is found The only living example I know implementing this is the Tor protocol, fact apparently unknown, this is probably why nobody cares and nobody is willing to take it into account (please follow bwd/fwd [1] and see [2]), this is not existing in any crypto implementations, unless you hack into it, and this applies to progressive encryption too [1] https://lists.w3.org/Archives/Public/public-webcrypto-comments/2013Feb/00= 18.html [2] https://github.com/whatwg/streams/issues/33#issuecomment-28554151 Le 23/02/2017 =E0 22:28, Peter Todd via bitcoin-dev a =E9crit : > On Thu, Feb 23, 2017 at 01:14:09PM -0500, Peter Todd via bitcoin-dev wr= ote: >> Worth noting: the impact of the SHA1 collison attack on Git is *not* l= imited >> only to maintainers making maliciously colliding Git commits, but also= >> third-party's submitting pull-reqs containing commits, trees, and espe= cially >> files for which collisions have been found. This is likely to be explo= itable in >> practice with binary files, as reviewers aren't going to necessarily n= otice >> garbage at the end of a file needed for the attack; if the attack can = be >> extended to constricted character sets like unicode or ASCII, we're in= trouble >> in general. >> >> Concretely, I could prepare a pair of files with the same SHA1 hash, t= aking >> into account the header that Git prepends when hashing files. I'd then= submit >> that pull-req to a project with the "clean" version of that file. Once= the >> maintainer merges my pull-req, possibly PGP signing the git commit, I = then take >> that signature and distribute the same repo, but with the "clean" vers= ion >> replaced by the malicious version of the file. > Thinking about this a bit more, the most concerning avenue of attack is= likely > to be tree objects, as I'll bet you you can construct tree objs with ga= rbage at > the end that many review tools don't pick up on. :( > > > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev --=20 Zcash wallets made simple: https://github.com/Ayms/zcash-wallets Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets Get the torrent dynamic blocklist: http://peersm.com/getblocklist Check the 10 M passwords list: http://peersm.com/findmyass Anti-spies and private torrents, dynamic blocklist: http://torrent-live.o= rg Peersm : http://www.peersm.com torrent-live: https://github.com/Ayms/torrent-live node-Tor : https://www.github.com/Ayms/node-Tor GitHub : https://www.github.com/Ayms --------------C9D09EED127694C30CF36C99 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

Maybe not, unlike frozen objects (certificates, etc), trees are supposed to extend

Then you can perform progressive hash operations on the objects, ie instead of hashing the intermediate hash of the objects you do it continuously (ie instead of hashing the hash of hash file a + hash file b + hash file c, wait for file d and then do the same, instead hash(file a + file b + file c), when d comes compute the hash of (file a + file b + file c + file d), which implies each time to keep the intermediary hash state because you are not going to recompute everything from the beginning)

I have not worked on this since some time, so that's just thoughts, but maybe it can render things much more difficult than computing two files until the same hash is found

The only living example I know implementing this is the Tor protocol, fact apparently unknown, this is probably why nobody cares and nobody is willing to take it into account (please follow bwd/fwd [1] and see [2]), this is not existing in any crypto implementations, unless you hack into it, and this applies to progressive encryption too

[1] https://lists.w3.org/Archives/Public/public-webcrypto-comments/2013Feb/0018.html

[2] https://github.com/whatwg/streams/issues/33#issuecomment-28554151

Le 23/02/2017 à 22:28, Peter Todd via bitcoin-dev a écrit :
On Thu, Feb 23, 2017 at 01:14:09PM -0500, Peter Todd via bitcoin-dev wrote:
Worth noting: the impact of the SHA1 collison attack on Git is *not* limited
only to maintainers making maliciously colliding Git commits, but also
third-party's submitting pull-reqs containing commits, trees, and especially
files for which collisions have been found. This is likely to be exploitable in
practice with binary files, as reviewers aren't going to necessarily notice
garbage at the end of a file needed for the attack; if the attack can be
extended to constricted character sets like unicode or ASCII, we're in trouble
in general.

Concretely, I could prepare a pair of files with the same SHA1 hash, taking
into account the header that Git prepends when hashing files. I'd then submit
that pull-req to a project with the "clean" version of that file. Once the
maintainer merges my pull-req, possibly PGP signing the git commit, I then take
that signature and distribute the same repo, but with the "clean" version
replaced by the malicious version of the file.
Thinking about this a bit more, the most concerning avenue of attack is likely
to be tree objects, as I'll bet you you can construct tree objs with garbage at
the end that many review tools don't pick up on. :(



_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev

-- 
Zcash wallets made simple: https://github.com/Ayms/zcash-wallets
Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets
Get the torrent dynamic blocklist: http://peersm.com/getblocklist
Check the 10 M passwords list: http://peersm.com/findmyass
Anti-spies and private torrents, dynamic blocklist: http://torrent-live.org
Peersm : http://www.peersm.com
torrent-live: https://github.com/Ayms/torrent-live
node-Tor : https://www.github.com/Ayms/node-Tor
GitHub : https://www.github.com/Ayms
--------------C9D09EED127694C30CF36C99--