Back to skill

Security audit

vRain 古籍电子书制作

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for making vRain-based Chinese classical-style PDFs, but it asks users to install and run unpinned third-party code, including an optional privileged Perl install path.

Review before installing. Prefer an isolated, unprivileged environment, avoid the `sudo cpan` path, pin or verify the vRain checkout and Perl dependency versions where possible, and confirm output paths before rerunning commands that may replace generated PDFs or images.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:28
Finding

Unpinned Third-Party Repository and Perl Dependencies Are Downloaded and Executed

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 28, 46–49, 78–103, 257–259, 398–425, and 463–467
Vulnerability Type: Unverified and unpinned third-party dependencies
Risk Level: Medium

Vulnerable Code

SKILL.md:28

bash
git clone https://github.com/shanleiguang/vRain.git

SKILL.md:46–49

bash
cpanm PDF::Builder Font::FreeType Math::Trig Image::Magick

sudo cpan PDF::Builder Font::FreeType Math::Trig Image::Magick

SKILL.md:78–103

bash
perl vrain.pl -b <book-id> [-f <start-number>] [-t <end-number>] [-c] [-z <page-count>]

perl vrain.pl -b 01 -c
perl vrain.pl -b 01 -z 10
perl vrain.pl -b 01 -f 11 -t 20 -c
perl vrain.pl -h

SKILL.md:257–259

bash
perl canvas.pl -c <background-id>
perl vintage.pl -c <background-id>
perl bamboo.pl -c <background-id>

SKILL.md:463–467

bash
cp tools/addyin.pl books/01/
cd books/01
perl addyin.pl

Technical Analysis

The skill directs users to clone the mutable default branch of an external GitHub repository without selecting a reviewed commit, signed tag, or verified release artifact. It subsequently instructs users to execute Perl scripts obtained from that repository. Consequently, the code that runs may differ from the code that was available when the skill was reviewed.

The skill also installs CPAN modules without version constraints, checksums, signatures, or a lockfile. Dependency resolution can therefore select newer or altered package releases. Installation hooks and module build scripts may execute code during installation.

The documented sudo cpan alternative increases the potential impact because package installation and associated build logic may run with elevated privileges. This is a supply-chain exposure; the audited file does not establish that the referenced repository or modules are currently malicious.

Attack Path

...[truncated 1343 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin vRain to a specifically reviewed commit hash or cryptographically signed release rather than cloning and executing the current default branch.
  2. Publish and verify SHA-256 checksums or signatures for all downloaded release artifacts, scripts, fonts, and other externally sourced assets.
  3. Pin direct and transitive Perl module versions through a dependency specification and lockfile, such as cpanfile with a committed snapshot.
  4. Remove the sudo cpan recommendation. Install dependencies as an unprivileged user in an isolated environment using tools such as local::lib, Perlbrew, a container, or a dedicated virtual machine.
  5. Review external scripts before execution and repeat the review whenever the pinned commit or dependency lockfile changes.
  6. Run PDF and image generation with least privilege, restricted filesystem access, no unnecessary credentials, and disabled network access where practical.
  7. Document trusted download locations and a reproducible update process that requires explicit review before changing repository revisions or dependency versions.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (4)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger condition is very broad: any request about 古籍风格电子书、直排 PDF、古籍刻本 may activate the skill without clear exclusion criteria. Overbroad activation can cause the agent to invoke local command-line workflows unexpectedly, increasing the chance of unintended file operations or tool execution outside the user's precise intent.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
88% confidence
Finding

The skill recommends a privileged installation path using 'sudo cpan ...', which encourages running package installation as root. If followed, this increases the blast radius of a compromised package, malicious dependency, or user mistake, and normalizes unnecessary elevation in a skill that otherwise operates on local content generation.

Content

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

cpanm PDF::Builder Font::FreeType Math::Trig Image::Magick

或使用系统 Perl + cpan

sudo cpan PDF::Builder Font::FreeType Math::Trig Image::Magick

text

### 1.3 准备字体文件

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill explicitly describes re-generating ranges with '覆盖已有' but does not require a warning, confirmation, backup step, or safe-output alternative. This can lead to silent destruction or replacement of previously generated PDFs, especially in batch workflows where users may not realize outputs will be overwritten.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The secondary trigger for background generation is similarly broad and can activate on general requests about backgrounds, borders, or paper-style assets without clearly limiting scope to the local vRain canvas tool. This makes accidental execution of image-generation commands more likely and may lead to unintended overwrites or processing of local files.

Content

No source excerpt is available for this finding.