Lucene search
K
Code423n4Recent

10190 matches found

Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Pair still operational during pause

Lines of code Vulnerability details Pair still operational during pause Severity: High Context: FraxlendPairCore.solL660 FraxlendPairCore.solL676 FraxlendPairCore.solL786 FraxlendPairCore.solL828https://github.com/code-423n4/2022-08-frax/blob/c4189a3a98b38c8c962c5ea72f1a322fb...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Interest rate can be gamed

Lines of code Vulnerability details Impact A lender may borrow to increase interest rate, and as such game the bank. Proof of Concept Suppose a lender borrows half of the amount he has lent. If by doing so he increases the utilization such that the interest rate more than doubles which may be...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.14 views

No Return Data Checks on Chainlink's latestRoundData() Might Return Stale Prices

Lines of code Vulnerability details Impact The updateExchangeRate function of FraxlendPairCore contract gets price using chainlink latestRoundData function. However it lacks the check on the return data and this might lead to stale prices. Proof of Concept ./FraxlendPairCore.sol:524: , int256...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.15 views

Calling borrowAsset function with 0 _collateralAmount can borrow asset tokens without providing any collateral tokens

Lines of code Vulnerability details Impact The borrowAsset function can be called with the collateralAmount input being set to 0. This will successfully bypass the step for providing any collateral tokens while directly borrowing the asset tokens. When a borrower borrows assets without providing...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.5 views

maxLTV == 0 shouldn't be solvent but currently always solvent, so borrower can borrow all assets without any collateral.

Lines of code Vulnerability details Impact maxLTV == 0 shouldn't be solvent but currently always solvent, so borrower can borrow all assets without any collateral since isSolvent always return true. Proof of Concept Assume maxLTV == 0 User call borrowAsset /// @notice The borrowAsset function is...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Users will never receive their borrow amount after tx the collateral

Lines of code Vulnerability details Impact You are not able to receive any borrowed amount after adding addCollateral Proof of Concept By invoking addCollateral you will transfer an amount of collateralAmount to the Pair But you will receive any borrowed amount Recommended Mitigation Steps Invoke...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

The vault account amount can be the result of an overflow

Lines of code Vulnerability details Impact The downcast uint128amountToTransfer can result in an overflow, which would impact the totalAsset.amout local variable, resulting in an incorrect amount for the totalAsset.amount state variable. function withdrawFeesuint128 shares, address recipient...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Using large liquidation fees to steal funds

Lines of code Vulnerability details The liquidation fees can be higher than the liquidation buffer i.e., cleanLiquidationFee LTVPRECISION - maxLTV. Lenders are not fully repaid during liquidation when this is true. In a malicious scenario, an attacker may deploy a pool with very large liquidation...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Even if the _isBorrowerWhitelistActive is not active, contract can get deployed if _maxLTV < LTV_PRECISION

Lines of code Vulnerability details Impact FraxlendPairCore can get deployed even if isBorrowerWhitelistActive is not active. Proof of Concept if maxLTV = LTVPRECISION && !isBorrowerWhitelistActive revert BorrowerWhitelistRequired; The above condition revert when both condition is true. Incase,...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.14 views

Use of transfer() instead of call() to send eth

Lines of code Vulnerability details Use of transfer instead of call to send eth Impact OZSafeERC20.safeTransfer relies on transfer at the end, but with a check of the returning value. Same happens with OZSafeERC20.safeTransferFrom and transferFrom. However, the use of transfer might render ETH...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.8 views

ERC20.approve can be error prone. It is known issue. ERC20.sol could not be safe.

Lines of code Vulnerability details Impact ERC20 - approve is not safe. Proof of Concept For approve, the entire contract depend on ERC20.approve assetContract.approveswapperAddress, borrowAmount; collateralContract.approveswapperAddress, collateralToSwap; Refer following articles for this issue...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.8 views

Unbounded loop while iterating deployedPairsArray

Lines of code Vulnerability details Impact If deployedPairsArray has a large amount of items, calls to getAllPairAddresses can result in a out of gas scenario, which would result in a DoS condition while retrieving the addresses. Proof of Concept 1. A large amount of items are pushed into...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Different SafeERC20 contracts are being used

Lines of code Vulnerability details Impact Two different contracts with the name SafeERC20 are being used. Proof of Concept Tools Used Vim Recommended Mitigation Steps Use a different name for the contract. --- The text was updated successfully, but these errors were encountered: 👎 1 0xA5DF react...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Multiplication performed after division can truncate the results

Lines of code Vulnerability details Multiplication performed after division can truncate the results Impact Solidity could truncate the results, performing multiplication before division will prevent rounding/truncation in solidity math. Details This can affect variables such as slopes, interests...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.16 views

Users could borrow all the liquidity in the FraxlendPair

Lines of code Vulnerability details Impact Any user can borrow any amount of Asset without transfer any Collateral Token to the Pair Proof of Concept By invoking borrowAsset and passe collateralAmount = 0 you will be able to borrow all the liquidity in the Pair As we can see they just check for i...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

LinearInterestRate mode has the risk of drastic fluctuation of interestRate by flash borrow attack, make borrower pay more interest

Lines of code Vulnerability details Impact In LinearInterestRate mode, the minInterest can be as low as MININT=0, and the maxInterest can be as high as MAXINT=146248508681. In getNewRate function, the newRate is determined by utilization. If utilization=1e5, the interestRate can be MAXINT. There...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.7 views

BORROWER CAN BORROW ASSET FROM HIMSELF AND GET THE SHARES

Lines of code Vulnerability details Impact User can borrow the asset from lender which the lender is himself. The user will get the share after he lend his asset to himself. Proof of Concept First the user, let say Alice, will call borrowAsset and set the address of the receiver to msg.sender...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.9 views

Losing precision of toShares and toAmount in VaultAccount.sol when doing accounting calculation.

Lines of code Vulnerability details Impact Detailed description of the impact of this finding. the code in VaultAccountingLibrary: function toShares VaultAccount memory total, uint256 amount, bool roundUp internal pure returns uint256 shares if total.amount == 0 shares = amount; else shares =...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.5 views

Interest rates will not compound correctly if seldom called

Lines of code Vulnerability details Impact While interest rates for second-by-second compounding are calculated correctly they are then not call every second, which leads to incorrect amounts of interest being calculated. This may have implications for the entire stability of the coin as the...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Math operation, condition check with two different data values (uint256 with uint128 and so).

Lines of code Vulnerability details Impact It may leads to unexpected result during math operation and condition checks. Proof of Concept It is obvious that following lines of codes are written with two different data types. nt256 deltaTime = block.timestamp - currentRateInfo.lastTimestamp;...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.12 views

repayAsset() but you will not receive your Collateral

Lines of code Vulnerability details Impact The user will just pay down the debt Proof of Concept By invoking repayAsset you will just pay the Asset Token, on the other hand, he does not send any amount of my Collateral Recommended Mitigation Steps Add a function to send the Collateral after...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Borrower can pay very little collateral for a huge amount of more valuable asset.

Lines of code Vulnerability details Impact When an approved borrower calls borrowAsset , they are able to borrow as much asset as possible and passing the user controlled collateralAmount input with a lesser value worth of collateral. For example, a user can pay 1 USDC collateral and receive 1000...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.7 views

Swap execution will revert with invalid block.timestamp deadline when leveraging position.

Lines of code Vulnerability details Impact Detailed description of the impact of this finding. In the code, we hard code the swap deadline to block.timestamp, which is easlity expired. ISwapperswapperAddress.swapExactTokensForTokens borrowAmount, amountCollateralOutMin, path, addressthis,...

7.1AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.12 views

Chainlink oracle data feed is not further validated and can return stale answer

Lines of code Vulnerability details Impact Although the protocol recognizes that Chainlink oracles can provide outdated answers, using stale answers without further validation might not be a good practice. Moreover, in the updateExchangeRate function, where the latestRoundData method is used, the...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Not calling approve(0) before setting a new approval might cause reverts when used with Tether (USDT)

Lines of code Vulnerability details Impact Some tokens do not implement the ERC20 standard properly but are still accepted by most code that accepts ERC20 tokens. For example Tether USDT's approve function will revert if the current approval is not zero, to protect against front-running changes o...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.6 views

Approved Borrower can borrow asset without paying collateral

Lines of code Vulnerability details Impact When an approved borrower calls borrowAsset , they are able to borrow as much asset as possible without pass the user controlled collateralAmount input as 0. This would allow the borrower to not pay any collateral and receive the borrowAmount Proof of...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.7 views

Approved Borrower can can walk away with collateral in leveraged borrowed Position

Lines of code Vulnerability details Impact When an approved borrower calls leveragedPosition , their userBorrowShares and userCollateralBalance values are updated. The borrow will be able to walk away with collateral balance by adding more collateral to pass the isSolvent check and remove all the...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.13 views

# Borrower can self liquidate to steal fund

Lines of code Vulnerability details Borrower can self liquidate to steal fund Impact Borrower has incentive to self liquidate. Since the shares to repay in liquidation is at discount, the contract would loss some fund by each liquidation. Every time the LTV touches the edge of liquidation, the...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.15 views

Return values not being checked

Lines of code Vulnerability details Return values not being checked Impact Return values not being checked may lead into unexpected behaviors with functions. Not events/Error are being emitted if that fails, so functions would be called even of not being working as expect as for example...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.15 views

If maxLTV == 0 case is used for allowing unlimited borrowing without any collateral, borrower whitelist must be enforced.

Lines of code Vulnerability details Impact If maxLTV == 0 case is used for allowing unlimited borrowing without any collateral, borrower whitelist must be enforced since it is a kind of undercollateral. Proof of Concept function isSolventaddress borrower, uint256 exchangeRate internal view return...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Chainlink's latestRoundData() might return stale or incorrect data

Lines of code Vulnerability details Impact The only value being checked from the return of latestRoundData is answer. Chainlink will return more fields that can be checked to ensure the data is not stale/incorrect. Proof of Concept Lack of checks inside the function updateExchangeRate might cause...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.5 views

there is no calculation or checks for LTV

Lines of code Vulnerability details Impact The users decide how much Collateral to send and how many assets to borrow Proof of Concept In the Functions: Borrowing part exactly with borrowAsset and addCollateral there is no calculation or checks for LTV so the users just pass any amount and it wil...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.15 views

Pausing can cause serious bad debt since debt can't be liquidated.

Lines of code Vulnerability details Impact Pausing can cause serious bad debt since debt can't be liquidated. For example, if 1 UST is used as collateral to borrow 0.7 USDT 30% safety. Then UST crashed and chainlink stopped working. You left no choice but to pause the contract. After that UST...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.7 views

Possible frontrunning attack in Vault.

Lines of code Vulnerability details Proof of Concept The project uses VaultAccount.sol library for math implementations. To determine the number of shares to mint to a depositor, shares = amount total.shares / total.amount is used in toShares function VaultAccount.sol's toShares calculation;...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.22 views

Chainlink oracle lacks proper validation

Lines of code Vulnerability details Impact Calls to the Chainlink price oracle via latestRoundData in FraxlendPairCore.sol use the correct function latestRoundData per Chainlink's documentation, but lack the recommended validations to ensure that the round is complete and does not return stale...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Possible frontrunning attack in Vault.

Lines of code Vulnerability details Impact First depositor will have the control of the vault and drain user funds. Proof of Concept The project uses VaultAccount.sol library for math implementations. To determine the number of shares to mint to a depositor, shares = amount total.shares /...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.15 views

Deployment of pairs with no oracles

Lines of code Vulnerability details The constructor allows both oracle options oracleMultiply and oracleDivide to be set to zero. A pair could be deployed with no oracle maliciously or unintentionally. Impact Borrowers would not be impacted by fluctuations in values of collateral or assets and...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.6 views

Oracle price could not be fresh

Lines of code Vulnerability details Vulnerability In FraxlendPairCore.updateExchangeRate, we are using latestRoundData, but there are no validations that the data is not stale. The current code is: , int256 answer, , , = AggregatorV3InterfaceoracleMultiply.latestRoundData; if answer = round, "Sta...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.7 views

Function may fail when called due to the imprecise length of arrays to be looped (initialize function)

Lines of code Vulnerability details Impact Detailed description of the impact of this finding. Proof of Concept Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept. Even though the array is calldata, there are...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.9 views

ERC20.approve can be error prone. It is known issue. ERC20.sol could not be safe.

Lines of code Vulnerability details Impact ERC20 - approve is not safe. Proof of Concept For approve, the entire contract depend on ERC20.approve assetContract.approveswapperAddress, borrowAmount; collateralContract.approveswapperAddress, collateralToSwap; Refer following articles for this issue...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.12 views

Chainlink’s latestRoundData might return stale or incorrect results

Lines of code Vulnerability details Impact On ChainlinkPriceOracle.sol, we are using latestRoundData, but there is no check if the return value indicates stale data. Proof of Concept File: contracts/FraxlendPairCore.sol , int256 answer, , , = AggregatorV3InterfaceoracleMultiply.latestRoundData; ,...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.10 views

Owner can change timelock at any time

Lines of code Vulnerability details Contract FraxlendPair implements logic for changing timelock and protocol fee. The functionality of changing fee is reserved to TIMELOCKADDRESS which is expected to be a timelock contract that protects users from accidental changes of fee while using the...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.16 views

Able to remove all collateral after borrow

Lines of code Vulnerability details Assuming to borrow asset tokens from a pair contract a user must first deposit collateral tokens. After they deposit collateral tokens their userCollateralBalance increases and they can then call borrowAsset to receive asset tokens from the contract. The...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.6 views

interest rate calculate vulnerability

Lines of code Vulnerability details Impact function addinterst uses the interest rate immediately generated by the current block first transaction calculated,it will cause some interest lose. Proof of Concepmt function addinterst uses the interest rate immediately generated by the current block t...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.6 views

Users could borrow all the liquidity in the Pair just by transferring some collateral Token

Lines of code Vulnerability details Impact Any user can borrow any amount of Asset just by transferring some collateral to the Pair Proof of Concept By invoking borrowAsset and passe some of collateralAmount you will be able to borrow all the liquidity in the Pair There is no check for the LTV. i...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.11 views

Anyone can deploy a pair with a potentially malicious token

Lines of code Vulnerability details By allowing anyone to create a pair with any two tokens there is a risk that an unsavory token will get included either as collateral or as an asset. It could range from a bad actor intentionally inserting a malicious token to a well-intentioned team that...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2022/08/17 12:0 a.m.6 views

repayAssetWithCollateral will likely revert. Hard to predict how much collateral to use to not underflow.

Lines of code Vulnerability details Impact The repayAssetWithCollateral function is difficult to use in order to pay off a user's entire balance. In an effort to pay off the user's entire debt, they will attempt to calculate the amount of collateral necessary that equivalates to their debt shares...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2022/08/16 12:0 a.m.4 views

Upgraded Q -> M from 161 [1660684093342]

Judge has assessed an item in Issue 161 as Medium risk. The relevant finding follows: --- The text was updated successfully, but these errors were encountered: All reactions...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/16 12:0 a.m.5 views

Upgraded Q -> M from 113 [1660684075488]

Judge has assessed an item in Issue 113 as Medium risk. The relevant finding follows: --- The text was updated successfully, but these errors were encountered: All reactions...

7AI score
Exploits0
Code423n4
Code423n4
added 2022/08/15 12:0 a.m.15 views

Use of arbitrary ERC20 tokens could result misaccounting of funds

Lines of code Vulnerability details Vulnerability details If the token is set to a deflationary/fee-on-transfer token then its actual transfer amounts will not be accurately reflected in the protocol accounting given the lack of pre-transfer and post-transfer checks on asset transfers. Impact Som...

7AI score
Exploits0
Total number of security vulnerabilities10190