You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contracts/core/04-channel/IBCChannelPacketSendRecv.sol
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,30 @@ contract IBCChannelPacketSendRecv is
30
30
* @dev sendPacket is called by a module in order to send an IBC packet on a channel.
31
31
* The packet sequence generated for the packet to be sent is returned. An error
32
32
* is returned if one occurs. Also, `timeoutTimestamp` is given in nanoseconds since unix epoch.
33
+
*
34
+
* **Developer Warning: Mitigating DoS Attack Vectors in Packet Relay**
35
+
*
36
+
* Module contract developers using `sendPacket()` must ensure that there are no potential DoS attack vectors related to packet relay.
37
+
* This is particularly critical for channels with an ORDERED ordering type, as packets that cannot be received on the destination chain (dst chain) will eventually timeout,
38
+
* leading to the channel being closed. Such scenarios can cause serious problems for module users.
39
+
* The following cases highlight potential scenarios where this vulnerability could occur. These have the common characteristic that the transaction for sending a packet on the source chain (src chain) is processable,
40
+
* but the transaction for receiving the packet on the destination chain is not. If the module is applicable to these, in particular developers must carefully design the size of packet data and the gas consumption of packet send and receive operations for their module contracts.
41
+
*
42
+
* Potential Attack Vectors:
43
+
*
44
+
* 1. Large Packet Data Size
45
+
*
46
+
* Packet data must not result in a recvPacket transaction that exceeds the processing limits of the destination chain. This can happen in cases such as:
47
+
*
48
+
* - Different block gas limits between the src and dst chains: An attacker could send a large packet that can be processed on the src chain but exceeds the gas limit on the dst chain,
49
+
* leading to an out-of-gas error and causing the packet to timeout. The larger the difference in block gas limits between the chains, the easier it becomes to exploit this vulnerability.
50
+
* - Exceeding the maximum transaction size on the dst chain node: Blockchain nodes typically specify a maximum transaction size for inclusion in the mempool (e.g., 128KB in Geth).
51
+
* This size restriction can often be exploited at a lower cost than exceeding the block gas limit, making it a critical consideration.
52
+
*
53
+
* 2. Imbalanced Gas Used Between Packet Sending and Receiving Logic
54
+
*
55
+
* If the gas used for sending a packet on the src chain is within its block gas limit, but the gas required for processing `recvPacket()` on the dst chain exceeds its gas limit, the `recvPacket()` transaction will fail due to an out-of-gas error.
0 commit comments