Re: [Bitcoin-development] Possible attack: Keeping unconfirmed transactions
>From what I know, Alice does not know to which node Bob will broadcast the transaction. Therefore, Alice cannot intercept the transaction and prevent the rest of the network from seeing it. Toshi On Fri, Jun 6, 2014 at 3:02 PM, Raúl Martínez wrote: > I dont know if this attack is even possible, it came to my mind and I will > try to explain it as good as possible. > > Some transacions keep unconfirmed forever and finally they are purged by > Bitcoin nodes, mostly due to the lack of fees. > > > Example: > - > > Alice is selling a pizza to Bob, Bob is now making the payment with > Bitcoin. > The main goal of this attack is to store a unconfirmed transaction send by > Bob for a few days (it will not be included in the blockchain because it > has no fee or due to other reason), Bob might resend the payment or might > just cancel the deal with Alice. > > Bob forgets about that failed trade but a couple of days later, Alice, who > has stored the signed transacion, relays the transaction to the network (or > mines it directly with his own hashpower). > Bob does not know what is happening, he believed that that transaction was > "canceled forever", he even does not remember the failed pizza deal. > > Alice has now the bitcoins and Bob does not know what happened with his > money. > > - > > This might also work with the Payment Protocol because when using it Bob > does not relay the transaction to the network, its Alices job to do it, > Alice stores it and tells Bob to resend the payment, Bob creates another > transaction (If has the same inputs as the first TX this does not work) > (this one is relayed by Alice to the network). > > Alice comes back a couple of days later and mines with his hashrate the > first transaction (the one she didnt relayed to the network). > > Alice now has two payments, Bob does not know what happened. > > > --- > > I hope that I explained well this possible attack, I dont know if there is > already a fix for this problem or if it is simply impossible to execute > this kind of attack. > > Thanks for your time. > > > > > > > -- > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/NeoTech > ___ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > > -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech___ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development
Re: [Bitcoin-development] Another uninitialized memory problem
I looked at this a bit more yesterday, and it looks like both sides of the comparison were uninitialized, and I fixed one side, but the other side has the same problem. I'll try to investigate further this afternoon once I get out of meetings/meetings prep. Toshi On Tue, Jun 3, 2014 at 9:43 AM, Jeff Garzik wrote: > I think I see the problem. > > > On Mon, Jun 2, 2014 at 4:01 PM, Toshi Morita wrote: > > I'm seeing another uninitialized memory problem in bitcoind using > valgrind: > > > > tm@tm-VirtualBox:~/bitcoind/bitcoin/src$ valgrind ./bitcoind > > ==2337== Memcheck, a memory error detector > > ==2337== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. > > ==2337== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright > info > > ==2337== Command: ./bitcoind > > ==2337== > > ==2337== Conditional jump or move depends on uninitialised value(s) > > ==2337==at 0x319176: CWallet::LoadKeyMetadata(CPubKey const&, > > CKeyMetadata const&) (wallet.cpp:110) > > ==2337==by 0x33645A: ReadKeyValue(CWallet*, CDataStream&, > CDataStream&, > > CWalletScanState&, std::string&, std::string&) (walletdb.cpp:509) > > ==2337==by 0x3374F0: CWalletDB::LoadWallet(CWallet*) > (walletdb.cpp:623) > > ==2337==by 0x3218FD: CWallet::LoadWallet(bool&) (wallet.cpp:1485) > > ==2337==by 0x157F16: AppInit2(boost::thread_group&) (init.cpp:958) > > ==2337==by 0x140142: AppInit(int, char**) (bitcoind.cpp:143) > > ==2337==by 0x13649E: main (bitcoind.cpp:180) > > ==2337== > > > > > > > -- > > Learn Graph Databases - Download FREE O'Reilly Book > > "Graph Databases" is the definitive new guide to graph databases and > their > > applications. Written by three acclaimed leaders in the field, > > this first edition is now available. Download your free book today! > > http://p.sf.net/sfu/NeoTech > > ___ > > Bitcoin-development mailing list > > Bitcoin-development@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > > > > > > -- > Jeff Garzik > Bitcoin core developer and open source evangelist > BitPay, Inc. https://bitpay.com/ > -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech___ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development
[Bitcoin-development] Another uninitialized memory problem
I'm seeing another uninitialized memory problem in bitcoind using valgrind: tm@tm-VirtualBox:~/bitcoind/bitcoin/src$ valgrind ./bitcoind ==2337== Memcheck, a memory error detector ==2337== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==2337== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==2337== Command: ./bitcoind ==2337== ==2337== Conditional jump or move depends on uninitialised value(s) ==2337==at 0x319176: CWallet::LoadKeyMetadata(CPubKey const&, CKeyMetadata const&) (wallet.cpp:110) ==2337==by 0x33645A: ReadKeyValue(CWallet*, CDataStream&, CDataStream&, CWalletScanState&, std::string&, std::string&) (walletdb.cpp:509) ==2337==by 0x3374F0: CWalletDB::LoadWallet(CWallet*) (walletdb.cpp:623) ==2337==by 0x3218FD: CWallet::LoadWallet(bool&) (wallet.cpp:1485) ==2337==by 0x157F16: AppInit2(boost::thread_group&) (init.cpp:958) ==2337==by 0x140142: AppInit(int, char**) (bitcoind.cpp:143) ==2337==by 0x13649E: main (bitcoind.cpp:180) ==2337== -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech___ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development
Re: [Bitcoin-development] bitcoind minor bug in wallet and possible fix
Ok. Done. Toshi On Thu, May 29, 2014 at 5:06 PM, Mark Friedenbach wrote: > Please make a pull request on github. It'll likely get merged quickly. > On May 29, 2014 5:04 PM, "Toshi Morita" wrote: > >> I ran bitcoind under valgrind and found a place where it references an >> uninitialized variable in some cases: >> >> tm@tm-VirtualBox:~/bitcoind/bitcoin/src$ valgrind ./bitcoind >> ==2337== Memcheck, a memory error detector >> ==2337== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. >> ==2337== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info >> ==2337== Command: ./bitcoind >> ==2337== >> ==2337== Conditional jump or move depends on uninitialised value(s) >> ==2337==at 0x319176: CWallet::LoadKeyMetadata(CPubKey const&, >> CKeyMetadata const&) (wallet.cpp:110) >> ==2337==by 0x33645A: ReadKeyValue(CWallet*, CDataStream&, >> CDataStream&, CWalletScanState&, std::string&, std::string&) >> (walletdb.cpp:509) >> ==2337==by 0x3374F0: CWalletDB::LoadWallet(CWallet*) >> (walletdb.cpp:623) >> ==2337==by 0x3218FD: CWallet::LoadWallet(bool&) (wallet.cpp:1485) >> ==2337==by 0x157F16: AppInit2(boost::thread_group&) (init.cpp:958) >> ==2337==by 0x140142: AppInit(int, char**) (bitcoind.cpp:143) >> ==2337==by 0x13649E: main (bitcoind.cpp:180) >> ==2337== >> >> The bug occurs here because nTimeFirstKey is not initialized when the >> wallet is instantiated: >> >> wallet.cpp:63 >> if (!nTimeFirstKey || nCreationTime < nTimeFirstKey) >> nTimeFirstKey = nCreationTime; >> >> >> I fixed it in my fork: >> >> diff --git a/src/wallet.h b/src/wallet.h >> index 9607415..b78045f 100644 >> --- a/src/wallet.h >> +++ b/src/wallet.h >> @@ -163,6 +163,7 @@ public: >> nOrderPosNext = 0; >> nNextResend = 0; >> nLastResend = 0; >> +nTimeFirstKey = 0; >> } >> >> If this fix is ok please pull from my GitHub fork; username on GitHub is >> tm314159. >> >> Toshi >> >> >> >> -- >> Time is money. Stop wasting it! Get your web API in 5 minutes. >> www.restlet.com/download >> http://p.sf.net/sfu/restlet >> ___ >> Bitcoin-development mailing list >> Bitcoin-development@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development >> >> -- Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet___ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development
[Bitcoin-development] bitcoind minor bug in wallet and possible fix
I ran bitcoind under valgrind and found a place where it references an uninitialized variable in some cases: tm@tm-VirtualBox:~/bitcoind/bitcoin/src$ valgrind ./bitcoind ==2337== Memcheck, a memory error detector ==2337== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==2337== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==2337== Command: ./bitcoind ==2337== ==2337== Conditional jump or move depends on uninitialised value(s) ==2337==at 0x319176: CWallet::LoadKeyMetadata(CPubKey const&, CKeyMetadata const&) (wallet.cpp:110) ==2337==by 0x33645A: ReadKeyValue(CWallet*, CDataStream&, CDataStream&, CWalletScanState&, std::string&, std::string&) (walletdb.cpp:509) ==2337==by 0x3374F0: CWalletDB::LoadWallet(CWallet*) (walletdb.cpp:623) ==2337==by 0x3218FD: CWallet::LoadWallet(bool&) (wallet.cpp:1485) ==2337==by 0x157F16: AppInit2(boost::thread_group&) (init.cpp:958) ==2337==by 0x140142: AppInit(int, char**) (bitcoind.cpp:143) ==2337==by 0x13649E: main (bitcoind.cpp:180) ==2337== The bug occurs here because nTimeFirstKey is not initialized when the wallet is instantiated: wallet.cpp:63 if (!nTimeFirstKey || nCreationTime < nTimeFirstKey) nTimeFirstKey = nCreationTime; I fixed it in my fork: diff --git a/src/wallet.h b/src/wallet.h index 9607415..b78045f 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -163,6 +163,7 @@ public: nOrderPosNext = 0; nNextResend = 0; nLastResend = 0; +nTimeFirstKey = 0; } If this fix is ok please pull from my GitHub fork; username on GitHub is tm314159. Toshi -- Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet___ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development