Skip to content

Admin should be able to refund or redeem the sanctioned users #265

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

Open
code423n4 opened this issue Jan 17, 2023 · 10 comments
Open

Admin should be able to refund or redeem the sanctioned users #265

code423n4 opened this issue Jan 17, 2023 · 10 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 M-01 primary issue satisfactory satisfies C4 submission criteria; eligible for awards selected for report This submission will be included/highlighted in the audit report sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-01-ondo/blob/f3426e5b6b4561e09460b2e6471eb694efdd6c70/contracts/cash/CashManager.sol#L707

Vulnerability details

Impact

Sanctioned user's funds are locked

Proof of Concept

It is understood that the sanctioned users can not mint nor redeem because the functions requestMint() and requestRedemption() are protected by the modifier checkKYC().
And it is also understood that the protocol team knows about this.
But I still believe the admin should be able to refund or redeem those funds.
And it is not possible for now because the KYC is checked for the redeemers and refundees in the function completeRedemptions().
So as long as the user becomes unverified (due to several reasons including the signature expiry), the funds are completely locked and even the admin has no control over it.

CashManager.sol
707:   function completeRedemptions(
708:     address[] calldata redeemers,
709:     address[] calldata refundees,
710:     uint256 collateralAmountToDist,
711:     uint256 epochToService,
712:     uint256 fees
713:   ) external override updateEpoch onlyRole(MANAGER_ADMIN) {
714:     _checkAddressesKYC(redeemers);
715:     _checkAddressesKYC(refundees);
716:     if (epochToService >= currentEpoch) {
717:       revert MustServicePastEpoch();
718:     }
719:     // Calculate the total quantity of shares tokens burned w/n an epoch
720:     uint256 refundedAmt = _processRefund(refundees, epochToService);
721:     uint256 quantityBurned = redemptionInfoPerEpoch[epochToService]
722:       .totalBurned - refundedAmt;
723:     uint256 amountToDist = collateralAmountToDist - fees;
724:     _processRedemption(redeemers, amountToDist, quantityBurned, epochToService);
725:     collateral.safeTransferFrom(assetSender, feeRecipient, fees);
726:     emit RedemptionFeesCollected(feeRecipient, fees, epochToService);
727:   }

Tools Used

Manual Review

Recommended Mitigation Steps

Assuming that the MANAGER_ADMIN can be trusted, I suggest removing KYC check for the redeemers and refundees.

@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 17, 2023
code423n4 added a commit that referenced this issue Jan 17, 2023
@c4-judge
Copy link
Contributor

trust1995 marked the issue as primary issue

@c4-judge c4-judge added primary issue satisfactory satisfies C4 submission criteria; eligible for awards labels Jan 22, 2023
@c4-judge
Copy link
Contributor

trust1995 marked the issue as satisfactory

@ali2251
Copy link

ali2251 commented Jan 31, 2023

Its not in scope as mentioned in README, specifically in Not in scope ->

KYC/Sanction related edge cases specifically when a user’s KYC status or Sanction status changes in between different actions, leaving them at risk of their funds being locked in the protocols or being liquidated in Flux

@c4-sponsor
Copy link

ali2251 marked the issue as sponsor disputed

@c4-sponsor c4-sponsor added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Jan 31, 2023
@trust1995
Copy link

Its not in scope as mentioned in README, specifically in Not in scope ->

KYC/Sanction related edge cases specifically when a user’s KYC status or Sanction status changes in between different actions, leaving them at risk of their funds being locked in the protocols or being liquidated in Flux

I don't believe this clause includes the described case, i.e. even admin cannot move the locked funds.

@c4-judge
Copy link
Contributor

c4-judge commented Feb 1, 2023

trust1995 marked the issue as selected for report

@c4-judge c4-judge added the selected for report This submission will be included/highlighted in the audit report label Feb 1, 2023
@C4-Staff C4-Staff added the M-01 label Feb 3, 2023
@Simon-Busch Simon-Busch removed the M-01 label Feb 8, 2023
@C4-Staff C4-Staff added the M-01 label Feb 8, 2023
@cameronclifton
Copy link

@trust1995 the out of scope section includes the words:
"[...] when a user’s KYC status or Sanction status changes in between different actions, leaving them at risk of their funds being locked in the protocols [....]"

Can you please explain how this is not the exact same scenario that we declare out of scope?

@trust1995
Copy link

The KYC edge cases disclaimer does not include funds being permanently locked in the protocol. It relates to the fact that when users lose their KYC or are sanctioned, their funds are locked in (from their perspective). The fact those funds can't be claimed by delegated authorities is concerning.

@cameronclifton
Copy link

While we see your concern, this is the intended design and we feel you are misinterpreting the out of scope section. There is nothing in the out of scope section that has an exception clause relating to whose perspective the funds are locked from.

Maybe an example could help clear up the miscommunication going on - Could you please explain an "in scope" scenario here that is not covered by the following?

""[...] when a user’s KYC status or Sanction status changes in between different actions, leaving them at risk of their funds being locked in the protocols [....]"

@hansfriese
Copy link

@cameronclifton I will explain the original intention of this submission as an auditor.
As I mentioned in the finding details (and the judge @trust1995 also commented), my main point was that the funds are permanently locked in the protocol. As far as I understand, the scope clarification says it is not in scope that the funds are locked in the user's perspective. The two example cases show this point clearly.
I wanted to point out that there should be a way to handle those funds NOT from the user's perspective, but from the protocol admin's perspective. I believe it is not a good practice to let funds be locked PERMANENTLY.

KYC/Sanction related edge cases specifically when a user’s KYC status or Sanction status changes in between different actions, leaving them at risk of their funds being locked in the protocols or being liquidated in Flux.

  • If someone gets sanctioned they can not supply collateral (CASH or stablecoin)
  • If someone loses KYC status they can not repay borrow or have someone repay borrow on behalf of them

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 M-01 primary issue satisfactory satisfies C4 submission criteria; eligible for awards selected for report This submission will be included/highlighted in the audit report sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

10 participants