Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Valid

Front-running attack on `createTaker()` leads to reduced referral earnings

Vulnerability Details

The Tadle system's SystemConfig contract manages referral rates, which are used when creating new takers. However, there's a critical vulnerability in the interaction between the updateReferrerInfo() function and the createTaker() function. An attacker can front-run a legitimate user's createTaker() call by calling updateReferrerInfo() to lower the referrer rate, resulting in the legitimate user receiving less funds than expected.

The updateReferrerInfo() function allows any caller to modify anyone's referral rates:

SystemConfig.sol#L41-L48

function updateReferrerInfo(
address _referrer,
uint256 _referrerRate,
uint256 _authorityRate
) external {
if (_msgSender() == _referrer) {
revert InvalidReferrer(_referrer);
}

This function can be called by anyone to update the referral rate for any address, as long as the caller is not setting their own rate. The vulnerability arises because there's no protection against front-running when a legitimate user attempts to create a new taker with an expected referral rate.

Proof of Concept

  1. Alice, a legitimate user, prepares a transaction to create a new taker, expecting a 50% referral rate.

  2. Bob, a malicious actor, monitors the mempool and sees Alice's pending createTaker() transaction.

  3. Bob quickly submits a transaction with a higher gas price: updateReferrerInfo(Alice's address, 300_000, 0).

  4. Bob's transaction is processed first, setting Alice's referrer rate to 30%.

  5. Alice's createTaker() transaction is processed next, but now uses the 30% rate instead of the expected 50%.

  6. Alice receives significantly less referral earnings than she should have.

Impact

Legitimate referrers receive lower referral fees than expected.

Recommendations

Implement a time-lock mechanism for rate changes.

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-SystemConfig-updateReferrerInfo-msgSender

Valid high severity. There are two impacts here due to the wrong setting of the `refferalInfoMap` mapping. 1. Wrong refferal info is always set, so the refferal will always be delegated to the refferer address instead of the caller 2. Anybody can arbitrarily change the referrer and referrer rate of any user, resulting in gaming of the refferal system I prefer #1500 description the most, be cause it seems to be the only issue although without a poc to fully describe all of the possible impacts

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.