Multiple contracts cannot be paused
Several contracts use the whenNotPaused modifier but provide no public method to change the paused state, so the owner cannot pause them during a security incident. This prevents the protocol from stopping vulnerable functions when needed.
0xadrii Follow with GiuseppeDeLaZara, Tendency and 1 other
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-02-tapioca-judging/issues/64
Found by
0xadrii, GiuseppeDeLaZara, Tendency, bin2chen
Summary
For safety, tapioca has added whenNotPaused restrictions to multiple contracts
But there is no method provided to modify the _paused state
If a security event occurs, it cannot be paused at all
Vulnerability Detail
Take mTOFT.sol as an example, multiple methods are whenNotPaused
function executeModule(ITOFT.Module _module, bytes memory _data, bool _forwardRevert)
external
payable
@> whenNotPaused
returns (bytes memory returnData)
{
...
function sendPacket(LZSendParam calldata _lzSendParam, bytes calldata _composeMsg)
public
payable
@> whenNotPaused
returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)
{
But the contract does not provide a public method to modify _paused
Note: Pausable.sol does not have a public method to modify _paused
In reality, there have been multiple reports of security incidents where the protocol side wants to pause to prevent losses, but cannot pause, strongly recommend adding
Note: The following contracts cannot be paused
- mTOFT
- TOFT
- Usdo
- AssetToSGLPLeverageExecutor
Impact
Due to the inability to modify _paused, it poses a security risk
Code Snippet
https://github.com/sherlock-audit/2024-02-tapioca/blob/main/TapiocaZ/contracts/tOFT/mTOFT.sol#L50
Tool used
Manual Review
Recommendation
+ function pause() external onlyOwner{
+ _pause();
+ }
+ function unpause() external onlyOwner{
+ _unpause();
+ }
Discussion
sherlock-admin2
1 comment(s) were left on this issue during the judging contest.
WangAudit commented:
refer to 24
sherlock-admin4
The protocol team fixed this issue in PR/commit https://github.com/Tapioca-DAO/TapiocaZ/commit/5cf2563fdd12787f5414690ede10681af6630eb8.
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
The contracts inherit a pausable pattern but do not expose owner-only functions to call the internal pause and unpause methods.
Impact
The protocol cannot pause the affected contracts during a security incident, which could allow losses to continue.
What the attacker needed
Owner role required to pause
The fix
The protocol team fixed this issue by adding owner-only pause and unpause functions.
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 pause switch lets an owner stop a contract in an emergency. Here the contracts check whether they are paused, but there is no way to actually flip that switch. So if something goes wrong, the owner cannot stop the contract.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.