Numoen contest - adeolu's results

Automated exchange for power perpetuals.

General Information

Platform: Code4rena

Start Date: 26/01/2023

Pot Size: $60,500 USDC

Total HM: 7

Participants: 31

Period: 6 days

Judge: berndartmueller

Total Solo HM: 3

Id: 207

League: ETH

Numoen

Findings Distribution

Researcher Performance

Rank: 16/31

Findings: 1

Award: $548.79

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: peakbolt

Also found by: adeolu, rvierdiiev

Labels

bug
2 (Med Risk)
downgraded by judge
partial-50
edited-by-warden
duplicate-174

Awards

548.791 USDC - $548.79

External Links

Lines of code

https://github.com/code-423n4/2023-01-numoen/blob/2ad9a73d793ea23a25a381faadc86ae0c8cb5913/src/periphery/Payment.sol#L44

Vulnerability details

Impact

Anyone that calls the refundEth function in Payments contract in payments.sol can withdraw all the eth in contract. Note that payment contract is inherited by LiquidityManager and LendgineRouter contracts.

Proof of Concept

line to code in repo - https://github.com/code-423n4/2023-01-numoen/blob/2ad9a73d793ea23a25a381faadc86ae0c8cb5913/src/periphery/Payment.sol#L44

function refundETH() external payable { if (address(this).balance > 0) SafeTransferLib.safeTransferETH(msg.sender, address(this).balance); }

As seen in this refundEth fcn in Payment contract, the msg.sender which can be anyone can call this function and empty all eth in Payments contract, the Payments contract is inherited by the LiquidtyManager contract, which is used by a user to manage its positions, if a user deposits eth to enter a position via any of the other payable functions in the payments contract in payments.sol or if not all eth is used up while entering a position, at a later moment any other person can come and take the eth before it is used.

This bug is similar to bug described by twitter user jeiwan7 in his blogpost here --> https://twitter.com/jeiwan7/status/1616981937293492224

I believe the best course of action should be calling refundETH() function in all functions where it is possible that not all eth will be used up when entering a position/swapping/trade, most especially in LiquidityManager contract and LendgineRouter contract.

This way makes it possible so the remaining unused eth is sent back to the user in a single function call.

#0 - c4-judge

2023-02-06T17:04:57Z

berndartmueller marked the issue as duplicate of #174

#1 - c4-judge

2023-02-14T15:51:54Z

berndartmueller changed the severity to 2 (Med Risk)

#2 - berndartmueller

2023-02-14T15:54:31Z

Compared to the other dupes, this submission lacks a more detailed PoC. Applying a partial credit.

#3 - c4-judge

2023-02-14T15:54:39Z

berndartmueller marked the issue as partial-50

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter