Lucene search
K
Code423n4Recent

10190 matches found

Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

bad actore can increase gas usage in swapfrom function

Lines of code Vulnerability details Impact bad actor can increase gas in swapfrom function because everytime calling swapfrom function it store new unit and everytime runs the loop for length of it Proof of Concept the swapfrom function includes function setReservesIERC20 memory tokens, uint256...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

cumulativeReserves can be incorrect

Lines of code Vulnerability details Impact Detailed description of the impact of this finding. Well updates the pump each time someone interacts with the well. update calculates the mev resistant values, one of which is the cumulativeReserves. If the update function is called twice or more times ...

7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

Wherever possible, _safeMint() should be used rather than _mint()

Lines of code Vulnerability details Impact mint is not recommended in favour of safeMint, which guarantees that the recipient is either an EOA. Proof of Concept, , Tools Used Vscode use safeMint instead of mint. Assessed type Upgradable --- The text was updated successfully, but these errors were...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.11 views

Inflation attack in well

Lines of code Vulnerability details Impact The Well.sol contract is vulnerable to a first depositor attack allowing someone to directly send funds to the pool in order to obfuscate the totalSupply and steal funds from the subsequent depositor. Proof of Concept Below is how the attack can be carri...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.7 views

Well.sol::swapFrom() Missing Fee-on-Transfer Token Check

Lines of code Vulnerability details Description The swapFrom in the Well.sol contract does not include a check for fee-on-transfer tokens, as specified in the Nespac. The comment states that the check for fee-on-transfer tokens is performed in the setReserves, but checks are not implemented in th...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

Well.sol contract allows anyone to add liquidity to tokens with fee-on-transfer by calling the addLiquidity function

Lines of code Vulnerability details Impact A malicious user can call the wrong function for adding liquidity for a pair with fee-on-transfer tokens. The reserves information maintained within the contract suffers from an inconsistency which can result in various miscalculations for liquidity...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

NO ACCESS CONTROL IN THE Well.skim() EXTERNAL FUNCTION

Lines of code Vulnerability details Impact The Well.skim external function is used to transfer the excess tokens held by the Well to recipient. But there is no access control in this function and hence anyone can call this function. Therefore this function allows any arbitory user recieve the...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

There is a large precision error in sqrt calculation of lp

Lines of code Vulnerability details Impact Compared with div, there is a larger precision error in calculating lp through sqrt, so there should be a way to check whether there are excess tokens left when adding liquidity. Proof of Concept function testCalcLpTokenSupplyDiff public uint256 memory...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

Due to bit-shifting errors, reserve amounts in the pump will be corrupted, resulting in wrong oracle values

Lines of code Vulnerability details Description It is advised to first read finding: Due to slot confusion, reserve amounts in the pump will be corrupted, resulting in wrong oracle values, which provides all the contextual information for this separate bug. We've discussed how a wrong sload sourc...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.7 views

Memory corruption in getBytes32FromBytes() can likely lead to loss of funds

Lines of code Vulnerability details Description The LibBytes library is used to read and store uint128 types compactly for Well functions. The function getBytes32FromBytes will fetch a specific index as bytes32. / @dev Read the ith 32-byte chunk from data. / function getBytes32FromBytesbytes memo...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

Long term denial of service due to lack of fees in Well

Lines of code Vulnerability details Description The Well allows users to permissionless swap assets or add and remove liquidity. Users specify the intended slippage in swapFrom, in minAmountOut. The ConstantProduct2 implementation ensures Kend - Kstart = 0, where K = Reserve1 Reserve2, and the...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.14 views

Users can swap tokens through shift() function without _updatePumps()

Lines of code Vulnerability details Impact Any user can swap tokens just transferring tokens to the contract in a batch with calling shift function. The problem is that the shift doesn't call the updatePumps function which update oracle. This way attackers can exploit this vulnerability to...

6.5AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.4 views

Possible Issues Related to Well Initial State

Lines of code Vulnerability details Description && Impact After creating the Well contract, there will be no reserves in the initial state. Therefore it could lead to the following possible issues and the attackers can take advantage of them through front running. 1. Price manipulation attacks Wh...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

Implementation of Well shift() function allows attackers to completely manipulate the oracles

Lines of code Vulnerability details Description The TWAP mechanism relies on measurements sent to the oracle at various points in time. Before reserve counts change, the TWAP is sent the last reserve counts, which are multiplied by the time passed and added to the accumulator. In MultiFlowPump, i...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.10 views

The existence of Pump may hinder large swaps or swaps from a low liquidity pool

Lines of code Vulnerability details Impact Large swaps or swaps with low liquidity value may not work properly. Proof of Concept According to the whitepaper, the purpose of the pump is to be a multi-block MEV manipulation resistant to large changes in liquidity value. Since the Well can be create...

6.5AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

First liquidity provider can break minting of shares

Lines of code Vulnerability details Impact The attack vector and impact is that users may not receive shares in exchange for their deposits if the total asset amount has been manipulated through a large “donation”. Proof of Concept The attack vector and impact is that users may not receive shares...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

You can expand your version of well in Aquifer.boreWell() with unpredictable results

Lines of code Vulnerability details Impact boreWell takes an implementation parameter. This parameter is not checked in any way. Thus, the user can pass any of his parameters and expand his well option. This can lead to unpredictable consequences. Proof of Concept 1. The user creates his own...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.3 views

Subsequent liquidity providers will suffer from the loss of funds

Lines of code Vulnerability details Impact When adding liquidity, lpAmountOut is calculated using the formula: calcLpTokenSupplywellFunction, reserves - totalSupply. function calcLpTokenSupply Call memory wellFunction, uint256 memory reserves internal view returns uint256 lpTokenSupply...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.7 views

_addLiquidity() function will revert in first call

Lines of code Vulnerability details Impact The first user cant calls the addLiquidity function because this function doesn't handle the first call. addLiquidity function is calculate lp amount by calling calcLPTokenUnderlying function. so this function has a division for lpTokenSupply. in this...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.16 views

Anyone can call Well.sol shift() function and withdraw Contract's extra ERC20 tokens whichever this contract is holding . From Well's contract balance, extra tokens for shifting, calculated amountOut for passed tokenOut token can be withdrawn by attacker.

Lines of code Vulnerability details Impact Whichever type of ERC20 token Well contract is holding it can loose all extra tokens of all types in an amount whatever is the difference reservesj -calcReservewellFunction, reserves, j, totalSupply comes for tokenOut token passed by attacker. Attacker c...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Possible to stop trading

Lines of code Vulnerability details Impact It's possible to stop market due to division by 0 exception. So better to prevent this, because better to revert with missing minAmountOut than revert with some error, which might be complicated to detect. Proof of Concept There is a change to withdraw a...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.18 views

Due to slot confusion, reserve amounts in the pump will be corrupted, resulting in wrong oracle values

Lines of code Vulnerability details Description The MultiFlowPump contract stores reserve counts on every update, using the libraries LibBytes16 and LibLastReserveBytes. Those libs pack bytes16 values efficiently with the storeBytes16 and storeLastReserves functions. In case of an odd number of...

7.1AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.8 views

Well.skim() TRANSACTION CAN BE FRONT RUN BY Well.sync() TRANSACTION THUS MAKING THE Well.skim() CALL INEFFECTIVE

Lines of code Vulnerability details Impact The Well.skim external function is used to transfer the excess tokens held by the well to teh recipient. This is done by calculating the differnce between the contract balance and the reserves for each of the tokens as shown below: skimAmountsi =...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.4 views

Anyone can receive funds from the Well.sol contract, thus reducing the token/tokenLp ratio for users

Lines of code Vulnerability details Impact In Well.sol skim, anyone can withdraw funds that are not in reserve by simply calling the function. Such funds may remain, for example, when transactions are rounded off. To credit extra tokens, reservetoken has sync. However, you can programmatically...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Well.shift could suffer from front-running attack

Lines of code Vulnerability details Impact The usage of Well.shift is described in the comment: 2. Using a router with shift: WETH.transfersender=0xUSER, recipient=Well1 1 Call the router, which performs: Well1.shifttokenOut=DAI, recipient=Well2 DAI.transfersender=Well1, recipient=Well2 2...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.10 views

A malicious user can steal a reserved token by using shift() function of Well.sol if the well was added liquidity unsafely with zero amount of the one of tokens.

Lines of code Vulnerability details Impact A malicious user can steal a reserved token by using shift function of Well.sol if the well was added liquidity unsafely with zero amount of the one of tokens. Proof of Concept Let's assume the well with WETH and USDC tokens. Currently totalSupply is zer...

6.6AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

LSP8CompatibleERC721InitAbstract._checkOnERC721Received return value is incorrect

Lines of code Vulnerability details Impact Can be transferred to EOA through safeTransferFrom Proof of Concept problematic code call path safeTransferFrom-safeTransfer-checkOnERC721Received safeTransferFrom annotate / @inheritdoc ILSP8CompatibleERC721 @dev Compatible with ERC721 safeTransferFrom...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

Well.sol#removeLiquidityImbalanced - Handling Excess Reserves in removeLiquidityImbalanced Function to Prevent Unnecessary Reverts

Lines of code Vulnerability details Impact The removeLiquidityImbalanced function in the Well.sol contract is vulnerable to a potential underflow. This could disrupt the contract's functionality and prevent users from removing liquidity in an imbalanced manner. Furthermore, the function does not...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.15 views

Anyone can call Well.sol skim method and transfer excessive tokens to its address.

Lines of code Vulnerability details Impact Excessive tokens balance of Well.sol more than returned from getReserves can be transferred by anyone to his account. Proof of Concept After getting hold token's instances from Well.sol contract tokens we can check the balances of Contract of Each token...

7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.10 views

No fee swap is possible through addLiquidity and removeLiquidityImbalanced

Lines of code Vulnerability details impact Some will not pay swap fees even after the swap fee is added. proof of concept This is equivalent to swap 1000 tokenA to 500 tokenB, but no fee calculation code lies in adding and removing liquidity. Add this test in Well.AddLiquidity.t.sol. function...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.7 views

Not all features of the protocol are used

Lines of code Vulnerability details Impact In current implementation The protocol won't be so popular as it can be. This is because a lot of transactions uses flash loan. In current implementation flash loan impossible, because user must transfer his funds at the first. This leads to small amount...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.8 views

Predictability of cloned address may be susceptible to frontrunning

Lines of code Vulnerability details Impact DoS for the Aquifer.boreWell function due to frontrunning. Proof of Concept From the video documentation, Anyone can call boreWell in Aquifer.sol after confirming an implementation contract. The address of the new Well depends solely upon the salt...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Flash loan price manipulation in Well.sol

Lines of code Vulnerability details Impact Line 214 of Well.sol calculates the price of tokens to tokens in the pool based on the balances at a single point in time. Pool balances at a single point in time can be manipulated with flash loans, which can skew the numbers to the extreme. The single...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.10 views

Well.sol::skim() anyone can transfer excess funds to their account.

Lines of code Vulnerability details Description The skim is designed to transfer excess tokens held by the contract to a specified recipient. However, it lacks proper access control checks, allowing any user to initiate the transfer of excess tokens, regardless of ownership. This presents a...

7.1AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Potential token duplication validation bypass

Lines of code Vulnerability details Impact Potential token duplication validation bypass Proof of Concept The loop statement in init function will check if there is duplicated token for a Well. function initstring memory name, string memory symbol public initializer ERC20Permitinitname;...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.7 views

Pool address predictability creates many problems

Lines of code Vulnerability details Impact The Aquifer.boreWell function is responsible for creating new Well. This is done using the LibClone.cloneDeterministic function. The address of the new Well depends solely on the salt and/or immutableData parameter provided by the user. Once a user creat...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

Absence of Function calcReserve(...) at src/interfaces/IBeanstalkWellFunction.sol

Lines of code Vulnerability details Impact Absence of Function calcReserve... at src/interfaces/IBeanstalkWellFunction.sol will affect the implementation of the function, the implementation is done in src/functions/ConstantProduct2.sol but the implementation cannot be accessed at...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Function collision between extension functions and account functions

Lines of code Vulnerability details Impact Users or owner can't use extensions because of collision between extension functions and account functions Proof of Concept Whenever someone calls account it will check for functions inside it, if there isn't function it goes to fallback to check...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.9 views

The constant product invariant can be broken.

Lines of code Vulnerability details description Let reserves returned by Well.getReserves as x, y and Well.tokenSupply as k. They must maintain the invariant x y EXPPRECISION = k 2. However, the reserves can increase without updating the token supply if a user transfers one token of the well and...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

Invariants doesn't checked

Lines of code Vulnerability details Impact Liquidity providers might lost their funds. Because wellFunction can be arbitrary. Proof of Concept I've asked publius about wellFunction, and he respond -- that anyone can create any wellFunction and pass it to the Well. So, let's consider for example...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.6 views

LSP8CompatibleERC721._checkOnERC721Received return value is incorrect

Lines of code Vulnerability details Impact Can be transferred to EOA through safeTransferFrom Proof of Concept problematic code call path safeTransferFrom-safeTransfer-checkOnERC721Received safeTransferFrom annotate / @inheritdoc ILSP8CompatibleERC721 @dev Compatible with ERC721 safeTransferFrom...

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

Well.sol::addLiquidity() Unauthorized Liquidity Addition for Fee-on-Transfer Tokens

Lines of code Vulnerability details Description The addLiquidity in the Well.sol contract allows any address to add liquidity to tokens with a fee-on-transfer mechanism. Although there is a another function available to add liquidity for Fee-on-transfer token name addLiquidityFeeOnTransfer. Howev...

6.5AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.15 views

the swapFrom() function allows the Fee On Transfer tokens and _setReserves doesn't revert

Lines of code Vulnerability details Impact the protocol supports the fee on transfer tokens and has implemented a special capable function for it and wants to not allow and revert the fee on transfer tokens in normal SwapFrom function as it says in comments of swapfrom function @dev MUST revert i...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.4 views

Pump is not updated in shift function

Lines of code Vulnerability details Impact According to comments in Well contract, updatePumps function "Fetches the current token reserves of the Well and updates the Pumps. Typically called before an operation that modifies the Well's reserves." In functions like swap, add/remove liquidity...

6.5AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.8 views

pump reserves will be corrupted if numberOfReserves become less

Lines of code Vulnerability details Impact Pump's reserves will be corrupted. Proof of Concept In MultiFlowPump, we didn't enforce if numberOfReserves has changed from slot.readNumberOfReserves. If update is called with less numberOfReserves, the reserves array can be corrupt, leading to unexpect...

6.8AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.12 views

TWAP can be easily manipulated by attacker through the sync() function, causing loss of funds

Lines of code Vulnerability details Description Please refer to the issue titled Implementation of Well shift function allows attackers to completely manipulate the oracles for relevant introduction and context. The safety of the TWAP relies on calling the observation function update with the...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/10 12:0 a.m.15 views

Possible Front Running on the Permit function

Lines of code Vulnerability details Impact It could cause damage to third parties who use the permit method for transferring the tokens. Proof of Concept The well contract extends the ERC20Permit.sol, which contains a permit function that allow users to transfer assets with signatures. / @dev...

6.7AI score
Exploits0
Code423n4
Code423n4
added 2023/07/09 12:0 a.m.8 views

Upgraded Q -> 2 from #198 [1688918565387]

Judge has assessed an item in Issue 198 as 2 risk. The relevant finding follows: QA1. UlyssesPool.maxRedeem needs to consider the protocol fees. --- The text was updated successfully, but these errors were encountered: All reactions...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/09 12:0 a.m.6 views

Potential draining Well via slippage imprecision and swapping the same token

Lines of code Vulnerability details Impact According to Well.sol comment: // Note: The rounding approach of the Well function determines whether // slippage from imprecision goes to the Well or to the User. imprecision can either goes to the Well or User. In this scenario we will assume that Well...

6.9AI score
Exploits0
Code423n4
Code423n4
added 2023/07/09 12:0 a.m.9 views

Stealing excess tokens from other users by either front-running skim function or calling it before legitimate user

Lines of code Vulnerability details Impact File /src/interfaces/IWell.sol comment's defines what the skim function is being responsible for: / @notice Sends excess tokens held by the Well to the recipient. @param recipient The address to send the tokens @return skimAmounts The amount of each toke...

6.8AI score
Exploits0
Total number of security vulnerabilities10190