T09 · Insecure Skill Coding Practices
- Location
scripts/shared/storage/keys.js:46- Finding
Private Keys Stored in Plaintext by Default Without Enforced Filesystem Permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its identity-linking purpose, but it can store agent private keys on disk without encryption by default, so it needs review before use.
Only install this if you intend the agent to create and use a persistent identity key. Set BILLIONS_NETWORK_MASTER_KMS_KEY before creating or importing any identity, use a dedicated key that holds no assets, restrict ~/.openclaw/billions permissions, and prefer pinned installation/dependency updates for higher assurance.
scripts/shared/storage/keys.js:46Private Keys Stored in Plaintext by Default Without Enforced Filesystem Permissions
scripts/shared/storage/crypto.js:25Master-Key Encryption Uses a Fast Unsalted SHA-256 Derivation
The stated purpose emphasizes identity verification/linking, but the skill also manages local private keys, persistence, and optional encryption via a master key. That broader behavior materially expands the trust boundary: users may invoke an identity-verification skill without realizing it creates, imports, stores, and maintains long-lived signing keys and sensitive state.
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
Lets AI agents create and manage their own identities on the Billions Network, and link those identities to a human owner.
cd scripts && npm inst
The skill explicitly identifies local storage locations for highly sensitive material, including private keys in kms.json and credentials in credentials.json, and notes that private keys may be stored in plaintext if a master key is not set. In an agent setting, this creates a clear credential exposure risk: compromise of the host, overbroad file access, or misuse by other tools/skills could lead to identity theft and unauthorized signing.
- `kms.json` - **CRITICAL**: Contains private keys (encrypted if BILLIONS_NETWORK_MASTER_KMS_KEY is set, otherwise in plaintext)
- `defaultDid.json` - DID identifiers and public keys
- `challenges.json` - Authentication challenges history
- `credentials.json` - Verifiable credentials
- `identities.json` - Identity metadata
- `profiles.json` - Profile data
ws 8.18.0 is a real vulnerable dependency with advisories for memory disclosure and fragment-driven memory exhaustion DoS. In an agent skill that may maintain WebSocket or RPC connections, these flaws can be reachable through network input and can expose process memory or crash the service.
brace-expansion 2.0.2 has several reported DoS conditions involving pathological expansion patterns. Although often only reachable in tooling or parsing scenarios, it is still a real vulnerable component and can cause hangs or memory exhaustion if untrusted patterns reach it.
fast-uri 3.1.0 is reported vulnerable to host confusion and SSRF-related parsing issues. In a decentralized identity stack that resolves DIDs, fetches remote JSON-LD contexts, or contacts registries/verifiers, malformed URI parsing can directly weaken network trust boundaries and enable SSRF or destination confusion.
ws 7.5.10 has a reported memory exhaustion DoS issue and is a genuine vulnerable dependency. If the associated JSON-RPC/WebSocket client stack processes attacker-controlled or hostile upstream traffic, the process can be destabilized or terminated.
underscore 1.13.6 is reported vulnerable to uncontrolled recursion in helpers like _.flatten and _.isEqual, enabling DoS with crafted nested input. In an agent ecosystem that may parse or compare attacker-provided identity objects, claims, or messages, this can be a realistic availability risk.
undici 5.29.0 carries multiple high-severity advisories including request smuggling, queue poisoning, and CRLF-related issues. This skill's identity-verification context likely performs network fetches to remote issuers, registries, or JSON-LD resources, making HTTP client correctness especially important and increasing the danger of transport-layer confusion or SSRF-adjacent abuse.
ws 8.17.1 is a real vulnerable WebSocket dependency with memory disclosure and memory exhaustion advisories. Because blockchain and identity SDKs often rely on long-lived WebSocket/RPC communications, exposure to malicious peers or intermediaries can meaningfully affect confidentiality and availability.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
function newDataStorage(ethStateStorage) {
return {
credential: new CredentialStorage(
new IdentitiesFileStorage("credentials.json"),
),
identity: new IdentityStorage(
new IdentitiesFileStorage("identities.json"),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
function newDataStorage(ethStateStorage) {
return {
credential: new CredentialStorage(
new IdentitiesFileStorage("credentials.json"),
),
identity: new IdentityStorage(
new IdentitiesFileStorage("identities.json"),
This code explicitly falls back to storing private keys with provider "plain" when no master key is available, meaning highly sensitive cryptographic material can be persisted to disk unencrypted. In an agent identity skill, compromise of these keys can enable account takeover, forged attestations, and irreversible impersonation of the linked agent or human identity.
The README instructs users to execute npx clawhub@latest install verified-agent-identity, which fetches and runs the latest remote package version at install time. This creates a supply-chain risk because a compromised publisher account, malicious update, or dependency hijack could cause arbitrary code execution on the user's system during installation.
The command npx skills add BillionsNetwork/verified-agent-identity executes an unpinned package/tool via npx, which may download and run whatever version is current at execution time. In a security-sensitive identity skill, this increases exposure to supply-chain compromise and unexpected behavior changes during installation.
The human installation instructions again use npx clawhub@latest, which causes runtime retrieval and execution of the newest published code. Because this skill handles private keys and identity linkage, installation-time code execution from an unpinned source is materially risky if the distribution channel is ever compromised.
The README repeats an unpinned npx skills add install path for humans, exposing them to the same package substitution and supply-chain risks as the agent path. Since end users may copy-paste commands directly from documentation, this is a practical avenue for remote code execution if the package source is tampered with.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
| `BILLIONS_NETWORK_MASTER_KMS_KEY` | `provider` on disk | `key` value on disk | Posture |
| --------------------------------- | ------------------ | ----------------------- | ---------------------------- |
| Not set | `"plain"` | Raw hex string | Acceptable on a single-user host with `chmod 700 ~/.openclaw/billions`. |
| Set | `"encrypted"` | `iv:authTag:ciphertext` | **Recommended for all deployments.** AES-256-GCM at rest. |
Mode is selected per-write, so an operator can switch from `plain` to `encrypted` at any time by exporting the variable before the next key creation or import — no migration step is required.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
| `BILLIONS_NETWORK_MASTER_KMS_KEY` | `provider` on disk | `key` value on disk | Posture |
| --------------------------------- | ------------------ | ----------------------- | ---------------------------- |
| Not set | `"plain"` | Raw hex string | Acceptable on a single-user host with `chmod 700 ~/.openclaw/billions`. |
| Set | `"encrypted"` | `iv:authTag:ciphertext` | **Recommended for all deployments.** AES-256-GCM at rest. |
Mode is selected per-write, so an operator can switch from `plain` to `encrypted` at any time by exporting the variable before the next key creation or import — no migration step is required.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
| `BILLIONS_NETWORK_MASTER_KMS_KEY` | `provider` on disk | `key` value on disk | Posture |
| --------------------------------- | ------------------ | ----------------------- | ---------------------------- |
| Not set | `"plain"` | Raw hex string | Acceptable on a single-user host with `chmod 700 ~/.openclaw/billions`. |
| Set | `"encrypted"` | `iv:authTag:ciphertext` | **Recommended for all deployments.** AES-256-GCM at rest. |
Mode is selected per-write, so an operator can switch from `plain` to `encrypted` at any time by exporting the variable before the next key creation or import — no migration step is required.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
The following mitigations are present in the codebase and the documented installation flow:
- **Out-of-workspace storage.** Keys live under `~/.openclaw/billions/`, never inside the project directory. Tools (and the agent itself) that operate inside the workspace cannot read or exfiltrate them.
- **Filesystem hardening.** The README instructs the operator to run `chmod 700 ~/.openclaw/billions` after the first run (`README.md` → "Key Storage and Isolation").
- **Dedicated-key warning.** The README warns the operator never to import an Ethereum wallet key that holds assets, only a dedicated identity key (`README.md` step 2 warning under the Human CTA).
- **At-rest encryption available behind one env var.** AES-256-GCM is provided via `BILLIONS_NETWORK_MASTER_KMS_KEY`. No code change, no migration, no extra dependency.
- **Versioned on-disk format.** Each `kms.json` entry carries a `version` and `provider` field, so future format upgrades (e.g. an OS-keystore provider) can ship without breaking existing installs. Legacy entries auto-migrate on next write (see `scripts/shared/storage/keys.js`, `_decodeEntry` legacy branch).
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
The following mitigations are present in the codebase and the documented installation flow:
- **Out-of-workspace storage.** Keys live under `~/.openclaw/billions/`, never inside the project directory. Tools (and the agent itself) that operate inside the workspace cannot read or exfiltrate them.
- **Filesystem hardening.** The README instructs the operator to run `chmod 700 ~/.openclaw/billions` after the first run (`README.md` → "Key Storage and Isolation").
- **Dedicated-key warning.** The README warns the operator never to import an Ethereum wallet key that holds assets, only a dedicated identity key (`README.md` step 2 warning under the Human CTA).
- **At-rest encryption available behind one env var.** AES-256-GCM is provided via `BILLIONS_NETWORK_MASTER_KMS_KEY`. No code change, no migration, no extra dependency.
- **Versioned on-disk format.** Each `kms.json` entry carries a `version` and `provider` field, so future format upgrades (e.g. an OS-keystore provider) can ship without breaking existing installs. Legacy entries auto-migrate on next write (see `scripts/shared/storage/keys.js`, `_decodeEntry` legacy branch).
The document acknowledges persistent storage of private keys in ~/.openclaw/billions/kms.json, including a plaintext mode when BILLIONS_NETWORK_MASTER_KMS_KEY is unset. Persisting authentication material locally can enable long-term identity compromise if the file is copied, backed up insecurely, exposed by local tooling, or accessed by another same-host context; the skill context reduces exposure somewhat because storage is outside the workspace, but it remains sensitive because these are agent identity keys.
- **Filesystem hardening.** The README instructs the operator to run `chmod 700 ~/.openclaw/billions` after the first run (`README.md` → "Key Storage and Isolation").
- **Dedicated-key warning.** The README warns the operator never to import an Ethereum wallet key that holds assets, only a dedicated identity key (`README.md` step 2 warning under the Human CTA).
- **At-rest encryption available behind one env var.** AES-256-GCM is provided via `BILLIONS_NETWORK_MASTER_KMS_KEY`. No code change, no migration, no extra dependency.
- **Versioned on-disk format.** Each `kms.json` entry carries a `version` and `provider` field, so future format upgrades (e.g. an OS-keystore provider) can ship without breaking existing installs. Legacy entries auto-migrate on next write (see `scripts/shared/storage/keys.js`, `_decodeEntry` legacy branch).
## Scanner Findings — Acknowledged Risks
This finding reflects the same underlying issue: the skill intentionally retains a write path that can persist key material without mandatory at-rest protection for compatibility and convenience. In a local CLI skill this is less dangerous than a networked multi-tenant service, but the consequence of compromise is still durable impersonation of the agent identity and possible broader loss if operators ignore the dedicated-key guidance.
#### Why the plaintext mode is retained
1. **Zero-config local development and CI smoke tests** — no master secret to fetch or commit.
2. **Backward compatibility** — existing `kms.json` files written by earlier versions of the skill remain readable; legacy entries auto-migrate on the next write (`scripts/shared/storage/keys.js` → `_decodeEntry` legacy branch).
3. **Single code path** — the same write path becomes encrypted at rest the moment `BILLIONS_NETWORK_MASTER_KMS_KEY` is set. There is no separate "secure mode" the operator has to migrate to, so the plaintext default cannot drift away from the encrypted path over time.
The [Operator Checklist](#operator-checklist) is the recommended deployment posture and exactly matches the scanner's recommendation.
The skill documents network access and environment-dependent secret handling but declares no explicit tool scope or permission boundary. In an agent environment, that omission can let the skill be invoked with broader-than-expected capabilities, increasing the chance of unauthorized network calls or secret-dependent operations.