This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
extractHash does not check the size of the script #161
Labels
solidity
Needs work in Solidity folder
Description
extractHash
checks that the template forP2PKH
,P2SH
,P2PKH
andP2WSH
is valid (proper prefix and suffix), but the actual size of the provided script is never checked.bitcoin-spv/solidity/contracts/BTCUtils.sol
Lines 406 to 434 in 3a35db8
Therefore a script encoded under the following format will be accepted:
This can cause issues if the provided data does not come from a validated transaction, for instance if the data is being provided directly from a user.
This is related to keep-network/tbtc#658
Invalid P2PKH example
The following call won't be caught, even though the script is invalid (notice the extra
88
by the end of the script):Fix
Add an additional check for maliciously formatted scripts to check the actual length of the provided script.
The text was updated successfully, but these errors were encountered: