Back to skill

Security audit

KarmaBank

Security checks for vulnerabilities and agentic risk

Overview

KarmaBank is a coherent USDC lending skill, but its live financial paths can record fake successful transfers and rely on weak identity checks, so it needs careful review before use.

Treat this as a Review install. Use only sandbox/testnet Circle credentials and isolated wallets unless the transfer-handling and identity-verification issues are fixed. Do not rely on its ledger for real financial accounting until failed Circle operations fail closed, transaction status is independently confirmed, Moltbook identity ownership is enforced, and dependencies are pinned and reproducible.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
src/adapters/circle.ts:190
Finding
Circle API failures are converted into fabricated successful transfers<![CDATA[ ## Vulnerability Details **File Location**: `src/adapters/circle.ts:84-87`, `src/adapters/circle.ts:108-111`, `src/adapters/circle.ts:190-196`, `src/adapters/circle.ts:233-238`, `src/cli/commands/borrow.ts:90-98`, `src/cli/commands/repay.ts:69-83` **Vulnerability Type**: Fail-open financial transaction handling **Risk Level**: High ### Vulnerable Code The Circle adapter substitutes mock state when real Circle operations fail: ```ts } catch { // If Circle API fails, return mock pool wallet return MOCK_WALLETS['credit-pool']; } ``` ```ts try { return await client.getBalance(walletId); } catch { // If Circle API fails (e.g., network error), return mock balance return 10000; } ``` Failed disbursements are represented as successful completed transactions: ```ts } catch (error) { // If Circle API fails, return mock success for demo return { success: true, transactionId: `mock-tx-${Date.now()}`, status: 'COMPLETE', }; } ``` Failed repayments are handled in the same way: ```ts } catch (error: any) { // If Circle API fails, return mock success for demo return { success: true, transactionId: `mock-repay-${Date.now()}`, status: 'COMPLETE', }; } ``` The borrowing command trusts this fabricated result and records a loan: ```ts const result = await disburseLoan(agent.walletAddress, amount, poolWallet.id); if (result.success || result.status === 'INITIATED') { // Update agent ledger agentRegistry.updateOutstandingLoan(agent.id, amount); console.log(`✅ Loan created successfully!`); console.log(` Amount: ${amount} USDC`); console.log(` Transaction ID: ${result.transactionId || 'N/A'}`); console.log(` Status: ${result.status || 'PENDING'}\n`); } else { console.error(`❌ Transfer failed: ${result.error}\n`); } ``` The repayment command similarly reduces debt based ...[truncated 2726 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Return `success: false` whenever a real Circle API operation throws or returns a rejected status. 2. Never fall back to mock wallets, balances, or transaction results after real Circle configuration has been detected. 3. Make mock mode an explicit configuration value, such as `MOCK_MODE=true`, and prohibit it in production environments. 4. Use distinct result types for real and mock transactions so the command layer cannot confuse them. 5. Record a transaction as pending after submission and update the loan balance only after Circle reports a confirmed or complete transaction. 6. Independently call `getTransactionStatus()` before finalizing disbursement or repayment state. 7. Preserve and securely log the original Circle error and provider request identifier for reconciliation. 8. Use idempotency keys and atomic ledger transitions to prevent duplicate submissions or inconsistent retry behavior. 9. Add tests proving that timeouts, rejected transactions, invalid credentials, and insufficient funds never alter confirmed loan balances. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
src/cli/commands/register.ts:20
Finding
Moltbook reputation can be used without proving ownership of the identity<![CDATA[ ## Vulnerability Details **File Location**: `src/cli/commands/register.ts:20-31`, `src/adapters/moltbook.ts:108-114`, `src/cli/commands/wallet.ts:18-41`, `src/cli/commands/borrow.ts:21-25`, `src/cli/commands/borrow.ts:90-98` **Vulnerability Type**: Missing identity authentication and authorization **Risk Level**: High ### Vulnerable Code Registration retrieves a profile solely from a caller-supplied public name: ```ts // Fetch Moltbook profile console.log(`Fetching Moltbook profile for @${name}...`); const profile = await getMoltbookProfile(name); // Calculate credit score console.log('Calculating credit score...'); const score = calculateCreditScore(profile as any); // Register agent const result = creditLedger.registerAgent( name, score.rawScore, score.maxBorrow ); ``` The corresponding API call only performs a profile lookup: ```ts async getAgentProfile(name: string): Promise<MoltbookProfile | MoltbookError> { try { const response = await this.client.get<{ success: boolean; agent: MoltbookProfile }>( `/agents/profile?name=${encodeURIComponent(name)}` ); ``` Wallet creation authorizes the operation by looking up the same name, without verifying the caller: ```ts const agent = agentRegistry.get(name); if (!agent) { console.log(`Agent "${name}" is not registered.`); console.log(`Run: credit register ${name}\n`); return; } // Check if agent already has a wallet if (agent.walletAddress) { console.log(`Agent "${name}" already has a wallet:`); console.log(` Address: ${agent.walletAddress}\n`); return; } console.log(`Creating wallet for agent "${name}"...`); // Create wallet via Circle adapter const wallet = await createAgentWallet(name); ...[truncated 2753 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require a short-lived Moltbook identity token during registration. 2. Set a fixed KarmaBank-specific audience and reject tokens issued for any other audience. 3. Verify the token through Moltbook before creating a ledger entry. 4. Bind the ledger to the verified immutable Moltbook agent ID rather than only to a display name. 5. Require fresh authentication or a securely maintained authenticated session for wallet creation, borrowing, repayment, and identity changes. 6. Confirm that the verified token identity matches the ledger identity for every sensitive operation. 7. Prevent unauthenticated callers from enumerating or modifying other agents’ records. 8. Add replay protection, token expiration checks, and nonce or challenge validation. 9. Define administrative and borrower roles explicitly and enforce least-privilege authorization at the command or service boundary. 10. Add negative tests showing that knowledge of a public Moltbook name and profile is insufficient to register, create a wallet, or borrow. ]]>

T08 · Insecure Dependencies

Warning
Location
package.json:31
Finding
Security-sensitive dependencies are installed without reproducible version resolution<![CDATA[ ## Vulnerability Details **File Location**: `package.json:31-44`, `SKILL.md:25-39`, project root with no committed package lockfile **Vulnerability Type**: Non-reproducible and externally resolved dependencies **Risk Level**: Medium ### Vulnerable Configuration The package uses mutable semantic-version ranges and a dependency outside the audited project: ```json "devDependencies": { "@types/jest": "^30.0.0", "@types/node": "^25.2.0", "jest": "^30.2.0", "ts-jest": "^29.4.6", "typescript": "^5.9.3" }, "dependencies": { "@circle-fin/developer-controlled-wallets": "^10.1.0", "@circle/openclaw-wallet-skill": "file:../skills/circle-wallet", "@types/uuid": "^10.0.0", "axios": "^1.13.4", "commander": "^14.0.3", "dotenv": "^17.2.3", "node-forge": "^1.3.3", "uuid": "^13.0.0" } ``` The documented installation process performs fresh dependency resolution: ```bash clawhub install karmabank cd ~/.openclaw/workspace/skills/karmabank npm install ``` ```bash git clone https://github.com/openclaw/agent-credit-system.git cd agent-credit-system npm install npm run build ``` No `package-lock.json` or other dependency lockfile was present in the audited project. ### Technical Analysis Without a committed lockfile, `npm install` can resolve different transitive dependency versions at different times. The caret ranges also permit later compatible releases that were not part of this audit. More significantly, `@circle/openclaw-wallet-skill` is loaded from `file:../skills/circle-wallet`, a sibling directory outside the audited project. The reviewed source therefore cannot establish which implementation will be imported at installation or runtime. This dependency is security-sensitive because the application delegates Circle configuration loading, wallet creation, balance queries, and USDC transfers to it. A substituted or compromised implementation could access Circle credentials and alter financial operatio ...[truncated 1416 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Generate, review, and commit a `package-lock.json`. 2. Replace documented `npm install` deployment steps with `npm ci`. 3. Pin security-sensitive direct dependencies to reviewed versions where practical. 4. Replace the external `file:../skills/circle-wallet` reference with a versioned, integrity-verifiable package or include the reviewed implementation in the deployment artifact. 5. If a local dependency is required, verify its path, ownership, permissions, source revision, and cryptographic digest before loading it. 6. Run dependency vulnerability and provenance checks in CI. 7. Review transitive dependencies and npm lifecycle scripts before release. 8. Disable dependency install scripts where they are unnecessary, using an appropriate controlled installation policy. 9. Produce an SBOM and retain the exact dependency tree for each release. 10. Ensure release artifacts cannot silently resolve code from writable sibling directories. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (57)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill reportedly accepts arbitrary credit limits and exposes broad administrative lifecycle operations instead of strictly enforcing the published Bronze-to-Diamond model derived from Moltbook karma. That makes the system more dangerous in context because it handles a lending workflow, where arbitrary limits and hidden admin actions can directly affect fund disbursement and borrower treatment.

Intent-Code Divergence

High
Confidence
99% confidence
Finding
Both disburseLoan and receiveRepayment return success:true with COMPLETE status when Circle API operations throw, even though no transfer may have occurred. In a lending system, this can desynchronize financial state from on-chain or provider reality, causing loans to be marked paid out or repaid without actual movement of USDC.

Missing User Warnings

High
Confidence
91% confidence
Finding
The disburseLoan function performs a real asset transfer via client.sendUSDC but provides no confirmation prompt, logging, or explicit user disclosure in the code around this safety-critical action. Because it can disburse loans and move funds on-chain, users or calling systems are not warned before an irreversible financial operation occurs.

Missing User Warnings

High
Confidence
92% confidence
Finding
The receiveRepayment function calls client.sendUSDC to transfer funds from an agent wallet to the pool wallet, which is a safety-critical and potentially irreversible action. There is no visible confirmation prompt, disclosure, or warning in the function to alert the user or operator that a real repayment transfer is being initiated.

Intent-Code Divergence

High
Confidence
97% confidence
Finding
When an agent's outstanding balance reaches zero or below after repayment, the code sets the agent status to SUSPENDED. In a lending system this inverts the expected business logic, allowing successful repayment to disable otherwise healthy accounts, which can cause denial of service, incorrect credit decisions, and potential abuse if attackers can trigger or race repayment updates.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The README encourages users to run borrowing and wallet-creation commands but provides no warning that these actions may trigger blockchain transactions, create custodial/non-custodial wallets, or interact with funded API-backed services. In a financial skill, omission of risk disclosures can cause users to expose funds, create wallets unintentionally, or assume the actions are harmless test commands when the configuration also supports real Circle integration.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README lists sensitive environment variables for Moltbook and Circle without any guidance on secure storage, least-privilege handling, or avoiding accidental disclosure. Users may place live API secrets into shell history, source control, logs, or shared agent environments, which is especially risky because the skill appears able to create wallets and handle borrowing flows tied to financial infrastructure.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill advertises network and environment-dependent behavior such as API-key use, Moltbook API access, and Circle wallet operations, but it does not declare any explicit tool scope or allowed-tools. In an agent ecosystem, missing permission boundaries can cause an agent to invoke network or env capabilities implicitly, making secret access and external actions less auditable and easier to misuse.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The documentation for borrow/repay and wallet commands does not clearly and prominently warn that, when Circle is configured, these actions may create wallets or move real USDC. In a finance-related skill, insufficient disclosure of real-world side effects increases the chance of accidental transfers, operator confusion, and unsafe autonomous use.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
# Due: 14 days (0% interest)

karmabank borrow myagent 500 --yes
# Auto-approved (within limit)
```

### Repay USDC
Confidence
90% confidence
Finding
The documented 'Auto-approved' borrowing flow indicates autonomous approval of a financial action when within a limit, especially in combination with a '--yes' flag. In context, this is risky because an agent could trigger borrowing without meaningful human review, and if the limit checks are weak or misimplemented, funds may be disbursed automatically.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The test file explicitly notes that behavior may differ when Circle is configured, then proceeds to call loan disbursement and repayment functions that may trigger real external payment flows. In a financial skill handling USDC, tests that can hit live infrastructure create a meaningful risk of unintended state changes, token transfers, or use of production credentials during routine test execution or CI.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
getPoolWallet and getWalletBalance silently substitute mock wallet data or a hardcoded balance when the real Circle API fails. In a credit product, this can lead to incorrect lending decisions, false liquidity assumptions, and follow-on fund movement attempts based on fabricated state.

Description-Behavior Mismatch

Medium
Confidence
88% confidence
Finding
The manifest describes a lending skill based on Moltbook karma score, which makes profile and karma lookup an expected implementation detail. However, this adapter also creates identity tokens and verifies identities, introducing an authentication/attestation capability not mentioned in the manifest's borrowing-and-tiering scope.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The register command calls `getMoltbookProfile(name)`, which indicates a network lookup of the provided identifier. Although there is a console log saying it is fetching the profile, the file does not provide any warning about external data transmission or privacy implications beyond the operational status message.

Static analysis

Detected: suspicious.env_credential_access, suspicious.exposed_secret_literal

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
src/adapters/moltbook.ts:234

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
src/cli/adapters/moltbook.ts:76

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SKILL.md:107