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 Relayer can withdraw his funds locked in the `Bond Manager` in two steps: 1) request the withdrawal and 2) execute the withdrawal, available after a period of `UPDATE_PERIOD` seconds. When the Relayer executes the first step for an amount `A`, that amount is deducted from the internal accounting. It means that this amount instantly becomes unslashable, while we would expect that the Relayer should remain slashable, especially after he asked for a withdrawal. In parallel, the function `slash()` contains the line `bonds[_tokenIndex] -= _amount;` which can be used by the Relayer to prevent being slashed, as illustrated in the "Exploit section".
the `_processMessageFromRoot()` function in `OptimismChildCheckpointManager` does not validate whether the provided block hash is null. As a result, the `optimismSendBlockInfo()` function can be invoked by any user, allowing them to update the block value to zero. This vulnerability can render any proof invalid if a sufficient number of blocks have been created. The same issue is also present in the `PolygonChildCheckPointManager` implementation.
The Relayer can plan a request to withdraw a given amount `A` of tokens from its bond by calling the function `executeWithdrawBond()`. He will have to wait for a delay of `UPDATE_PERIOD` before being able to withdraw that amount by calling the function `finalizeWithdrawalBond()`. However, in the special case where the Relayer is a contract and the withdrawn token is a native token or some special ERC20 implementation, reentrancy is possible and the Relayer can withdraw a maximum of `totalLockedAmount - totalLockedAmount % A` because each withdrawal must be of exactly A tokens. It would result in a broken internal accounting and in the worst case, only `totalLockedAmount % A` remaining in the bond manager.
When a relayer executes `PheasantNetworkBridgeChild.acceptUpwardTrade()`, it supplies the `_tokenTypeIndex` as an additional parameter next to the evidence struct. Note that this trade will not be subject to slashing as a result of such a malicious relay, as all rules have been followed, and the target network is still the correct one.
When the relayer calls the function `withdraw()` for accepting an L2->L1 trade, they submit the `evidence` struct in the `calldata` of the function call. This evidence is, however, not put to much of a test, as the bridge is optimistic, and the relayer is assumed to be honest. In order for this evidence to be disputable, disputers must have the option to submit the L1 block hash of the transaction contained in the evidence, or else the evidence cannot be verified. However, there are currently no checks in place assuring that the submitted evidence is from a sufficiently fresh block. So technically, a relayer could forge malicious evidence of a transaction of more than 256 blocks ago. This is mainly a problem for the L2->L1 trades, as the relayer can potentially withdraw deposits of other users with evidence of a made up L1-transaction that is indisputable. In theory, relayers can also submit fraudulent evidence with a block number that is more than `SLASHABLE_PERIOD` in the future, making the transaction unslashable, as no block hash can be forwarded on time. Technically, more than 3 hours in the future would be sufficient, as this gives the relayer enough time to withdraw their bond assets under the current design.
The evidence submitted by the Relayer is not checked at all in the function `withdraw()`. This may be explained by the fact that the system is an optimistic bridge and that if the evidence provided is incorrect, it will be detected, and the Relayer will get slashed. However, the current system makes the following scenario possible: 1. One user sends the equivalent of `100$` to Relayer on L1 because he wants to do a L1 -> L2 trade. 2. In that exploit, the goal of the Relayer is to keep this '100$` (meaning, not sending on L2 the `100$` to the user) and not get slashed for that. 3. For that exploit to work, a trade L2 -> L1 initiated by anyone (it can be the Relayer itself) must exist with a small amount, let's say, `10$`. That trade is created using the function `newTrade()`, so it has the status `Lib_DefaultValues.STATUS_START`. 4. The Relayer calls `withdraw()` with the evidence of the trade of `100$` and the tradeID of the trade of `10$`. As a result, the lines `isUniqueHashedEvidence[hashedEvidence] = uint(Bool.TRUE);` and `hashedEvidences[_user][_index] = hashedEvidence;` are executed. 6. The Relayer cannot get slashed anymore for the trade of `100$` by a user calling `slashUpwardTrade()`, because the first require statement will revert since the evidence he will have to use has already been recorded. 7. Relayer can still get slashed by a disputer calling the function `slash()` for the trade of `10$`, but the whole exploit will be profitable for the Relayer.
Relayer can withdraw the funds deposited in `BondManager` by calling `executeWithdrawBond()`, waiting `UPDATE_PERIOD`, and calling `finalizeWithdrawalBond()`. However, if the relayer calls `executeWithdrawBond()` several times without finalizing the withdrawal with `finalizeWithdrawalBond()`, the amount of the bonds will be decreased, and `bondWithdrawal` will be overwritten in each call, blocking the amount of funds passed in the previous calls.
The function `safeCheckEvidenceExceptBlockHash()` incorrectly calls the function `BondDisputeManager.checkEvidenceExceptBlockHash()` to check if a given evidence matches a given trade: 1. It always uses the value true for the first parameter `_isNativeTokenCheck` when the trade is made from L1 to L2. As a result, the evidence will be incorrectly checked as a native token transfer transaction and the function will likely return false. 2. It always uses the token address of the destination network for the fifth parameter `_tokenAddress`, even if the transaction to check is always made on the L1. As a result, the evidence of a L1 -> L2 transfer will be incorrectly checked for the token address on the L2, and the function will likely return false.
Smart contracts will often have `owner` or other variables to designate persons with special privileges to make modifications to the smart contract. * The `owner` role of the `PheasantNetworkBridgeChild` (currently set to the same address as the relayer) contract can arbitrarily pause the contract, most importantly resulting in pending trades being unslashable. While trades can no longer be disputed in that case, the relayer can continue to accept trades. * The `relayer` role of the `PheasantNetworkBridgeChild` contract can initiate arbitrary updates to most of the global state variables required for processing trades and their disputes possibly making slashable trades unslashable. * Owners of the `CoreChildCheckpointManager` contracts of any of the supported networks can update the `rootCheckpointManager`, i.e. the L1 address from which the block hash is expected to be forwarded, via the same two-step mechanism, three hours delay process present in the `PheasantNetworkBridgeChild` contract. This can theoretically result in incorrect configurations, where block hashes can no longer be forwarded, resulting in trades becoming unslashable. The current update mechanism can lead to issues, as a user could expect the relayer to operate under a different set of values for the updatable state variables. After the 3h mark, the update can be finalized at any time, resulting in all recently requested and currently slashable trades only to be considered under the new updated values, e.g. marking some network unslashable that previously was slashable or making users pay a higher amount of fees than anticipated). This also could result in pending, slashable trades becoming unslashable.
ERC-20 `transfer()` and `transferFrom()` can fail if the ERC-20 token implementation deviates from the standard in some ways, such as if the return value is omitted (e.g. USDT). The return values are not handled correctly in the following functions: * `PheasantNetworkBridgeChild.tokenTransfer()` * `PheasantNetworkBridgeChild.tokenTransferFrom()` * `PheasantNetworkBridgeChild.tokenReceive()` * `PolygonPheasantNetworkBridgeChild.tokenTransfer()` * `PolygonPheasantNetworkBridgeChild.tokenTransferFrom()` * `PolygonPheasantNetworkBridgeChild.tokenReceive()` * `BondManager.slash()` * `BondManager.deposit()` * `BondManager.finalizeWithdrawalBond()` As a result, transfer of funds can silently fail in the following functions, ultimately leading to issues in validating operations where funds are received/transferred: * `PheasantNetworkBridgeChild.newTrade()` * `PheasantNetworkBridgeChild.cancelTrade()` * `PheasantNetworkBridgeChild.withdraw()` * `PheasantNetworkBridgeChild.cancelTradeByRelayer()` * `PheasantNetworkBridgeChild.withdrawAssetFromSlashedTrade()` * `PheasantNetworkBridgeChild.acceptUpwardTrade()`
Some important state transitions in the system are not logged, which could be beneficial for monitoring the contracts, and also tracking eventual bugs or hacks. For instance, events could be emitted when any of the two-step upgrades action is performed or funds are slashed, deposited, or removed in the Bond Manager.
The `PheasantNetworkBridgeChiled.getUserTradeListByIndex()` function only has a start index `_index` as a parameter and loops from `_index` to the end. Considering this is a unified array for the trades of all users, this array could get massive in size, resulting in block gas limit exceptions.
A greedy contract is a contract that can receive ether that can never be redeemed. The contract `BondManager.sol` is a greedy contract because it accepts in the function `deposit()` native tokens that should be equal to or higher than what is required. Similarly, `PheasantNetworkBridgeChild.tokenTransferFrom()` checks if the `msg.value` is greater or equal to `amount` when it should be a strict equality check.
When a user requests a L2->L1 trade, that request is first registered via the `PheasantNetworkBridgeChild.newTrade()` function. A relayer basically accepts that trade request by calling the `withdraw()` function, where they provide the evidence of having taken care of the L1 transfer to the end user, enabling them to withdraw the assets the user deposited in the `newTrade()` function call. However, there is a front-running opportunity for the end-user to call `cancelTrade()` right after they receive the L1 assets within the initial `CANCELABLE_PERIOD ` before the relayer is able to call `withdraw()` for this trade successfully. If this were to happen, the user would double their token amount, leaving the relayer at a loss of the L1 assets they forwarded to the user.
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