Holograph contest - cdahlheimer's results

Omnichain protocol for deploying, minting, & bridging NFTs between blockchains.

General Information

Platform: Code4rena

Start Date: 18/10/2022

Pot Size: $75,000 USDC

Total HM: 27

Participants: 144

Period: 7 days

Judge: gzeon

Total Solo HM: 13

Id: 170

League: ETH

Holograph

Findings Distribution

Researcher Performance

Rank: 55/144

Findings: 3

Award: $57.64

QA:
grade-b
Gas:
grade-c

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: minhtrng

Also found by: Deivitto, V_B, __141345__, adriro, cdahlheimer, d3e4, ladboy233, nadin, teawaterwire

Labels

bug
duplicate
2 (Med Risk)
edited-by-warden

Awards

1.9681 USDC - $1.97

External Links

Lines of code

https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/HolographOperator.sol#L484-L539 https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/HolographOperator.sol#L1185-L1193

Vulnerability details

Impact

Weak PRNG due to a modulo on block.timestamp, now or blockhash. These can be influenced by miners to some extent so they should be avoided.

Exploit Scenario

Example exploit scenario. Eve is a miner. Eve calls guessing and re-orders the block containing the transaction. As a result, Eve wins the game.

Proof of Concept

HolographOperator.crossChainMessage(bytes) (HolographOperator.sol#484-539) uses a weak PRNG: "operatorIndex = random % podSize (HolographOperator.sol#511)" HolographOperator.crossChainMessage(bytes) (HolographOperator.sol#484-539) uses a weak PRNG: "pod = random % _operatorPods.length (HolographOperator.sol#503)" HolographOperator._randomBlockHash(uint256,uint256,uint256) (HolographOperator.sol#1185-1193) uses a weak PRNG: "(random + uint256(blockhash(uint256)(block.number - n))) % podSize (HolographOperator.sol#1191)" Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#weak-PRNG

Tools Used

Slither

Do not use block.timestamp, now or blockhash as a source of randomness

#0 - gzeoneth

2022-11-19T17:33:52Z

using #427 as primary

Lines of code

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/abstract/ERC20H.sol#L106-L229

Vulnerability details

Impact

Contract ERC20H has payable functions (receive(), fallback(), etc.), but does not have a function to withdraw, therefore, every Ether sent to HolographERC20 will be lost.

Proof of Concept

Contract functions and structure illustrate the concept.

Tools Used

Slither

Remove the payable attribute or add a withdraw function.

#0 - alexanderattar

2022-11-08T21:58:05Z

Low risk but valid. We will either remove the payable attribute or add a withdraw function as suggested

#1 - gzeoneth

2022-11-21T07:18:17Z

As QA report

Code

Admin.admin() - https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/abstract/Admin.sol#L117-L119

Admin.setAdmin(address) - https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/abstract/Admin.sol#L127-L131

Description

public functions that are never called by the contract should be declared external, and its immutable parameters should be located in calldata to save gas.

Recommendation

Use the external attribute for functions never called from the contract, and change the location of immutable parameters to calldata to save gas.

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