Back to skill

Security audit

Pay Bills

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its bill-payment purpose, but it stores and prints account session tokens in plaintext while enabling authenticated wallet purchases.

Review carefully before installing. Only use this in a private workspace, avoid pasting OTPs, PINs, or tokens into places that may be logged, clear the saved session after use, and prefer a version that redacts tokens and stores credentials in a protected secret store rather than .session_token.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
session-token.js:14
Finding
Plaintext Session Token Storage and Disclosure Through CLI Arguments and Output<![CDATA[ ## Vulnerability Details **File Location**: `session-token.js`, lines 14-42 **Vulnerability Type**: Plaintext sensitive-data storage and credential disclosure **Risk Level**: High ### Vulnerable Code ```javascript const TOKEN_FILE = path.join(__dirname, ".session_token") function saveToken(token) { fs.writeFileSync(TOKEN_FILE, token, "utf-8") process.stdout.write(JSON.stringify({ saved: true, sessionToken: token })) } function loadToken() { if (fs.existsSync(TOKEN_FILE)) { const token = fs.readFileSync(TOKEN_FILE, "utf-8").trim() if (token) { process.stdout.write(token) return } } process.stderr.write("No session token found. User is not logged in.\n") process.exit(1) } function checkLogin() { let loggedIn = false let token = null if (fs.existsSync(TOKEN_FILE)) { const stored = fs.readFileSync(TOKEN_FILE, "utf-8").trim() if (stored) { loggedIn = true token = stored } } process.stdout.write(JSON.stringify({ loggedIn, sessionToken: token })) } ``` The documented command interface also requires the token to be passed as a command-line argument: ```text node pay-bills-skill/session-token.js save <token> ``` ### Technical Analysis The bearer session token is stored unencrypted in `.session_token`. The call to `fs.writeFileSync()` does not specify a restrictive file mode, so the resulting permissions depend on the process umask and existing file permissions. On a shared or incorrectly configured system, another local user or process may be able to read the token. The token is additionally exposed through several channels: - The `save` command accepts it as a command-line argument, potentially exposing it through process inspection, command history, execution telemetry, or Agent transcripts. - The `save` command returns the complete token in its JSON output. - The `load` command prints the raw token. - The `check` command returns the raw token in its JSON output. A bearer token is sufficient to authenticate with ...[truncated 1625 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Store session tokens in an operating-system credential manager or another protected secret-storage facility rather than in the project directory. 2. If file storage is unavoidable: - Create the token file with mode `0600`. - Verify that the file is owned by the expected user. - Refuse to use files with unsafe ownership, symbolic links, or excessive permissions. - Write atomically through a securely created temporary file in the same protected directory. 3. Do not pass tokens as command-line arguments. Read them from protected standard input or receive them directly through an in-process secret API. 4. Change `save` output to a non-sensitive status such as: ```json { "saved": true } ``` 5. Change `check` to return only whether a session exists: ```json { "loggedIn": true } ``` 6. Remove or tightly restrict functionality that prints the raw bearer token. 7. Ensure command output, error reporting, telemetry, and Agent transcripts redact authentication credentials. 8. Use short-lived tokens with server-side expiration, rotation, and immediate revocation on logout or suspected disclosure. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
generate-device-id.js:12
Finding
Predictable and Non-Device-Bound Device Identifier<![CDATA[ ## Vulnerability Details **File Location**: `generate-device-id.js`, lines 12-18 **Vulnerability Type**: Weak and predictable device identity generation **Risk Level**: Medium ### Vulnerable Code ```javascript function getDeviceId(userId) { return `openclaw_${userId}` } const userId = process.argv[2] const deviceId = getDeviceId(userId) process.stdout.write(deviceId) ``` ### Technical Analysis The generated device identifier is a deterministic string derived solely from the user ID. It contains no random, installation-specific, or cryptographically protected component. Anyone who knows or guesses a user ID can reproduce the same identifier on another system. When the script is run without an argument—as directed for the pre-login stage in `skill.md`—`process.argv[2]` is `undefined`, causing every such invocation to return the same value: ```text openclaw_undefined ``` The authentication workflow distinguishes recognized devices from new devices. A recognized device may proceed directly to PIN entry, while a new device may require OTP verification. A predictable identifier therefore cannot reliably establish possession of a previously registered device and may weaken device-recognition controls if the server trusts this client-supplied value. The script also performs no validation to reject missing, malformed, or attacker-selected user IDs. ### Attack Path 1. An attacker learns or guesses a user's numeric ID through another source. 2. The attacker runs the generator with that value or manually constructs `openclaw_<userId>`. 3. The attacker submits the predictable identifier to the authentication-start endpoint with the victim's phone number. 4. If the server treats the identifier as sufficient evidence of a recognized device, it may route the session directly to PIN verification instead of requiring the new-device OTP step. 5. The attacker can then attempt PIN authentication, subject to the server's PIN rate limits and lockout controls. F ...[truncated 1166 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Generate a cryptographically random identifier on first use, for example with `crypto.randomUUID()`. 2. Persist that identifier securely for the specific installation instead of deriving it from a public or guessable user ID. 3. Reject missing or invalid input rather than emitting `openclaw_undefined`. 4. Do not use a bare client-generated identifier as proof that a device is trusted. 5. After OTP verification, have the server issue a random, revocable device credential bound to the user and device registration. 6. Store the server-issued device credential in an operating-system credential manager or a file protected with mode `0600`. 7. Require the client to prove possession of that credential during future authentication attempts, preferably using a challenge-response design or a device-held cryptographic key. 8. Preserve server-side OTP requirements for new or untrusted devices, and retain rate limiting, anomaly detection, device revocation, and user-visible device-management controls. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Missing User Warnings

High
Confidence
97% confidence
Finding
The script prints the session token directly to stdout in both the `load` and `check` flows, and also echoes it after `save`. Session tokens are bearer credentials, so exposing them to terminal history, logs, calling processes, shell pipelines, or agent transcripts can allow immediate account/session hijacking. In an agent skill context, stdout is especially sensitive because other tools or orchestration layers may automatically capture and persist outputs.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
GET    /contacts?page=&limit=&search=    → { contacts[], total, page, totalPages }
POST   /contacts                          { "name":"Mum", "phoneNumber":"09012345678" } → { ok, contact }
PATCH  /contacts/:id                      { "name":"Mother" } or { "phoneNumber":"..." } or both → { ok, contact }
DELETE /contacts/:id                      → { ok, message:"Contact deleted" }
GET    /contacts/search?name=mum          → { ok, contacts: [{ id, name, phoneNumber }] }  (max 5 results)
```
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script stores the session token in a predictable plaintext file (`.session_token`) in the script directory without access controls, encryption, or permission hardening. Any local user, process, backup system, or adjacent tool with filesystem access may read and reuse the token, resulting in credential theft and persistent session compromise. The skill context increases risk because shared workspaces and automated agents often run with broad file visibility.

Whitespace Padding

Medium
Category
Prompt Injection
Content
These Node.js scripts live in the `pay-bills-skill/` directory. Run them with `node` to generate IDs and manage auth state.

| Script                  | Command                                               | Purpose                                                                                                                            |
| ----------------------- | ----------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------|
| `generate-order-id.js`  | `node pay-bills-skill/generate-order-id.js`           | Outputs a unique `ORDER_<timestamp>_<random>` string. Use this as `trx_id` for every order — **never hardcode or reuse a trx_id**. |
| `generate-device-id.js` | `node pay-bills-skill/generate-device-id.js [userId]` | Outputs a device ID. With `userId`: `openclaw_<userId>`. Use as `deviceId` in auth requests. |
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Whitespace Padding

Medium
Category
Prompt Injection
Content
| ----------------------- | ----------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------|
| `generate-order-id.js`  | `node pay-bills-skill/generate-order-id.js`           | Outputs a unique `ORDER_<timestamp>_<random>` string. Use this as `trx_id` for every order — **never hardcode or reuse a trx_id**. |
| `generate-device-id.js` | `node pay-bills-skill/generate-device-id.js [userId]` | Outputs a device ID. With `userId`: `openclaw_<userId>`. Use as `deviceId` in auth requests. |
| `session-token.js`      | see below                                             | Manages the session token for auth.                                                                                                |

### Session Token Commands
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill explicitly instructs persistence of a bearer session token to a local `.session_token` file and provides commands to print or load that token without any warning about secure storage, access control, redaction, or user consent. Because bearer tokens grant authenticated access, exposing or weakly storing them can enable account takeover or unauthorized purchases if the token is read from logs, terminal history, shared workspaces, or local files.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The authentication flow collects highly sensitive information including phone numbers, OTPs, 4-digit PINs, full name, email, and session tokens, but the skill provides no privacy/safety guidance, no minimization advice, and no warning about how these secrets should be handled. In an agent setting, this increases the risk that users disclose credentials and verification codes into channels that may be logged, replayed, or mishandled, enabling unauthorized access to the financial account.

Static analysis

No suspicious patterns detected.