Closed c4-bot-9 closed 8 months ago
Picodes marked the issue as duplicate of #1007
Picodes marked the issue as not a duplicate
Picodes marked the issue as not a duplicate
Picodes changed the severity to 2 (Med Risk)
The mitigation described is not convincing and the issue in itself is confusing. What's the difference if this happens within 2 blocks? No one likely has the time to interfere.
To me this report is missing the key issues (lack of snapshot, voting after the completion timestamp) so I'll give partial credit
Picodes marked the issue as duplicate of #840
Picodes changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/dao/Proposals.sol#L385 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/dao/Proposals.sol#L259 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/dao/DAO.sol#L278
Vulnerability details
Impact
The voting process of the DAO is vulnerable to flash loan attacks. It will comprise the governance process and make malicious proposals confirmed.
Proof of Concept
In the DAO's proposal voting, the weight of each voter's vote is determined by the number of SALT Tokens they have staked (i.e.,
uint256 userVotingPower = staking.userShareForPool( msg.sender, PoolUtils.STAKED_SALT );
) https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/dao/Proposals.sol#L259Once the weight exceeds the quorum, anyone can finalize the vote by executing the finalizeBallot() function (https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/dao/DAO.sol#L278).
However, this voting mechanism could be vulnerable to a flash loan attack.
In such an attack, someone could borrow a sufficient number of SALT Tokens through a flash loan, call the
castVote
function to stake and vote with these borrowed tokens, and then, within the same transaction, call thefinalizeBallot
function to conclude the voting on any proposal.Considering that DAO proposals often involve critical modifications to system parameters, such flash loan attacks are extremely dangerous.
Tools Used
Manual Analysis
Recommended Mitigation Steps
Add protection schemes against flashloan attacks. For example, enforce a rule that prohibits the executing the
castvote()
and thefinalizeBallot()
functions within the same transaction or block.Assessed type
Governance