Platform: Code4rena
Start Date: 11/12/2023
Pot Size: $90,500 USDC
Total HM: 29
Participants: 127
Period: 17 days
Judge: TrungOre
Total Solo HM: 4
Id: 310
League: ETH
Rank: 71/127
Findings: 1
Award: $114.88
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Sathish9098
Also found by: 0xSmartContract, 14si2o_Flint, JayShreeRAM, Myd, SBSecurity, beber89, hunter_w3b, invitedtea, pavankv
114.8801 USDC - $114.88
My audit technique analyzes discrete components and then synthesizes findings against architectural whitepapers to gauge systematic risks. I utilize diagrams to map flows and tables to log key mechanisms. Attack vectors are diagrammed to detail risk scenarios. Code markers pinpoint locations tying analysis to implementation.
Profit Sharing Integrity
The profit sharing flows spanning LendingTerm
, ProfitManager
, GuildToken
, and CreditToken
rely on tightly ordered notification logic. Functions like:
LendingTerm._repay() ProfitManager.notifyPnL()
Must couple closely to ensure interest gets attributed properly across lending terms based on relative weights. Front-running manipulation could violate this priority.
I recommend formal verification of the notification sequences to guarantee fidelity.
Collateral Token Risks
The LendingTerm
trust of ERC20 collateral could enable violations as malicious tokens drain or deflate value.
Explicit denylisting of collateral is advised. Additionally:
This shores up external margins from unintended behavior.
Access Control
Reviewing role management across the core contracts is paramount to tuning authority. As governance decentralizes, streamlining and compartmentalizing permissions reduces attack surfaces.
Especially crucial are the deep call paths opened by functions like CoreRef.emergencyAction
.
ECG employs an intriguing split between pooled neutral collateralized debt and isolated lending terms allowing automated position creation. This balances liquidity breadth with risk siloing.
However, the interconnectedness also necessitates diligent access control tuning between contracts to prevent dangerous compositions across mechanisms.
At the core, the Ethereum Credit Guild (ECG) employs a split structure:
Pooled Liquidity
The SimplePSM
aggregates collateral into deep liquidity pools using market operations to maintain redeemability.
This consolidated breadth attracts capital efficiency and usability.
Isolated Lending
Discrete LendingTerm
instances provision specialized, automated loan creation per asset with bespoke parameters.
This contains risk subsets to avoid contamination while allowing customization.
Interlinked Ecosystem
Critically, the pooled and isolated layers interconnect for contagion transmission:
[LendingTerm
](https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol) debt finances draw from the pooled collateralSimplePSM
redemption value depends on LendingTerm
solvencyEmergent Risks
So while dividing market types segments capital, the contracts integration introduces fragility risks around:
I recommend carefully validating consistency across layers (risk parameters, margin requirements etc.) and streamlining integrations reduce these attack surfaces.
Overall the codebase displays sound engineering - usage of inheritance, ample natspec comments, and segmentation into logical contracts. Core logic around accounting and distributions remains complex with room for improvement.
The protocol grants strong authority to GOVERNOR
and GUARDIAN
roles for contingency control. Manual assembly of auxiliary contracts also centralizes trust.
Migrating to an autonomous governance and extension model helps mitigate this long-term.
The Core
contract houses the primary GOVERNOR
and GUARDIAN
roles that grant expansive authority.
Governor Powers
The GOVERNOR
can:
AuctionHouse
and ProfitManager
rulesGuardian Powers
The GUARDIAN
can:
This hands full systemic oversight to the assigned Admin Keys controlling the roles. The ECG currently depends on the guiding stability of these key holders without decentralized checks.
Additionally, approved new contract assemblies like LendingTerm
onboarding relies on the current permissioned structure. So loss of keys could inhibit innovation.
Over the longer term, migrating admin rights and extension approval flows to autonomous on-chain governance via smart contract votes will help democratize control.
But for now, the protocol remains fundamentally reliant on specific trusted actors not to abuse their wide powers or lose keys. This necessitates very careful key management in the interim until further maturation.
Innovative designs around ephemeral lending rates and auction liquidations enable neutral open access. However, guaranteeing sequential integrity between rate accrual, profit distribution, and liquidation across contracts is paramount. Formal verification recommended.
While the novel ephemeral lending rate model and auction liquidation design unlock useful properties, ensuring sequential integrity between connected mechanisms is crucial.
The Ethereum Credit Guild (ECG) employs creative ephemeral interest rates tied to market demand signals rather than external data. This allows open participation without centralized oracle risk.
Additionally, the multi-phase collateral auction liquidation avoids permanent position loss.
However, these mechanisms deeply interlink across contracts:
Lending Term Interactions
Key interactions include:
Integrity Requirements
Isolated vulnerabilities are insufficient - the end-to-end sequence integrity matters most:
My Recommendations
Formally verifying invariants along cross-contract control flows AP/AR would greatly boost confidence.
For example, proving interest calculation supplied during auction bid initiation indeed matches signed rate terms at borrowing would lock in reliable sequences.
The interconnected nature of ECG's moving pieces poses overarching model threats. For example, disruptions to the ProfitManager
accounting flows could corrode reliant downstream debt integrity. Rigorous architectural reviews should pressure test composability & ordering dependence.
At core, ECG demonstrates a deeply interconnected system linking vital functions like:
Profit Accounting
Key flows:
LendingTerm
ProfitManager
Debt Integrity
Key interactions:
LendingTerm
ProfitManager
Fragility Risks
While modularization enables flexibility, linkage introduces fragility:
Stress Testing
ECG should undergo robust stress testing across layers to validate resilience:
ProfitManager
hacked)This provides systemic confidence.
64 hours
#0 - 0xSorryNotSorry
2024-01-04T19:34:52Z
Contains no added value for the Sponsors.
#1 - c4-pre-sort
2024-01-04T19:34:57Z
0xSorryNotSorry marked the issue as insufficient quality report
#2 - c4-judge
2024-01-31T04:56:13Z
Trumpero marked the issue as grade-b