Back to skill

Security audit

3x-ui VPN Server Setup

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its VPN setup purpose, but it uses high-privilege unverified installers, network scanning, and plaintext credential bundles in ways users should review carefully before installing.

Review this skill before use. It should only be run against a VPS you own and are authorized to configure. Prefer pinned and verified installer sources, avoid subnet scanning unless permitted by your provider, do not store the sudo or panel passwords in the generated markdown guide, and rotate credentials after setup.

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

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:288
Finding

Mutable 3x-ui Installer Is Downloaded and Executed with Root Privileges

Content
View full analysis
Remediation
View remediation
/install.sh" \ --output /tmp/3x-ui-install.sh printf '%s %s\n' '' /tmp/3x-ui-install.sh | sha256sum --check - sudo bash /tmp/3x-ui-install.sh rm -f /tmp/3x-ui-install.sh ``` ]]>

T03 · Remote Payload Retrieval and Execution

Error
Location
references/vless-tls.md:40
Finding

acme.sh Is Installed Through curl-to-Shell and Subsequently Invoked with sudo

Content
View full analysis
Remediation
View remediation

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:378
Finding

Unverified RealiTLScanner Binary Is Executed and Used to Probe Third-Party Subnets

Content
View full analysis
&1 | head -80' ``` ```bash ARCH=$(dpkg --print-architecture); case "$ARCH" in amd64) SA="64";; arm64|aarch64) SA="arm64-v8a";; *) SA="$ARCH";; esac && curl -sL "https://github.com/XTLS/RealiTLScanner/releases/latest/download/RealiTLScanner-linux-${SA}" -o /tmp/scanner && chmod +x /tmp/scanner && file /tmp/scanner | grep -q ELF || { echo "ERROR: scanner binary not valid for this architecture"; exit 1; }; MY_IP=$(curl -4 -s ifconfig.me); SUBNET=$(echo $MY_IP | sed "s/\.[0-9]*$/.0\/24/"); echo "Scanning subnet: $SUBNET"; timeout 120 /tmp/scanner --addr "$SUBNET" 2>&1 | head -80 ``` ### Technical Analysis The Skill retrieves an executable through the mutable GitHub `latest` release URL, marks it executable, and runs it without verifying a checksum or signature. The `file ... | grep -q ELF` test confirms only the file format; a malicious executable would also pass this test. The executable scans the VPS `/24` subnet. The instructions later permit expanding the scan to `/23`, potentially probing 512 addresses. Finding a compatible Reality destination supports VPN configuration, but probing unrelated neighboring systems is broader than the minimum network scope necessary and may violate hosting-provider acceptable-u ...[truncated 1370 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:150
Finding

Unsanitized Template Values Are Interpolated into Privileged Shell Commands

Content
View full analysis
/home/{username}/.ssh/authorized_keys chmod 700 /home/{username}/.ssh chmod 600 /home/{username}/.ssh/authorized_keys chown -R {username}:{username} /home/{username}/.ssh ``` Additional unsafe substitutions include: ```bash sshpass -p '{sudo_password}' ssh-copy-id -i ~/.ssh/{nickname}_key.pub -o StrictHostKeyChecking=accept-new {username}@{SERVER_IP} ``` ```bash ssh {nickname} "sudo x-ui setting -username {new_username} -password {new_password}" ``` ### Technical Analysis The Skill inserts usernames, passwords, paths, nicknames, domains, and public-key content directly into shell commands. Quoting is inconsistent and does not safely handle embedded quotes, command substitutions, newlines, shell metacharacters, or option-like values. For example, `{PUBLIC_KEY_CONTENT}` is placed inside double quotes, where command substitutions such as `$(...)` remain active after textual interpolation. Unquoted values such as `{username}`, `{new_username}`, and `{new_password}` can split into multiple arguments or introduce shell operators. Single-quoted password use fails if the password itself contains a single quote. Several affected commands run in an initial root session or through `sudo`, so successful injection may execute with administrative privileges. ### Attack Path 1. An attacker or untrusted input source supplies a crafted username, password, domain, nickname, or public-key string. 2. The Agent substitutes the value verbatim into the documented command. 3. The shell parses injected metacharacters or command substitution syntax. 4. ...[truncated 861 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:799
Finding

Mandatory Guide Stores Administrative and VPN Credentials in Plaintext

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (141)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

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

T_MODE=a apt upgrade -y

text

## Step 4: Create Non-Root User

```bash
useradd -m -s /bin/bash {username}
echo "{username}:{GENERATE_STRONG_PASSWORD}" | chpasswd
usermod -aG sudo {username}

Generate a strong random password. Tell the user to save it (needed for sudo). Then:

bash
# Verify
groups {username}

Step 5: Install SSH Key for New User

bash
mkdir -p /home/{username}/.ssh
echo "{PUBLIC_KEY_CONTENT}" > /home/{username}/.ssh/authorized_keys
chmod 700 /home/{username}/.ssh
chmod 600 /home/{username}/.ssh/authorized_keys
chown -R {username}:{username} /home/{username}/.ssh

Step 6: TEST New User Login -- CRITICAL CHECKPOINT

DO NOT proceed without successful test!

Open a NEW connection (keep root session alive):

bash
ssh -i ~/.ssh/{nickname}_key {username}@{SERVER_IP}

Verify sudo works:

bash
sudo whoami
# Must output: root

If this fails -- debug permissions, do NOT disable root login:

bash
# Check on server as root:
ls -la /home/{

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The command chains a network fetch directly into privileged execution of a remote installer, minimizing opportunities for user review and integrity checks. In one step, attacker-controlled upstream content could be downloaded and run as root, leading to complete server compromise.

Content

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

3x-ui install script requires root. Run with sudo:

bash
ssh {nickname} "curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh -o /tmp/3x-ui-install.sh && echo 'n' | sudo bash /tmp/3x-ui-install.sh"

The echo 'n' answers "no" to port customization prompt -- a random port and credentials will be generated.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

BBR (Bottleneck Bandwidth and RTT) dramatically improves TCP throughput, especially on lossy links -- critical for VPN performance.

bash
ssh {nickname} 'current=$(sysctl -n net.ipv4.tcp_congestion_control); echo "Current: $current"; if [ "$current" != "bbr" ]; then echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf && echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf && sudo sysctl -p && echo "BBR enabled"; else echo "BBR already active"; fi'

Verify:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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).

Content

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

Cleanup session cookie:

bash
ssh {nickname} "rm -f /tmp/3x-cookie"

Step 20: Guide User -- Install Hiddify Client

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill tells the agent to create a local guide file containing all passwords, access details, and instructions without a prominent warning about the sensitivity of that file. Persisting aggregated secrets in a convenient plaintext bundle materially increases blast radius if the workstation, home directory, clipboard history, sync service, or backups are compromised.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

These instructions require storing all collected secrets in a local file advertised as containing all passwords and access details. Centralizing sensitive authentication data in plaintext creates an attractive single point of compromise and conflicts with the skill's own stated rule against storing passwords in files.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The fallback behavior explicitly allows revealing the full guide content in chat if SCP fails, which would place collected secrets directly into conversation history. Chat logs may be retained, exported, searched, or visible to other tools, so disclosing credentials there materially increases exposure risk.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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).

Content

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

chmod 700 /home/{username}/.ssh chmod 600 /home/{username}/.ssh/authorized_keys chown -R {username}:{username} /home/{username}/.ssh rm -f /home/{username}/{nickname}_key.pub

text

Tell user to test from their laptop:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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).

Content

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

22L-8: Delete guide file from server

bash
rm -f /home/{username}/vpn-guide.md

Tell user: Методичка удалена с сервера. Убедись, что она сохранена на твоём компьютере.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The guide template embeds server login data, VPN connection artifacts, and administrative panel credentials for later retrieval. Such durable storage of live secrets increases the likelihood of compromise through local malware, accidental sharing, versioning, cloud backup, or shoulder surfing.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The template explicitly embeds the server IP, username, sudo password, panel URL, panel username, panel password, and VLESS link in markdown. This consolidates multiple live secrets and access artifacts into a single exfiltration target, making compromise of that file highly damaging.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The embedded instructions direct another model to use the saved password and install sshpass for automated password-based access to the server. That encourages propagation of credentials into additional tools and command histories, expanding the trust boundary and the opportunities for accidental leakage or misuse.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill explicitly states passwords must never be stored in files, yet elsewhere instructs generating a guide file containing the sudo password and panel credentials. This contradiction increases the chance that long-lived credentials will be written to disk and later exposed via local compromise, backups, sync tools, or accidental sharing.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

Step 1: Install Nginx

bash
ssh {nickname} "sudo apt update && sudo apt install -y nginx"

Step 2: Configure Nginx on Localhost

Static analysis

No suspicious patterns detected.