You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alice registers with profile1 and creates a market.
Alice is deleted from profile1 and re-registers with profile2.
Alice receive the ownership of market in profile2.
Now, Alice is reciving donations from 2 markets.
Assuming that the donation amount from profile1 is 2e18, and the donation amount from profile2 is 1e18.
Alice is going to transfer ownership to Bob, who in profile1.
At this time, Alice should send the ownership and 2e18.
However, in L641, all of Alice's 3e18 are sent to Bob.
@notice Deleted addresses can be re-registered to any profile.
As you can see, the deleted address can be re-registered to any profile as long as it is not marked as Compromised.
The EthosProfile.sol is implemented this way.
ReputationMarket.sol
function updateDonationRecipient(
uint256profileId,
addressnewRecipient
) public whenNotPaused nonReentrant {
if (newRecipient ==address(0)) revertZeroAddress();
// if the new donation recipient has a balance, do not allow overwritingif (donationEscrow[newRecipient] !=0)
revertInvalidMarketConfigOption("Donation recipient has balance");
// Ensure the sender is the current donation recipientif (msg.sender!= donationRecipient[profileId]) revertInvalidProfileId();
// Ensure the new recipient has the same Ethos profileIduint256 recipientProfileId =_ethosProfileContract().verifiedProfileIdForAddress(newRecipient);
if (recipientProfileId != profileId) revertInvalidProfileId();
// Update the donation recipient reference
donationRecipient[profileId] = newRecipient;
// Swap the current donation balance to the new recipient641: donationEscrow[newRecipient] += donationEscrow[msg.sender];
642: donationEscrow[msg.sender] =0;
emitDonationRecipientUpdated(profileId, msg.sender, newRecipient);
}
Mitigation
Consider using both the recipient and profileId as parameters for the donationEscrow. This ensures that funds are correctly attributed to the specific profile and recipient combination, preventing potential loss of funds.
The text was updated successfully, but these errors were encountered:
Magnificent Tortilla Eel
High
Incorrect
updateDonationRecipient()
Function.Summary
There could be a situation where a user has multiple markets, leading to a loss of funds for the owner when updating the donation recipient.
Root Cause
https://github.com/sherlock-audit/2024-12-ethos-update/blob/main/ethos/packages/contracts/contracts/ReputationMarket.sol#L641
Internal pre-conditions
N/A
External pre-conditions
N/A
Attack Path
Alice
registers withprofile1
and creates a market.Alice
is deleted fromprofile1
and re-registers withprofile2
.Alice
receive the ownership of market inprofile2
.Now,
Alice
is reciving donations from 2 markets.Assuming that the donation amount from
profile1
is2e18
, and the donation amount fromprofile2
is1e18
.Alice
is going to transfer ownership toBob
, who inprofile1
.At this time,
Alice
should send the ownership and2e18
.However, in L641, all of
Alice
's3e18
are sent toBob
.Impact
Loss of funds.
PoC
https://github.com/sherlock-audit/2024-12-ethos-update/blob/main/ethos/packages/contracts/contracts/EthosProfile.sol#L415
As you can see, the deleted address can be re-registered to any profile as long as it is not marked as Compromised.
The
EthosProfile.sol
is implemented this way.Mitigation
Consider using both the recipient and profileId as parameters for the donationEscrow. This ensures that funds are correctly attributed to the specific profile and recipient combination, preventing potential loss of funds.
The text was updated successfully, but these errors were encountered: