Badger eBTC Audit + Certora Formal Verification Competition - 7ashraf's results

Use stETH to borrow Bitcoin with 0% fees | The only smart contract based #BTC.

General Information

Platform: Code4rena

Start Date: 24/10/2023

Pot Size: $149,725 USDC

Total HM: 7

Participants: 52

Period: 21 days

Judge: ronnyx2017

Total Solo HM: 2

Id: 300

League: ETH

eBTC Protocol

Findings Distribution

Researcher Performance

Rank: 48/52

Findings: 1

Award: $19.71

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

19.712 USDC - $19.71

Labels

bug
grade-b
QA (Quality Assurance)
sufficient quality report
Q-09

External Links

Possible division by zero

Instances

CDPManager.sol #621-622 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/CdpManager.sol#L621

LiquidationLibrary.sol #555 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/LiquidationLibrary.sol#L555

LiquidationLibrary.sol #558 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/LiquidationLibrary.sol#L558

LiquidationLibrary.sol #579 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/LiquidationLibrary.sol#L579

Need to validate _redeemColFromCdp to avoid division by 0 risk CdpManager.sol #135 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/CdpManager.sol#L135

Description

by tracing the function calls, after calling decrease system debt to zero, a zero value may be passed to the function

Mitigation

Add a require value > 0 statement before diding by value

Check if cpd exists first

Instances

Should check if borrower and position manager exist first

Instances

Unsafe subtraction

Instances

systemStEthBalance = _isCollIncrease ? systemStEthBalance + _stEthBalanceChange : systemStEthBalance - _stEthBalanceChange;

Mitigation

Add require val1 >= val2; statement

Function vulnerable to reentrancy

Instances

BorrowerOperations.sol #533 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/BorrowerOperations.sol#L553C36-L553C36

In-accurate and non-descriptive emit and error messages

Instances

Add else block

Description

Should add an else block specifying what should happen if the condition does not apply and emit the correct error message.

Instances

Empty catch block

Instances

PriceFeed.sol # 597 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/PriceFeed.sol#L597

Unnecessary require block

Instances

BorrowerOperations.sol #517 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/BorrowerOperations.sol#L517

Description

the check of cdp non-existent is already present in the insert method called above

Prevent allowance of 0

Instances

EbtcToken.sol #285 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/EBTCToken.sol#L285

Mitigation

Add require amount > 0 statement

Add Governeror to: (ensure not system block)

Instances

LeaverageMacroBase.sol #450 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/LeverageMacroBase.sol#L450

Add comments to explain assembly code

Instances

SimplifiedDiamondLike.sol #189 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/SimplifiedDiamondLike.sol#L189

Consider allowing fee recipient to be able to claim coll shares

ActivePool.sol #346 https://github.com/code-423n4/2023-10-badger/blob/main/packages/contracts/contracts/ActivePool.sol#L346

General

  • No transfer of authority in CpdManager
  • Protocol not pausable
  • Consider adding a list of authorized addresses or wards on the protocol

#0 - c4-pre-sort

2023-11-17T13:21:21Z

bytes032 marked the issue as sufficient quality report

#1 - c4-judge

2023-11-27T11:06:23Z

jhsagd76 marked the issue as grade-c

#2 - jhsagd76

2023-12-08T06:26:12Z

0 + 3 + 3 + 0 + 0 + 1 + 1 + 2 + 2 + 1 + 1

4 Low

4 N

#3 - c4-judge

2023-12-08T06:26:37Z

jhsagd76 marked the issue as grade-b

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