Closed sherlock-admin2 closed 10 months ago
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no effect on protocol
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no effect on protocol
Invalid, no issue here if you want to approve to an address during a pause, sure the other user can transfer after, this is the approvers responsibility
shubhzDev
high
User is able to give allowance of tokens while Contract UbiquityDollarToken.sol is paused
High Severity
Summary
User is able to successfully give allowance while contract UbiquityDollarToken is paused,and when contract is unpaused able to transfer approved tokens(which were approved in state of pause) to another user.
Vulnerability Detail
UbiquityDollarToken.sol inherits from ERC20Ubiquity.sol and ERC20Ubiquity.sol inherits from ERC20Upgradeable.sol(openzepplin's contract).
Here, ERC20Ubiquity.sol doesn't override _approve() method which should have been overridden with modifier attached to it called whenNotPaused like they did with _transfer() method.
Here is the test in Foundry which proves this behavior
Impact
A malicious can take advantage of this meanwhile contract is exploited and take access of funds from affected wallets and when contract is unpaused he can successfully transfer those funds to itself. Pausing a contract can be a safety measure during potential vulnerabilities or attacks. Allowing allowances during this time might risk unauthorized access or transfers, defeating the purpose of the pause and compromising security. It might also cause confusion or distrust among users regarding the protocol's reliability.
Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/core/UbiquityDollarToken.sol#L13 https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/core/ERC20Ubiquity.sol#L21 https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/core/ERC20Ubiquity.sol#L8C81-L8C97
Tool used
Foundry
Recommendation
Here,In ERC20Ubiquity.sol should have overridden _approve method which should have modifier attached to it called whenNotPaused like they did with _transfer() method.