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

Incorrect operator in CollateralToken.settleAuction checks #376

Closed
code423n4 opened this issue Jan 18, 2023 · 2 comments
Closed

Incorrect operator in CollateralToken.settleAuction checks #376

code423n4 opened this issue Jan 18, 2023 · 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-582 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/CollateralToken.sol#L526

Vulnerability details

Description:

CollateralToken.settleAuction intends to enforce that both an auction exists for the collateralId and the ClearingHouse is the owner of the collateral, but instead it enforces only one of them by only reverting if they're both invalid.

Remediation:
if (
  s.collateralIdToAuction[collateralId] == bytes32(0) &&
  ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(
    s.idToUnderlying[collateralId].tokenId
  ) !=
  s.clearingHouse[collateralId]
) {
  revert InvalidCollateralState(InvalidCollateralStates.NO_AUCTION);
}

Should be replaced with

if (
  s.collateralIdToAuction[collateralId] == bytes32(0) ||
  ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(
    s.idToUnderlying[collateralId].tokenId
  ) !=
  s.clearingHouse[collateralId]
) {
  revert InvalidCollateralState(InvalidCollateralStates.NO_AUCTION);
}
@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 Jan 18, 2023
code423n4 added a commit that referenced this issue Jan 18, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #582

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 21, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

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-582 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants