Boost | Folks Finance-logo

Boost | Folks Finance

|

Folks Finance is a leading DeFi platform providing innovative tools for lending, borrowing, trading and managing digital assets, all in one place.

Solidity

Status

Finished
Max Bounty
$100,000
Rewards Pool
$100,000
Vault TVL
$102.41
Started
16 July 2024
Ended
06 August 2024
Rewards Token
USDC
nSLOC
4,958
  • Triaged by Immunefi

  • PoC required

  • Vault program

Select the category you'd like to explore

Assets in Scope

Target
Type
Added on
Primacy Of Impact
Smart Contract
17 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - BridgeRouterHub
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - BridgeRouterSpoke
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - HubAdapter
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - WormholeDataAdapter
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - WormholeCCTPAdapter
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - CCIPDataAdapter
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - CCIPTokenAdapter
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - Hub
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - NodeManager
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - OracleManager
16 July 2024
Target
Type
Added on
Smart Contract - Smart Contract - SpokeManager
16 July 2024

Impacts in Scope

Proof of Concept (PoC) Requirements

A PoC, demonstrating the bug's impact, is required for this program and has to comply with the Immunefi PoC Guidelines and Rules.

Whitehat Educational Resources & Technical Info

  1. Design Overview for Cross-chain Lending Protocol: Link to Google Docs

  2. Operation lifecycle in cross-chain lending protocol: Link to Google Docs

  3. Formulae Used in Cross-chain Lending Protocol: Link to Google Docs

  4. Testnet for Cross-chain Lending Protocol: Link to Testnet

  5. Smart Contract README for Cross-chain Lending Protocol: Link to GitHub README

  6. Docs for Existing Folks Finance Products: Link to Folks Finance Docs

  7. Medium Articles: Link to Medium Articles

Is this an upgrade of an existing system? If so, which? And what are the main differences?

This is a new cross chain lending protocol that follows a similar model to our existing Algorand lending protocol. The loans and economic structure are the same with the only difference being how liquidations work. All the cross chain infrastructure is new.

The cross chain lending protocol also uses an oracle design from Synthetix which takes up less than 5% of the total codebase. The codebase language is fully Solidity.

Where do you suspect there may be bugs? Useful aspects of this question are:

Which parts of the code are you most concerned about? What attack vectors are you most concerned about? Which part(s) of the system do you want whitehats to attempt to break the most? Are there any assumed invariants that you want whitehats to attempt to break?

In general all parts of the code should be checked and attack vectors explored. We write here some areas to look at in particular but this is not to discount any other areas.

One area to explore is the communication between chains. Messages are relayed between the spoke chain and the hub chain via Chainlink CCIP and Wormhole Messaging. In addition, Circle CCTP is used for USDC transfers. It is important to verify that we are using these protocols as intended and have correctly reasoned about the lifecycle of a message.

We have a contract named “HubAdapter” which mimics the behaviour of the Chainlink CCIP and Wormhole messaging, without actually relaying anything. Its purpose is to have a common interface for interacting with the protocol through the spoke contracts regardless of whether on the hub chain or not.

We also have a new process for liquidations which should be checked both economically and codewise. The oracle integration is also new and should be checked for resistance against tampering.

One invariant to ensure that there is sufficient funds such that if all borrowers repaid their loans, all depositors can withdraw their tokens. Not an invariant, but the average stable interest rate should be closely tracking the weighted average of all the stable borrows for a given pool.

What ERC20 / ERC721 / ERC777 / ERC1155 token standards are supported? Which are not?

ERC20 and ERC777 are the only two supported. The modular design allows ERC1155 to be supported in the future too if needed.

What emergency actions may you want to use as a reason to invalidate or downgrade an otherwise valid bug report?

We have rate limiting which sets the maximum amount which can be withdrawn or deposited. If the limit is consumed through a denial of service attack, we have the ability to temporarily boost the capacity.

Other mitigating actions we can take involve removing/adding an adapter, lowering rate limits, lowering pool caps and deprecating a pool. If the bug report’s impact is small in the scope of the protocol as a whole, considering the possible mitigations, then that could be reason to invalidate or downgrade the severity.

What addresses would you consider any bug report requiring their involvement to be out of scope, as long as they operate within the privileges attributed to them?

E.g An ‘Operator’ address with the ability to pause smart contracts who could use their privileged functions to exploit a bug and steal funds

All admin and role addresses, as well as 3rd party infrastructure the project relies on.

What external dependencies are there?

  • Chainlink Price Feeds
  • Pyth Price Feeds
  • Folks Finance Centralised Fallback Oracle
  • Wormhole’s Messaging
  • Chainlink’s CCIP
  • Circle’s CCTP

Where might whitehats confuse out-of-scope code to be in-scope?

The external services such as the WormholeRelayer, Chainlink CCIP RouterClient and external oracle services.

Are there any unusual points about your protocol that may confuse whitehats?

We have our own standard of sending and receiving messages. Certain operations require finality as they involve a value transfer while the others can be immediately relayed. There is the “HubAdapter” too which is mentioned above.

We split tokens into two categories in our lending protocol. The first are tokens which are not bridged and remain on the spoke chain e.g. ETH, Link. The second are tokens which are bridged and reside on the hub chain e.g. USDC.

Our lending protocol also is different from others in that a user can have multiple loans, and that a loan can have multiple collaterals and borrows within it. We also define various loan types which have their own respective parameters. One of these is the “deposit” loan type which has borrow caps of zero for every token.

What is the test suite setup information?

If this is already provided in Github, then linking that resource is enough.

It will be in the GitHub report with the rest of the code.

Public Disclosure of Known Issues

Bug reports covering previously-discovered bugs (listed below) are not eligible for a reward within this program. This includes known issues that the project is aware of but has consciously decided not to “fix”, necessary code changes, or any implemented operational mitigating procedures that can lessen potential risk.

  • Griefing through consuming external rate limits of tokens e.g. Circle CCTP rate limits for USDC
  • Griefing through consuming internal rate limits where we have the ability to respond by temporarily boosting capacity

Previous Audits

Folks Finance’s completed audit reports can be found at https://github.com/Folks-Finance/audits/blob/13f8d8307902e8ff7018fe9b6df0b5668c638863/OtterSec%20-%20Audit%20of%20XChain%20Lending%20-%20May%202024.pdf. Any unfixed vulnerabilities mentioned in these reports are not eligible for a reward.

Critical
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Critical
Permanent freezing of funds
Critical
Protocol insolvency
High
Theft of unclaimed yield
High
Theft of unclaimed royalties
High
Permanent freezing of unclaimed yield
High
Permanent freezing of unclaimed royalties
High
Temporary freezing of funds of at least 24h
Medium
Smart contract unable to operate due to lack of token funds
Medium
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Medium
Theft of gas
Medium
Unbounded gas consumption

Out of scope

Program's Out of Scope information

These impacts are out of scope for this bug bounty program

All Categories:

  • Impacts requiring attacks that the reporter has already exploited themselves, leading to damage
  • Impacts caused by attacks requiring access to leaked keys/credentials
  • Impacts caused by attacks requiring access to privileged addresses (governance, strategist) except in such cases where the contracts are intended to have no privileged access to functions that make the attack possible
  • Impacts relying on attacks involving the depegging of an external stablecoin where the attacker does not directly cause the depegging due to a bug in code
  • Mentions of secrets, access tokens, API keys, private keys, etc. in Github will be considered out of scope without proof that they are in-use in production
  • Best practice recommendations
  • Feature requests
  • Impacts on test files and configuration files unless stated otherwise in the bug bounty program

Blockchain/DLT & Smart Contract Specific:

  • Incorrect data supplied by third party oracles
  • Not to exclude oracle manipulation/flash loan attacks
  • Impacts requiring basic economic and governance attacks (e.g. 51% attack)
  • Lack of liquidity impacts
  • Impacts from Sybil attacks
  • Impacts involving centralization risks

Prohibited Activities:

  • Any testing on mainnet or public testnet deployed code; all testing should be done on local-forks of either public testnet or mainnet
  • Any testing with pricing oracles or third-party smart contracts
  • Attempting phishing or other social engineering attacks against our employees and/or customers
  • Any testing with third-party systems and applications (e.g. browser extensions) as well as websites (e.g. SSO providers, advertising networks)
  • Any denial of service attacks that are executed against project assets
  • Automated testing of services that generates significant amounts of traffic
  • Public disclosure of an unpatched vulnerability in an embargoed bounty