# The implementation of `payExecutionFee()` didn't take `EIP-150` into consideration. Keepers can steal additional execution fee from users.

GasProcess.processExecutionFee miscalculates used gas under EIP-150's 63/64 rule, letting keepers inflate tx.gaslimit to drain users' full execution fee refund.

- Payout: Contest reward
- Severity: medium
- Program: Elfi Protocol
- Credited: blackhole
- Disclosed: 2024-05-09
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-05-elfi-protocol-judging/issues/95
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AM-9
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:fee-bypass

**Target:** GasProcess.processExecutionFee external library called from StakeFacet
**Root cause:** processExecutionFee is an external call, so only 63/64 of gas is forwarded; the 1/64 retained in the caller is refunded to the keeper but still counted in usedGas = startGas - gasleft().
**Steps:**
1. Keeper calls executeMintStakeToken with user-paid executionFee of e.g. 200K Gwei and tx.gasprice 1 Gwei.
2. Set tx.gaslimit so startGas ≈ 164K: usedGas = 164K - (164K-100K)*63/64 ≈ 101K, keeper gets 101K Gwei, user refunded 99K.
3. Increase tx.gaslimit to ~6500K: usedGas = 6500K - (6500K-100K)*63/64 ≈ 200K, keeper takes full 200K Gwei, user refund 0.
4. Excess gas is refunded to msg.sender, so inflating gaslimit costs the keeper nothing.
**How found:** Code review of GasProcess.sol L18 recognizing that processExecutionFee is an external call subject to EIP-150's 63/64 gas forwarding rule, then modeling usedGas under varying tx.gaslimit.
**Exploitation:** Malicious keeper inflates tx.gaslimit on execution calls; the 1/64 gas retained by the caller is counted as used, so the computed executionFeeForKeeper reaches the user's full paid fee while the keeper is refunded the unused gas.
**Insight:** When a fee/refund formula uses startGas - gasleft() inside an external call, account for EIP-150's 63/64 forwarding; attacker-controlled tx.gaslimit can inflate the measured delta and capture the retained 1/64.
