Bitcoin Forum
May 03, 2024, 12:20:33 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Vulnerability: variable secret size in cross-chain atomic swaps  (Read 220 times)
markblundeberg (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 2


View Profile
February 16, 2018, 05:55:16 AM
Merited by d5000 (1), AGD (1)
 #1

I believe I have found a serious vulnerability in the way that hash locked cross-chain atomic swap smart contracts are being written right now (!). The vulnerability allows the initiating party (holding hash secret) to scam the counterparty and steal funds, in certain pairs of cryptocurrencies (e.g., BTC-ETH) but not in others (e.g., BTC-LTC).

https://gist.github.com/markblundeberg/7a932c98179de2190049f5823907c016

Luckily, it has an easy fix.

Please criticize!
1714738833
Hero Member
*
Offline Offline

Posts: 1714738833

View Profile Personal Message (Offline)

Ignore
1714738833
Reply with quote  #2

1714738833
Report to moderator
1714738833
Hero Member
*
Offline Offline

Posts: 1714738833

View Profile Personal Message (Offline)

Ignore
1714738833
Reply with quote  #2

1714738833
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714738833
Hero Member
*
Offline Offline

Posts: 1714738833

View Profile Personal Message (Offline)

Ignore
1714738833
Reply with quote  #2

1714738833
Report to moderator
1714738833
Hero Member
*
Offline Offline

Posts: 1714738833

View Profile Personal Message (Offline)

Ignore
1714738833
Reply with quote  #2

1714738833
Report to moderator
1714738833
Hero Member
*
Offline Offline

Posts: 1714738833

View Profile Personal Message (Offline)

Ignore
1714738833
Reply with quote  #2

1714738833
Report to moderator
ArsenyP
Member
**
Offline Offline

Activity: 86
Merit: 15


View Profile WWW
February 16, 2018, 07:35:44 AM
Merited by d5000 (1)
 #2

The initial idea of atomic transfers (https://bitcointalk.org/index.php?topic=193281.0) was proposed for the altcoins built upon BC with a 520 bytes element size.
No one is going to use it unmodified for an ETH-BC transfer.
For every altcoin there has to be a confirmation from an independent security expert that a particular form of contract is suitable for it.
Imagine a coin that has a built in timer and self-burns if unused for longer than a day (there actually are some tokens that behave this way). There has to be an extra check for both ATime and Btime to be less then a day in this case.
But your exploit is to be taken into consideration when actually constructing swaps between altcoins with mismatching element sizes. I think it will work.
DooMAD
Legendary
*
Offline Offline

Activity: 3780
Merit: 3104


Leave no FUD unchallenged


View Profile
February 16, 2018, 01:44:07 PM
 #3

The impression I get is that cross-chain transactions won't apply by default to every altcoin out there straight out of the box.  Each individual altcoin will have to undergo rigorous compatibility checks to ensure it all works smoothly when someone tries to hop from one chain to another.  Some may be easier to meld than others.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Cryptagio
Copper Member
Jr. Member
*
Offline Offline

Activity: 158
Merit: 1


View Profile
February 20, 2018, 09:21:41 AM
 #4

I believe I have found a serious vulnerability in the way that hash locked cross-chain atomic swap smart contracts are being written right now (!). The vulnerability allows the initiating party (holding hash secret) to scam the counterparty and steal funds, in certain pairs of cryptocurrencies (e.g., BTC-ETH) but not in others (e.g., BTC-LTC).

https://gist.github.com/markblundeberg/7a932c98179de2190049f5823907c016

Luckily, it has an easy fix.

Please criticize!

Well, not each cryptocurrency can be swapped. It has to have certain prerequisites that are as follows:
- branched transaction scripts (i.e. existence of scripting language)
- the same hash algorithm in both chains’ transaction scripts
- signature checks in transaction scripts
- CheckLockTimeVerify or CheckSequenceVerify (“CLTV” and “CSV” for short) in transaction scripts

https://cryptagio.com - crypto exchange platform
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!