VaultTracker has the wrong admin
The VaultTracker contract set its admin to the Creator contract's address rather than the Marketplace's address, because it used msg.sender during a nested call. The Creator contract cannot and is not meant to interact with VaultTracker, so the intended admin (Marketplace) lacks admin rights.
Submitted by itsmeSTYJ, also found by GimelSec
https://github.com/code-423n4/2022-07-swivel/blob/main/Marketplace/MarketPlace.sol#L77
https://github.com/code-423n4/2022-07-swivel/blob/main/Creator/Creator.sol#L41
https://github.com/code-423n4/2022-07-swivel/blob/main/VaultTracker/VaultTracker.sol#L32
Description
MarketPlace.createMarket() calls Creator.create() which creates an instance of ZcToken and a VaultTracker. VaultTracker takes msg.sender as the admin. We know that if contract A calls contract B which calls contract C, msg.sender in contract C is the address of B i.e. the msg.sender in VaultTracker is the address of the creator contract. However, the creator contract is not able (and not supposed to) interact with the VaultTracker unlike the marketplace contract.
Recommended Mitigation Steps
Modify the constructor of the VaultTracker contract so that the creator contract can pass in msg.sender (MarketPlace’s address) to be used as admin.
Using this as the main
adminconstructor issue. Given it is admin related, I believe going with the Medium issue instead of #134 makes sense.
See #134.
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 VaultTracker constructor used msg.sender directly instead of accepting the intended admin address as a parameter.
Impact
The Marketplace contract, which is supposed to administer the VaultTracker, cannot do so because the Creator contract holds the admin role instead.
What the attacker needed
Deployment of Marketplace, Creator and VaultTracker
The fix
The VaultTracker constructor should be changed so the Creator contract can pass in the Marketplace's address to be used as admin.
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 one smart contract calls another, the second contract sees the first contract's address as the caller, not the original user. Here the VaultTracker was set up to treat that intermediate contract as its admin, but that contract was never meant to manage it. So the real manager (the Marketplace) was locked out of admin actions.
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.