Skip to content
Business logic Audit finding Intermediate

Cred creator could cause stuck funds

The cred creator can update the sell share royalty to up to 50%, which means users who later sell their shares must pay that fee to the creator. This can trap users or force them to lose a large portion of their funds.

petarP1998 Follow

Originally disclosed on Code4rena

Submitted by petarP1998

Update of cred can be triggered by the cred creator. If there are already issued shares for users, and the cred creator decides to update the sellShareRoyalty_ this will lead users to pay up to 50% fee depending on the value. And users will be in situation that to withdraw their funds, they need to pay 50% to the cred creator and additionally some fee to the protocol.

Proof of Concept

We have the following situation:

  1. 500 issued shares and the current sell fee is 0.05%.
  2. And the cred creator decides to increase the fee to 50%.
  3. If any of the users wants to withdraw funds, they need to pay 50% to the creator and also protocol fee.

For example, let’s imagine that the current number of shares issued is 500 of max 999 and one of the users is owner of 5 shares. If we add this test to Cred.t.sol:

function test_value() public {
        uint256 x = bondingCurve.getSellPrice(500, 5);
        assertEq(153_019_801_980_198_020, x);
    }

We will see that the sell price is around 1.53e17 which in the current price is equal to $420, this means that the 50% or $210 will be paid to the cred creator as fee, which will lead to significant lose of funds for share holders. If the number of shares that are issued the lose is growing.

Recommended Mitigation Steps

The protocol should implement a mechanism where this type of updates, will be applied after some period. I will explain my idea in the below lines:

  1. If cred creator wants to increase the sellShareRoyalty_, it should first create a request for updating which can be applied after 2 days, for example.
  2. In these two days users who are not okay with the new value of sellShareRoyalty_ can withdraw their funds from the protocol.

My proposal is to have two functions:

  1. updateSellShareRoyaltyRequest which will create this request and this request can be approved after some period.
  2. approveUpdateSellShareRoyaltyRequest if the period already passed the cred creator can apply the change.

Assessed type

Access Control

ZaK3939 (Phi) confirmed and commented:

The observation is valid. However, I believe the main issue is the ability to update the royalty percentage. The high percentage is deliberately set to allow creators to set up creds where they prefer to minimize sharing with others. Therefore, my plan is to keep the current high percentage limit, but remove the update functionality altogether. This vulnerability should be rated medium severity in my opinion.

0xDjango (judge) decreased severity to Medium and commented:

I agree that the functionality should be removed or placed behind a timelock. Medium.

MrPotatoMagic (warden) commented:

Hi @0xDjango, I believe this issue should be of QA-severity.

The main intention behind creds is for users to form, visualize, showcase their onchain identity. When a cred is created, the creator (i.e., the onchain identity) is the source of trust when users buy up their shares. This means, the more social, reputed and trusted an identity is, the lower are the chances of a creator wanting to perform such an attack.

It is highly unlikely a high reputed creator would want to perform such an attack. When it comes to low reputed creators, who are more likely to perform this attack, the impact would be low because the shares being bought for such untrusted entities would not be high (Note: This claim is based on onchain data I’ve observed from a similar protocol). If we look at the price curve, even if 5-10 shares were bought by users, the overall loss would be minimum and bearable, considering that users know the risk when buying shares of untrusted onchain identities.

I think the above points along with the fact that 0-50% is an acceptable range defined by the protocol as per sponsor’s comments above, it seems that this issue is rather suited for QA-severity.

0xDjango (judge) commented:

This is a valid medium severity issue. Such a function that can directly affect user funds, especially through frontrunning, should be mitigated by a timelock or similar.


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

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 cred creator can change the sell share royalty at any time without a delay, and the new fee applies to existing shares.

Impact

Users could lose up to 50% of their funds when selling shares, and the loss grows with the number of shares issued.

What the attacker needed

A cred with issued shares; cred creator acts maliciously

The fix

The update functionality should be removed or placed behind a timelock so users can withdraw before a fee increase takes effect.

How it was found

  1. A cred has 500 issued shares and the current sell fee is 0.05%.
  2. The cred creator increases the sell fee to 50%.
  3. A user who owns 5 shares tries to withdraw funds and must pay 50% to the creator plus protocol fee.

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 'cred' is like a profile or identity on this platform, and people can buy shares in it. The person who created the cred can change the fee charged when shares are sold, up to 50%. If they raise it after people have bought shares, those people lose a lot of money when they try to sell.

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 from Phi

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.