Back to skill

Security audit

R4

Security checks for vulnerabilities and agentic risk

Overview

This skill is clearly meant to connect an agent to R4, but it grants broad credential and domain-management authority without enough user confirmation or scoping.

Review this before installing if the agent will have real production secrets, billing authority, or DNS control. Only use it with a tightly scoped R4 vault, avoid running untrusted commands through `r4 run`, and require explicit approval before purchases, DNS changes, or supplying credentials to third-party services.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (1)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:25
Finding

Blanket Vault Enumeration and Excessive Secret Injection into Child Processes

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:25-32, SKILL.md:68-78, and SKILL.md:183-185
Vulnerability Type: Excessive credential access and violation of least privilege
Risk Level: High

Vulnerable Code

SKILL.md:25-32:

markdown
**Before asking the user for any credential, always check R4 first.**

### List all environment variables

```bash
r4 vault list

Lists all project environment variables as a key-value table. Keys are in SCREAMING_SNAKE_CASE format.

text

`SKILL.md:68-78`:

```markdown
r4 run -- <command>

Executes a command with all vault secrets injected as environment variables. This is the preferred way to run scripts that need access to secrets.

Examples:

bash
r4 run -- node deploy.js
r4 run -- docker compose up
r4 run --prefix R4 -- ./start.sh

SKILL.md:183-185:

markdown
- **ALWAYS** use `r4 run` to inject secrets as environment variables when running commands
- **ALWAYS** use `r4 vault get <KEY>` to retrieve individual values programmatically
- **ALWAYS** check R4 vault before asking the user for any credential or secret

Technical Analysis

The skill instructs agents to inspect the credential vault preemptively and recommends r4 run, which injects all available vault secrets into a selected process. This design violates the principle of least privilege because a command that requires one credential receives every credential shared with the project.

Environment variables are accessible to the launched process and may also be inherited by its descendants. Consequently, a compromised dependency, malicious script, diagnostic utility, build hook, or otherwise untrusted command launched through r4 run can inspect and disclose credentials unrelated to its legitimate task.

The mandatory wording—“ALWAYS check R4” and “ALWAYS use r4 run”—makes exposure systematic rather than exceptional. Although the d ...[truncated 1897 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the blanket requirement to inspect the vault before every credential-related interaction. Require a demonstrated, task-specific need before accessing a secret.
  2. Do not inject the full vault into child processes. Replace r4 run with an interface that accepts an explicit allowlist of required keys.
  3. Retrieve only individually named secrets and expose them only to the exact process that requires them.
  4. Require explicit user confirmation before accessing highly privileged credentials or supplying credentials to unfamiliar commands.
  5. Add a trust assessment that prohibits secret injection into downloaded scripts, package lifecycle hooks, unreviewed binaries, or commands capable of executing third-party code.
  6. Prevent unnecessary inheritance by subprocesses and remove secrets from the environment immediately after the intended operation.
  7. Use narrowly scoped, short-lived credentials where supported, with separate credentials for development, deployment, and production.
  8. Redact secrets from stdout, stderr, crash reports, telemetry, shell tracing, and command logs.
  9. Audit and alert on vault access, full-environment injection, and unusual credential retrieval patterns.
  10. Update the skill documentation so least-privilege retrieval is the mandatory default and full-vault injection is prohibited.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

The skill explicitly encourages autonomous use of stored credentials and domain-management capabilities without asking the user first. In context, this is more dangerous because the agent is granted access to a secret store and potentially billable or high-impact infrastructure actions, so reduced human confirmation materially raises the chance of unauthorized secret use or resource changes.

Content

Scanner excerpt · SKILL.md (reported line 5)May include surrounding context.

md
You have access to the **R4 platform** — your personal password manager, secret store, and domain registrar. R4 is how you manage credentials and buy domains.

**Think of R4 as your password manager.** Whenever you need a login, API key, database credential, SSH key, or any other secret — look it up in R4 first. Do not ask the user for credentials that are already stored in R4. Your owner has shared vault items with you so you can operate autonomously.

**R4 is also your domain registrar.** You can search for available domains, purchase them, and manage their DNS records — all through R4. When you need to buy or configure a domain, use R4.

External Transmission

Medium
Category
Data Exfiltration
Confidence
82% confidence
Finding

The skill instructs the agent to send data and an API key to an external service (r4.dev) for domain operations. Even if this is the intended platform, external transmission of sensitive metadata and credentials is security-relevant, and in this context the skill strongly encourages autonomous secret-backed outbound requests.

Content

Scanner excerpt · SKILL.md (reported line 113)May include surrounding context.

Search for available domains

bash
curl -X GET "https://r4.dev/api/v1/machine/domain-manager/search?name=<base-name>" \
  -H "X-API-Key: $R4_API_KEY"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill authorizes domain purchases and presents a direct purchase command without requiring explicit user confirmation or warning that the action may be irreversible and billable. In an autonomous-agent context, this increases the risk of unintended purchases, financial loss, and registration of attacker-influenced domains.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

At L027-L033, the section says r4 vault list will 'List all environment variables' and return a key-value table of project environment variables. However, the surrounding documentation describes R4 primarily as a password manager/secret store with vault items and fields, so this wording misstates what the command conceptually exposes and could mislead an agent about the nature of the data being accessed.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.