T09 · Insecure Skill Coding Practices
- Location
SKILL.md:93- Finding
Untrusted Package Installation Uses a Writable Host Bind Mount
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:93
Vulnerability Type: Unsafe container isolation and writable host-directory exposure
Risk Level: HighVulnerable Code:
bash # 在 Docker 中安装测试 docker run --rm -v $(pwd):/app node:alpine npm install package-nameTechnical Analysis
The documented security-testing procedure installs an untrusted npm package inside a container while mounting the current host directory at
/appwith read-write access. npm packages can execute lifecycle scripts such aspreinstall,install, andpostinstall. Those scripts would execute inside the container but could read, create, overwrite, or delete files through the writable/appbind mount.Consequently, the command does not provide the isolation claimed by the Skill. Container boundaries may protect unrelated host paths, but they do not protect the explicitly mounted directory. Code running as root inside the container may modify mounted files subject to the host filesystem and container-runtime mappings.
The
$(pwd)expansion is also unquoted. Working-directory paths containing whitespace or command-option-like components can cause incorrect argument splitting and unpredictable command behavior.The writable mount is not necessary for initial package inspection. A disposable volume or temporary directory would satisfy the declared testing purpose with substantially lower privileges.
Attack Path
- An attacker publishes an npm package containing a malicious lifecycle script.
- A user asks the Skill to perform a preflight safety check on that package.
- The agent follows the documented Docker command and mounts the current host project directory at
/appwith write access. npm installexecutes the attacker's lifecycle script inside the container.- The script accesses
/appand modifies or deletes files in the host working directory. - The malicious changes persist on the host after t ...[truncated 772 chars]
- Remediation
View remediation
Remediation Suggestions
-
Perform installation in a newly created disposable Docker volume rather than a host bind mount.
-
If host content is needed only for inspection, mount it read-only:
bash docker run --rm \ --mount type=bind,src="$PWD",dst=/input,readonly \ --workdir /work \ node:alpine \ npm install --ignore-scripts package-name -
Copy only the minimum required files into an isolated temporary location before testing.
-
Use
npm install --ignore-scriptsduring static inspection. Run lifecycle scripts only in a second-stage sandbox with no host mounts, restricted networking, resource limits, dropped Linux capabilities, and a non-root user. -
Quote all path expansions, including
"$PWD". -
Record filesystem changes inside a disposable container or volume rather than exposing the host project.
-
