> For the complete documentation index, see [llms.txt](https://paymasterdocs.gitbook.io/paymasterdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paymasterdocs.gitbook.io/paymasterdocs/vectors-of-paymaster/general-vectors/threats-in-v0.6.md).

# Threats in v0.6

Many services are still using v0.6 of EntryPoint. This page explains the potential threats that may arise from v0.6.

## postOp with postOpReverted mode

In v0.6 of EntryPoint, the `postOp` function can be executed twice. If the first `postOp` function results in a revert, the second `postOp` function is executed with `PostOpMode.postOpReverted` as an argument. This can lead to gas griefing for the paymaster.

Example Case:

```solidity
// https://github.com/eth-infinitism/account-abstraction/blob/6ac12fe80ad7ee6fa622fc5cd825eb11415e6f4e/contracts/samples/TokenPaymaster.sol

function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override {
    if (mode == PostOpMode.postOpReverted) {
        return;
    }
    ...
    ...
    refillEntryPointDeposit(_cachedPrice);    
}
```

If the `TokenPaymaster` immediately returns when the mode is `PostOpMode.postOpReverted`, the `refillEntryPointDeposit` function will not be called, and the paymaster’s gas will not be refilled. As a result, a malicious user can intentionally trigger a revert in the first `postOp` function to set the mode to `PostOpMode.postOpReverted` and attempt to gas grief the paymaster.

* Mitigation : The function to refill the paymaster's funds must be executed regardless of the mode to ensure the paymaster's gas is replenished properly.

```solidity
function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override {
    ...
    ...
    refillEntryPointDeposit(_cachedPrice);    
}
```

***
