Fee Distribution Re-Entrancy
The `distribute` function in `NFTXFeeDistributor` lacks access control and calls a fallback on fee receivers, allowing a malicious receiver to re-enter and repeatedly claim its allocation, potentially draining the contract's balance and leaving other recipients with zero.
NFTX contest
Originally disclosed on Code4rena
The distribute function of NFTXFeeDistributor has no access control and will invoke a fallback on the fee receivers, meaning that a fee receiver can re-enter via this function to acquire their allocation repeatedly potentially draining the full balance and sending zero amounts to the rest of the recipients.
A smart contract with a malicious receiveRewards function can re-enter the distribute function with the same vault ID, thereby causing the exploit.
Recommend that re-entrancy protection should be incorporated into the distribute function. I should note that a seemingly innocuous contract can cause this re-entrancy by simply asking the owners of the project to include an upgrade-able contract that is then replaced for a malicious implementation.
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 `distribute` function lacks re-entrancy protection and access control, allowing a malicious fee receiver to call back into it during the distribution.
Impact
A malicious fee receiver could drain the full balance, leaving other recipients with zero amounts.
What the attacker needed
Malicious fee receiver contract; project owners include upgradeable contract
The fix
Re-entrancy protection should be incorporated into the `distribute` function.
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 function that sends fees to multiple recipients can be called again by a recipient before the first call finishes. This lets that recipient take more than its fair share, possibly all the money, while others get nothing.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.