Cybro V2

Cybro V2 Smart Contract Audit Report

Share
Share
BlastBlast
VaultsDeFi
BlastBlast
VaultsDeFi

QuillAudits audited the Cybro V2 smart contracts on Blast between Nov 5, 2024 and Nov 29, 2024. The audit found 9 issues: 5 high, 2 medium, 1 low, 1 informational, of which 1 resolved, 6 acknowledged and 2 partially resolved.

Project Description

Cybro Vaults create contracts as wrappers around many popular DeFi projects, adding investment fund functionality to them. For example, there’s the StarGate protocol. Investors can invest in it independently, then manually claim profits in STG tokens, exchange STG for ETH, and reinvest the ETH back into StarGate. This process requires multiple steps from the investor. The purpose of our fund is to streamline these actions — collecting, distributing, and reinvesting automatically. Our StarGate contract handles all of this autonomously. Every investor in our StarGate fund receives shares — a portion of the fund. The fund’s profits are reflected in the increasing share price, making it a straightforward share-based system that is easily understood by the average investor.

Timeline

S1
Nov 5, 2024
S2
Nov 29, 2024

Scope of Audit

The Scope of the Audit is to Analyse the Security ,Code Quality and Correctness of Cybro Vault Codebase

Methodology: the QuillAudits smart contract audit process.

speedometer
0
50%
60%
70%
90%
100%
93.9%
AUDIT SCORE
icon

High

Medium

Low

Informational

open0000
acknowledged2211
partially resolved2000
resolved1000

High Severity Issues

Vault is vulnerable to first depositor inflation attack

Partially Resolved
arrow-right
Description

Currently, when depositing to a vaultl, the way shares are calculated is the following:
1. If totalAssetsBefore is 0, mint shares equivalent to the asset
2. If totalAssetsBefore is not 0, mint sharess equivalent to `totalSupply() * increase / totalAssetsBefore`
It is a classic attack with the following flow:
1. The user is the first to interact with the vault, he sends a deposit transaction.
2. Attacker frontruns user's tx by performing 2 actions: 1) deposit 1 wei asset thus minting 1 wei share; 2) donate a big amount of asset to the vault.
3. User's transaction executes and the user mints 0 shares because of rounding in a formula that is used inside ERC4626: `shares = assets * sharesSupply / totalAssets`. That is because `sharesSupply` is 1 and `totalAssets` is large due to donation.
4. Then the attacker withdraws donated assets plus the user's deposit.

Contract

src/BaseVault.sol

Recommendation

 I like how this issue is handled in uniswapV2 so would suggest that or Implement the concept of virtual shares, similar to the ERC4626 OZ contract. More info about this concept here.

totalAssets() function might return wrong value because of hardcoded division

Acknowledged
arrow-right
Description

The totalAssets() function calculates the total assets by multiplying the pool’s balance by the exchange rate and then dividing by 1e18. However, this division is hardcoded and may lead to an incorrect result if the exchangeRateStored() function doesn’t return a value that properly scales to a 1e18 denominator.
The function assumes that the exchangeRateStored() value is always scaled by 1e18 (i.e., 18 decimals), but the description provided by Compound documentation suggests that the exchange rate is actually scaled by 1 * 10^(18 - 8 + Underlying Token Decimals) (i.e., accounting for 8 decimals of the underlying token). This mismatch in expected scaling could cause precision errors and incorrect results in the total assets calculation.

Contract

src/CompoundVaultErc20.sol & src/CompoundVaultEth.sol

Recommendation

1. Verify the Decimals of the Underlying Token: Instead of hardcoding the division by 1e18, use a dynamic approach to determine the correct denominator based on the number of decimals of the underlying token or the exchange rate’s scale.
2. Implement Dynamic Scaling: Adjust the formula to correctly scale the exchangeRateStored() value according to its actual decimals. For example, if the exchange rate uses 8 decimals for the underlying token, then the denominator should be 1e(18 - underlyingDecimals).

Precision loss and potential overflow in _deposit function due to multiplication after division

Partially Resolved
arrow-right
Description

The _deposit() function calculates assetToDeposit using the formula:
uint256 assetToDeposit = uint64(assets / _convertRate) * _convertRate;
This approach introduces two critical issues:
1. Precision Loss:
• When assets is not a perfect multiple of _convertRate, the division assets / _convertRate truncates the fractional part. This results in precision loss, and the calculated assetToDeposit will be less than the intended value.
• If the truncated value is zero (e.g., assets < _convertRate), the transaction will revert due to a subsequent operation requiring assetToDeposit > 0.
1. Overflow Risk:
The multiplication uint64(assets / _convertRate) * _convertRate can cause an overflow if _convertRate or assets exceeds the uint64 limit after casting. This could result in incorrect calculations and unexpected behavior.

Contract

vault-contracts/src/StargateVault.sol

Recommendation


1. Avoid Precision Loss: Use SafeMath or equivalent operations to calculate the floor without truncating precision. Check for scenarios where assets < _convertRate and handle these cases explicitly.
2. Avoid Overflow Risk: Ensure all calculations use appropriate data types (uint256) without unnecessary downcasting. Validate inputs before performing operations.

Precision loss in _getAmounts function due to integer division

Acknowledged
arrow-right
Description

This implementation introduces a precision loss due to integer division. Specifically, when the amount is an odd number, the division amount / 2 truncates the decimal, causing the result to be slightly smaller than expected. This leads to an imbalance between amountFor0 and amountFor1, resulting in the total being less than the original amount by 1.
For example, if amount = 5:
• amountFor0 = 5 / 2 = 2 (truncated).
• amountFor1 = 5 - 2 = 3.
So, the total sum amountFor0 + amountFor1 equals 5, but this is only possible because amountFor1 is effectively one unit larger than the truncated result.

Contract

vault-contracts/src/BlasterSwapV2Vault.sol

Recommendation

To avoid precision loss, ensure the amounts for amountFor0 and amountFor1 are split as evenly as possible by rounding up the division result when needed.

Evm panic in redeem function when msg.sender has allowance

Resolved
arrow-right
Description

The redeem() function may cause a VM panic during execution if the msg.sender has a balance of zero. This occurs in the _applyPerformanceFee function where the division is performed.
If balanceOf(msg.sender) is zero, the division triggers a VM panic, causing the entire redeem() function to fail. This is problematic when msg.sender is not the owner and does not hold shares themselves but has been granted an allowance to spend the owner’s shares.
This can lead to Transaction Failures: The redeem() function will revert when msg.sender has zero balance but is authorized to redeem on behalf of the owner.

Contract

vault-contracts/src/BaseVault.sol

Recommendation

Modify _applyPerformanceFee to handle cases where the msg.sender is redeeming on behalf of another account. If balanceOf(msg.sender) is zero, skip the fee calculation for msg.sender to avoid panic.

Medium Severity Issues

Low Severity Issues

Informational Issues

Appendix

Disclaimer

Cybro V2

Cybro V2

High Severity Issues
Medium Severity Issues
Low Severity Issues
Informational Issues
Appendix
Disclaimer
View Report PDF

Get an Audit done today for your Smart Contract

Join 1500+ leaders who secured themselves from losing Billion Dollars

cta-banner
cta-banner-bgcta-banner-bg-mobile

Related audits

WE SECURE EVERYTHING YOU BUILD.

From day-zero risk mapping to exchange-ready audits, QuillAudits helps projects grow with confidence. Smart contracts, dApps, infrastructure, compliance: secured end to end.

QuillAudits Logo


ISO 27001Circle Alliance Program
Uniswap FoundationAethiropt-collectivePolygon SPNBNB Chain Kickstart

All Rights Reserved. © 2026. QuillAudits - LLC