Quantstamp reviewed Pheasant Network on 2 Aug 2023: 24 findings, 0 critical; 14 marked fixed, 10 acknowledged; 8 more marked mitigated.
Report hosted on certificate.quantstamp.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed | Mitigated |
|---|---|---|---|---|
| Critical | 0 | 0 | 0 | 0 |
| High | 0 | 2 | 8 | 3 |
| Medium | 0 | 3 | 2 | 1 |
| Low | 0 | 5 | 4 | 4 |
The system is an optimistic bridge that should make sure that, at any moment during the dispute period, all the amount at risk (amount optimistically deposited/transferred by users) must be fully collateralized in the worst-case scenario when all the amount can be disputed. However, this is not the case. While each individual trade has to not exceed the `tradeAmount * tradableBondRatio`, the bond manager has no state on the currently pending trades, as bond assets are not mapped to individual trades. This means that the relayer can accept an arbitrary amount of trades, in total vastly exceeding the deposited bond, as long as each of those individual trades` bond requirements does not exceed the bond assets. 1. Several users can initiate a transfer on L1 for a L1 -> L2 transfer, and this could exceed the collateralized amount in the Bond Manager. 2. Several users can deposit tokens on L2 for a L2 -> L1 transfer, and this could exceed the collateralized amount in the Bond Manager. 3. The Relayer can at any time request the withdrawal of any amount locked in the Bond Manager, potentially reducing the collateralized amount to an amount lower than the current `totalSlashableAmount`. </br> As a side note, the core issue of this finding can lead to slash operations getting reverted when not enough funds remains in the bond manager. For example, if there is only 990 of a token remaining in the bond manager and a slash operation occurs for an amount of 1000, it will fail instead of taking all that remains in the bond, meaning 990.
The function `Lib_BridgeUtils.hashEvidence()` concatenates two elements and returns the resulting hash. The second element is vulnerable to hash collisions because its value is obtained by using the instruction `abi.encodePacked()` which gets ambiguous when two dynamic items (here, `bytes[]`) are used one after the other. It becomes possible for an attacker to arbitrarily put elements back and forth between the two items. The function will return the same hash even if the underlying transaction fields are different. This can lead to high-severity issues for both L1->L2 and L2->L1: **User Can Dispute Arbitrary L2->L1 Trades**</br> In the evidence struct, a malicious user can easily forge evidence by e.g. shifting over the first array element of `txProof` to the last element of `txReceiptProof`. As evidence hashes can be forged, we can easily find an invalid evidence struct with the same hash that enables us to dispute any L2->L1 trade. As we are only comparing the hash of the evidence used by the relayer when they performed the `withdraw()` function call, we can slash the relayer with our invalid forged evidence, even though the relayer might have submitted a correct one. **Relayer Can Send Out Less Funds For L1->L2 And Not Be Disputable**</br> In this scenario, a relayer could make a fraudulent evidence with a matching evidence hash of the theoretically correct evidence of the L1 transaction they received from the requesting user. As this hash will be registered in the `isUniqueEvidence` mapping, the slashing will be impossible, as the `slashUpwardTrade()` function requires the `isUniqueEvidence` entry for the evidence hash to be unused. Assuming that the malicious user simply shifts over some of the trailing bits of the binary representation of the `amount` field to the following field, they could have evidence with the same evidence hash as the correct one requiring them to send out significantly less funds. Again, this would be undisputable, as the L1-evidence hash would match the manipulated one.
The function `BridgeDisputeManager.rlpEncode()` has a specific behavior when a transaction is RLP encoded (param `isTxEncode == true`): it will encode as an empty list the 9th item in the list of transaction's items. That item is optional and represents an access list, defined in `EIP2930` to save gas when the user says in advance the storage slots ID he plans to use. The field is usually encoded as an empty list. Let's consider two transactions `T1` a transaction with an empty access list field and `T2` the same transaction, with a non-empty access list field. As a result: * the function `BridgeDisputeManager.recoverAddress()` will return `address(0)` for `T2`, because it will try to recover the signer of `T1` (because `rlpEncode(T2) == T1`) and the signer of the transaction signed `T2`, not `T1`. It will result in an incorrect `recoveredUser` found in the functions `PheasantNetworkBridgeChild.slashUpwardTrade()` and `PheasantNetworkBridgeChild.acceptUpwardTrade()`, hence disrupting the L1 -> L2 trades. * the function `BridgeDisputeManager.verifyRawTx()` will always return false when comparing `T2` and its transaction hash, making the function `BridgeDisputeManager.checkEvidenceExceptBlockHash()` return false as well when comparing `T2`. As a consequence, the functions `BridgeDisputeManager.safeCheckEvidenceExceptBlockHash()` and `BridgeDisputeManager.isValidEvidence()` will have the same result, making any call to `isValidEvidence()` for `T2` returns false. Depending on who executed `T2`, both L1 -> L2 trades (the require statement in the functions `PheasantNetworkBridgeChild.slashUpwardTrade()` and `PheasantNetworkBridgeChild.acceptUpwardTrade()` will not pass) and L2 -> L1 trades (the require statement in `PheasantNetworkBridgeChild.slash()` will pass) could be disrupted. Also, following the same principle, the function `BridgeDisputeManager.composeTx()` could lead to the same consequences when a transaction of type 0 or 1 is submitted on-chain because it hardcodes the transaction type to type 2.
The system expects as the first step for upward trades a transfer to the EOA of the Relayer. However, even if that trade cannot be rejected, it is considered invalid under several conditions: * if we cannot extract a valid `networkId` from the transferred amount; * if the transferred amount is too low or too big.
For the relayer, there is currently no way to throttle the trade requests for L1->L2 trades. All valid direct L1 transfers make the relayer subject to slashing. As the relayer will be slashable starting after 30 minutes, the protocol seems to assume that the relayer has the tokens readily available on the target network. However, if this bridge were to become heavily used (and perhaps more for L1->L2 than L2->L1 trades), the relayer could quickly get liquidity problems. The relayer could attempt to swap for the desired token on a DEX, but that also requires some liquidity from other tokens accessible on L2. So the relayer might need to make use of a traditional "mint-and-burn" bridge for this. If L1->L2 would continue to be the dominant trade direction, the fees could even begin to exceed the ones of a traditional bridge, as the relayer would need to use such a bridge to bridge the funds with the additional overhead of performing the appropriate function calls in this protocol. The liquidity problem is also amplified by the relayer theoretically needing to hold a bond for a trade for 14 days (though that is currently not enforced by the protocol). This could be an attack vector for a malicious user, requesting a high quantity of upward trades that the relayer will struggle to handle on time, making them subject to slashing.
Several contracts are inheriting from the contract `Ownable`. First, the ownership can be renounced if the current owner of the contract executes `Ownable.renounceOwnership()`. Second, it is also possible to simulate an ownership renouncement by calling the function `Ownable.transferOwnership()` with the parameter `newOwner` being controlled by no one.
It is possible in the code to have two different `tokensIds` mapping to the same token address. As a result, it becomes possible to have separate `tokenIds` with separate rules (fees, min and max thresholds) in the same network. Also, the Relayer can override an existing association between a `tokenId` and a token address by calling the function `executeTokenAddressUpdate()`. This could disrupt any pending trade.
Block reorgs on L1 could impact the evidence shared on L2 because the transaction details can be different after the block finality. Furthermore, the relayer technically has to wait for around 15 minutes to be safe in order to finalize a L2 -> L1 trade. If the relayer forwards from L1 to L2 a block-hash for a block that is not final via the root checkpoint managers, and a reorg happens, every L1 transaction from the reorg-ed chain will not have correct evidence, resulting in slashable trades. Accepting a trade is also what starts the 30-minutes dispute period. If a disputer would wait until the last second to dispute and given that block hashes are only accessible for 52 minutes, it would give a small amount of time to the relayer to forward the block hash in order to defend himself, especially if they were to wait for block finality.
The function `BridgeDisputeManager.recoverAddress()` does not verify the return value of `ecrecover()` not to be `address(0)`. If the signature validation fails, `ecrecover()` returns `address(0)`. As a result, an erroneous transaction could result in the recovered address being `0`. The function is used at two locations: 1. in `PheasantNetworkBridgeChild.slashUpwardTrade()`, where the impact is limited as we should expect the transaction to revert when the function `isValidEvidence()` is executed; 2. in `PheasantNetworkBridgeChild.acceptUpwardTrade()`, where the impact is medium as we should expect the relayer to submit a correct transaction. But, if not, the amount extracted from the transaction data will be sent to `address(0)` instead of the recovered user.
The storage mapping `slashableNetwork` records if a given network is slashable or not. As a result, any call to the function `slash()` will revert if the destination network of the trade has not a slashing mechanism enabled. It means that the system lets users initiate a trade for which there is no active dispute mechanism. In other words, the Relayer will not have any negative incentive not to relay the trade.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (17)
240 projects reviewed · 338 reports · latest Nov 2026
See Quantstamp’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us