Closed code423n4 closed 2 years ago
Resolved - we now just use transferId
instead of router to index debt and repayment
I don't think this is a serious concern but it is definitely a worthwhile improvment. Emitting events with incorrect details does not pose any direct security risk. The only issue present is the lack of integrity checks on _transferId
. There are no checks to ensure_router
is the same router whom provided liquidity to the respective _transferId
. Downgrading to QA
.
Merging with #231.
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/facets/PortalFacet.sol#L115-L162
Vulnerability details
Impact
function
repayAavePortalFor()
inPortalFacet
is to allows anyone to repay the portal in the adopted asset for a given router and transfer but the code don't use the value of_router
anywhere and in the end execution flow emit eventAavePortalRouterRepayment()
with wrong data for router address.Proof of Concept
This is
repayAavePortalFor()
and_backLoan()
code inPortalFacet
:As you can see
_router
is never used in any logic and_backLoan()
is get called and in the end code runemit AavePortalRouterRepayment(msg.sender, _asset, _backing, _fee)
which emits event with wrong data as usesmsg.sender
instead of_router
.Tools Used
VIM
Recommended Mitigation Steps
add
_router
value to_backLoan()
parameters and update where_backLoan()
is called and updateemit AavePortalRouterRepayment()