Submitted by SBSecurity, also found by Abdessamed, joicygiore (1, 2), 0xHelium, aldarion (1, 2), Sabit, 0x37 (1, 2), Tigerfrake, kutugu, Trooper, BY_DLIFE, Brene, jasonxiale, Coinymous (1, 2, 3), Cybrid, DanielArmstrong, IzuMan, bhilare_, 0x18a6 (1, 2), kind_killerwhale, 0xNirix, Kaysoft, calc1f4r (1, 2, 3), DimaKush, Shubham, Respx (1, 2), agent3bood, b0g0 (1, 2), Taiger (1, 2, 3), 10ap17 (1, 2), Omik, tekkac, jesjupyter, Bauchibred, Subroutine (1, 2), eierina, minato7namikazi, LuarSec (1, 2), JanuaryPersimmon2024 (1, 2), haxatron, said (1, 2), shaflow2 (1, 2), mojito_auditor, fyamf (1, 2), gesha17, klau5 (1, 2), 4rdiii, ZdravkoHr, yudan, NexusAudits, Sparrow, and biakia
SettlementSignatureVerifier::verifyECDSA and settlement::check_chakra_signatures lack checks for duplicate validators and allow passing the threshold with a single valid signature.
From the README, we see that validators arent trusted roles, they simply have to perform their duties and in case they are misbehaving MANAGER can remove them. Its not expected they all to decide to perform a sybil attack.
But for this issue single validator can harm the entire protocol because signature verifiers dont check for duplicated validators and one valid signature is enough to pass the check:
SettlementSignatureVerifier.sol
As we can see nowhere do we check whether this sig is contained twice in the signatures argument.
Knowing that a single validator can call ChakraSettlement::receive_cross_chain_msg with arbitrary arguments and drain all the ChakraSettlementHandler balances where he is an active validator.
The caller of the function should only give valid chains and handlers, the payload will also be valid so it can be decoded but the amount will be the entire balance (this is the max impact, but even 1 wei is considered steal because the caller has not burned or locked any tokens by first calling the send_cross_chain_msg function) of the handler.
Furthermore, the entire handler can be blocked because of the missing duplicate signature check:
The same issue applies to the Cairo code as well:
settlement.cairo
Here, settlement::receive_cross_chain_msg also can be called directly from a single validator and bypass all the checks, stealing the entire balance of the handler.
The caller of the functions should only give valid chains and handlers, the payload will also be valid so it can be decoded but the amount will be the entire balance (this is the max impact, even 1 wei is considered steal because the caller has not burned or locked any tokens by first calling the send_cross_chain_msg function) of the handler.
In case both issues are separated because they happen in different places we split this one into two, covering both languages, so it is to be accepted by both.
NOTE: Keep in mind that the issue shows that any validator can drain the entire protocol due to a missing duplicate signatures (used) check that allows him to do anything with only 1 signed message. The problem is not only that validators are not trusted, when the problem is fixed as below, even if a validator decides to do something like that, he cant achieve it, thats why required_validators is defined at all to protect the protocol from situations like this.
In the end this single validator doesnt lose anything, nowhere in the README it is mentioned that they are trusted, or any token stake is required from them, the only thing that can lose is their rights to continue signing transactions. On the other hand, they will receive the entire token supply or entire locked token balance.
For Solidity:
For Cairo:
pidb (Chakra) disputed and commented on duplicate issue #4:
0xsomeone (judge) increased severity to High and commented:
