Skip to content
Back to skills

2524 Access Control Patterns 97de2c9d

ASecurity

You are reviewing a Uniswap V4 hook for access control vulnerabilities.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
securitysecurity

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2524-access-control-patterns_97de2c9d --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2524 Access Control Patterns 97de2c9d?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2524 Access Control Patterns 97de2c9d
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2524-access-control-patterns-97de2c9d/badge)](https://www.skillsdirectory.com/skills/tools-only-2524-access-control-patterns-97de2c9d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# Access Control Pattern Recognition

You are reviewing a Uniswap V4 hook for access control vulnerabilities.

## Context

A developer has submitted the following hook code for security review:

```solidity
contract MyHook is BaseHook {
    mapping(address => uint256) public userRewards;

    function beforeSwap(
        address sender,
        PoolKey calldata key,
        IPoolManager.SwapParams calldata params,
        bytes calldata hookData
    ) external override returns (bytes4, BeforeSwapDelta, uint24) {
        // Track rewards for the swapper
        userRewards[msg.sender] += 10;

        return (BaseHook.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0);
    }

    function claimRewards() external {
        uint256 amount = userRewards[msg.sender];
        userRewards[msg.sender] = 0;
        // Transfer rewards...
    }
}
```

## Questions

1. Identify the critical access control vulnerability in this code.
2. Explain why using `msg.sender` to identify users in hooks is incorrect.
3. What is the correct pattern for caller verification in V4 hooks?
4. How should the developer track user identity if they need it for rewards?

## Requirements

Your response should:

1. Identify the msg.sender trap in V4 hooks
2. Explain that msg.sender is always the PoolManager in hook callbacks
3. Provide the correct onlyPoolManager verification pattern
4. Explain router allowlisting and hookData approaches for user identity

## Expected Output

A security analysis that identifies the vulnerability and provides correct implementation patterns.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.