Platform: Code4rena
Start Date: 18/02/2022
Pot Size: $125,000 USDC
Total HM: 13
Participants: 24
Period: 14 days
Judge: GalloDaSballo
Total Solo HM: 6
Id: 88
League: ETH
Rank: 6/24
Findings: 4
Award: $5,575.72
🌟 Selected for report: 1
🚀 Solo Findings: 0
2697.0588 USDC - $2,697.06
Using the forceBurn()
function of EthErc20
, an address with BURNER_ROLE
can burn an arbitrary amount of tokens from any address.
We believe this is unnecessary and poses a serious centralization risk.
A malicious or compromised BURNER_ROLE
address can take advantage of this.
Consider removing the BURNER_ROLE
and change forceBurn()
function to:
function forceBurn(uint256 amount) external override { _burn(_msgSender(), amount); }
#0 - cstrangedk
2022-03-04T00:32:38Z
Duplicate of #16, sponsor disputed, see #16
🌟 Selected for report: 0x1f8b
Also found by: IllIllI, cmichel, gzeon, kirk-baird
786.4623 USDC - $786.46
The DepositBoxERC20
contract do not appear to support rebasing/deflationary/inflationary tokens whose balance changes during transfers or over time. The necessary checks include at least verifying the amount of tokens transferred to contracts before and after the actual transfer to infer any fees/interest.
Add support in contracts for such tokens before accepting user-supplied tokens Consider to check before/after balance on the vault.
#0 - cstrangedk
2022-03-08T18:07:17Z
Reference https://github.com/code-423n4/2022-02-skale-findings/issues/8, https://github.com/code-423n4/2022-02-skale-findings/issues/9, https://github.com/code-423n4/2022-02-skale-findings/issues/10, https://github.com/code-423n4/2022-02-skale-findings/issues/12, https://github.com/code-423n4/2022-02-skale-findings/issues/19 #42
Only standard functions are applied to out-of-the-box DepositBoxes and TokenManagers. It's up to the SKALE chain owner's discretion to create custom DepositBoxes/TokenManagers that specifically support non-standard functions like Rebasing/Deflationary/Inflationary tokens, and add these custom contracts to the bridge using registerExtraContract() functions in MessageProxy.
#1 - GalloDaSballo
2022-06-01T16:41:03Z
Because this is reliant on configuration, I believe the finding to be valid and of medium severity.
End users can verify if the DepositBoxes are properly handling rebasing tokens at the time they wish to bridge
pragma solidity 0.8.6;
is used and affected by bugs fixed in 0.8.94.5.0
"@openzeppelin/contracts-upgradeable": "^4.3.2"
DepositBox whitelist is enabled by default, so it's more a black list than a whitelist.
There are a lack of input checks around the contracts:
#0 - DimaStebaev
2022-03-14T13:49:35Z
#1 - GalloDaSballo
2022-05-05T14:06:08Z
Agree because of actual evidence, would recommend the sponsor to update to 0.8.9+ (0.8.11 seems to be fairly used)
I think the finding has validity but I wouldn't stress too much on that, would recommend diffind the codebases for any patches
Don't think it's a vulnerability
Finding is valid
Agree but non-critical / informational
Appreciate the finding, but believe this is a testing contract
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, CertoraInc, TerrierLover, Tomio, WatchPug, d4rk, gzeon, kenta, kyliek, m_smirnova2020, rfa, robee, saian, ye0lde
require
messages bigger than 32 bytes. More than 32 bytes for message will incur an extra gas costs.i++
to ++i
in order to save some opcodes:immutable
keyword for the following variables:erc721ContractOnSchain
and receiverContractOnMainnet
in ERC721ReferenceMintAndMetadataSchain.sol#L34-L35erc721ContractOnMainnet
, schainName
and owner
in ERC721ReferenceMintAndMetadataMainnet.sol#L34-L38returns
is not used and could be removed in:_saveTransferredAmount
and _removeTransferredAmount
in DepositBoxEth.sol#L231-L238keccak256(xxxxxxxxxxxx)
as a constantfalse
or 0
)allowance
not needed. The transferFrom
already check the expected amount.data
variable is assigned, but in the case of isMainChainToken=true
, the previous content will be discarded and the calculation could be saved if done inside the else
block#0 - yavrsky
2022-03-14T14:33:26Z
Only marginal gas improvements.
#1 - GalloDaSballo
2022-04-28T15:08:05Z
Require messages gas savings. I'll detail my reasoning here and then link to this for my thoughts.
Ultimately this is saving a small amount of runtime gas but it's saving a pretty hefty amount of gas for deployment.
If we assume that 32bytes costs 20k gas (SSTORE), then each extra char will save 625 gas.
21 Shortened Messages * 2500 = 52500
Saves 3 gas * 25 = 75
###Â Use of immutable This would not only save the SSTORE but also save on the SLOAD each time the functions are called, in lack of further details I'll give one SLOAD per variable 5 * 2100 = 10500
I don't believe this saves gas
Would save 8 * 2 = 16 gas
Would save 30 gas for each time this is done = 30 * 4 = 120
Doesn't save gas
Agree that the check is not necessary, would save a STATICCALL (100) + a Hot SLOAD (100) = 200 * 2 = 400
Skipping the extra computation would save 100 gas (STATICCALL) as well as the cost of copying from memory again (3 * params=4 = 12) 112
Total Gas Saved: 63648