tx.file: require have_wif field to be absent for transaction outputs

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:
The MMGen Project 2026-11-22 09:11:10 +00:00
commit fa0d2a631c
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -47,6 +47,10 @@ 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:
raise ValueError(
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),