DestinationBridge
contract: transactions can be executed even if the contract is paused
#88
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-529
grade-b
low quality report
This report is of especially low quality
Q-32
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L197-L203
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L156-L167
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L337-L353
Vulnerability details
Impact
The purpose of adding pausability feature in a contract is to prevent the execution of its functions in certain cases; which are mostly emergency cases (when calls to some contracts/tokens start to act maliciously).
The
DestinationBridge
contract implements this feature; where transactions initiation (callingexecute
) is disabled when the contract is paused .But even if the contract is paused; approvers can still approve transactions (by calling
approve
that doesn't check if the contract is paused) and eventually leading these transactions to be executed if they met the approvals threshold.This will break the main purpose of adding the pausability feature; which is protecting the contract in the cases of emergancies; such when the bridged token contract starts to act in a malicious way that will lead to harming the destination bridge.
Proof of Concept
Code:
approve function
_approve function
_mintIfThresholdMet function
Foundry PoC:
test_Transaction_Executed_When_Contract_Is_Paused()
test is added toforge-tests/bridges/DestinationBridge.t.sol
file; with the following scenario:DestinationBridge
contract owner pauses the contract.Test result:
Tools Used
Manual Testing & Foundry.
Recommended Mitigation Steps
Update
approve
function to be called only when the contract is not paused:Assessed type
Context
The text was updated successfully, but these errors were encountered: