Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mint/Redeem Hook setting can be frontrun #9

Closed
code423n4 opened this issue Dec 10, 2022 · 2 comments
Closed

Mint/Redeem Hook setting can be frontrun #9

code423n4 opened this issue Dec 10, 2022 · 2 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-93 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/prepo-io/prepo-monorepo/blob/feat/2022-12-prepo/apps/smart-contracts/core/contracts/PrePOMarket.sol#L109-L117

Vulnerability details

Impact

Mint/Redeem Hooks are not set in the constructor, but with a separate transaction. If the owner wants to add a mint/redeem hook that requires
msg.sender validation, an adversary can back run the market-creation/front-run the hook-setting transaction to allow them to mint/redeem where there normally would be rejected due to some action or requirement being implemented in the mint-hook

Proof of Concept

  1. Market is Deployed, _mintHook and _redeemHook == address(0)
  2. Adversary mints tokens without any kind of hook validation
  3. Owner changes the address of _mintHook to some kind of validation contract.
  4. Since the address was zero when the adversary minted, they did not need to meet any contract validation requirements to mint.

Tools Used

Recommended Mitigation Steps

Include IMarketHook parameters for _mintHook and _redeemHook in the constructor so that all mints are required to obey hook rules from the start. The address can be zero if the owner chooses not to include a hook but should have the option to.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Dec 10, 2022
code423n4 added a commit that referenced this issue Dec 10, 2022
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #312

@c4-judge
Copy link
Contributor

c4-judge commented Jan 7, 2023

Picodes marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-93 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants