Dao.sol : Insufficient validation for proposal creation
The proposal creation functions did not validate the proposal type string or reject null proposed values, so anyone could create malformed proposals. Because a created proposal cannot be cancelled for 15 days, an attacker could block the DAO from creating new proposals.
Submitted by hickuphh3, 0xRajeev, also found by gpersoon and shw
In general, creating invalid proposals is easy due to the lack of validation in the new*Proposal() functions.
- The
typeStris not validated at all. For example, one can callnewActionProposal()withtypeStr = ROUTERortypeStr = BAD_STRING, both of which will pass. The first will causefinaliseProposal()to fail because the proposed address is null, preventingcompleteProposal()from executing. The second does nothing because it does not equate to any of the checktypeStr, and socompleteProposal()isn’t executed at all. - Not checking the proposed values are null. The checks only happen in
finaliseProposal()when the relevant sub-functions are called, like themove*()functions.
All of these scenarios lead to a mandatory 15 day wait since proposal creation in order to be cancelled, which prevents the creation of new proposals (in order words, denial of service of the DAO).
Recommended Steps:
-
Since the number of proposal types is finite, it is best to restrict and validate the
typeStrsubmitted. Specifically,newActionProposal()should only allowFLIP_EMISSIONSandGET_SPARTAproposal typesnewAddressProposal()should only allowDAO,ROUTER,UTILS,RESERVE,LIST_BOND,DELIST_BOND,ADD_CURATED_POOLandREMOVE_CURATED_POOLproposal typesnewParamProposal()should only allowCOOL_OFFandERAS_TO_EARNproposal types
-
Perhaps have a “catch-all-else” proposal that will only call
_completeProposal()infinaliseProposal()
function finaliseProposal() external {
...
} else if (isEqual(_type, 'ADD_CURATED_POOL')){
_addCuratedPool(currentProposal);
} else if (isEqual(_type, 'REMOVE_CURATED_POOL')){
_removeCuratedPool(currentProposal);
} else {
completeProposal(_proposalID);
}
- Do null validation checks in
newAddressProposal()andnewParamProposal()
function newAddressProposal(address proposedAddress, string memory typeStr) external returns(uint) {
require(proposedAddress != address(0), "!address");
// TODO: validate typeStr
...
}
function newParamProposal(uint32 param, string memory typeStr) external returns(uint) {
require(param != 0, "!param");
// TODO: validate typeStr
...
}
verifyfirst (Spartan) confirmed and disagreed with severity:
A valid issue in reducing annoyance for DAO proposals. Suggested mitigation fixes the issue. Medium Severity.
The only attack vector here is DoS attack which could be fought by the community by pooling funds for flashbot TX that front runs the attacker. While inconvenient, it doesn’t stop the protocol for long. Agree with sponsor about severity.
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 new proposal functions never checked that the type string was one of the known values or that the proposed address and parameter were non-zero, leaving those checks to a later stage.
Impact
An attacker could create invalid proposals that block new proposals for the 15 day cancellation wait, a denial of service, though the judge noted the community could front-run the attacker with a flashbot transaction and the protocol would not be stopped for long.
What the attacker needed
Ability to submit proposals; no special privileges needed
The fix
The type string should be restricted to the allowed values per function, null values should be rejected, and a catch-all branch should complete unknown proposals; the text says the suggested mitigation fixes the issue.
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.
A DAO is an organisation run by smart contracts, and members change it by creating proposals that others vote on. Here the contract accepted proposals that made no sense, such as an unknown type or an empty address, and once created a proposal could not be removed for 15 days. Filling the queue with junk proposals therefore stopped real ones from being made.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.