Skip to content

Security: Patronum-Labs/force-transfer

Security

SECURITY.md

Security Considerations

Use of selfdestruct

Our contracts utilize the selfdestruct opcode to force Ether transfers. While this approach is effective, it's important to note that selfdestruct was deprecated in EIP-6049 as it may be subjected in the future to potential breaking changes.

Our implementation should not be affected by these potential changes:

  1. EIP-6049: Deprecation of selfdestruct

    • selfdestruct has been deprecated according to EIP-6049.
    • It may be subject to breaking changes in future Ethereum upgrades.
  2. EIP-6780: SELFDESTRUCT only in same transaction

    • Our implementation is not affected by EIP-6780.
    • We use selfdestruct in the same transaction as contract creation, which is an exception in EIP-6780.
    • In this case, selfdestruct behaves as it did prior to the EIP:
      • The current execution frame halts.
      • Contract data is deleted as previously specified.
      • The entire account balance is transferred to the target.
      • The account balance of the contract calling selfdestruct is set to 0.
  3. Other Proposed Changes

    • EIP-6046 and EIP-4758 proposed changes to selfdestruct behavior, but were not adopted.

Forced Ether Transfers

The primary function of these contracts is to force Ether transfers to any address, including contracts without a receive function. While this can be useful, it comes with risks:

  1. Unexpected Behavior: Forcing Ether into a contract that isn't designed to handle it can lead to unexpected behavior.
  2. Balance Inconsistencies: It may create inconsistencies between a contract's actual balance and its internal accounting.
  3. Potential Exploits: In some cases, this could be exploited to manipulate contract logic that relies on Ether balances.

Recommendations

  1. Use these contracts with caution and only when absolutely necessary.
  2. Be aware of the potential risks and implications of forced Ether transfers.
  3. Keep an eye on future Ethereum upgrades that may affect selfdestruct behavior.
  4. Consider alternative designs that don't rely on selfdestruct for long-term maintainability.

For the most up-to-date information, always refer to the latest Ethereum Improvement Proposals (EIPs) and Ethereum documentation.

There aren’t any published security advisories