Skip to content
DoS Audit finding Intermediate

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.

hickuphh3 Follow

Originally disclosed on Code4rena

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 typeStr is not validated at all. For example, one can call newActionProposal() with typeStr = ROUTER or typeStr = BAD_STRING, both of which will pass. The first will cause finaliseProposal() to fail because the proposed address is null, preventing completeProposal() from executing. The second does nothing because it does not equate to any of the check typeStr, and so completeProposal() 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 the move*() 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:

  1. Since the number of proposal types is finite, it is best to restrict and validate the typeStr submitted. Specifically,

    • newActionProposal() should only allow FLIP_EMISSIONS and GET_SPARTA proposal types
    • newAddressProposal() should only allow DAO, ROUTER, UTILS, RESERVE, LIST_BOND, DELIST_BOND, ADD_CURATED_POOL and REMOVE_CURATED_POOL proposal types
    • newParamProposal() should only allow COOL_OFF and ERAS_TO_EARN proposal types
  2. Perhaps have a “catch-all-else” proposal that will only call _completeProposal() in finaliseProposal()

function finaliseProposal() external {
	...
	} else if (isEqual(_type, 'ADD_CURATED_POOL')){
		_addCuratedPool(currentProposal);
  } else if (isEqual(_type, 'REMOVE_CURATED_POOL')){
    _removeCuratedPool(currentProposal);
  } else {
		completeProposal(_proposalID);
	}
  1. Do null validation checks in newAddressProposal() and newParamProposal()
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.

ghoul-sol (judge) commented:

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.

The original report as published on Code4rena, by hickuphh3. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by hickuphh3

View all

43 more disclosed reports, best first.

More from Spartan Protocol Contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.