Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 2.24 KB

075.md

File metadata and controls

62 lines (46 loc) · 2.24 KB

J4de

medium

The LenderCommitmentForwarder.sol contract does not require any cost to issue a commitment

Summary

The LenderCommitmentForwarder.sol contract does not require any cost to issue a commitment

Vulnerability Detail

File: LenderCommitmentForwarder.sol
177     function createCommitment(
178         Commitment calldata _commitment,
179         address[] calldata _borrowerAddressList
180     ) public returns (uint256 commitmentId_) {
181         commitmentId_ = commitmentCount++;
182
183         require(
184             _commitment.lender == _msgSender(),
185             "unauthorized commitment creator"
186         );
187
188         commitments[commitmentId_] = _commitment;
189
190         //make sure the commitment data adheres to required specifications and limits
191         validateCommitment(commitments[commitmentId_]);
192
193         //the borrower allowlists is in a different storage space so we append them to the array with this method s
194         _addBorrowersToCommitmentAllowlist(commitmentId_, _borrowerAddressList);
195
196         emit CreatedCommitment(
197             commitmentId_,
198             _commitment.lender,
199             _commitment.marketId,
200             _commitment.principalTokenAddress,
201             _commitment.maxPrincipal
202         );
203     }

Lenders can create commitments in the LenderCommitmentForwarder.sol contract. Each commitment represents a loan, which contains information such as the principal amount of the loan, the loan interest rate and the required collateral, etc. Borrowers can browse each loan in the LenderCommitmentForwarder.sol contract and choose the appropriate one to borrow.

The problem is that LenderCommitmentForwarder.sol releases commitments with zero cost, and attackers can maliciously spread various preferential but invalid loans, disrupting the entire market.

Impact

Disrupting the LenderCommitmentForwarder.spl contract market

Code Snippet

https://github.com/teller-protocol/teller-protocol-v2/blob/cb66c9e348cdf1fd6d9b0416a49d663f5b6a693c/packages/contracts/contracts/LenderCommitmentForwarder.sol#L177-L201

Tool used

Manual Review

Recommendation

It is recommended to deposit a part of the loan when releasing the commitment.