Back to skill

Security audit

thu-thesis

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real thesis-conversion tool, but it has review-worthy risks from mutable remote template downloads, unsandboxed LaTeX compilation of user-controlled content, and packaged thesis data containing personal information.

Review before installing. Use only with thesis documents you are comfortable having the agent read and rewrite. Run setup and conversion in a contained workspace, avoid untrusted DOCX files, do not keep private theses or real student data in published packages, and prefer a pinned thuthesis release plus sandboxed TeX compilation.

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 (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/setup.sh:52
Finding

Mutable Remote Source Is Retrieved and Processed Without Integrity Verification

Content
View full analysis
/dev/null 2>&1) fi ``` The retrieved files are subsequently copied into generated projects by `scripts/render.py:977-1003` and processed again during compilation: ```python _candidates = [ os.environ.get('THUTHESIS_DIR', ''), '/tmp/thuthesis-latest', str(Path(__file__).parent.parent / 'thuthesis'), ] for f in cls_files: src = src_base / f if src.exists(): shutil.copy2(src, output_dir / f) ``` ### Technical Analysis The setup process retrieves the current state of a mutable Git branch using either `git pull` or a shallow `git clone`. It does not pin an audited commit, verify a release signature, compare a cryptographic digest, or validate the downloaded file set. The downloaded `thuthesis.ins` file is then directly processed by XeLaTeX. Generated class, bibliography, and style files are copied into user projects and loaded during later XeLaTeX or BibTeX executions. This creates a remote payload execution channel whose effective contents may change after the Skill package itself has been reviewed. HTTPS protects transport integrity but does not protect against compromise of the upstream repository, maintainer account, release workflow, or an unexpected upstream change. ### Attack Path 1. An attacker compromises the upstream repository, a maintainer account, or its delivery workflow. 2. The attacker modifies `thuthesis.ins`, a cla ...[truncated 1255 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render.py:420
Finding

Insufficient LaTeX Escaping Allows Command Injection Through Document Metadata

Content
View full analysis
str: if not text: return '' for char, replacement in [('&', r'\&'), ('%', r'\%'), ('#', r'\#')]: text = text.replace(char, replacement) return text ``` Untrusted chapter titles, section titles, and figure captions are passed through this incomplete function: ```python title = escape_meta(chap.get('title', '')) blocks.append({ 'type': 'heading', 'level': item.get('level', 2), 'title': escape_meta(strip_section_number(item.get('title', ''))), }) blocks.append({ 'type': 'figure', 'path': fig_filename, 'caption': escape_meta(cap_clean), 'label': label, }) ``` The generated TeX is then executed: ```python result = subprocess.run( ['xelatex', '-interaction=nonstopmode', 'thesis.tex'], cwd=latex_dir, env=env, capture_output=True, text=True ) ``` ### Technical Analysis Document titles, section headings, and captions originate from the supplied DOCX and parsed JSON. The `escape_meta` function escapes ampersands, percent signs, and hash signs, but leaves TeX control characters and syntax intact, including: - Backslashes used to begin commands. - Opening and closing braces used to construct arguments. - Dollar signs used to enter math mode. - Carets and underscores with special TeX meaning. - Other command-building syntax accepted by the active TeX engine and loaded packages. As a result, attacker-controlled metadata can escape its intended textual context and inject TeX commands into generated `.tex` files. The stronger `escape_latex` function is used for most body text, but it is not consistently applied to metadata ...[truncated 1990 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
output/parsed_2023211612-王亚玲-论文.json:1438
Finding

Generated Artifacts Disclose Personally Identifiable Student Information

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (31)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

Using 'rm -rf assets/databk/' in setup is a destructive file operation that can permanently delete data if path handling is wrong, if the script runs from an unexpected location, or if users have placed important files there. Because the skill also instructs users to pass directory paths into setup, any implementation mistake or path confusion increases the blast radius of deletion.

Content

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

md
`setup.sh` 做三件事:
1. 从 GitHub clone(首次)或 `git pull`(已有)最新 [thuthesis](https://github.com/tuna/thuthesis) 到 `/tmp/thuthesis-latest`
2. 编译生成 `thuthesis.cls`(如尚未生成)
3. **`rm -rf assets/databk/ && cp -r data/ assets/databk/`** → 保持格式参考始终为最新版本

**每次 thuthesis 版本有重大更新时,重跑 `setup.sh` 即可刷新 databk。**

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/convert.py (reported line 158)May include surrounding context.

python
else:
        extra_path = ''

    env = os.environ.copy()
    if extra_path:
        env['PATH'] = extra_path + ':' + env.get('PATH', '')

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill explicitly assigns AI to read thesis structure, inspect generated artifacts, and automatically modify LaTeX files, but it does not clearly warn users that thesis contents may be sent to an AI system for analysis and rewriting. For academic theses, this can expose unpublished research, personal data, and confidential content without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented setup step performs destructive replacement of a project directory using 'rm -rf assets/databk/' followed by copying new data, but there is no explicit warning about deletion or backup expectations. This can cause silent loss of local modifications or trusted reference material if the user has customized that directory.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire report is presented only in Chinese, including headings, warnings, and remediation text, with no indication that the user can choose another language or that the file is limited to a Chinese-only audience. The policy specifically flags language or locale constraints when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The natural-language sections for acknowledgements and resume are presented only in Chinese, while the file otherwise includes bilingual metadata and abstracts. This creates a locale inconsistency that appears to assume a Chinese-language audience without offering any language choice or documenting why a Chinese-only constraint is required.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The resume field is written entirely in Chinese and presents biographical content without any indication that the skill or output supports user language choice. For a general JSON content file, this can violate the language/locale policy because it implicitly fixes one language without opt-in or documented region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file includes a personal resume containing a full birth date and birthplace, which are sensitive personal identifiers and unnecessary for the apparent purpose of the skill content. If exposed or reused, this data can enable profiling, identity verification abuse, or facilitate social engineering against the individual.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

This JSON skill file contains major natural-language fields such as acknowledgements and resume only in Chinese, and the overall document content is primarily Chinese. For a general-purpose skill artifact, this imposes a language constraint without offering user opt-in or documenting that the skill is intended solely for a Chinese-language or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This JSON structure uses Chinese-only chapter numbers and titles such as "第1章", "引言", and other Chinese labels across the schema content. Because SQP-3 applies to all file types and flags language or locale policy violations, this appears to impose a specific language without any visible opt-in or justification in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python file contains its primary docstring, usage instructions, and many user-facing status messages entirely in Chinese, which imposes a specific language on users. The file does not offer an opt-in language selection or explain that the skill is intentionally limited to a Chinese-only/regional context, so it falls under the language/locale policy concern.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
83% confidence
Finding

Although the subprocess call itself avoids shell injection, it compiles attacker-influenced LaTeX using xelatex, which can be dangerous in document-conversion pipelines. If untrusted document content reaches generated .tex files without strict escaping, TeX primitives or package features may enable file disclosure, unwanted file writes, or command execution depending on engine settings and environment.

Content

Scanner excerpt · scripts/convert.py (reported line 163)May include surrounding context.

python
env['PATH'] = extra_path + ':' + env.get('PATH', '')

    def xelatex():
        result = subprocess.run(
            ['xelatex', '-interaction=nonstopmode', 'thesis.tex'],
            cwd=latex_dir, env=env,
            capture_output=True, text=True

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/convert.py (reported line 183)May include surrounding context.

python
xelatex()

    print('   运行 bibtex...')
    subprocess.run(['bibtex', 'thesis'], cwd=latex_dir, env=env,
                   capture_output=True, text=True)

    print('   第 2 次编译(写入参考文献)...')

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/convert.py (reported line 235)May include surrounding context.

python
print(f'{"="*60}\n')

    print('【Step 1】机械提取 Word 文档...')
    result = subprocess.run(
        [sys.executable, str(scripts_dir / 'extract_raw.py'), str(docx_path), str(output_dir)],
        capture_output=False
    )

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/convert.py (reported line 333)May include surrounding context.

python
# Step 3: build_parsed
    print('【Step 3】组装 parsed JSON...')
    result = subprocess.run(
        [sys.executable, str(scripts_dir / 'build_parsed.py'),
         str(raw_path), str(struct_path), str(output_dir)],
        capture_output=False

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/convert.py (reported line 352)May include surrounding context.

python
# Step 4: render
    print('\n【Step 4】渲染 LaTeX 项目...')
    result = subprocess.run(
        [sys.executable, str(scripts_dir / 'render.py'), str(parsed_path), str(latex_dir)],
        capture_output=False
    )

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/convert.py (reported line 385)May include surrounding context.

python
import platform
    if platform.system() == 'Darwin':
        subprocess.run(['open', str(pdf_path)], check=False)


# ── 入口 ──────────────────────────────────────────────────────────────────────

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring describes a mechanical raw export of existing .docx contents and says it performs no understanding or judgment. However, the implementation parses chart XML and synthesizes PNG files via matplotlib, which is a transformation/reconstruction step rather than exporting content verbatim. This is an active contradiction in documented intent versus behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The top-level docstring presents the skill's purpose and output description entirely in Chinese, indicating a fixed language/locale expectation for users and operators. Under the stated policy, language constraints should be optional or explicitly justified; this file does not offer opt-in or explain a region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The user-facing docstring and command description are presented only in Chinese, which effectively forces a specific language for understanding and use. Under the language/locale policy, this is a natural-language constraint without opt-in or justification that the tool is intended exclusively for a Chinese-only audience.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code creates directories and writes many files such as thusetup.tex, chapter files, bibliography files, and placeholders into the user-supplied output path. Although the behavior is central to rendering, the script lacks any explicit disclosure in its top-level docstring or startup messaging that running it will populate and potentially overwrite contents in the target directory.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The workflow creates a new '-latex' directory adjacent to the source thesis and later modifies files inside it, but the skill does not clearly warn users that local filesystem changes will occur near their original document. This is less severe than direct overwrite, but it still risks confusion, accidental disclosure through predictable output placement, or interference with existing directories of the same name.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

This JSON file is a manifest-like text file, so vague-trigger checks apply. The abstract broadly describes many capabilities and use contexts for the platform without any explicit activation boundaries, negative examples, or constrained trigger phrases, which could make invocation scope ambiguous if this file is used as descriptive metadata for a skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

This JSON file is a manifest-like content file, so natural-language policy checks apply. The primary title is provided only in Chinese while the English title field is empty, which can indicate a language/locale constraint without any visible opt-in or justification in the file.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.