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

Borrowing of the whole asset supply can yield a low-level division revert #96

Open
code423n4 opened this issue Jan 7, 2022 · 1 comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

hyh

Vulnerability details

Impact

System will fail with low-level message without giving a business reason, which can be an issue for troubleshooting and further programmatic usages by other projects.

Proof of Concept

If a borrower tries to get almost all available assets, the low level division can fail in the check function:

https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/libraries/BorrowMath.sol#L35

Recommended Mitigation Steps

Add a maximum share of current assets that can be borrowed and revert with the corresponding error message before running the computations.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Jan 7, 2022
code423n4 added a commit that referenced this issue Jan 7, 2022
@Mathepreneur Mathepreneur added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Jan 24, 2022
@Mathepreneur
Copy link
Collaborator

It's designed such that borrowers cannot borrow up to that amount.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

2 participants