Open code423n4 opened 2 years ago
[L-02] ArbRetryableTx.getSubmissionPrice can't be queried from L1, as it is an L2-only interface. After the Nitro upgrade submission price is checked by the Arbitrum bridge.
[L-03] we need to use older versions of OZ contracts because the newer ones are solidity 0.8 only
[L-01] PROXY'S ADMIN CAN BE SET TO WRONG ADDRESS
When the following
setAdmin
function in theGraphProxy
contract is called,require(_newAdmin != address(0), ...)
is executed. However, this does not prevent setting the proxy's admin to a wrong address. If the admin of the proxy is set to a malicious address, actions like re-initializing the implementation to use a malicious controller can be performed. To avoid the proxy's admin from being locked and decrease the potential attack surface, a two-step procedure for setting the proxy's admin can be used instead of directly setting it through callingsetAdmin
; using this approach, if the wrong address is set to the pending admin, the current admin can immediately call the function, which is the first step, to set the pending admin to the correct address before the wrong address accepts the admin role.https://github.com/code-423n4/2022-10-thegraph/blob/main/contracts/upgrades/GraphProxy.sol#L104-L107
[L-02]
ArbRetryableTx.getSubmissionPrice
CAN BE QUERIED AND CHECKED AGAINST INL1GraphTokenGateway.outboundTransfer
FUNCTIONWhen calling the following
outboundTransfer
function in theL1GraphTokenGateway
contract,uint256 expectedEth = maxSubmissionCost.add(_maxGas.mul(_gasPriceBid)); require(msg.value >= expectedEth, "WRONG_ETH_VALUE");
is executed. BecausemaxSubmissionCost
can be arbitrarily encoded in the_data
input, thisrequire
statement does not guarantee that the decodedmaxSubmissionCost
covers the actual base submission fee. Sending ETH that does not cover the actual base submission fee will cause the Retryable Ticket creation to fail and break the atomicity of the L1 to L2 transactions. To prevent this,ArbRetryableTx.getSubmissionPrice
can be queried to get the current base submission fee. As mentioned in https://github.com/OffchainLabs/arbitrum/blob/master/docs/L1_L2_Messages.md#important-note-about-base-submission-fee, the returned current base submission fee can increase once every 24 hour period by at most 50% of its current value, and any amount overpaid will be credited to the specified credit-back-address; hence, before ensuring that the provided ETH is enough, arequire
statement can be added in thisoutboundTransfer
function to verify thatmaxSubmissionCost
is at least 1.5 times of the current base submission fee returned byArbRetryableTx.getSubmissionPrice
.https://github.com/code-423n4/2022-10-thegraph/blob/main/contracts/gateway/L1GraphTokenGateway.sol#L191-L250
[L-03] VULNERABILITIES IN
@openzeppelin/contracts 3.4.1
AND@openzeppelin/contracts-upgradeable 3.4.2
As shown in the following code in
package.json
, version 3.4.1 of@openzeppelin/contracts
and version 3.4.2 of@openzeppelin/contracts-upgradeable
can be used. For these versions, there are vulnerabilities related toECDSA.recover
,initializer
, etc. It looks like that the code in scope are not affected by these vulnerabilities but the protocol team should be aware of them.Please see the following links for reference:
To reduce potential attack surface and be more future-proofed, please consider upgrading these packages to at least version 4.7.3.
https://github.com/code-423n4/2022-10-thegraph/blob/main/package.json#L27-L28
[L-04] MISSING
address(0)
CHECKS FOR CRITICAL ADDRESS INPUTSTo prevent unintended behaviors, critical address inputs should be checked against
address(0)
.Please consider checking
_impl
and_admin
in the following constructor. https://github.com/code-423n4/2022-10-thegraph/blob/main/contracts/upgrades/GraphProxy.sol#L46-L58[N-01] MISSING INDEXED EVENT FIELD
Querying event can be optimized with index. Please consider adding
indexed
to the relevant field of the following event.https://github.com/code-423n4/2022-10-thegraph/blob/main/contracts/gateway/L1GraphTokenGateway.sol#L56
[N-02] MISSING REASON STRINGS IN
require
STATEMENTSWhen the reason strings are missing in the
require
statements, it is unclear about why certain conditions revert. Please add descriptive reason strings for the followingrequire
statements.[N-03] INCOMPLETE NATSPEC COMMENTS
NatSpec comments provide rich code documentation. @param and/or @return comments are missing for the following functions. Please consider completing NatSpec comments for them.
[N-04] MISSING NATSPEC COMMENTS
NatSpec comments provide rich code documentation. NatSpec comments are missing for the following functions. Please consider adding them.
[N-05] FLOATING PRAGMAS
It is a best practice to lock pragmas instead of using floating pragmas to ensure that contracts are tested and deployed with the intended compiler version. Accidentally deploying contracts with different compiler versions can lead to unexpected risks and undiscovered bugs. Please consider locking pragma for the following contracts.