SettlementSignatureVerifier’s required_validators is not updated, resulting in a low or high number of signatures being required
The BaseSettlement contract's set_required_validators_num function does not update the required_validators in the SettlementSignatureVerifier contract. This means the number of required validator signatures for settlement verification remains unchanged, potentially requiring fewer or more signatures than intended.
Submitted by klau5, also found by 0x37, Topmark, Draiakoo, jesjupyter, rbserver, gesha17, Breeje, SBSecurity, and 0xNirix
Impact
The required_validators in SettlementSignatureVerifier is not updated when updating BaseSettlement‘s. This results in either fewer or more signatures being required when verified.
Proof of Concept
The functions BaseSettlement.add_validator and BaseSettlement.remove_validator in the BaseSettlement contract also update the validators of the SignatureVerifier contract. However, the function BaseSettlement.set_required_validators_num does not call SettlementSignatureVerifier.set_required_validators_num. Therefore, the number of required validator signatures will not be set.
function set_required_validators_num(
uint256 _required_validators
) external onlyRole(MANAGER_ROLE) {
uint256 old = required_validators;
required_validators = _required_validators;
emit RequiredValidatorsChanged(msg.sender, old, required_validators);
}
This is the PoC. You can add it to solidity/settlement/test/ChakraSettlement.ts and run it.
it('PoC set_required_validators_num', async () => {
const { settlmentInstance, verifierInstance, manager } = await loadFixture(deploySettlementFixture)
await settlmentInstance.connect(manager).set_required_validators_num(3);
expect(await settlmentInstance.required_validators()).to.equal(3);
expect(await verifierInstance.required_validators()).to.equal(2); // does not changed
});
Recommended Mitigation Steps
Call SettlementSignatureVerifier.set_required_validators_num at BaseSettlement.set_required_validators_num .
function set_required_validators_num(
uint256 _required_validators
) external onlyRole(MANAGER_ROLE) {
+ signature_verifier.set_required_validators_num(_required_validators);
uint256 old = required_validators;
required_validators = _required_validators;
emit RequiredValidatorsChanged(msg.sender, old, required_validators);
}
The Warden and its duplicates have outlined how the
BaseSettlement::set_required_validators_numfunction fails to take effect as expected, causing it to be ineffectual in relation to the actual signature validation performed within theSettlementSignatureVerifiercontract.I believe a medium-risk rating is appropriate given that functionality of the system is missing but no exploitable attack path has been defined.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the set_required_validators_num function in BaseSettlement does not call the corresponding function in SettlementSignatureVerifier to update the required number of validators.
Impact
The number of required signatures for settlement verification may be lower or higher than intended, potentially weakening security or causing valid settlements to be rejected.
What the attacker needed
Manager role in BaseSettlement
The fix
The set_required_validators_num function in BaseSettlement should also call SettlementSignatureVerifier.set_required_validators_num to keep the required number in sync.
How it was found
- Deploy the contracts using the deploySettlementFixture.
- Call set_required_validators_num(3) on the settlement instance as the manager.
- Check that the settlement's required_validators is now 3.
- Check that the verifier's required_validators remains 2 (unchanged).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a blockchain system, multiple validators sign off on settlements. The BaseSettlement contract lets an admin set how many signatures are needed, but it forgets to tell the SettlementSignatureVerifier contract, which actually checks the signatures. So the verifier keeps using the old number, which could be too low (less secure) or too high (blocking valid settlements).
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.