Agent skill

Share Allocation Fairness

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents, depth-edge-case

MITAuto-check passed

Install Share Allocation Fairness

skills CLI
$ npx skills add PlamenTSV/plamen --skill share-allocation-fairness -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen share-allocation-fairness --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/sui/share-allocation-fairness .claude/skills/share-allocation-fairness && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
share-allocation-fairness
GitHub stars
303
Token cost
~2.8k tokens
SKILL.md length
1,289 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents, depth-edge-case

  • Works in 4 steps: Classify Allocation Mechanism → Late Entry Attack Model → Queue Position and Batch Processing → …
  • Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents
  • SKILL.md covers Purpose, Methodology, Output and Finding Template, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Share Allocation Fairness is an agent skill from PlamenTSV/plamen. Trigger Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents, depth-edge-case

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents
  • Depth-edge-case

Example prompts

  • “/share-allocation-fairness”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Classify Allocation Mechanism
  2. Late Entry Attack Model
  3. Queue Position and Batch Processing
  4. Share Redemption Symmetry

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Share Allocation Fairness loads about 2.8k tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 1,289 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 1,289 words, ~2,831 tokens.

Download SKILL.mdSave it as .claude/skills/share-allocation-fairness/SKILL.md (or your agent's skills folder).
name
share-allocation-fairness
description
Trigger Pattern SHARE_ALLOCATION flag detected in pattern scan - Inject Into Breadth agents, depth-edge-case

Skill: Share Allocation Fairness (Sui)

Trigger Pattern: SHARE_ALLOCATION flag detected in pattern scan Inject Into: Breadth agents, depth-edge-case Finding prefix: [SAF-N] Rules referenced: R5, R10, R13, R14

shares|allocation|distribute|pro.rata|proportional|vest|reward.*per.*share|
balance::join|balance::split|coin::mint|reward_index|cumulative|epoch.*reward

Purpose

Analyze fairness of share/token allocation mechanisms on Sui where users receive Coin<T> shares or Balance<T> proportional to deposits, contributions, or participation -- checking for late-entry advantages, PTB-based timing exploitation, queue-position gaming, and time-weighting omissions.

Sui-specific share representations:

  • Coin<ShareToken>: Fungible, freely transferable (has key + store). User holds as owned object.
  • Balance<ShareToken> inside a position object: Non-transferable accounting. Locked within the protocol's object model.
  • u64 field in a shared/owned struct: Simple numerical tracking, no token representation.
  • Check which representation is used -- it affects transferability, composability, and gaming vectors.

Methodology

STEP 1: Classify Allocation Mechanism

Identify which pattern the protocol uses:

TypeSui PatternKey Risk
Pro-rata snapshotShares minted at fixed ratio via balance::split/coin::mint_balance at deposit timeLate depositors dilute early depositors' accrued value
Time-weightedPer-user owned object tracks reward_per_share_paid and accrued_rewards with clock::timestamp_ms()Checkpoint manipulation, discrete vs continuous accrual
Queue-basedTable/VecMap in shared object stores pending depositsQueue position gaming, PTB-based front-running
Epoch-basedShares valued per Sui epoch boundary via tx_context::epoch()Cross-epoch timing arbitrage at epoch transition
STEP 2: Late Entry Attack Model

For each allocation entry function:

  1. Identify accrual source: What generates value for existing share holders? (yield from external DeFi, fees collected in shared pool, token emissions via TreasuryCap)
  2. Trace timing: When does accrued value become claimable vs when can new shares enter? Is there a separate crank/update function?
  3. Check for time-weighting: Does allocation account for HOW LONG shares were held, or only THAT shares are held at checkpoint time?
  4. Model attack: Can a depositor enter AFTER value accrues but BEFORE distribution, capturing value they did not earn?
Entry FunctionAccrual SourceTime-Weighted?Late Entry Possible?Impact

Sui timing model:

  • clock::timestamp_ms() provides millisecond-precision timestamps (read from the Clock shared object)
  • Timestamps advance per checkpoint (~0.5-2s), NOT per transaction
  • Multiple transactions within the same checkpoint see the SAME timestamp
  • Implication: time-weighted calculations based on clock::timestamp_ms() have ~0.5-2s granularity. An attacker can deposit and withdraw within the same checkpoint and see zero time elapsed, potentially capturing rewards with zero time commitment.

PTB-specific timing: With PTB composability, an attacker can compose multiple function calls in a single atomic transaction: [deposit] -> [trigger_distribution] -> [withdraw] within one PTB. This is more powerful than EVM flash loans for timing attacks because PTBs execute atomically with no inter-step cost.

STEP 2c: Cross-Address Deposit Model

For each entry function accepting a recipient address parameter:

Entry FunctionAccepts Recipient?Default State for New RecipientExploitable?Impact

Check: When a new position object or dynamic field is created for a recipient:

  • What is the DEFAULT state? (reward_per_share_paid = 0? last_deposit_epoch = 0?)
  • If reward_per_share_paid starts at 0 while the global index is at N, the new position holder captures ALL historical rewards on their deposit -- FINDING
  • Can deposit(recipient, coin) where recipient != sender create a position that captures historical rewards the recipient did not earn?
  • On Sui, this may manifest as a new owned object created for the recipient (clean state -- typically safe) or a new dynamic field added to a shared object keyed by address (check default values).
STEP 2d: Pre-Setter Timing Model

For each admin-settable reward/rate parameter:

Parameter SetterCap RequiredStaked-Before-Set?Retroactive Rewards?Fair?

Model: user deposits (position created with current index) -> admin sets reward rate -> rewards accrue.

  • Does the user receive retroactive rewards for the period BEFORE the rate was set?
  • Is the global reward index updated atomically with the rate change in the same function call?
2e. Pre-Configuration State Analysis

For the allocation mechanism identified in Step 1:

Configuration StepParameter SetFunctions Available Before SetExploitable Default?
  1. What is the deployment/initialization sequence? In Sui, init runs once at package publish. What configuration happens in init vs subsequent admin transactions?
  2. For each step: what functions are callable BEFORE this configuration completes?
  3. Are there reward/share calculations that use unconfigured (zero/default) values in shared objects?
  4. Can a user deposit/stake before full configuration and receive outsized rewards/shares?
  5. Is there a version flag or is_initialized check that gates user interactions?

Sui-specific: init() runs atomically at publish. If configuration requires MULTIPLE transactions (init -> configure_pool -> set_rates), there are windows between these transactions where the protocol is partially configured.

If users can interact during partial configuration AND default values create unfair advantage -> FINDING (minimum Medium, Rule 13: design gap).

Show full SKILL.md (559 more words)Show less
STEP 3: Queue Position and Batch Processing

For protocols with batch/queue processing:

  1. Ordering fairness: Is queue order FIFO (Table insertion order), arbitrary (admin-chosen), or manipulable (PTB composition order)?
  2. Partial processing: Can admin process some deposits but not others within a batch? Does the batch function iterate with a limit?
  3. Cross-batch state: Does processing order within a batch affect allocation ratios?
  4. Deposit splitting: Can a user split one large Coin<T> into many small deposits (via coin::split in a PTB) for queue advantage or per-deposit limit bypass?

Sui-specific ordering:

  • Transactions touching only owned objects are processed without consensus (fast path) -- no ordering manipulation
  • Transactions touching shared objects go through consensus -- validator-influenced ordering within checkpoint
  • PTB atomicity: all commands execute atomically, batch processing within a single PTB is all-or-nothing
  • An attacker can use PTB to atomically: read queue state -> deposit at favorable position -> trigger processing -> claim
STEP 4: Share Redemption Symmetry

Check that entry and exit use consistent valuation:

  1. Mint vs burn ratio: Are shares minted at the same exchange rate they can be burned? (check share price calculation in both deposit and withdraw)
  2. Pending claims: Can unclaimed reward Balance<T> dilute active shares' value? (rewards already owed but counted in TVL)
  3. Withdrawal queue: Does withdrawal ordering create unfair priority?

Sui-specific redemption:

  • If shares are Coin<ShareToken>, user burns them via protocol function. Check: can user transfer shares to another address and redeem there to bypass cooldowns?
  • If shares are Balance<ShareToken> inside position object, redemption requires the position object. Check: can position object be transferred (has store?) to bypass restrictions?
  • First-depositor / last-withdrawer edge cases: what happens when total_supply == 0 and someone deposits? (division by zero in share calculation?)

TreasuryCap authority risks:

  • Can TreasuryCap be used outside of deposit logic to inflate share supply?
  • Is TreasuryCap stored in a shared object with access control? If store allows extraction from the wrapper -> unauthorized minting.
  • If freeze authority pattern exists (rare on Sui): who controls it?
STEP 4b: Aggregate Constraint Coherence (Rule 14)

For independently-settable allocation rates/shares (e.g., per-pool weights, fee splits, distribution percentages):

Rate/Weight SetterAggregate ConstraintEnforced On-Chain?What if Sum Exceeds/Falls Short?

Sui-specific: If weights are stored as dynamic fields on a shared object (one field per pool), the setter function may not iterate all fields to validate the sum. Check: does the setter read all weight dynamic fields and validate the total?

If aggregate constraint NOT enforced and rates independently settable -> FINDING (Rule 14).


Output

For each finding, specify:

  • Allocation mechanism type (pro-rata, time-weighted, queue, epoch)
  • Whether time-weighting is present or missing
  • Concrete attack sequence with numerical example (SUI/token amounts)
  • Who benefits and who is harmed
  • Whether the attack requires PTB composition or is achievable with single function calls
  • Sui-specific timing factors (clock::timestamp_ms() granularity, checkpoint ordering)

Finding Template

markdown
**ID**: [SAF-N]
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: (see checklist below)
**Rules Applied**: [R5:___, R10:___, R13:___, R14:___]
**Severity**: Critical/High/Medium/Low/Info
**Location**: sources/{module}.move:LineN
**Title**: {fairness violation type}
**Description**: {specific issue with numerical example}
**Impact**: {quantified at worst-state parameters -- who loses how much}

Step Execution Checklist (MANDATORY)

StepRequiredCompleted?Notes
1. Classify Allocation MechanismYES
2. Late Entry Attack ModelYESPTB composition timing check
2c. Cross-Address Deposit ModelYESCheck recipient != sender patterns
2d. Pre-Setter Timing ModelYESModel deposit-before-rate-set sequence
2e. Pre-Configuration State AnalysisYESPost-init() window + unconfigured defaults
3. Queue Position and Batch ProcessingIF queue/batch detectedInclude PTB deposit splitting
4. Share Redemption SymmetryYESInclude TreasuryCap access check
4b. Aggregate Constraint CoherenceIF multiple settable weightsRule 14 enforcement check

If any step skipped, document valid reason (N/A, no queue, single pool, no settable weights).

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/sui/share-allocation-fairness of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Share Allocation Fairness next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Share Allocation Fairness compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Share Allocation Fairness this skillPlamenTSV/plamen303—~2.8kAutomated safety check: PassMIT
Detecting Indirect Prompt Injectionmukul975/Anthropic-Cybersecurity-Skills34k—~2.8kAutomated safety check: WarnApache-2.0
Detecting AI Model Prompt Injection Attacksmukul975/Anthropic-Cybersecurity-Skills34k—~1.9kAutomated safety check: WarnApache-2.0
Detecting SQL Injection Patternsjeremylongshore/tons-of-skills-marketplace2.8k—~1.5kAutomated safety check: PassMIT
Detecting Command Injection Patternsjeremylongshore/tons-of-skills-marketplace2.8k—~1.3kAutomated safety check: PassMIT
Detecting Anomalous Authentication Patternsmukul975/Anthropic-Cybersecurity-Skills34k—~7.5kAutomated safety check: PassApache-2.0

Similar skills

  • Detecting Indirect Prompt Injection

    mukul975/Anthropic-Cybersecurity-Skills

    Detect and defend against indirect prompt injection hidden in web pages, documents, and images consumed by an agent, via content extraction (HTML/PDF/OCR), normalization, and scanning with LLM…

    34k GitHub stars~2.8k tokensUpdated 1 mo ago
    SecurityAuto-check: warnings
  • Detecting AI Model Prompt Injection Attacks

    mukul975/Anthropic-Cybersecurity-Skills

    Detects prompt injection using regex signature matching, heuristic scoring for structural anomalies, and DeBERTa-based transformer classification, flagging direct injections (system-prompt…

    34k GitHub stars~1.9k tokensUpdated 1 mo ago
    SecurityAuto-check: warnings
  • Detecting SQL Injection Patterns

    jeremylongshore/tons-of-skills-marketplace

    Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods…

    2.8k GitHub stars~1.5k tokensUpdated today
    SecurityAuto-check passed
  • Detecting Command Injection Patterns

    jeremylongshore/tons-of-skills-marketplace

    Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node childprocess.exec with template literals…

    2.8k GitHub stars~1.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Detecting Anomalous Authentication Patterns

    mukul975/Anthropic-Cybersecurity-Skills

    Detects anomalous authentication patterns using UEBA analytics, statistical baselines, and machine learning models to identify impossible travel, credential stuffing, brute force, password spraying…

    34k GitHub stars~7.5k tokensUpdated 1 mo ago
    Data & AnalyticsAuto-check passed
  • Detecting Process Injection Techniques

    mukul975/Anthropic-Cybersecurity-Skills

    Detects and analyzes process injection techniques used by malware including classic DLL injection, process hollowing, APC injection, thread hijacking, and reflective loading.

    34k GitHub stars~3.5k tokensUpdated 1 mo ago
    SecurityAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 12 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 12 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 12 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 12 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 12 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 12 days ago
    Auto-check passed

Questions about Share Allocation Fairness

What does Share Allocation Fairness do?

Trigger Pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents, depth-edge-case. Share Allocation Fairness is an agent skill from PlamenTSV/plamen.

When should I use Share Allocation Fairness?

Share Allocation Fairness fits situations like: pattern SHAREALLOCATION flag detected in pattern scan - Inject Into Breadth agents; depth-edge-case.

How do I install Share Allocation Fairness in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill share-allocation-fairness -a claude-code`. Or copy the skill folder (agents/skills/sui/share-allocation-fairness in PlamenTSV/plamen) into .claude/skills/share-allocation-fairness in your project. Claude Code loads it when a task matches its description.

How do I install Share Allocation Fairness in Codex?

Run `npx skills add PlamenTSV/plamen --skill share-allocation-fairness -a codex`. Or copy the skill folder (agents/skills/sui/share-allocation-fairness in PlamenTSV/plamen) into .agents/skills/share-allocation-fairness in your project. Codex loads it when a task matches its description.

Can I use Share Allocation Fairness in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill share-allocation-fairness -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/share-allocation-fairness, .gemini/skills/share-allocation-fairness, .github/skills/share-allocation-fairness and .opencode/skills/share-allocation-fairness in your project.

What does Share Allocation Fairness need to run?

SKILL.md names no scripts, command-line tools or credentials: Share Allocation Fairness is instructions for the agent only.

Does Share Allocation Fairness access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Share Allocation Fairness safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Share Allocation Fairness use?

Share Allocation Fairness is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Share Allocation Fairness use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Share Allocation Fairness?

Skills that share tags, products or a category with Share Allocation Fairness: Detecting Indirect Prompt Injection (mukul975/Anthropic-Cybersecurity-Skills, 34k stars), Detecting AI Model Prompt Injection Attacks (mukul975/Anthropic-Cybersecurity-Skills, 34k stars), Detecting SQL Injection Patterns (jeremylongshore/tons-of-skills-marketplace, 2.8k stars) and Detecting Command Injection Patterns (jeremylongshore/tons-of-skills-marketplace, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Share Allocation Fairness?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.