background
logo

Security Audit Report for Ref Finance's Burrowland, Ref-Dcl, Ref-Exchange

專案簡介

The target of this audit is the private code repository of Burrowland, Ref-Dcl, Ref-Exchange of Ref Finance. Note that, we did NOT audit all the modules in the repository. Specifically, the files covered in this audit include: 1 burrowland/contracts/contract/src/upgrade.rs 2 burrowland/contracts/contract/src/events.rs 3 burrowland/contracts/contract/src/price_receiver.rs 4 burrowland/contracts/contract/src/legacy.rs 5 burrowland/contracts/contract/src/config.rs 6 burrowland/contracts/contract/src/lib.rs 7 burrowland/contracts/contract/src/account_view.rs 8 burrowland/contracts/contract/src/margin_actions.rs 9 burrowland/contracts/contract/src/margin_trading.rs 10 burrowland/contracts/contract/src/margin_pyth.rs 11 burrowland/contracts/contract/src/margin_config.rs 12 burrowland/contracts/contract/src/fungible_token.rs 13 burrowland/contracts/contract/src/big_decimal.rs 14 burrowland/contracts/contract/src/margin_accounts.rs 15 burrowland/contracts/contract/src/asset_config.rs 16 burrowland/contracts/contract/src/account.rs 17 burrowland/contracts/contract/src/asset_view.rs 18 burrowland/contracts/contract/src/pyth.rs 19 burrowland/contracts/contract/src/prices.rs 20 burrowland/contracts/contract/src/storage.rs 21 burrowland/contracts/contract/src/shadow_actions.rs 22 burrowland/contracts/contract/src/margin_position.rs 23 burrowland/contracts/contract/src/utils.rs 24 burrowland/contracts/contract/src/margin_base_token_limit.rs 25 burrowland/contracts/contract/src/protocol_debts.rs 26 burrowland/contracts/contract/src/storage_keys.rs 27 burrowland/contracts/contract/src/booster_staking.rs 28 burrowland/contracts/contract/src/actions.rs 29 burrowland/contracts/contract/src/client_echo.rs 30 31 ref-contracts/ref-exchange/src/account_deposit.rs 32 ref-contracts/ref-exchange/src/token_receiver.rs 1https://github.com/burrowHQ/burrowland/tree/margin_trading 2https://github.com/rhea-finance/burrowland-fix/tree/fix 3https://github.com/ref-finance/ref-dcl/tree/margin_trading 4https://github.com/ref-finance/ref-contracts/tree/margin_trading

Please refer to the report for the detailed audit scope.

Our audit methodology employs automated vulnerability scans, manual verification, and business logic analysis to uncover potential security issues coupled with gas and code quality optimization recommendations.

In summary, we have found that the codebase contains 6 high-risk issues that require prompt attention. In addition, we have identified other non-critical issues as well as recommendations and notes that should be considered. The Burrowland, Ref-Dcl, Ref-Exchange team has addressed these issues promptly. It is important to note that our audit covers only the final reported versions of the codebase. Any subsequent updates would require a re-evaluation.

關鍵發現

我們在該智能合約中共發現 14 個潛在問題,另有 5 條建議與 2 條說明,明細如下:

高風險:6
中風險:1
低風險:7
建議:5
說明:2
ID Severity Description Status
1 Low Failure to remove position timestamp from position_latest_actions Fixed
2 High Lack of sender account check when handling SwapReference message Fixed
3 High Lack of lock when decreasing collateral Fixed
4 High Incorrect enumeration of tokens requiring price feeds Fixed
5 Low Unreasonable pos_id design Fixed
6 Low Lack of reasonable configuration check Fixed
7 High Potential panic during handling message SwapReference Fixed
8 Low Unreasonable check of reserves Fixed
9 Low Potential sandwich attack in force close position token swap Confirmed
10 Medium Unreasonable leverage rate computation Fixed
11 Low Potential gas waste due to improper fee validation Fixed
12 High Lack of account lock check in withdrawal and collateral operations Fixed
13 Low Potential underflow in function internal_storage_balance_of() after forced storage adjustment Fixed
14 High Incorrect aggregation of intermediate swap outputs Fixed
15 - Automatically construct swap indication from the token information Confirmed
16 - Use UnorderedMap for margin_positions instead of HashMap Fixed
17 - Incorrect error message in get_token_out() Fixed
18 - Lack of check in function update_asset() Fixed
19 - Remove redundant code in function internal_decrease_collateral_for_gap() Fixed
20 - Potential centralization risks -
21 - Collateral tracking approximation due to legacy asset accounting -

更多細節見審計報告

邁出走向安全的第一步

立即聯絡我們,獲取 BlockSec 的專業程式碼審計服務,在協議上線之前把安全性提上來!