Closed code423n4 closed 1 year ago
0xA5DF marked the issue as low quality report
Might be a QA, if the position isn't registered that means nothing for the protocol (and there are always ways to deceive people with fake contracts)
0xA5DF marked the issue as primary issue
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/PositionFactory.sol#L13-L20
Vulnerability details
Impact
Malicious user can create a new position and pretend the pool as Frakencoin and deceive user to deposit in it.
Proof of Concept
createNewPosition
can be called by any user. This function does not have any access modifier. While the comments saysMust be called through minting hub to be recognized as valid position
, but there are such restriction to call the function.When we see the new position creation flow,
createNewPosition
is called fromMintingHub.sol#L88-L113
, minting hub contract is the caller here. https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/MintingHub.sol#L88-L113In
createNewPosition
function , for Position, it has the msg.sender as one of the argument. This msg.sender is mintinghub contract here.When looking at the Position contract's constructor,
the second argument is hub. This mean, Minting hub is only allowed to create new position.
But when we look at the
createNewPosition
function inside thePositionFactory.sol
, there are no restriction such that only theMintingHub
should be caller.Tools Used
Manual code review
Recommended Mitigation Steps
Add access modifier as MintingHub contract. So that only the hub would be called.