Aladdindao: Security Assessment
Aladdindao: Security Assessment
Aladdindao: Security Assessment
Security Assessment
For :
AladdinDAO Protocol
Disclaimer
CertiK reports are not, nor should be considered, an “endorsement” or “disapproval” of any particular project or team.
These reports are not, nor should be considered, an indication of the economics or value of any “product” or “asset”
created by any team or project that contracts CertiK to perform a security review.
CertiK Reports do not provide any warranty or guarantee regarding the absolute bug-free nature of the technology
analyzed, nor do they provide any indication of the technologies proprietors, business, business model or legal
compliance.
CertiK Reports should not be used in any way to make decisions around investment or involvement with any particular
project. These reports in no way provide investment advice, nor should be leveraged as investment advice of any sort.
CertiK Reports represent an extensive auditing process intending to help our customers increase the quality of their code
while reducing the high level of risk presented by cryptographic tokens and blockchain technology.
Blockchain technology and cryptographic assets present a high level of ongoing risk. CertiK’s position is that each
company and individual are responsible for their own due diligence and continuous security. CertiK’s goal is to help reduce
the attack vectors and the high level of variance associated with utilizing new and consistently changing technologies, and
in no way claims any guarantee of security or functionality of the technology we agree to analyze.
A document describing in detail an in depth analysis of a particular piece(s) of source code provided to CertiK by a
Client.
An organized collection of testing results, analysis and inferences made about the structure, implementation and
overall best practices of a particular piece of source code.
Representation that a Client of CertiK has indeed completed a round of auditing with the intention to increase the
quality of the company/product’s IT infrastructure and or source code.
Overview
Project Summary
Commits 2a84dbdb3fc75b1ef75f7232f83e0e32cf9c3652
Audit Summary
Consultants Engaged 2
Vulnerability Summary
Total Issues 9
Total Critical 0
Total Major 1
Total Minor 1
Total Informational 7
Total Discussion 0
Executive Summary
This report has been prepared for AladdinDAO smart contract to discover issues and vulnerabilities in the source code of
their Smart Contract as well as any contract dependencies that were not part of an officially recognized library. A
comprehensive examination has been performed, utilizing Dynamic Analysis, Static Analysis, and Manual Review
techniques.
Testing the smart contracts against both common and uncommon attack vectors.
Assessing the codebase to ensure compliance with current best practices and industry standards.
Ensuring contract logic meets the specifications and intentions of the client.
Cross referencing contract structure and implementation against similar smart contracts produced by industry
leaders.
Thorough line-by-line manual review of the entire codebase by industry experts.
File in Scope
ID Contract SHA256-Checksum
TS Treasury.sol 160451b4e029c173c80c100a934dde733a16f8fd6f08cd037edc67f4d7e92041
VT VoteToken.sol 301981c3631eb57b5a7c14ca60fdf65bff37a9e42282fa195991afe903be40ba
BS BaseStrategy.sol 4deec1108bbc994d0fc1a5722fbf895684dab172e68fbb4ef344507f148951e7
BV BaseVault.sol bfb599fe908dcff380e6d895dd7242202539855b5958ef347dd78bcbd64c9a97
CL Controller.sol b0e4d0ab0b8830c8d1454f87c291ba378ba3d37d03fa626d9b6f129cd31f461b
MR MultiStakingRewards.sol fcbfc6f98a0d872914354db1361d4a808796844fe0814cdb1d8a159c7f88e3ab
RD RewardDistributor.sol d61b1c0e8ff7094571307f241882f9323fac5f978a87d8251a9f660789998388
WE WrappedERC20.sol e6650b064830214793cf55d2f8f4b57da1818f66c730bedf095f116368ef247d
TD TokenDistributor.sol 3e37a7ead7117c5ed97b0953e14d0323f10433393dee2d96bc082c001ab00441
TM TokenMaster.sol 15c5c4c4e89b0c70d1b0d9aa8f54a520e9df06b1c0c0b5906e48612265941c20
Findings
Pie Chart
11%
11%
Informational
Major
Minor
78%
ID Title Type Severity Resolved
Description:
The declaration of public functions that are never called by the contract should be declared external to save gas.
function takeOut(
address _token,
address _destination,
uint _amount
)
public
onlyGov
{
require(_amount <= holdings(_token), "!insufficient");
SafeERC20.safeTransfer(IERC20(_token), _destination, _amount);
}
Recommendation:
Use the external attribute for functions never called from the same contract.
Alleviation:
The development team heeded our advice and resolved this issue in commit
bfa1fab65406d125dbfc5f57cb648fc275d6b12b
VT-01: Boolean Equality
Description:
Boolean constants can be used directly and do not need to be compare to true or false .
// located on VoteToken.sol
require(isMinter[msg.sender] == true, "!minter");
// located on MultiStakingRewards.sol
require(pool.isActive == false, "Cannot withdraw active reward token");
//located on RewardDistributor.sol
require(fundManager[msg.sender] == true, "!manager");
Recommendation:
Consider removing the equality to the boolean constant. An example revision is shown below:
// located on VoteToken.sol
require(isMinter[msg.sender], "!minter");
// located on MultiStakingRewards.sol
require(!pool.isActive, "Cannot withdraw active reward token");
// located on RewardDistributor.sol
require(fundManager[msg.sender], "!manager");
Alleviation:
No alleviation.
BS-01: Improved Checks For harvest() Operation
Description:
When the user calls the harvest() function, if the variable _balance is zero, the caller is not rewarded, and gas is
consumed.
Recommendation:
The development team heeded our advice and resolved this issue in commit
6a9e156e4016c0053e34f6d9a37daf757ff05d2b
BV-01: A Possible Denial-of-Service Vulnerability In The deposit() Function
Description:
Consider the scenario: Before user first calls deposit function, Eve transfers DAI token to StrategyCompoundDAI
contract address. Subsequently, Bob uses deposit function to deposit DAI token, and the variable shares will be zero.
Recommendation:
The development team heeded our advice and resolved this issue in commit
63af6f3ab94f7880807c42c1d6f45ae9fb14351c
BV-02: Unconditional Transfer
Description:
When the variable keeperFee is zero, the safeTransfer operation is not required . If so, it will consume additional
gas.
Recommendation:
Alleviation:
The development team heeded our advice and resolved this issue in commit
460521a40359c6e64c5f9c894dbe5b696f4019b7
BV-03: Unlimited Call
Description:
Considering that farm function can be called by anyone without restriction, the possibility of malicious arbitrage exists.
Alleviation:
The development team heeded our advice and resolved this issue in commit
5a949ce9a211df225d4573d9813a148c6f468af3
BV-04: Unconditional Transfer
Description:
As in the case of BV-01 above, additional gas may be consumed here as well:
Recommendation:
Alleviation:
The development team heeded our advice and resolved this issue in commit
511d50508aa3c9ce9670100ae61c22fbdefa27bb
MR-01: Data Accuracy
Description:
When the value of balance is too small, data accuracy will be lost.
Recommendation:
Alleviation:
This was resolved after thorough discussions with the developer team.
TM-01: Missing Modifier
Description:
Recommendation:
Alleviation:
The development team heeded our advice and resolved this issue in commit
7840bdec094c7f7b68f7e64c190508b0d2993e62
Appendix
Finding Categories
Gas Optimization
Gas Optimization findings refer to exhibits that do not affect the functionality of the code but generate different, more
optimal EVM opcodes resulting in a reduction on the total gas cost of a transaction.
Mathematical Operations
Mathematical Operation exhibits entail findings that relate to mishandling of math formulas, such as overflows, incorrect
operations etc.
Logical Issue
Logical Issue findings are exhibits that detail a fault in the logic of the linked code, such as an incorrect notion on how
block.timestamp works.
Control Flow
Control Flow findings concern the access control imposed on functions, such as owner-only functions being invoke-able
by anyone under certain circumstances.
Volatile Code
Volatile Code findings refer to segments of code that behave unexpectedly on certain edge cases that may result in a
vulnerability.
Data Flow
Data Flow findings describe faults in the way data is handled at rest and in memory, such as the result of a struct
assignment operation affecting an in-memory struct rather than an instorage one.
Language Specific
Language Specific findings are issues that would only arise within Solidity, i.e. incorrect usage of private or delete .
Coding Style
Coding Style findings usually do not affect the generated byte-code and comment on how to make the codebase more
legible and as a result easily maintainable.
Inconsistency
Inconsistency findings refer to functions that should seemingly behave similarly yet contain different code, such as a
constructor assignment imposing different require statements on the input variables than a setter function.
Magic Numbers
Magic Number findings refer to numeric literals that are expressed in the codebase in their raw format and should
otherwise be specified as constant contract variables aiding in their legibility and maintainability.
Compiler Error
Compiler Error findings refer to an error in the structure of the code that renders it impossible to compile using the
specified version of the project.
Dead Code
Code that otherwise does not affect the functionality of the codebase and can be safely omitted.
Icons explanation
: Issue resolved
: Issue not resolved / Acknowledged. The team will be fixing the issues in the own timeframe.