Back to skill

Security audit

PDF Font Fixer

Security checks for vulnerabilities and agentic risk

Overview

This PDF repair skill needs review because it can ignore text-preservation settings, replace an original file, and report success after failed or incomplete checks.

Use disposable document copies and explicit unused output paths. The text-preservation options and validation success codes are unreliable until corrected, so check copying, searching, and visual output yourself. Paired native and converted PDFs are intentional. Review found concrete control failures, but no evidence supporting a malicious classification; verification covered source and mocked control flow, not real document rendering.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (20)

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

ghostscript 官方获取(脚本检测不到时会自动打印这段,且不会擅自安装):

text
Debian/Ubuntu : sudo apt-get install ghostscript
Fedora        : sudo dnf install ghostscript
macOS         : brew install ghostscript
Windows       : winget install ArtifexSoftware.GhostScript

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

text
Debian/Ubuntu : sudo apt-get install ghostscript
Fedora        : sudo dnf install ghostscript
macOS         : brew install ghostscript
Windows       : winget install ArtifexSoftware.GhostScript
官方下载页     : https://ghostscript.com/releases/gsdnld.html

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/common.py (reported line 62)May include surrounding context.

python
未检测到 ghostscript(把文字转成矢量轮廓时需要它)。
请从**官方**渠道安装(以下均为官方源,任选其一):

  Debian/Ubuntu : sudo apt-get install ghostscript
  Fedora        : sudo dnf install ghostscript
  macOS         : brew install ghostscript
  Windows       : winget install ArtifexSoftware.GhostScript

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/common.py (reported line 63)May include surrounding context.

python
请从**官方**渠道安装(以下均为官方源,任选其一):

  Debian/Ubuntu : sudo apt-get install ghostscript
  Fedora        : sudo dnf install ghostscript
  macOS         : brew install ghostscript
  Windows       : winget install ArtifexSoftware.GhostScript
  官方下载页     : https://ghostscript.com/releases/gsdnld.html

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/discover.py (reported line 162)May include surrounding context.

python
Linux:
      Noto Sans SC(TrueType 版):https://fonts.google.com/noto/specimen/Noto+Sans+SC
      文泉驿微米黑:https://wenq.org/wqy2/index.cgi?ZenHei=
      Debian/Ubuntu:sudo apt-get install fonts-wqy-microhei fonts-noto-cjk(⚠️ noto-cjk 是 CFF,装了也用不上)
  通用(Google 官方字体站,选 Noto Sans SC 的 .ttf 而不是 .otf):
      https://github.com/notofonts/noto-cjk/releases
"""

The command-execution helper runs subprocesses without disclosing the action.

Medium
Category
Output Handling
Confidence
90% confidence
Finding

The run() helper executes the supplied command without a confirmation prompt, user-facing log, or explanatory docstring or comment. Capturing and returning command output does not itself notify the user that an external process is being launched.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/common.py (reported line 88)May include surrounding context.

python
def run(cmd, timeout=300):
    try:
        r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
        return r.returncode, (r.stdout or '') + (r.stderr or '')
    except Exception as e:
        return 1, str(e)

The default output path can overwrite the source PDF instead of creating the documented separate repaired file.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

For a typical .pdf input, the default output expression resolves to the input path itself. Successful charset-only or fully repaired charset branches then move the rewritten file over the original, removing the untouched source without explicit overwrite authorization.

Content

No source excerpt is available for this finding.

--charset-only can fall through to outline or raster conversion despite promising charset-only repair.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

--charset-only is enforced only after a successful charset rewrite, so absent or failed charset repair can fall through to outline or raster conversion. The resulting document can lose its text layer despite the user's explicit restriction to charset-only changes.

Content

No source excerpt is available for this finding.

--keep-copy can produce a non-copyable outline PDF and report success, contradicting its documented guarantee.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

The successful outline-conversion branch writes a non-copyable PDF and returns success before enforcing --keep-copy. This violates an explicit user constraint and can cause automated workflows to accept a document that has lost searchable or copyable text, although the original input is retained in this branch.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/fontkit.py (reported line 37)May include surrounding context.

python
def list_zh_ttf():
    """返回 [(path, family)],只列 fontformat=TrueType 的中文字体。"""
    try:
        r = subprocess.run(['fc-list', ':lang=zh', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=25)
    except Exception:
        return []

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/fontkit.py (reported line 55)May include surrounding context.

python
def find_family(family):
    rows = []
    try:
        r = subprocess.run(['fc-list', ':', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=25)
    except Exception:
        return rows

JSON mode returns delivery approval even when font checks fail, contradicting the documented gate contract.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

In JSON mode, failing checks are included in the payload but never update worst, so an existing PDF with detected problems still yields exit code 0. Because this script is explicitly the delivery gate, automation relying on its exit status can release documents that failed validation.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/locate.py (reported line 174)May include surrounding context.

python
for mod, use in (('pymupdf', '读字体/渲染'), ('fontTools', 'CFF 解析/OTF→TTF'),
                     ('pikepdf', 'charset 修复')):
        try:
            __import__(mod)
            print('   ✅ %s(%s)' % (mod, use))
        except ImportError:
            print('   ⚠️ %s 缺失(%s 不可用)' % (mod, use))

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/pptx.py (reported line 76)May include surrounding context.

python
def fc_lookup(family):
    """返回该 family 在本机的所有记录 [(path, format)]。"""
    try:
        r = subprocess.run(['fc-list', ':', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=20)
    except Exception:
        return []

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/pptx.py (reported line 186)May include surrounding context.

python
if a.stage <= 2:
            print('\n[第 2 步] 转矢量轮廓(显示保真,失去复制)...')
            ol = os.path.join(work, 'outline.pdf')
            okk, msg = __import__('fix').to_outline(keep, ol)
            if okk:
                res = inspect_pdf(ol)
                if not res['bad']:

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/pptx.py (reported line 207)May include surrounding context.

python
# ---------- 第 3 步 ----------
        print('\n[第 3 步] 输出 300dpi 位图(扫描版)...')
        scan = os.path.join(work, 'scan.pdf')
        okk, msg = __import__('fix').to_raster(keep, scan, dpi=a.dpi)
        if not okk:
            C.die('位图导出失败:%s' % msg)
        shutil.move(keep, out)

Fallback stages deliver both the potentially defective native PDF and the repaired PDF, contradicting the documented non-parallel fallback workflow.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

L005 explicitly states that the stages are fallbacks, not parallel outputs. However, L190–L197 publish both the native PDF and the outlined PDF; L210–L216 repeat this behavior for raster fallback. The native PDF can be the same artifact that failed inspection at L155–L164, yet it is delivered at the primary output path with advice to use it if a phone preview looks normal, undermining the stated delivery-gate purpose.

Content

No source excerpt is available for this finding.

Pages that cannot be inspected are silently skipped, allowing an incomplete audit to pass the delivery gate.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

Exceptions from page.get_texttrace are silently ignored, and the final verdict considers only problems found on successfully inspected pages. An uninspectable page can therefore hide missing glyphs while the audit reports success; the separate font inventory does not replace the promised per-character verification.

Content

No source excerpt is available for this finding.