Back to skill

Security audit

V2rayn

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly about managing V2RayN, but it asks users to install recurring automation with weak safeguards and includes a broad restart command.

Review carefully before installing. Use the status and log commands on demand, but avoid adding the cron job unless you place the script in a fixed user-owned path with restrictive permissions and know how to remove it. Do not run the restart command with sudo, and prefer a V2RayN-specific quit/reopen method over pkill -f.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (2)

T06 · System Persistence

Error
Location
SKILL.md:18
Finding
Persistent Scheduled Execution Through an Insufficiently Secured Cron Job<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 18–29 **Vulnerability Type**: Persistent scheduled task using an unspecified and potentially mutable script path **Risk Level**: High ### Vulnerable Code ```markdown ## Auto-Check Node Health (Every 30 min) This skill automatically: 1. Check if current node is working 2. If failed, update subscription 3. Select a new working node ### Implementation Create a cron job: ``` */30 * * * * /path/to/check_v2rayn.sh ``` ``` ### Technical Analysis The instructions direct the user or agent to create a cron entry that executes `check_v2rayn.sh` every 30 minutes. This causes the script to continue executing across sessions and system use, creating persistent system state. Periodic health checking can be relevant to the declared functionality, but installing a persistent scheduled task is not the minimum privilege necessary to provide an on-demand status check. The instructions also do not specify: - A trusted, absolute location for the script. - Restrictive file and directory permissions. - Validation of script ownership. - An absolute interpreter path. - Integrity verification before each execution. - A cleanup or uninstallation procedure. The placeholder `/path/to/check_v2rayn.sh` may be replaced with a location writable by another local account, process, shared group, or synchronization mechanism. If the script or one of its parent directories is insufficiently protected, another party can replace or modify the script and obtain repeated code execution as the owner of the crontab. The scheduled script itself performs outbound HTTPS requests and reads the user's V2RayN configuration. Those operations are consistent with a health check, but their repeated unattended execution increases the consequences of later script compromise. ### Attack Path 1. The user follows the Skill instructions and creates the supplied cron entry. 2. The selected script path or one of its parent directories is w ...[truncated 1245 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Make the health check on-demand by default and require explicit, informed user consent before installing any recurring task. - Store the script in a fixed, user-owned directory rather than an arbitrary placeholder path. - Require restrictive permissions, for example: - Script permissions of `0700`. - Parent directories not writable by group members or other users. - Ownership matching the crontab owner. - Invoke a fixed interpreter and fixed script path, such as `/bin/bash "$HOME/.local/libexec/check_v2rayn.sh"`. - Configure a minimal `PATH` inside the script and use absolute paths for security-sensitive utilities where practical. - Verify the script's ownership and permissions before installation. - Avoid installing the task in a root or system crontab; the health check does not require administrative privileges. - Document how to inspect and remove the cron entry. - Consider a macOS `launchd` user agent only when recurring execution is explicitly requested, applying equivalent ownership and permission controls. - Ensure documentation accurately states that the supplied script only detects failure and notifies the user; it does not currently update subscriptions or select another node. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:157
Finding
Overbroad Process Termination Using Command-Line Pattern Matching<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 157–161 **Vulnerability Type**: Unvalidated process termination through broad command-line matching **Risk Level**: Medium ### Vulnerable Code ```bash ### 6. Restart V2RayN ```bash # Kill and restart pkill -f v2rayN open /Applications/v2rayN.app ``` ``` ### Technical Analysis The restart procedure uses `pkill -f v2rayN`. The `-f` option matches the pattern against each process's full command line rather than restricting the operation to a validated V2RayN application process. Consequently, any process whose command line contains the string `v2rayN` may be terminated. This can include unrelated scripts, terminals, monitoring commands, development tools, or other applications whose arguments happen to contain that text. The command performs no validation of the executable path, bundle identity, process owner, or PID before sending the termination signal. Restarting the target application is within the Skill's declared functionality, but terminating every command-line match exceeds the minimum process-control scope needed to restart one application. ### Attack Path 1. An unrelated or security-relevant process runs under the same user and has `v2rayN` somewhere in its command line. 2. The user or agent follows the documented restart procedure. 3. `pkill -f v2rayN` enumerates full command lines and selects every matching process that the invoking user is permitted to signal. 4. The unrelated matching process is terminated along with the intended application. 5. Its work may be interrupted, unsaved state may be lost, or a user-level service may become unavailable. A local attacker could deliberately launch or rename a user-level process so that its command line matches the pattern, but the primary risk is accidental denial of service rather than privilege escalation. ### Impact Assessment The command can terminate processes accessible to the invoking account. Under ordinary use, the sc ...[truncated 446 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Prefer V2RayN's supported graceful shutdown or restart mechanism, if available. - Identify the intended application by validated executable path, bundle identifier, or an application-specific PID rather than a substring of the full command line. - On macOS, use application-aware control where supported, such as asking the exact application to quit before reopening it. - If PID-based termination is necessary: 1. Resolve candidate PIDs. 2. Verify the process owner. 3. Verify the executable path or bundle identity. 4. Signal only the validated PID. 5. Wait for graceful termination before escalating the signal. - Do not run the restart command with `sudo`, because restarting a user application does not require elevated process-control privileges. - Report ambiguous or multiple matches to the user instead of terminating all of them automatically. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

External Script Fetching

High
Category
Supply Chain
Content
# Test connection
test_connection() {
    curl -s --max-time 5 -x socks5://127.0.0.1:10808 https://www.google.com -o /dev/null -w "%{http_code}" 2>/dev/null
}

# Get current node info
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

File System Enumeration

Medium
Category
Data Exfiltration
Content
### 5. View Logs
```bash
ls -la ~/Library/Application\ Support/v2rayN/guiLogs/
tail -50 ~/Library/Application\ Support/v2rayN/guiLogs/*.log 2>/dev/null | tail -30
```
Confidence
60% confidence
Finding
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Static analysis

No suspicious patterns detected.