access-control
하는 일
이 플레이북은 스마트 컨트랙트에서 중요한 설정을 바꾸거나 자금을 옮길 수 있는 주체를 검토하는 방법을 안내합니다. 권한 검사가 제대로 되어 있는지 확인하려는 감사자와 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Solidity 컨트랙트에 소유권, 설정, 자금을 바꾸는 함수가 있을 때.
- ✓역할이나 소유자 검사가 올바른지 확인하고 싶을 때.
- ✓공개되어 있지만 제한되어야 하는 함수를 찾으려는 팀의 경우.
스킬 링크
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/access-control/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 컨트랙트의 관리자 함수에 올바른 소유자 검사가 빠진 곳이 있는지 확인해 주시겠어요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 상태를 바꾸는 모든 함수를 찾고, 어떤 권한 수정자가 적용되는지 확인하며, 검사가 빠졌거나 잘못된 함수를 표시합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Access Control Playbook
Access control bugs are the most boring class — and the most common in production audits. They're cheap to find with grep + LSP. They drain millions when missed (LeetSwap, Audius, Saddle, Akropolis).
Audit steps
1. Find every state-changing function
# Functions that are NOT view/pure and NOT internal/private
grep -rE 'function [a-zA-Z_]+\(.*\)(public|external)' src/ | grep -v 'view\|pure'
# Or via slither
slither . --print function-summary
2. For each external/public state-changer, ask
- Does it modify storage that affects user funds, ownership, or configuration?
- Is there a modifier (
onlyOwner,onlyRole,onlyDAO, custom auth)? - If yes, what's the modifier checking?
- If no, should there be one?
3. Audit each modifier
Common modifier patterns + bugs:
| Pattern | Bug |
|---|---|
require(msg.sender == owner) |
owner settable by anyone? setOwner unprotected? |
require(msg.sender == tx.origin) |
Wrong — tx.origin breaks meta-transactions, AND it's phishable |
_msgSender() in OZ ERC2771Context |
Forwarder trusted but anyone can forward — does the contract validate the forwarder? |
onlyRole(MINTER) |
Who can grant MINTER? Is the admin a multisig or single key? |
require(initialized == false) |
Initializer can be called twice if initialized writeable elsewhere |
require(block.timestamp > deployTime + 24 hours) |
Time-based is often a fake delay — check if deployTime is settable |
require(approvedSigners[msg.sender]) |
Approval list managed by single key? |
4. Specific anti-patterns to grep
# Functions accidentally external (default in Solidity <0.5)
grep -rn 'function [a-zA-Z_]*[^ ]* *{' src/ | grep -v 'internal\|private\|public\|external'
# msg.sender == tx.origin (phishable)
grep -rn 'tx.origin' src/
# Reentrancy in access-control checks
grep -rn 'onlyOwner.*nonReentrant' src/ # both? often wrong order
# `delegatecall` without auth gate
grep -rn 'delegatecall' src/
# `selfdestruct` available
grep -rn 'selfdestruct\|suicide(' src/
5. Initializer bugs
// VULNERABLE
function initialize(address _owner) external {
owner = _owner;
// missing: require(!initialized); initialized = true;
}
// VULNERABLE (proxy implementation)
contract Impl {
constructor() { ... } // NEVER RUNS in proxy context
// initialize() should set proxy state but doesn't gate
}
// SAFE
function initialize(address _owner) external initializer {
// OZ's initializer modifier enforces single-call
__Ownable_init(_owner);
}
For UUPS/Transparent proxies: check _authorizeUpgrade is overridden
and gated. Default OZ override is empty (revert).
6. Function-selector collisions (proxies)
Transparent proxy admin function selectors collide w/ impl function selectors → admin functions become uncallable, OR impl functions are shadowed by admin. Check w/ slither:
slither-check-erc src/Impl.sol --erc ERC1967
7. Role grant/revoke
For AccessControl:
DEFAULT_ADMIN_ROLEis the admin of all roles by default- Anyone with DEFAULT_ADMIN_ROLE can grant any role to anyone
- If init code grants DEFAULT_ADMIN_ROLE to deployer w/ no transfer to multisig → key person risk
Check role hierarchy:
grep -rn '_setRoleAdmin\|_setupRole\|grantRole' src/
PoC template (Foundry)
function test_unauth_call() public {
address attacker = address(0xBEEF);
vm.prank(attacker);
// Call the function that should require auth
target.dangerousFunction(arg1, arg2);
// Assert state change happened
assertEq(target.criticalParam(), expectedManipulatedValue);
// No revert = vulnerable
}
function test_role_takeover() public {
address attacker = address(0xBEEF);
vm.startPrank(attacker);
// If grantRole is callable by anyone
target.grantRole(target.MINTER_ROLE(), attacker);
assertTrue(target.hasRole(target.MINTER_ROLE(), attacker));
// Now exploit MINTER_ROLE
target.mint(attacker, 1_000_000 ether);
}
function test_init_re_entry() public {
// Call initialize twice
target.initialize(address(this));
vm.expectRevert("Initializable: contract is already initialized");
target.initialize(attacker);
}
function test_upgrade_no_auth() public {
address attacker = address(0xBEEF);
address malicious = address(new MaliciousImpl());
vm.prank(attacker);
target.upgradeTo(malicious);
// Now any call goes to
자주 묻는 질문
이 버그 유형은 왜 흔한가요?
플레이북은 실제 운영 감사에서 가장 흔한 유형이며, 간단한 검색으로 쉽게 찾을 수 있다고 설명합니다.
흔한 잘못된 패턴은 무엇인가요?
인가에 tx.origin을 쓰는 것이며, 플레이북은 이것이 잘못되었고 피싱으로 악용될 수 있다고 설명합니다.
에이전트는 역할에 대해 무엇을 확인하나요?
누가 역할을 부여할 수 있는지, 그리고 관리자가 멀티시그인지 단일 키인지 확인합니다.
상세 정보
작성자의 원본 설명
Missing modifiers, wrong msg.sender checks, default-public functions, missing onlyOwner / onlyRole / onlyDAO authorization.
인기도
- GitHub 스타
- 6.5k
- 순위
- #14005
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
detector-overview
6.5k에이전트가 스캐너가 표시한 코드를 읽고, 표시된 곳 중 어디가 실제 보안 버그이고 어디가 오탐인지 판단하도록 돕습니다.
exploiter-overview
6.5k에이전트가 확인된 여러 보안 약점을 하나의 테스트 체인으로 묶고, 그 체인이 어디까지 닿을 수 있는지 확인하도록 돕습니다.
llm-redteam-overview
6.5k에이전트가 프롬프트 인젝션부터 모델 악용까지 15개 전술 그룹 중 테스트에 맞는 AI 레드팀 가이드를 찾도록 돕습니다.
aatmf-t01-prompt-injection
6.5k숨겨진 지시가 AI 시스템을 덮어쓰려 하는 프롬프트 인젝션을 설명해, 보안 테스터가 이를 점검할 수 있게 합니다.