# Combined Vulnerability Code Review

> You are conducting a security review of a Uniswap V4 hook. The developer believes their implementation is secure, but there may be multiple vulnerabilities present.

- Skill: `tools-only/combined-vulnerability-code-review` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/combined-vulnerability-code-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/combined-vulnerability-code-review/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/combined-vulnerability-code-review

---

# Combined Vulnerability Code Review

You are conducting a security review of a Uniswap V4 hook. The developer believes their implementation is secure, but there may be multiple vulnerabilities present.

## Context

Review the following hook implementation for security vulnerabilities:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {BaseHook} from "v4-periphery/src/base/hooks/BaseHook.sol";
import {Hooks} from "v4-core/src/libraries/Hooks.sol";
import {IPoolManager} from "v4-core/src/interfaces/IPoolManager.sol";
import {PoolKey} from "v4-core/src/types/PoolKey.sol";
import {BalanceDelta} from "v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "v4-core/src/types/BeforeSwapDelta.sol";

contract RewardHook is BaseHook {
    mapping(address => uint256) public rewards;
    address public rewardToken;

    constructor(IPoolManager _poolManager, address _rewardToken) BaseHook(_poolManager) {
        rewardToken = _rewardToken;
    }

    function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
        return Hooks.Permissions({
            beforeInitialize: false,
            afterInitialize: false,
            beforeAddLiquidity: false,
            afterAddLiquidity: false,
            beforeRemoveLiquidity: false,
            afterRemoveLiquidity: false,
            beforeSwap: false,
            afterSwap: true,
            beforeDonate: false,
            afterDonate: false,
            beforeSwapReturnDelta: false,
            afterSwapReturnDelta: true,
            afterAddLiquidityReturnDelta: false,
            afterRemoveLiquidityReturnDelta: false
        });
    }

    function afterSwap(
        address sender,
        PoolKey calldata key,
        IPoolManager.SwapParams calldata params,
        BalanceDelta delta,
        bytes calldata hookData
    ) external override returns (bytes4, int128) {
        // Reward the user for swapping
        uint256 rewardAmount = uint256(params.amountSpecified > 0 ? params.amountSpecified : -params.amountSpecified) / 100;

        // Transfer rewards to user
        IERC20(rewardToken).transfer(msg.sender, rewardAmount);

        // Update state after external call
        rewards[msg.sender] += rewardAmount;

        // Take a small fee
        uint256 fee = 100;
        poolManager.take(key.currency0, address(this), fee);

        return (BaseHook.afterSwap.selector, 0);
    }

    function claimRewards() external {
        uint256 amount = rewards[msg.sender];
        rewards[msg.sender] = 0;
        IERC20(rewardToken).transfer(msg.sender, amount);
    }
}

interface IERC20 {
    function transfer(address to, uint256 amount) external returns (bool);
}
```

## Questions

1. Identify ALL security vulnerabilities in this code.
2. For each vulnerability, explain:
   - The severity (Critical/High/Medium/Low)
   - How an attacker could exploit it
   - The correct mitigation
3. Are there any vulnerability chains where one issue enables or worsens another?

## Requirements

Your response should:

1. Identify at least 3 distinct vulnerabilities
2. Correctly classify severity levels
3. Provide specific code fixes for each issue
4. Explain how vulnerabilities might compound

## Expected Output

A comprehensive security review identifying multiple vulnerabilities, their interactions, and complete mitigations.

