CallistoSecurity / Smart-contract-auditing

This is a working repo of @EthereumCommonwealth audits. We performed more than 400 security audits since 2018. Not even a single contract was hacked after our auditors approved the code. Accepting audit requests here.
https://audits.callisto.network/
2 stars 2 forks source link

Audit: token-operating smart contracts #29

Closed RobertBobor closed 7 months ago

RobertBobor commented 7 months ago

Audit request

We would like to have 4 smart contracts to be audited:

vesting/VestingFactory.sol staking/Staking.sol token/Launchpad.sol generic/TimeMultisig.sol

Descriptions for each of them can be found in README files in corresponding folders.

Source code

https://github.com/VIS-DEI/smart-contracts-public/tree/main/contracts

Payment plan

Disclosure policy

Please notify me privately.

Contact information (optional)

robert.bobor@dei.cz

Platform

ETH

yuriy77k commented 7 months ago

VIS-DEI Security Audit Report v2

1. Summary

VIS-DEI smart contract security audit report performed by Callisto Security Audit Department

2. In scope

Commit: 93135602752eff72097f602dae44b0d1bed5986d

generic:

staking:

token:

vesting:

3. Findings

In total, 1 issue were reported, including:

In total, 5 notes were reported, including:

3.1. Remove owner issues

Severity: medium

Description

There are multiple issues in the function removeOwner:

  1. The ownersLength initiated before removing the owner, so condition if (requiredApprovals > ownersLength) will be always false since you compare requiredApprovals with the old ownersLength.
  2. To change requirements you call changeRequirement(ownersLength); which will fail, because it requires enough approvals.

Code snippet

Recommendation

Replace this part https://github.com/VIS-DEI/smart-contracts-public/blob/93135602752eff72097f602dae44b0d1bed5986d/contracts/generic/TimeMultisig.sol#L166-L169 with:

        ownersLength--;
        if (requiredApprovals > ownersLength){
            _changeRequirement(ownersLength);
        }

3.2. For dust transactions, the current price would return zero allowing arbitrary wallets to buy tokens without paying.

Severity: minor observation

Description

For dust amount of tokens, the function currentPrice() would always be zero allowing wallets to buy tokens without paying any USDT tokens.

Code Snippet

Recommendation

Add in the and of function currentPrice following requirement:

    require(price != 0, "Too small amount");

3.3. Owner privileges

Severity: owner privileges

Description

  1. Any owner can Pause/unpause Staking and Launchpad contracts.
  2. Set interest in a Staking contract.
  3. Withdraw tokens from the Staking contract (including users' deposits).
  4. Withdraw tokens from Launchpad contract.

4. Security practices

5. Conclusion

The audited smart contract must not be deployed. Reported issues must be fixed before the usage of this contract.

Staking contract do not guarantee users that they will be able to withdraw their deposits if tokens for interest are not added by the owner.

It is recommended to adhere to the security practices described in pt. 4 of this report to ensure the contract's operability and prevent any issues that are not directly related to the code of this smart contract.

6. Revealing audit reports

yuriy77k commented 7 months ago

VIS-DEI Security Audit Report v3

1. Summary

VIS-DEI smart contract security audit report performed by Callisto Security Audit Department

2. In scope

Commit: 4f036260dce9a439c16afcb3dfd298535483e2c7

generic:

staking:

token:

vesting:

3. Findings

In total, 0 issues were reported, including:

In total, 4 notes were reported, including:

3.1. Owner privileges

Severity: owner privileges

Description

  1. Any owner can Pause/unpause Staking and Launchpad contracts.
  2. Set interest in a Staking contract.
  3. Withdraw tokens from the Staking contract (including users' deposits).
  4. Withdraw tokens from Launchpad contract.

4. Security practices

5. Conclusion

The audited smart contract can be deployed. No security issues were found during the audit.

Users should pay attention to owners' privileges.

Staking contract do not guarantee users that they will be able to withdraw their deposits if tokens for interest are not added by the owner.

It is recommended to adhere to the security practices described in pt. 4 of this report to ensure the contract's operability and prevent any issues that are not directly related to the code of this smart contract.

6. Previous audit reports