Skip to content
Business logic Audit finding Intermediate

Restored addresses will not be able to take any action on behalf of the profile due to still being marked as compromised

When a compromised address is deleted, it is marked as compromised in a mapping. If the same address is later restored, it remains marked as compromised, preventing it from acting on behalf of the profile.

KlosMitSoss Follow with LeFy, PNS and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-10-ethos-network-judging/issues/152

Found by

KlosMitSoss, LeFy, PNS, newspacexyz, onthehunt, pkqs90

Summary

When an address is restored after being deleted due to being compromised, it remains marked as compromised in the isAddressCompromised mapping. This prevents the address from taking any actions on behalf of the profile, even though it should be able to.

Vulnerability Detail

When an address is compromised, it can be deleted by calling EthosProfile::deleteAddressAtIndex(), which marks the address as compromised in the isAddressCompromised mapping.

Solidity
  function deleteAddressAtIndex(uint256 addressIndex) external whenNotPaused {
    ... ...
    isAddressCompromised[addressStr] = true;
    ... ...
  }

The purpose of the isAddressCompromised mapping is to ensure that no address marked as compromised and deleted can take any action on behalf of the profile. If a previously deleted address is no longer compromised, it can be restored when an address associated with the same profile as the deleted address calls EthosProfile::registerAddress() and provides that address.

However, the address is not unmarked in isAddressCompromised, meaning that restored addresses will still be unable to take any actions on behalf of the profile as they remain flagged as compromised.

Attack Path

  1. AddressA calls EthosProfile::registerAddress() to register AddressB.
  2. AddressB is compromised.
  3. AddressA calls EthosProfile::deleteAddressAtIndex() to delete AddressB and mark it as compromised in isAddressCompromised.
  4. AddressB is no longer compromised.
  5. AddressA calls EthosProfile::registerAddress() to restore AddressB.
  6. AddressB remains marked as compromised in isAddressCompromised and cannot act on behalf of the profile, even though it should be able to.

Impact

A previously deleted address will not be able to take any action on behalf of the profile when restored, as it remains marked as compromised.

Code Snippet

EthosProfile#L373-409 EthosProfile#L415-438

Tool Used

Manual Review

Recommendation

Consider unmarking addresses as compromised when they are restored. If it is necessary to store the addresses that were removed in the past, this should be managed with a separate mapping.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/trust-ethos/ethos/pull/2204

The original report as published on Sherlock, by KlosMitSoss. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 contract does not clear the compromised flag when an address is restored via registerAddress.

Impact

A restored address cannot take any action on behalf of the profile, even though it should be able to.

What the attacker needed

A profile with at least two addresses; one address is compromised and deleted; the compromised address is later restored

The fix

The protocol team fixed this issue by unmarking addresses as compromised when they are restored.

How it was found

  1. AddressA calls registerAddress to register AddressB.
  2. AddressB is compromised.
  3. AddressA calls deleteAddressAtIndex to delete AddressB and mark it as compromised.
  4. AddressB is no longer compromised.
  5. AddressA calls registerAddress to restore AddressB.
  6. AddressB remains marked as compromised and cannot act on behalf of the profile.

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 lets you manage addresses linked to your profile. If one address is hacked, you can delete it, and the contract marks it as compromised so it cannot be used. Later, if you want to add that address back, the contract still thinks it is compromised and blocks it from doing anything.

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.

More by KlosMitSoss

View all

25 more disclosed reports, best first.

More from Ethos Network Social Contracts

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.