Skip to content

Conversation

@awemany
Copy link
Contributor

@awemany awemany commented Mar 28, 2017

The number of arguments is not checked in MutateTxAddOutAddr(..), meaning
that

./bitcoin-tx -create outaddr=

accessed the vStrInputParts vector beyond its bounds.

The number of arguments is not checked MutateTxAddOutAddr(..), meaning
that

> ./bitcoin-tx -create outaddr=

accessed the vStrInputParts vector beyond its bounds.
@instagibbs
Copy link
Member

utACK 71a6133

@gmaxwell
Copy link
Contributor

gmaxwell commented Mar 28, 2017

MutateTxAddOutPubKey appears to have the same issue. I recommend reviewing 61a1534 and addressing it completely.

Also, pinging @jnewbery

@laanwj laanwj added this to the 0.14.1 milestone Mar 29, 2017
@laanwj
Copy link
Member

laanwj commented Mar 29, 2017

Ugh. Needs backport to 0.14.1

@jnewbery
Copy link
Contributor

I've reviewed 61a1534 and I think MutateTxAddOutAddr() and MutateTxAddOutPubKey() are the only functions that aren't properly checking their inputs. Extra eyes to review are always good though.

The check in MutateTxAddOutPubKey() should be:

    if (vStrInputParts.size() < 2 || vStrInputParts.size() > 3)
        throw std::runtime_error("TX output missing or too many separators");

since MutateTxAddOutPubKey() can have an optional flag.

I'm currently writing test cases for bitcoin-tx that test this and other errors. We should include that in this PR when it's ready.

@jnewbery
Copy link
Contributor

Extra testcases are here: https://github.com/jnewbery/bitcoin/commits/bitcoin_tx_input_sanitiser

  • 31c4dbf81a164e57a414ee548ec3227dfee35cba adds stderr checking to bctest.py
  • 718063a84dd78187171f60759bebd64aea1fed58 is the fix for bitcoin-tx (which you should just squash into your existing fix)
  • 0768e51977924aadf19c21331a15e30d97ba44c0 adds tests for bitcoin-tx correctly checking the number of separators in inputs.

@jtimon
Copy link
Contributor

jtimon commented Mar 30, 2017

Yes, it seems MutateTxAddOutAddr and MutateTxAddOutPubKey are the only ones with more than one part but not checking it.
utACK but better to fix both.

@jnewbery
Copy link
Contributor

@awemany - there's some enthusiasm to get this merged into master quickly, so I've opened #10130 with your fix and my test changes.

Thanks for reporting this (and providing a fix!)

@fanquake
Copy link
Member

Closing in favour of #10130 . @awemany your changes are still included in the new pull-request.

@fanquake fanquake closed this Mar 30, 2017
@fanquake fanquake removed this from the 0.14.1 milestone Mar 30, 2017
@awemany awemany deleted the bitcointx-addoutaddr branch November 24, 2017 17:31
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants