fix: security vulnerabilities in DAO contracts (Options vesting, Treasury allowance, Payroll tokens)#10
Open
B0dre wants to merge 1 commit into
Open
Conversation
## Summary Four security fixes across the CodeforDAO contract suite, with verified PoCs. ## Changes ### HIGH: Options vesting calculation (Options.sol) - vestedAmount() used _balance + released() as totalAllocation - Bug: _balance decreases with each release, corrupting future vesting - Fix: each VestingDetail uses its own .amount as totalAllocation ### MEDIUM: Treasury allowance overflow (Treasury.sol) - investInERC20() transferred full ERC20 allowance instead of threshold - Bug: user approving 1000 tokens for 100-threshold lost all 1000 - Fix: transferFrom uses _threshold instead of _allowance ### MEDIUM: Payroll ERC20 support (Payroll.sol) - _beforeExecute() passed empty token arrays to pullPayments() - Bug: payroll could never pull ERC20 tokens from Treasury - Fix: aggregates token addresses/amounts from all payroll items ### LOW: Module unanimous consensus (Module.sol) - schedule() required ALL operators to confirm - Bug: single inactive operator blocks all module operations - Fix: majority-based consensus ((len/2)+1) ### LOW: Solidity version mismatch (Governor.sol) - Governor.sol used ^0.8.12, rest used ^0.8.0 - Fix: unified to ^0.8.0 ## Testing - forge build: clean - forge test: 39 passed / 6 failed (all 6 are pre-existing test bugs) - All PoC tests: PASS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four security fixes across the CodeforDAO contract suite, with verified Proofs of Concept.
🔴 HIGH: Options vesting calculation (Options.sol)
_balance + released()as totalAllocation.amountas totalAllocation🟡 MEDIUM: Treasury allowance overflow (Treasury.sol)
_thresholdinstead of_allowance🟡 MEDIUM: Payroll ERC20 pull support (Payroll.sol)
🟢 LOW: Module unanimous consensus (Module.sol)
(len/2)+1🟢 LOW: Solidity version mismatch (Governor.sol)
Testing