agents/skills/solana/centralization-risk/SKILL.md
Trigger Pattern Protocol has privileged authorities (upgrade authority, admin, operator, governance, multisig) - Inject Into Breadth agents (optional), depth-state-trace
npx skillsauth add plamentsv/plamen centralization-riskInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger Pattern: Protocol has privileged authorities (upgrade authority, admin, operator, governance, multisig) Inject Into: Breadth agents (optional), depth-state-trace Finding prefix:
[CR-N]Rules referenced: R2, R6, R9, R10, R13 Required: NO (recommended when protocol has 3+ distinct privileged roles)
Covers: single points of failure, privilege escalation, program upgrade risk, external governance dependencies, emergency powers. On Solana, centralization risk has unique dimensions: BPFLoaderUpgradeable allows full program replacement, freeze authority can lock user token accounts, close authority can destroy accounts and their lamports, and PDA self-authority patterns can create hidden centralization.
Enumerate ALL privileged instructions by scanning for signer checks against stored authority pubkeys:
| # | Instruction | Program | Authority/Signer | What It Controls | Impact If Abused | |---|-------------|---------|------------------|------------------|-----------------| | 1 | {ix_name} | {program} | {authority pubkey field} | {parameter/state} | {worst case} |
Solana authority patterns to scan for:
has_one = authority / has_one = admin / has_one = owner in Anchor account constraintsrequire!(ctx.accounts.authority.key() == config.authority) manual checks#[account(signer)] or Signer<'info> combined with stored pubkey comparisonupgrade_authority in program deploy config (BPFLoaderUpgradeable)mint_authority / freeze_authority / close_authority on SPL Token mintsCategorize each by impact:
Map the role hierarchy:
| Role | Stored In (Account) | Granted By | Can Grant Others? | Revocable? | Timelock? | |------|---------------------|-----------|-------------------|-----------|-----------| | {role} | {config PDA / mint} | {grantor instruction} | YES/NO | YES/NO | YES/NO ({mechanism}) |
| Program | Upgrade Authority | Type | Immutable? | Risk Level | |---------|------------------|------|-----------|------------| | {program_id} | {authority pubkey} | EOA / Squads / Realms / Revoked | YES/NO | {assessment} |
Check via: solana program show <program_id> or read BPFLoaderUpgradeable programdata account.
Risk levels:
upgrade_authority: NoneFor each privileged role:
| Role | Key Compromise Impact | Mitigation | Residual Risk | |------|----------------------|------------|---------------| | {role} | {what attacker can do} | {multisig? timelock? immutable?} | {what remains} |
| Risk | Description | Severity | |------|-------------|----------| | Upgrade authority compromise | Attacker replaces program with malicious version. ALL user funds at risk. | CRITICAL if single EOA, HIGH if multisig without timelock | | Freeze authority active | Authority can freeze any user's token account. Users cannot transfer, sell, or withdraw. | HIGH if single key, MEDIUM if multisig | | Close authority on user accounts | Authority can close user PDAs, reclaiming lamports and destroying state. | HIGH - user data and rent-exempt lamports lost | | Mint authority active | Authority can mint unlimited tokens, diluting all holders. | HIGH if supply-sensitive protocol | | PDA self-authority | Program uses its own PDA as authority - program upgrade changes PDA behavior. Upgrade authority effectively controls all PDA-authorized actions. | Severity inherits from upgrade authority risk |
Severity assessment:
Identify parameters or behaviors controlled by EXTERNAL governance:
| Dependency | External Entity | What They Control | Protocol Impact If Changed | Notification? | |------------|----------------|-------------------|---------------------------|---------------| | {dep} | {entity} | {parameter/behavior} | {impact on this protocol} | YES/NO |
Solana-specific external governance:
Check:
Document emergency/pause capabilities:
| Emergency Function | Who Can Call | What It Affects | Recovery Path | Time to Recover | |-------------------|-------------|-----------------|---------------|-----------------| | {instruction} | {authority} | {scope} | {how to resume} | {estimate} |
| Pattern | Description | Risk |
|---------|-------------|------|
| Global pause flag | Config account has paused: bool. All user instructions check it. | Standard - check: can users emergency-withdraw when paused? |
| Account freeze via SPL Token | Freeze authority freezes user token accounts. | HIGH if no thaw path independent of authority |
| Program close | BPFLoaderUpgradeable allows closing the program entirely. All CPI calls to it fail. | CRITICAL if user funds locked in PDAs |
| Account close cascade | Authority closes critical config/state accounts. Program instructions fail due to missing accounts. | HIGH - effectively a permanent pause |
Check:
For each authority type, assess revocation status and path:
| Authority | Current State | Revocation Path | Should Be Revoked? | Risk If Not Revoked |
|-----------|--------------|-----------------|-------------------|-------------------|
| Upgrade authority | {active/revoked} | solana program set-upgrade-authority --final | {assessment} | {risk level} |
| Mint authority | {active/revoked} | spl-token authorize <mint> mint --disable | {assessment} | {risk level} |
| Freeze authority | {active/revoked} | spl-token authorize <mint> freeze --disable | {assessment} | {risk level} |
| Close authority (per account type) | {active/none} | {code change required} | {assessment} | {risk level} |
Rule 13 check: Is the authority retention documented? If the protocol claims to be "decentralized" or "trustless" but retains upgrade/freeze/mint authority, apply the 5-question test:
## Finding [CR-N]: Title
**Verdict**: CONFIRMED / PARTIAL / REFUTED
**Step Execution**: check1,2,3,4,5,6 | skip(reason) | uncertain
**Severity**: Critical/High/Medium/Low/Info
**Location**: program_id or instruction name
**Centralization Type**: FUND_CONTROL / PARAMETER_CONTROL / OPERATIONAL_CONTROL / UPGRADE_CONTROL / MINT_CONTROL
**Affected Role**: {authority_name}
**Mitigation Present**: {Squads multisig / Realms DAO / Clockwork timelock / Immutable / NONE}
**Description**: What is wrong
**Impact**: What can happen if authority is compromised or acts maliciously
**Recommendation**: How to mitigate (add timelock, revoke authority, use multisig, separate roles)
| Step | Required | Completed? | Notes | |------|----------|------------|-------| | 1. Privilege Inventory (all instructions with authority checks) | YES | | | | 2. Role Hierarchy and Separation | YES | | | | 3. Single Points of Failure (per role) | YES | | | | 4. External Governance Dependencies | YES | | | | 5. Emergency Powers and Recovery Paths | YES | | | | 6. Authority Revocation Assessment | YES | | |
After Step 1: Cross-reference with ACCOUNT_VALIDATION skill - are all authority checks properly validated (not just signer, but signer == stored authority)?
After Step 2: If upgrade authority is single EOA -> immediate finding (minimum HIGH).
After Step 3: If PDA self-authority pattern detected, severity inherits from upgrade authority assessment.
After Step 5: If no emergency withdraw exists AND pause is possible -> Rule 9 stranded asset finding.
After Step 6: If protocol claims trustlessness but retains mutable authorities -> Rule 13 anti-normalization finding.
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline