Skip to content
Access control Audit finding Intermediate

Compromise check will prevent malicious operations

The verifiedProfileIdForAddress function in EthosProfile.sol does not check whether an address is marked as compromised, so a compromised address can still interact with dependent contracts. An attacker who has stolen a private key can perform actions like adding reviews even after the legitimate user has marked the address as compromised.

056Security Follow with 0x37, 0xBhumii and 24 others

Originally disclosed on Sherlock

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

Found by

056Security, 0x37, 0xBhumii, 0xMosh, 0xbrivan, Bozho, DigiSafe, Dliteofficial, IvanFitro, John44, KlosMitSoss, LeFy, PNS, TessKimy, dany.armstrong90, debugging3, dobrevaleri, durov, heeze, justAWanderKid, newspacexyz, onthehunt, s0x0mtee, sammy, shaflow01, t.aksoy, y4y

Summary

A missing compromise check in verifiedProfileIdForAddress will cause unauthorized access for affected contracts as compromised addresses can bypass security measures and perform malicious actions. (e.g: Attacker can steal user's private key, so address is compromised)

Root Cause

In EthosProfile.sol, the verifiedProfileIdForAddress function is missing a check to ensure _address is not compromised, allowing compromised addresses to interact with other contracts without restriction. https://github.com/sherlock-audit/2024-10-ethos-network/blob/979e352d7bcdba3d0665f11c0320041ce28d1b89/ethos/packages/contracts/contracts/EthosProfile.sol#L568-L574

The verifiedProfileIdForAddress function used in many contracts.

Here: https://github.com/sherlock-audit/2024-10-ethos-network/blob/979e352d7bcdba3d0665f11c0320041ce28d1b89/ethos/packages/contracts/contracts/EthosAttestation.sol#L228 https://github.com/sherlock-audit/2024-10-ethos-network/blob/979e352d7bcdba3d0665f11c0320041ce28d1b89/ethos/packages/contracts/contracts/EthosDiscussion.sol#L111-L113 https://github.com/sherlock-audit/2024-10-ethos-network/blob/979e352d7bcdba3d0665f11c0320041ce28d1b89/ethos/packages/contracts/contracts/EthosDiscussion.sol#L158-L160 ...

In this project, there are many issues about this compromised address. In almost contracts, it doesn't check msg.sender is compromised address. Address is already unregistered from profile by deleteAddressAtIndex function, but it is still used in many functions.

Internal pre-conditions

User needs to call deleteAddressAtIndex to set isAddressCompromised to be true for the target address.

External pre-conditions

No response

Attack Path

  1. Attack steal user's private key.
  2. User detected it is compromised and calls deleteAddressAtIndex for marking isAddressCompromised as true for the target address.
  3. Attacker can calls addReview in EthorsReview contract by compromised address. (private key is stolen so attacker can do this operation)

It calls ethosProfile.verifiedProfileIdForAddress(msg.sender); msg.sender is compromised but it doesn't revert.

Impact

The protocol suffers a potential security breach as compromised addresses can bypass verification and execute unauthorized actions in dependent contracts, potentially leading to manipulation of contract functionality. The attacker gains access to otherwise restricted operations without proper authorization.

PoC

No response

Mitigation

Add modifier checkIfCompromised and use checkIsAddressCompromised function.

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 056Security. 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

Likely, the verifiedProfileIdForAddress function lacks a check for the isAddressCompromised flag, allowing compromised addresses to pass verification.

Impact

Compromised addresses can bypass verification and execute unauthorized actions in dependent contracts, potentially leading to manipulation of contract functionality.

What the attacker needed

Attacker steals user's private key; user marks address as compromised

The fix

The protocol team fixed this issue by adding a check for compromised addresses in the verifiedProfileIdForAddress function.

How it was found

  1. Attacker steals the user's private key.
  2. User detects the compromise and calls deleteAddressAtIndex to mark the address as compromised.
  3. Attacker uses the compromised address to call addReview in the EthosReview contract, which calls verifiedProfileIdForAddress and does not revert.

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.

When a user's private key is stolen, they can mark that address as compromised in the system. However, the function that checks if an address has a verified profile does not look at this compromised status. So the attacker can keep using the stolen address to do things like post reviews, even though the real owner tried to disable it.

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.

More by 056Security

View all

13 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.

Broken access control

The lesson behind this report.

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.