#47122 [SC-Medium] Array Length Mismatch Enables Partial Settlement Processing
Submitted on Jun 9th 2025 at 03:46:08 UTC by @Catchme for IOP | Term Structure Institutional
Report ID: #47122
Report Type: Smart Contract
Report severity: Medium
Target: https://github.com/term-structure/tsi-contract/blob/main/src/Settlement.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Protocol insolvency
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
The createSettlement function in the Settlement contract lacks crucial array length validation between the _loanIds and _loans parameters. This oversight allows partial processing of authorized settlements where only a subset of operator-signed loans are processed, creating a critical discrepancy between authorized and executed operations.
Vulnerability Details
The vulnerability exists in the createSettlement function at lines 113-114 and 139-147 in src/Settlement.sol:
The logical flaw stems from the asymmetric treatment of two related arrays:
Signature Generation: The
_getSettlementHashincludes both complete arrays in the signature calculationProcessing Logic: The loop boundary depends solely on
_loanIds.lengthwhile accessing both arrays with identical indicesMissing Validation: No enforcement mechanism ensures array length equality before processing
This creates two possible scenarios:
Scenario A:
_loans.length < _loanIds.lengthTriggers array out-of-bounds access when i >= _loans.length
Results in automatic transaction reversion due to Solidity bounds checking
Scenario B:
_loans.length > _loanIds.lengthProcesses only the first _loanIds.length entries from both arrays
Remaining _loans entries are silently ignored despite being part of the operator's signature
Creates discrepancy between authorized data and executed operations
Impact Details
When _loans.length > _loanIds.length, only a subset of intended loans undergo settlement while the operator's signature authorizes the complete set. This creates several issues:
Partial Execution: The operator's signature authorizes a complete set of loans, but only a subset gets processed
Settlement Confusion: Users and operators may believe all loans were settled when only some were
Proof of Concept
Proof of Concept
Was this helpful?