authorProfileId can avoid being slashed
The accused authorProfileId can unvouch all their staked funds before a slashing occurs, because the contract does not enforce the documented 24-hour lock on staking and withdrawals after an accusation. This allows the accused to avoid being slashed.
0xAnmol Follow with 0xPhantom2, 0xbakeng and 9 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-11-ethos-network-ii-judging/issues/1
Found by
0xAnmol, 0xPhantom2, 0xbakeng, 0xc0ffEE, BengalCatBalu, Contest-Squad, LeFy, X12, farismaulana, newspacexyz, rmdanxyz, volodya
Summary
there is not lock lock on lock on staking (and withdrawals) for the accused authorProfileId
Root Cause
According to docs their should be lock
Any Ethos participant may act as a "whistleblower" to accuse another participant of inaccurate claims or unethical behavior. This accusation triggers a 24h lock on staking (and withdrawals) for the accused. Currently anyone can unvouch at any time
function unvouch(uint256 vouchId) public whenNotPaused nonReentrant {
Vouch storage v = vouches[vouchId];
_vouchShouldExist(vouchId);
_vouchShouldBePossibleUnvouch(vouchId);
// because it's $$$, you can only withdraw/unvouch to the same address you used to vouch
// however, we don't care about the status of the address's profile; funds are always attached
// to an address, not a profile
if (vouches[vouchId].authorAddress != msg.sender) {
revert AddressNotVouchAuthor(vouchId, msg.sender, vouches[vouchId].authorAddress);
}
v.archived = true;
// solhint-disable-next-line not-rely-on-time
v.activityCheckpoints.unvouchedAt = block.timestamp;
// remove the vouch from the tracking arrays and index mappings
_removeVouchFromArrays(v);
// apply fees and determine how much is left to send back to the author
(uint256 toWithdraw, ) = applyFees(v.balance, false, v.subjectProfileId);
// set the balance to 0 and save back to storage
v.balance = 0;
// send the funds to the author
// note: it sends it to the same address that vouched; not the one that called unvouch
(bool success, ) = payable(v.authorAddress).call{ value: toWithdraw }("");
if (!success) {
revert FeeTransferFailed("Failed to send ETH to author");
}
emit Unvouched(v.vouchId, v.authorProfileId, v.subjectProfileId);
}
contracts/contracts/EthosVouch.sol#L452
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
Accused profile sees that a lot of complains going against him and unvouch all vouched funds before slashing
Impact
authorProfileId can avoid being slashed
PoC
No response
Mitigation
+ function pauseActions(uint authorProfileId) external onlyOwner{
+ ...
+ }
function unvouch(uint256 vouchId) public whenNotPaused nonReentrant {
+ uint256 authorProfileId = IEthosProfile(
+ contractAddressManager.getContractAddressForName(ETHOS_PROFILE)
+ ).verifiedProfileIdForAddress(msg.sender);
+ require(!isActionsPaused(authorProfileId), "actions paused")
Vouch storage v = vouches[vouchId];
_vouchShouldExist(vouchId);
_vouchShouldBePossibleUnvouch(vouchId);
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/trust-ethos/ethos/pull/2284
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 unvouch function lacks a check for an active accusation lock, so it allows withdrawal at any time.
What the attacker needed
An accusation against the authorProfileId; the accused controls the vouch author address
The fix
The protocol team fixed this issue in a pull request.
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.
In this system, people stake money (vouch) on others. If someone accuses a participant of bad behaviour, the rules say that participant's funds should be locked for 24 hours so they can be slashed (penalised) if the accusation is valid. But the code does not actually lock the funds, so the accused can simply withdraw their stake before any penalty is applied.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.