check_swap_memo(): require is_swap to be set if memo present in transaction
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 containing a swap memo but with the “is_swap” field unset or set to false.
This commit is contained in:
parent
9eb45c3c20
commit
1be9184b56
1 changed files with 5 additions and 2 deletions
|
|
@ -101,10 +101,13 @@ class Completed(Base):
|
|||
tokensym = r.tokensym,
|
||||
need_amt = True)
|
||||
|
||||
if not (self.is_swap or self.is_deposit):
|
||||
raise ValueError(
|
||||
'Swap memo present in transaction but ‘is_swap’ field not set. '
|
||||
'Your online installation may be compromised!')
|
||||
|
||||
if mmid := getattr(self, 'swap_recv_addr_mmid', None):
|
||||
return self.Output(proto, addr=p.address, mmid=mmid, amt=proto.coin_amt('0'))
|
||||
elif not self.is_swap:
|
||||
pass
|
||||
elif self.cfg.allow_non_wallet_swap:
|
||||
ymsg('Warning: allowing swap to non-wallet address (--allow-non-wallet-swap)')
|
||||
return self.Output(proto, addr=p.address, mmid=None, amt=proto.coin_amt('0'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue