Platform: Code4rena
Start Date: 27/10/2022
Pot Size: $33,500 USDC
Total HM: 8
Participants: 96
Period: 3 days
Judge: kirk-baird
Total Solo HM: 1
Id: 176
League: ETH
Rank: 22/96
Findings: 1
Award: $234.83
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: robee
Also found by: 0x007, 0x1f8b, 0x52, 0xDjango, 0xNazgul, 0xSmartContract, 8olidity, Awesome, B2, Bnke0x0, Chom, Diana, Dravee, JTJabba, Jeiwan, Josiah, Lambda, Mathieu, Picodes, RaoulSchaffranek, RaymondFam, RedOneN, ReyAdmirado, Rolezn, Ruhum, Sm4rty, Tricko, Trust, Waze, __141345__, a12jmx, adriro, ajtra, brgltd, c3phas, carlitox477, cccz, ch0bu, chaduke, chrisdior4, corerouter, cryptonue, csanuragjain, ctf_sec, cylzxje, delfin454000, dic0de, djxploit, horsefacts, imare, jayphbee, jwood, ktg, ladboy233, leosathya, lukris02, minhtrng, neko_nyaa, oyc_109, pashov, peritoflores, rbserver, rvierdiiev, shark, tnevler, yixxas
234.8322 USDC - $234.83
Some fee parameters of functions are not checked for invalid values. Validate the parameters:
WardenPledge.increasePledgeRewardPerVote (maxFeeAmount) WardenPledge.extendPledge (maxFeeAmount) WardenPledge.createPledge (maxFeeAmount) WardenPledge.updatePlatformFee (newFee)
You use safeApprove of openZeppelin although it's deprecated. (see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/566a774222707e424896c0c390a84dc3c13bdcb2/contracts/token/ERC20/utils/SafeERC20.sol#L38) You should change it to increase/decrease Allowance as OpenZeppilin says.
Deprecated safeApprove in SafeERC20.sol line 64: _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); Deprecated safeApprove in SafeERC20.sol line 76: _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); Deprecated safeApprove in SafeERC20.sol line 55: _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
external / public functions parameters should be validated to make sure the address is not 0. Otherwise if not given the right input it can mistakenly lead to loss of user funds.
WardenPledge.sol.recoverERC20 token
The project is compiled with different versions of solidity, which is not recommended because it can lead to undefined behaviors.
owner param should be validated to make sure the owner address is not address(0). Otherwise if not given the right input all only owner accessible functions will be unaccessible.
Ownable.sol.transferOwnership newOwner
The following contracts have a function that allows them an admin to change it to a different address. If the admin accidentally uses an invalid address for which they do not have the private key, then the system gets locked. It is important to have two steps admin change where the first is announcing a pending new admin and the new address should then claim its ownership. A similar issue was reported in a previous contest and was assigned a severity of medium: code-423n4/2021-06-realitycards-findings#105
Ownable.sol
The following functions are missing reentrancy modifier although some other pulbic/external functions does use reentrancy modifer. Even though I did not find a way to exploit it, it seems like those functions should have the nonReentrant modifier as the other functions have it as well..
WardenPledge.sol, recoverERC20 is missing a reentrancy modifier
In the following functions no value is returned, due to which by default value of return will be 0. We assumed that after the update you return the latest new value. (similar issue here: https://github.com/code-423n4/2021-10-badgerdao-findings/issues/85).
WardenPledge.sol, updateChest WardenPledge.sol, updateMinTargetVotes WardenPledge.sol, updatePlatformFee WardenPledge.sol, updateRewardToken
Transferring tokens to the zero address is usually prohibited to accidentally avoid "burning" tokens by sending them to an unrecoverable zero address.
https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L658 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L472 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L271 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L438 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L333 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L394 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L505
The following functions are missing commenting as describe below:
Pausable.sol, paused (public), @return is missing
use openzeppilin's safeCast in:
https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L665 : unsafe cast uint64(n)
Division by 0 can lead to accidentally revert, (An example of a similar issue - https://github.com/code-423n4/2021-10-defiprotocol-findings/issues/84)
https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L256 boostDuration might be 0
There are ERC20 tokens that charge fee for every transfer() / transferFrom().
Vault.sol#addValue() assumes that the received amount is the same as the transfer amount, and uses it to calculate attributions, balance amounts, etc. But, the actual transferred amount can be lower for those tokens. Therefore it's recommended to use the balance change before and after the transfer instead of the amount. This way you also support the tokens with transfer fee - that are popular.
https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L438 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L333 https://github.com/code-423n4/2022-10-paladin/tree/main/contracts/WardenPledge.sol#L394
#0 - c4-judge
2022-11-12T00:53:47Z
kirk-baird marked the issue as grade-a
#1 - c4-judge
2022-11-12T00:53:51Z
kirk-baird marked the issue as selected for report