Cudos contest - GermanKuber's results

Decentralised cloud computing for Web3.

General Information

Platform: Code4rena

Start Date: 03/05/2022

Pot Size: $75,000 USDC

Total HM: 6

Participants: 55

Period: 7 days

Judge: Albert Chon

Total Solo HM: 2

Id: 116

League: COSMOS

Cudos

Findings Distribution

Researcher Performance

Rank: 8/55

Findings: 4

Award: $1,836.27

🌟 Selected for report: 1

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: p_crypt0

Also found by: 0x1337, GermanKuber, IllIllI, WatchPug, csanuragjain, danb, dirk_y, kirk-baird

Labels

bug
duplicate
2 (Med Risk)

Awards

502.4722 USDC - $502.47

External Links

Lines of code

https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L632

Vulnerability details

Impact

Someone with access to admin keys could rug pull all funds

Proof of Concept

The gravity.sol contract should work as an escrow to mint equivalent tokens in the cosmos chain. This is maintained by a system of validators. The possible decentralization of the validators is ruined by the withdraw withdrawERC20 function that allows a single address with the admin role to take all tokens.

This adds a single point of failure to the contract since these admin keys could take all the money without any voting by the validators. If the keys are lost an attacker could use them to get all user funds. Also it lessens the trust in the contracts since the admin has to be trusted.

Remove this function. The only way to take tokens out should be by vote of a portion of the validators.

#0 - mlukanova

2022-05-10T14:34:23Z

Duplicate of #14

Findings Information

🌟 Selected for report: wuwe1

Also found by: Dravee, GermanKuber, GimelSec, WatchPug, cccz, defsec, dipp, jah, reassor

Labels

bug
duplicate
2 (Med Risk)

Awards

502.4722 USDC - $502.47

External Links

Lines of code

https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L595

Vulnerability details

Impact

Loss of 1 to 1 ratio with fee on transfer tokens

Proof of Concept

Some tokens like USDT have a fee on transfer that can be activated. If such a token is used then wrong amounts will be minted on the other side. As we can see in the sendToCosmos function in gravity.sol the emitted event (which will be the cause of the mint on the cosmos side) will be emitted with the transfer amount.

If the token has a fee on transfer the real transfer amount could be less. For example if the fee is 0.1 % and 1000 USDT is sent the contract will receive 999 USDT but the event will emit 1000 USDT that will be minted on the cosmos side. If this is repeated the difference between the amount escrowed in the contract and the amount minted on cosmos will grow larger and larger until not all tokens can be redeemed.

Check the balance difference after transference and emit an amount equal to the balance difference

#0 - mlukanova

2022-05-10T14:47:30Z

Duplicate of #3

Awards

188.2942 USDC - $188.29

Labels

bug
QA (Quality Assurance)

External Links

MAX_UINT would spend less gas if it is a constant (tests on remix said a difference of 5600).

Awards

643.0392 USDC - $643.04

Labels

bug
duplicate
disagree with severity
G (Gas Optimization)

External Links

In the sendToCosmos() function it is not validated that _amount != 0, therefore the state_lastEventNonce could be made to grow only by spending gas. If they go up to type(uint256).max could it cause an overflow and DoS system wide?

#0 - V-Staykov

2022-05-10T13:23:00Z

Marked it with "disagree with severity" because this is not a gas optimization issue. It seems to be low/mid finding. It is indeed a valid issue, but mitigating it with just checking if the amount is not zero doesn't seem good, since an attack can then be made with _amount= 1e-18 lets say and still be cheap enough.

#1 - V-Staykov

2022-05-11T14:07:12Z

Duplicate of #85

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