tx.file: require have_wif field to be absent
Fixes a vulnerability whereby an attacker with access to the online machine could bypass the address-belongs-to-wallet test performed by the offline signer by crafting a transaction file with the “have_wif” field set for a transaction output.
This commit is contained in:
parent
1be9184b56
commit
ab545e189f
3 changed files with 7 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
17.1.0dev2
|
||||
17.1.0dev3
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ def eval_io_data(tx, data, *, desc):
|
|||
if not (desc == 'outputs' and tx.proto.base_coin == 'ETH'): # ETH txs can have no outputs
|
||||
assert len(data), f'no {desc}!'
|
||||
for d in data:
|
||||
if 'have_wif' in d:
|
||||
die(
|
||||
'TxKeysError',
|
||||
f'transaction file {desc} contains extraneous ‘have_wif’ field. '
|
||||
'Your online installation may be compromised!')
|
||||
d['amt'] = tx.proto.coin_amt(d['amt'])
|
||||
io, io_list = {
|
||||
'inputs': (tx.Input, tx.InputList),
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ class TxKeys:
|
|||
ret = self.get_keys_for_non_mmgen_inputs()
|
||||
memo_output = self.tx.check_swap_memo() # do this for non-swap transactions too!
|
||||
okeys, mkeys = ([], [])
|
||||
num_okeys = len([e for e in self.tx.outputs if e.mmid and not e.have_wif])
|
||||
num_okeys = len([e for e in self.tx.outputs if e.mmid])
|
||||
num_mkeys = 1 if memo_output and memo_output.mmid else None
|
||||
|
||||
if self.keyaddrlist:
|
||||
|
|
|
|||
Loading…
Reference in a new issue