Pause and unpause functions are inaccessible
The contracts inherit OpenZeppelin's Pausable but never expose the internal pause and unpause functions, so administrators cannot pause or resume operations. This leaves the emergency stop feature unusable, potentially preventing timely intervention during incidents.
Submitted by Ward, also found by klau5, atoko, MSaptarshi, _thanos1, LogBytes, 0xAleko, c4whitehat, Autosaida, lrivo, TECHFUND-inc, dic0de, Tigerfrake, zhaojohnson, gajiknownnothing, Abdessamed, UAARRR, oxwhite, p0wd3r, ZanyBonzy, PetarTolev, kodyvim, samuraii77, Mahi_Vasisth, jesjupyter, 0xcontrol, persik228, blackVul, peanuts, Matin, zarkk01, zeroProtocol, yaioxy, avoloder, 0xDarko, ABAIKUNANBAEV, 0xAkira, boraichodrunkenmaster, Bac0nj, anonymousjoe, Stoicov, JustUzair, aldarion, _karanel, Shubham, unnamed, 0xjarix, King_, 0xlemon, ak1, Trident-Audits, MKVsentry, kingnull, dontonka, shui, nervouspika, VulnViper, Chad0, 0xDemon, binary, Yunaci, mgf15, sl1, pep7siup, cryptomoon, yixxas, 4B, kutugu, dimah7, BajagaSec, korok, ast3ros, kartik_giri_47538, dobrevaleri, rekxor, dyoff, 0x0bserver, 0xAadi, Pataroff, Xcrypt, LonelyWolfDemon, Shahil_Hussain, arman, hail_the_lord, bhavya0911, ArsenLupin, KupiaSec, Ryonen, hl_, ilchovski, Stefanov, ke1caM, dimulski, ZdravkoHr, and Kalogerone
https://github.com/code-423n4/2024-07-traitforge/blob/main/contracts/NukeFund/NukeFund.sol#L11
https://github.com/code-423n4/2024-07-traitforge/blob/main/contracts/DevFund/DevFund.sol#L9
Impact
All in-scope contracts of TraitForge inherit from the Pausable contract of OpenZeppelin, a feature designed to allow the pausing and unpausing of contract functionalities in emergency situations or for maintenance. However, (parent) contracts do not expose the _pause() and _unpause() functions and the Pausable contract contains only internal pausing/unpausing functions.
As a result, despite inheriting the pausability feature, administrators are unable to utilize these critical controls to pause or resume the contract’s operations when needed, potentially leading to issues during periods requiring immediate intervention.
Proof of Concept
Pause and unpause functions of the Pausable contract:
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
All in-scope contracts inherit Pausable but do not expose it. An example is EntityTrading.sol, which explicitly tries to use the pausing functionality, as can be seen with the whenNotPaused modifier used in several functions.
Tools Used
Foundry
Recommended Mitigation Steps
To leverage the full capabilities of the Pausable inheritance and enhance the contract’s operational security and flexibility, it is recommended to expose the pause and unpause functions in the parent contracts. These should be accessible by the contract owner or other authorized roles, ensuring they can respond effectively to operational needs or emergencies:
/**
* @dev Pauses all functions affected by `whenNotPaused`.
*/
function pause() public onlyOwner {
_pause();
}
/**
* @dev Unpauses all functions affected by `whenNotPaused`.
*/
function unpause() public onlyOwner {
_unpause();
}
Assessed type
Library
TForge1 (TraitForge) confirmed
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 Pausable but do not add public functions that call the internal _pause and _unpause methods.
What the attacker needed
None
The fix
Expose public pause and unpause functions restricted to the owner or an authorised role that call the internal Pausable methods.
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 smart contract can include a 'pause' switch to stop activity in an emergency. Here the switch exists inside the code but no public button was added to press it, so the owner cannot actually 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.