Skip to content

Conversation

@random-zebra
Copy link

Backports #2258 and #2428

@random-zebra random-zebra added this to the 5.2.0 milestone Jun 18, 2021
@random-zebra random-zebra self-assigned this Jun 18, 2021
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review ACK 3698900a42cd082660dc5e4eceeb315ac7b093a3.

>>> Backports dced6c0 (PIVX-Project#2258)

The validation for P2CS scriptPubKey is incomplete and doesn't check all
the opcodes.
This opens a vulnerability.
A script could be crafted so that:
* it is identified as P2CS (passing IsPayToColdStaking), and recognized
by the wallet as ISMINE_SPENDABLE_DELEGATED.
* the assumed owner is not actually the owner (or not the only one) of
the coins.

In this Proof of concept, we craft a script that is recognized as own
P2CS by the owner wallet, but can actually be spent with **any** key.

This is achieved by including OP_DROP in a strategic position, so that,
during the script evaluation, part of the locking condition (included
only to fake IsPayToColdStaking) is removed, and replaced by a new
condition embedded in the spending scriptSig.
>>> Backports 889a9e7 (PIVX-Project#2258)

Ensure stack consistency (size, signature and pubkey encoding) during
evaluation
>>> Backports 74bc415 (PIVX-Project#2258)

check the whole script template (leave only the 20 bytes for the staker
keyID and 20 for the owner keyID).
>>> adapted from df11631 (PIVX-Project#2275)

without introducing the new opcode
>>> Backports caad3fb57fa8d7e4b33405be21dee8fa3659932c (PIVX-Project#2428)
@random-zebra random-zebra force-pushed the 202106_5.2-cs-backports branch from 3698900 to 62bf095 Compare June 19, 2021 11:58
@random-zebra
Copy link
Author

Rebased on 5.2 to run updated GA jobs.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re code-ACK 62bf095

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 62bf095

@furszy furszy merged commit 3853bc4 into PIVX-Project:5.2 Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants