Back to skill

Security audit

FastapiAdmin WSL 自动部署

Security checks for vulnerabilities and agentic risk

Overview

This deployment skill is coherent in purpose but asks users to run broad privileged setup steps that can overwrite system web-server configuration and use weak deployment practices.

Review every command before running it. Use a disposable WSL2 instance or take a backup first, generate unique database credentials, pin repository commits and dependency versions, avoid replacing the global Nginx config for one app, and do not delete existing enabled sites unless you know they are unused.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:47
Finding
Predictable Hardcoded Database Credential<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 47–49 and 68–70 **Vulnerability Type**: Hardcoded default database credential **Risk Level**: Medium ### Vulnerable Code ```bash sudo mysql -e "CREATE DATABASE IF NOT EXISTS fastapiadmin CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" sudo mysql -e "CREATE USER IF NOT EXISTS 'fastapiadmin'@'localhost' IDENTIFIED BY 'fastapiadmin123';" sudo mysql -e "GRANT ALL PRIVILEGES ON fastapiadmin.* TO 'fastapiadmin'@'localhost'; FLUSH PRIVILEGES;" ``` The deployment instructions subsequently direct the user to place the same password in the backend configuration: ```text DATABASE_USER = "fastapiadmin" DATABASE_PASSWORD = "fastapiadmin123" REDIS_PASSWORD = "" ``` ### Technical Analysis The Skill assigns every deployment the publicly documented and predictable password `fastapiadmin123`. This is not a secret once the Skill is distributed. The account is granted all privileges on the `fastapiadmin` database. The initial MySQL host restriction to `localhost` reduces remote exposure, but it does not make the credential safe. Any compromised local application, shell account, server-side request capability, or database proxy can attempt authentication using the known password. A later configuration change that exposes MySQL beyond localhost would make the account directly vulnerable to remote authentication. The password may also remain in shell history, process argument records, installation logs, and copied configuration files. ### Attack Path 1. An attacker obtains database connectivity through local code execution, a compromised application component, an exposed MySQL listener, or an unintended proxy. 2. The attacker identifies that the deployment follows these public instructions. 3. The attacker authenticates as `fastapiadmin` with the known password `fastapiadmin123`. 4. The attacker exercises the account's privileges over the entire `fastapiadmin` database. 5. Application records can the ...[truncated 575 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Generate a unique, cryptographically random password for every installation, for example with `openssl rand`. 2. Avoid putting the password directly in command-line arguments, where it may be exposed through shell history or process inspection. 3. Supply the SQL through a protected temporary input file or standard input, and remove temporary material immediately after use. 4. Store the backend credential in a file readable only by the service account, with permissions such as `0600`. 5. Keep MySQL bound to the required local interface and enforce host firewall restrictions. 6. Grant only the specific database privileges required by the application instead of `ALL PRIVILEGES` where practical. 7. Document a credential rotation procedure and require rotation if the example credential was previously deployed. ]]>

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:29
Finding
Execution of Unpinned and Mutable Third-Party Code<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 29–34, 54–56, and 64; `references/troubleshooting.md`, lines 120–124 **Vulnerability Type**: Unverified remote code retrieval and insecure dependency installation **Risk Level**: High ### Vulnerable Code ```bash curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py python3 /tmp/get-pip.py --break-system-packages npm install -g pnpm ``` ```bash mkdir -p ~/workdir && cd ~/workdir git clone https://gitee.com/fastapiadmin/FastapiAdmin.git git clone https://gitee.com/fastapiadmin/FastDocs.git ``` ```bash ./venv/bin/pip install -r requirements.txt ``` The troubleshooting instructions introduce another unpinned package installation: ```bash ./venv/bin/pip install prefect ./venv/bin/python main.py run --env=dev ``` ### Technical Analysis The Skill retrieves and executes a current remote Python bootstrap script without verifying a cryptographic digest or signature. It also installs the current version of `pnpm` globally, clones repositories without checking out an audited commit, and installs Python dependencies whose integrity guarantees are not established by the audited Skill. The effective code executed by these commands can change after the Skill itself has been reviewed. Dependency installation can execute package build hooks, setup logic, lifecycle scripts, and imported application code. Consequently, compromise of an upstream package, repository, maintainer account, or dependency resolution path can result in arbitrary code execution. Using `--break-system-packages` bypasses the distribution's externally managed Python protection and increases the possibility of modifying or conflicting with system-managed Python components. The global npm installation also has broader scope than a project-local tool installation. ### Attack Path 1. An attacker compromises an upstream repository, package release, package-maintainer account, or the content served as `get-pip.py`. 2. Th ...[truncated 1184 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin cloned repositories to reviewed commit hashes and verify the expected commit before using their contents. 2. Pin exact Python and npm package versions using reviewed lockfiles. 3. Require package hashes, such as pip hash-checking mode with `--require-hashes`. 4. Download bootstrap assets from versioned locations and verify a documented SHA-256 digest or trusted signature before execution. 5. Prefer the operating system's packaged `pip` and `python3-venv` over executing a live bootstrap script. 6. Avoid `--break-system-packages`; install Python tooling and dependencies in a dedicated virtual environment. 7. Install `pnpm` at a pinned version and avoid a global installation where project-local tooling or Corepack can satisfy the requirement. 8. Pin `prefect` to a reviewed compatible version and add it to the audited dependency lockfile rather than installing the latest release ad hoc. 9. Perform dependency installation and application builds as an unprivileged, dedicated service or build user. 10. Review package provenance and use automated dependency and integrity scanning before deployment. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:142
Finding
Privileged Replacement of Global Nginx Configuration with Unpinned Repository Content<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 91 and 142–145 **Vulnerability Type**: Excessive privileged deployment scope and unsafe configuration trust boundary **Risk Level**: High ### Vulnerable Code The Skill identifies an Nginx configuration inside the remotely cloned project as its source: ```text Nginx configuration source is located at ~/workdir/FastapiAdmin/devops/nginx/nginx.conf and is copied to /etc/nginx/nginx.conf during deployment. ``` It then replaces the system-wide configuration and removes the existing default site: ```bash sudo cp ~/workdir/FastapiAdmin/devops/nginx/nginx.conf /etc/nginx/nginx.conf sudo rm -f /etc/nginx/sites-enabled/default sudo nginx -t && sudo nginx ``` ### Technical Analysis The source configuration comes from a repository cloned without a pinned commit. The Skill then uses elevated privileges to replace `/etc/nginx/nginx.conf`, which controls Nginx globally, rather than installing a narrowly scoped virtual-host configuration. This exceeds the minimum privileges and modification scope needed to deploy one web application. It can overwrite unrelated host configuration and affect every site handled by the Nginx instance. Removing the default enabled site can also disrupt an existing deployment. `nginx -t` validates configuration syntax and some referenced resources, but it does not establish that the configuration is safe. A syntactically valid configuration can still introduce unintended proxy destinations, disclose local files, alter logging, bind additional ports, weaken TLS, or load modules where supported. Because the file originates from mutable external repository content, the privileged copy creates a trust-boundary transition from unprivileged remote content to system-wide service configuration. ### Attack Path 1. An attacker compromises the FastapiAdmin repository, its default branch, or an account authorized to modify it. 2. The attacker adds malicious but syntactically val ...[truncated 1190 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not replace `/etc/nginx/nginx.conf` for a single application deployment. 2. Provide a minimal, audited FastapiAdmin virtual-host file and install it under `/etc/nginx/sites-available/`. 3. Enable only that site through a controlled symbolic link under `/etc/nginx/sites-enabled/`. 4. Do not delete existing sites unless the user explicitly confirms that they are obsolete. 5. Pin the source repository to a reviewed commit and verify the commit before copying any configuration. 6. Prefer configuration shipped directly with the reviewed Skill over configuration taken from a mutable clone. 7. Review the complete effective configuration using `nginx -T`, in addition to running `nginx -t`. 8. Back up existing configuration before changes and use an atomic deployment with rollback on failure. 9. Limit privileged commands to copying the specific audited site file, validating it, and reloading the service. 10. Explicitly reject dangerous or unnecessary directives, including unexpected module loading, broad filesystem aliases, unapproved upstream proxies, and new listening interfaces. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (32)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```bash
sudo cp ~/workdir/FastapiAdmin/devops/nginx/nginx.conf /etc/nginx/nginx.conf
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo nginx
```
Confidence
85% confidence
Finding
The command unconditionally deletes `/etc/nginx/sites-enabled/default`, which is a destructive system modification that can disable existing web content or service routing. In a skill intended for broad deployment help, removing a live config without backup or environment checks can cause outage or erase local customizations.

Chaining Abuse

High
Category
Tool Misuse
Content
```bash
sudo cp ~/workdir/FastapiAdmin/devops/nginx/nginx.conf /etc/nginx/nginx.conf
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo nginx
```

## Step 7:启动后端服务
Confidence
88% confidence
Finding
`sudo nginx -t && sudo nginx` chains validation and service start in one line, encouraging immediate execution after a single check and making rollback or operator review less likely. In deployment docs that already overwrite global nginx config, this pattern increases the chance of rapidly applying a bad or unsafe configuration to a live system.

Chaining Abuse

High
Category
Tool Misuse
Content
hostname -I | awk '{print $1}'

# Nginx 配置测试与重载
sudo nginx -t && sudo nginx -s reload

# 查看 Nginx 错误日志
sudo tail /var/log/nginx/error.log
Confidence
75% confidence
Finding
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Credential Access

High
Category
Privilege Escalation
Content
**修复:**
```bash
cat > frontend/.env.production << 'EOF'
VITE_APP_ENV=production
VITE_APP_TITLE=FastapiAdmin
VITE_API_BASE_URL=http://<WSL2_IP>
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
**修复:**
```bash
cat > frontend/.env.production << 'EOF'
VITE_APP_ENV=production
VITE_APP_TITLE=FastapiAdmin
VITE_API_BASE_URL=http://<WSL2_IP>
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
**修复:**
```bash
cat > frontend/.env.production << 'EOF'
VITE_APP_ENV=production
VITE_APP_TITLE=FastapiAdmin
VITE_API_BASE_URL=http://<WSL2_IP>
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill directs package installation, service startup, configuration replacement, and other system-modifying actions without an upfront warning about privileged operations and host impact. In a deployment skill, this increases the chance an operator or agent executes broad changes on the wrong machine or without understanding the security consequences.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npm install -g pnpm

# 安装 MySQL + Redis + Nginx
sudo apt-get update
sudo apt-get install -y mysql-server redis-server nginx

# 安装 python3-venv(venv 创建必需)
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
sudo apt-get install -y python3.12-venv

# 启动服务
sudo service mysql start
sudo service redis-server start
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Static analysis

No suspicious patterns detected.