How Does a Read-Only Attack Impact an On-Chain Lending Protocol?
In an on-chain lending protocol, a read-only reentrancy attack can impact the protocol by allowing an attacker to manipulate the valuation of collateral or debt. For example, an attacker calls a deposit function, which then calls an external token contract to check the balance.
If the attacker re-enters the deposit function to read the balance before the first call's state is updated, they can pass a check based on a stale, incorrect balance. This can lead to the protocol miscalculating the collateral ratio, potentially allowing an undercollateralized loan to be approved.