Hubble contest - 0x1f8b's results

Multi-collateral/Cross-Margin Perpetual Futures on Avalanche.

General Information

Platform: Code4rena

Start Date: 17/02/2022

Pot Size: $75,000 USDC

Total HM: 20

Participants: 39

Period: 7 days

Judges: moose-code, JasoonS

Total Solo HM: 13

Id: 89

League: ETH

Hubble

Findings Distribution

Researcher Performance

Rank: 11/39

Findings: 4

Award: $3,138.50

🌟 Selected for report: 1

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: hyh

Also found by: 0x1f8b, WatchPug, cccz, csanuragjain, defsec, hubble, leastwood, pauliax, ye0lde

Labels

bug
duplicate
2 (Med Risk)

Awards

107.9164 USDC - $107.92

External Links

Lines of code

https://github.com/code-423n4/2022-02-hubble/blob/8c157f519bc32e552f8cc832ecc75dc381faa91e/contracts/Oracle.sol#L115

Vulnerability details

Vulnerability

On Oracle.sol#L115, we are using latestRoundData, but there are no validations that the data is not stale.

The current code is:

(uint80 round, int256 latestPrice, , uint256 latestTimestamp, ) = _aggregator.latestRoundData(); finalPrice = uint256(latestPrice); if (latestPrice < 0) { requireEnoughHistory(round); (round, finalPrice, latestTimestamp) = getRoundData(_aggregator, round - 1); } return (round, finalPrice, latestTimestamp);

But is missing the checks to validate the data is stale

(uint80 round, int256 latestPrice, , uint256 latestTimestamp, answeredInRound) = _aggregator.latestRoundData(); require(latestPrice > 0, "Chainlink price <= 0"); require(latestTimestamp != 0, "Incomplete round"); require(answeredInRound >= round, "Stale price");

This could affect in all the logic, including funds.

#0 - atvanguard

2022-02-24T06:02:04Z

Duplicate of #46

#1 - moose-code

2022-03-09T20:54:40Z

Marking as a duplicate of #9 (i.e. lumping them together)

Findings Information

🌟 Selected for report: 0x1f8b

Labels

bug
2 (Med Risk)
resolved
sponsor confirmed

Awards

2785.5118 USDC - $2,785.51

External Links

Lines of code

https://github.com/code-423n4/2022-02-hubble/blob/8c157f519bc32e552f8cc832ecc75dc381faa91e/contracts/VUSD.sol#L11

Vulnerability details

Impact

The contract use two governance model, one looks hidden.

Proof of Concept

The VUSD contract uses VanillaGovernable but inherits from ERC20PresetMinterPauserUpgradeable and this contract uses roles to use some administrative methods like pause or mint.

This two-governance model does not seem necessary and can hide or raise suspicion about a rogue pool, thus damaging the user's trust.

Unify governance in only one, VanillaGovernable or role based.

#0 - moose-code

2022-03-06T09:28:28Z

Yes a good suggestion to keep governance more tightly coupled. OZ has AccessControlledAndUpgradeable which is really nice. Various roles for varying level of admin functionality. Allows tighter controls on more controversial items and easier control on less controversial items.

Awards

157.6711 USDC - $157.67

Labels

bug
duplicate
QA (Quality Assurance)

External Links

LOW

  1. Open TODO it seems that the logic is not finished and the logic might not be as expected.
  1. It seems that use an outdated version of openzeppelin

"@openzeppelin/contracts": "4.2.0", "@openzeppelin/contracts-upgradeable": "4.3.2",

  1. The modification process of an owner is a delicate process, since the governance of our contract and therefore of the project may be at risk, for this reason it is recommended to adjust the owner’s modification logic, to a logic that allows to verify that the new owner is in fact valid and does exist. It's mandatory to create a logic of the owner’s modification where a new owner is proposed first, the owner accepts the proposal and, in this way, we make sure that there are no errors when writing the address of the new owner.
  1. The following contracts use Governable and can be paused, so a denial of service could happend if the keys are compromised or the issue number 3 happens.
  1. There are a lack of input checks around the contracts:
  1. The current lock logic does not contemplate ERC20 tokens with fee during the safeTransferFrom, therefore, the amount received by VUSD will be less than the expected. Some tokens may implement a fee during transfers, this is the case of USDT, even though the project has currently set it to 0. So, the transferFrom function would return 'true' despite receiving less than expected.
  1. Wrong logic around the method processWithdrawals

The logic is while (i < withdrawals.length && (i - start) <= maxWithdrawalProcesses) {

If maxWithdrawalProcesses=0 and start=0 then i=0. So (0-0)<=0 == true But the expected maxWithdrawalProcesses is zero.

#0 - atvanguard

2022-02-26T07:33:46Z

1 issue is a duplicate of #21 , disputing the rest.

#1 - moose-code

2022-03-05T15:59:07Z

https://github.com/OpenZeppelin/openzeppelin-contracts/releases upgrading open zeppelin can be considered. Its good

Findings Information

Awards

87.3994 USDC - $87.40

Labels

bug
duplicate
G (Gas Optimization)

External Links

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