Badger eBTC Audit + Certora Formal Verification Competition - twcctop'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: 50/52

Findings: 1

Award: $19.71

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

19.712 USDC - $19.71

Labels

bug
downgraded by judge
grade-b
QA (Quality Assurance)
insufficient quality report
duplicate-218
Q-11

External Links

Lines of code

https://github.com/code-423n4/2023-10-badger/blob/99796c52f25618d706752fe51f80d146629fc4c6/packages/contracts/contracts/PriceFeed.sol#L57-L89

Vulnerability details

Impact

PriceFeed constructor doesn't check fallbackCaller state, it assumes fallbackCaller is trusted without any check. It may set the wrong state of oracle status.

Proof of Concept

status is to show the status of Oracle in init or previous call fetchPrice.It affects the return value of price and trusted status of oracle.Every time of status change should check current oracle return value and this will guarantee next call of fetchPrice have a right status to refer to. But in constructor,status is set to chainlinkWorking,and it doesn't check the state of fallback oracle.It assume fallback oracle works well. It will provide a bad reference to next call of fetchPrice , and it's possible to return imprecise oracle value. If don't check fallback oracle value,the status should be usingChainlinkFallbackUntrusted

Tools Used

manual


diff --git a/packages/contracts/contracts/PriceFeed.sol b/packages/contracts/contracts/PriceFeed.sol
index ef244d4..5f7438a 100644
--- a/packages/contracts/contracts/PriceFeed.sol
+++ b/packages/contracts/contracts/PriceFeed.sol
@@ -85,7 +85,7 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner {
         _storeChainlinkPrice(chainlinkResponse.answer);

         // Explicitly set initial system status after `require` checks
-        status = Status.chainlinkWorking;
+        status = Status.usingChainlinkFallbackUntrusted;
     }

     // --- Functions ---
~

Assessed type

Oracle

#0 - bytes032

2023-11-15T15:08:25Z

OOS

#1 - c4-pre-sort

2023-11-15T15:08:29Z

bytes032 marked the issue as insufficient quality report

#2 - bytes032

2023-11-16T06:40:16Z

CleanShot 2023-11-16 at 8  39 05

#3 - c4-pre-sort

2023-11-16T06:41:21Z

bytes032 marked the issue as duplicate of #218

#4 - c4-judge

2023-11-26T00:43:08Z

jhsagd76 changed the severity to QA (Quality Assurance)

#5 - c4-judge

2023-11-27T11:05:20Z

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