bitcore icon indicating copy to clipboard operation
bitcore copied to clipboard

BAD_SIGNATURES / SERVER_COMPROMISED error code when cosigning/fetching a transaction proposal

Open bitalias opened this issue 11 years ago • 14 comments

Hi,

I have got a 2/3 wallet, created with bitcore-wallet 0.0.7. Using bitcore-wallet-client 0.1.3 to propose+sign and then cosign a transaction. The cosigning part fails with the BAD_SIGNATURES error code.

Anybody who knows why this is happening? Version incompatibility? Thankful for any help!

bitalias avatar Oct 04 '15 18:10 bitalias

When trying to sign proposal by cosigning Copay client following message appears: 'Could not accept payment: Server response could not be verified'. Using bitpays bitcore-wallet-service. could-not-accept-payment-copay

bitalias avatar Oct 04 '15 22:10 bitalias

Upgraded to bitcore-wallet-client 0.6.0 and now having following error message when I try to get a transaction proposal from the bitcore-wallet-service:

{ code: 'SERVER_COMPROMISED', message: 'Server response could not be verified' }

Any ideas?

bitalias avatar Oct 07 '15 13:10 bitalias

Hi, are you trying to access a wallet with a previously created pending transaction proposal? We had a report of a similar problem some days ago. It got fixed in bitcore-wallet-client 0.6.4. Could you please try installing that version and check if the problem still persists? Thanks!

isocolsky avatar Oct 08 '15 13:10 isocolsky

No pending transaction proposal. First proposal ever. Bitcore wallet client does not seem to be compatible with bitcore wallet. I have a newer version than 0.6.4 now. If it got fixed downgrading does not seems the right thing to do. Would be awesome to know which versions of BWC work with which versions of BW, so I can install the proper versions...

bitalias avatar Oct 08 '15 15:10 bitalias

I see, will look into the issue ASAP and get back to you.

isocolsky avatar Oct 08 '15 16:10 isocolsky

I upgraded the bitcore-wallet-client dependency from 0.6.0 to 0.6.4 and did some extensive testing (1-of-1 and multi-sig wallets interacting with the Copay app). Everything works as expected. Could you try the new release [email protected]? If you continue to see the error, could you please describe step-by-step what you are doing so we can try to reproduce the issue? Thanks.

isocolsky avatar Oct 08 '15 19:10 isocolsky

Hi, are you trying to access a wallet with a previously created pending transaction proposal? We had a report of a similar problem some days ago. It got fixed in bitcore-wallet-client 0.6.4. Could you please try installing that version and check if the problem still persists? Thanks!

Actually this is indeed what happens. One server proposes the transaction and the other server fetches it from BWS and is supposed to cosign it. Afterwards the transaction proposal gets again fetched from the first server to get broadcasted. So I keep receiving

{ code: 'SERVER_COMPROMISED', message: 'Server response could not be verified' }

Even after upgrading to 0.6.4 as you suggested. I also reinstalled everything else related.

BTW it seems that I did not use BW 0.0.7, just that the --version flag always returns 0.0.7, another (little) bug since in package.json clearly a higher version is mentioned?

Also not sure if BAD_SIGNATURES (version incompatibility) and SERVER_COMPROMISED (?) are separate bugs. I created the keys with a simple script using BWC and was able to use them with BW.

bitalias avatar Oct 10 '15 02:10 bitalias

Something we do differently. Bug still exists. Definetly using 0.6.4 and Bitpay's BWS.

Here is the debug output:

[debug:equest._callback (.../wallet/node_modules/bitcore-wallet-client/lib/api.js:573:9)] [ { version: '2.0.0', type: 'multiple_outputs', createdOn: 1444759177, id: '014447591776626edead07-077a-44cb-aa50-2e5210843007', walletId: '2fab9a3c-2fea-4fcf-a5e5-5541e4a1053d', creatorId: 'ea642f48d8d6932e06556057a7f9fc8d7a6ac2628920c5ae8acc71ec86f284f3', outputs: [ { amount: 1000, toAddress: '3EysCGt78T5svgxc5eZMaUjgGL1tuMmGc6', message: '{"iv":"Fc+XsTUmUAO95xCfe3ALYQ==","v":1,"iter":1,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","ct":"XLmGGqCc/XCJFVnp4Wkb6CVCo0yx7zHA3KjInktnOz5mpqRctvQ67hBhxUeCcWApcySVtqSgw00eYZ5T1XOw72nc777tIZEQDuI6QvJu0lvhOTaGT+Qs4v6obHBDOkRs55MmacHT3IWLorRux8rOAm1IweQDM+tu5y7CfOSabd1ahIw0LL+DCFLWoca+NGh+4rmKB2Xb515wwQAhY60sirRBD8r84m6xWzcyqd5Ss3zvpQ9FW3yGC2HZhd61aRMpvWAWfJpfG++l+B9vSUkK/p6gQOC4pLe3Tg=="}' } ], toAddress: null, amount: null, message: '{"iv":"DPslcuDJf+5n09ImgrBrpA==","v":1,"iter":1,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","ct":"ABiyfF79RrRZDeXP6ztSMQvCLgbyOJpeQl2jz7TdNjsMcQ0="}', payProUrl: null, proposalSignature: '304402207880f4a0fdb61f03f762c7b7b69755b22eee6d79d88aa2c24a29de9822c19957022001f2cf2ca9ff2a01b04190ce3aba8722c51ae4cdf4d0bc43208d1722455eac8a', changeAddress: { version: '1.0.0', createdOn: 1444759177, address: '3Pqt45LoEauhVZkgqBfHvz565y6qaUb21B', walletId: '2fab9a3c-2fea-4fcf-a5e5-5541e4a1053d', isChange: true, path: 'm/1/0', publicKeys: [ '039e1b2e71cde0563a4290fa81f7eaf0d379eebd1cd80b501e2563a37e87ac7975', '02947a679fb8eefd8232993a1a6d998fd011dbd31604aeaf5874378feb7cc6742b', '022dad5711690c3227a9685ae6c87e9a2583be919fce7397c26dc0cd487b2c9172' ], network: 'livenet', type: 'P2SH', _id: '561d4689f8841d8c69f9c773' }, inputs: [ { txid: '2a0ebac22506a7a1b05fd1c345eb37d873b6f85fcea2b06010f8fd0d1e744749', vout: 0, address: '3B3ZNCcStE8YiSn2MHmQKfrNkPQye5qAA3', scriptPubKey: 'a914669bb2b3c46d480d0b923dd1c945081317b10ef687', confirmations: 0, locked: false, satoshis: 9874439, path: 'm/0/1', publicKeys: [ '02b5b782cf72b0e3195ea39dedaf03a826d0109d747eb89b4c58ebbe9f5b6ab2a8', '030a43b73d4f666b553253cb3112986d2f2e24217ba3bf40133599bf2ae2027887', '03714dfa12e438731e4d4fe3258f537768bcebe240f896062a9ce4c7b01ace8c6e' ] } ], requiredSignatures: 2, requiredRejections: 2, walletN: 3, status: 'pending', txid: null, broadcastedOn: null, inputPaths: [ 'm/0/1' ], actions: [ { version: '1.0.0', createdOn: 1444759178, copayerId: 'ea642f48d8d6932e06556057a7f9fc8d7a6ac2628920c5ae8acc71ec86f284f3', type: 'accept', signatures: [ '3045022100df359c7e0b23f704bbef93ed2a8c27f919bccee46e18180fc151e9bc5839bef402200a340de1a4919c47dd9633bad673ac4617ee0808473d90539fa27bdfe36b788e' ], xpub: 'xpub6DDEUUPmrQs1vr5xBhy6qQ2Ei54rbtyzTWyGUbhgKgsLkNXa9mN2vSBVXHyBtpA1VgDNdbXrZ5716WKjojYQDLdpR4ATs7a86vtSBnCoRP4', comment: null, copayerName: 'firstNode' } ], outputOrder: [ 0, 1 ], fee: 4100, network: 'livenet', feePerKb: 10000, excludeUnconfirmedUtxos: false, proposalSignaturePubKey: null, proposalSignaturePubKeySig: null, derivationStrategy: 'BIP44', addressType: 'P2SH', customData: null, creatorName: 'firstNode', deleteLockTime: 0 } ]

and then:

[debug:unction.Verifier.checkTxProposalBody (...wallet/node_modules/bitcore-wallet-client/lib/verifier.js:124:7)] Regenerating & verifying tx proposal hash -> Hash: ["{"message":"{\"iv\":\"DPslcuDJf+5n09ImgrBrpA==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"ABiyfF79RrRZDeXP6ztSMQvCLgbyOJpeQl2jz7TdNjsMcQ0=\"}","outputs":[{"amount":1000,"message":"{\"iv\":\"Fc+XsTUmUAO95xCfe3ALYQ==\",\"v\":1,\"iter\":1,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"ct\":\"XLmGGqCc/XCJFVnp4Wkb6CVCo0yx7zHA3KjInktnOz5mpqRctvQ67hBhxUeCcWApcySVtqSgw00eYZ5T1XOw72nc777tIZEQDuI6QvJu0lvhOTaGT+Qs4v6obHBDOkRs55MmacHT3IWLorRux8rOAm1IweQDM+tu5y7CfOSabd1ahIw0LL+DCFLWoca+NGh+4rmKB2Xb515wwQAhY60sirRBD8r84m6xWzcyqd5Ss3zvpQ9FW3yGC2HZhd61aRMpvWAWfJpfG++l+B9vSUkK/p6gQOC4pLe3Tg==\"}","toAddress":"3EysCGt78T5svgxc5eZMaUjgGL1tuMmGc6"}],"payProUrl":null}"," Signature: ","304402207880f4a0fdb61f03f762c7b7b69755b22eee6d79d88aa2c24a29de9822c19957022001f2cf2ca9ff2a01b04190ce3aba8722c51ae4cdf4d0bc43208d1722455eac8a"]

returns error

{ code: 'SERVER_COMPROMISED', message: 'Server response could not be verified' }

Please help!

bitalias avatar Oct 13 '15 18:10 bitalias

Figured out what is failing:

if (!WalletUtils.verifyMessage(hash, txp.proposalSignature, creatorSigningPubKey)) return false;

is returning indeed false (in lib/verifier.js)

How come? When we switch this check off, what are the security implications?

bitalias avatar Oct 13 '15 19:10 bitalias

Thank you for the detailed info. I still cannot reproduce the issue. How are you generating the proposal? Bitcore Wallet does not support multiple_output proposals yet. Are you going through BWC or are you using BWS REST API?

isocolsky avatar Oct 13 '15 20:10 isocolsky

When we switch this check off, what are the security implications?

The purpose of this check is so each user can verify that a given tx proposal is actually coming from one of their copayers. If removed, the user is vulnerable to an attack from a compromised server that could send a fake tx proposal on behalf of one of the copayers for the user to sign.

isocolsky avatar Oct 14 '15 02:10 isocolsky

How are you generating the proposal? Bitcore Wallet does not support multiple_output proposals yet. Are you going through BWC or are you using BWS REST API?

Using BWC 0.6.4. Compatibility issue with BW and BWC disappeared after upgrading to the newest version each. Keys also get created with BWC. With BW I can read the tx-proposal, no warnings.

So is Bitpay's bitcore wallet service actually compromised? Is there an alternative I can use without running a full node? Also please give me instructions how I can check the signature manually.

bitalias avatar Oct 14 '15 05:10 bitalias

This issue is probably related with https://github.com/bitpay/bitcore-wallet-client/pull/170

Could you check again using BWC master at BW? Please note that the tx proposal need to be created again.

matiu avatar Nov 09 '15 19:11 matiu

closing this one one, in favor of: https://github.com/bitpay/bitcore-wallet-client/issues/155

matiu avatar Nov 09 '15 19:11 matiu