Lack of Access Control in onNewIssuance Function Allows Unauthorized Liquidity Manipulation and Forced LP Liquidation
Summary
The onNewIssuance function in VaultLibrary.sol is marked as external without proper access control. As a result, any malicious actor can call this function directly, leading to potential unauthorized actions such as liquidity manipulation or liquidating LP positions. These actions could severely destabilize the protocol by allowing unauthorized minting, liquidity provisioning, or even triggering liquidations that could harm both users and the protocol.
Vulnerability Detail
In the ModuleCore.sol contract, the function issueNewDs correctly uses the onlyConfig modifier to restrict access, ensuring only authorized parties can invoke the function. However, inside issueNewDs, the vulnerable VaultLibrary.onNewIssuance function is called, which is marked as external and lacks proper access control. This exposes the system to unauthorized actions, as any external party can directly call onNewIssuance, bypassing intended restrictions.
The onNewIssuance() function, when called, interacts with other critical functions like _liquidateLp and __provideAmmLiquidityFromPool, which can be exploited for unauthorized liquidity manipulation or liquidation of LP positions.
Impact
A malicious actor could directly call the onNewIssuance() function, triggering _liquidateLp which allows a user to forcibly liquidate an LP position. This could lead to the premature liquidation of liquidity providers' positions, resulting in loss of assets for legitimate users and potentially causing a negative ripple effect in the liquidity pools.
Code Snippet
function onNewIssuance(
State storage self,
uint256 prevDsId,
IDsFlashSwapCore flashSwapRouter,
IUniswapV2Router02 ammRouter
) external {
// do nothing at first issuance
if (prevDsId == 0) {
return;
}
if (!self.vault.lpLiquidated.get(prevDsId)) {
_liquidatedLp(self, prevDsId, ammRouter, flashSwapRouter);
}
__provideAmmLiquidityFromPool(self, flashSwapRouter, self.ds[self.globalAssetIdx].ct, ammRouter);
}
Note: This poses a significant risk as it can trigger unauthorized actions such as _liquidatedLp, which liquidates liquidity providers’ positions, or _provideAmmLiquidityFromPool, which affects liquidity provisioning.
Tool used
Manual Review
Recommendation
Add appropriate access control mechanisms to restrict access to the onNewIssuance function in VaultLibrary.sol
0xEkko
High
Lack of Access Control in
onNewIssuance
Function Allows Unauthorized Liquidity Manipulation and Forced LP LiquidationSummary
The
onNewIssuance
function inVaultLibrary.sol
is marked as external without proper access control. As a result, any malicious actor can call this function directly, leading to potential unauthorized actions such as liquidity manipulation or liquidating LP positions. These actions could severely destabilize the protocol by allowing unauthorized minting, liquidity provisioning, or even triggering liquidations that could harm both users and the protocol.Vulnerability Detail
In the ModuleCore.sol contract, the function issueNewDs correctly uses the onlyConfig modifier to restrict access, ensuring only authorized parties can invoke the function. However, inside issueNewDs, the vulnerable VaultLibrary.onNewIssuance function is called, which is marked as external and lacks proper access control. This exposes the system to unauthorized actions, as any external party can directly call onNewIssuance, bypassing intended restrictions.
The
onNewIssuance()
function, when called, interacts with other critical functions like_liquidateLp
and__provideAmmLiquidityFromPool
, which can be exploited for unauthorized liquidity manipulation or liquidation of LP positions.Impact
A malicious actor could directly call the
onNewIssuance()
function, triggering_liquidateLp
which allows a user to forcibly liquidate an LP position. This could lead to the premature liquidation of liquidity providers' positions, resulting in loss of assets for legitimate users and potentially causing a negative ripple effect in the liquidity pools.Code Snippet
Note: This poses a significant risk as it can trigger unauthorized actions such as
_liquidatedLp
, which liquidates liquidity providers’ positions, or_provideAmmLiquidityFromPool
, which affects liquidity provisioning.Tool used
Manual Review
Recommendation
Add appropriate access control mechanisms to restrict access to the
onNewIssuance
function in VaultLibrary.sol