Back to skill

Security audit

persian-documents

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Persian document-generation helper with local DOCX/PDF/validation scripts and no evidence of hidden, persistent, destructive, or exfiltrating behavior.

Install this if you specifically need Persian/RTL document generation. Review output paths and config files before running the scripts, and treat PDF content as document input you trust because the PDF generator builds HTML from provided text.

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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (42)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The manifest promises document generation, regeneration, and RTL fixing, but the described implementation does not clearly provide those capabilities and may only validate content. This mismatch can mislead an agent into taking actions or making guarantees it cannot actually fulfill, which is dangerous when handling user documents and file outputs.

Content

No source excerpt is available for this finding.

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

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

md
---
name: persian-documents
description: Generate production-quality Persian documents with correct RTL layout, bidirectional text handling, and professional typography. Use this skill whenever the user asks to create Persian documents — reports, letters, articles, technical documentation, PDFs, Word documents, or any document containing Persian text mixed with English, numbers, code, URLs, or other LTR content. Also trigger when the user asks to "fix RTL" or "fix direction" in a Persian document, or when a document needs to be regenerated because Persian text rendered incorrectly. This skill is NOT just for writing Pe

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

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

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

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

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · agents/grader.md (reported line 79)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/document-patterns.md (reported line 141)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/document-patterns.md (reported line 166)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/document-patterns.md (reported line 176)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/document-patterns.md (reported line 177)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/persian-typography.md (reported line 29)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/persian-typography.md (reported line 30)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/persian-typography.md (reported line 32)May include surrounding context.

md
ZWNJ (U+200C) is used to prevent two characters from joining. Meaningful uses in Persian:

- **Verb prefixes**: می‌خواهم (I want), می‌شود (becomes), می‌توانم (I can)
- **Compound words**: کتاب‌ها (books), خانه‌ها (houses)
- **After certain particles**: از او، با او، در او
- **Before certain suffixes**: نمی‌روم، نمی‌خوانم

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/generate_docx.py (reported line 458)May include surrounding context.

python
F demonstrating all features."""
    gen = PersianPDFGenerator(
        title="گزارش نمونه — تولید سند فارسی",
        output_path=output_path
    )

    # Title
    gen.add_title("گزارش نمونه تولید سند فارسی")

    # Mixed content paragraph
    gen.add_paragraph(
        "نسخه Next.js 16.0.7 منتشر شد. این نسخه شامل قابلیت‌های جدید متعددی است.",
        mixed_parts=[
            {'text': 'نسخه ', 'type': 'persian'},
            {'text': 'Next.js', 'type': 'latin'},
            {'text': ' 16.0.7 منتشر شد. این نسخه شامل قابلیت‌های جدید متعددی است.', 'type': 'persian'},
        ]
    )

    # Technical content
    gen.add_paragraph(
        "دستور نصب: npm install @tanstack/react-query",
        mixed_parts=[
            {'text': 'دستور نصب: ', 'type': 'persian'},
            {'text': 'npm install @tanstack/react-query', 'type': 'mono'

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/generate_pdf.py (reported line 323)May include surrounding context.

python
F demonstrating all features."""
    gen = PersianPDFGenerator(
        title="گزارش نمونه — تولید سند فارسی",
        output_path=output_path
    )

    # Title
    gen.add_title("گزارش نمونه تولید سند فارسی")

    # Mixed content paragraph
    gen.add_paragraph(
        "نسخه Next.js 16.0.7 منتشر شد. این نسخه شامل قابلیت‌های جدید متعددی است.",
        mixed_parts=[
            {'text': 'نسخه ', 'type': 'persian'},
            {'text': 'Next.js', 'type': 'latin'},
            {'text': ' 16.0.7 منتشر شد. این نسخه شامل قابلیت‌های جدید متعددی است.', 'type': 'persian'},
        ]
    )

    # Technical content
    gen.add_paragraph(
        "دستور نصب: npm install @tanstack/react-query",
        mixed_parts=[
            {'text': 'دستور نصب: ', 'type': 'persian'},
            {'text': 'npm install @tanstack/react-query', 'type': 'mono'

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/generate_docx.py (reported line 515)May include surrounding context.

python
gen.add_ordered_list([
        'نصب Node.js نسخه 20.11.0 یا بالاتر',
        'اجرای دستور npm install',
        'تنظیم فایل محیط .env',
        'اجرای دستور npm run dev',
    ])

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/generate_pdf.py (reported line 380)May include surrounding context.

python
gen.add_ordered_list([
        'نصب Node.js نسخه 20.11.0 یا بالاتر',
        'اجرای دستور npm install',
        'تنظیم فایل محیط .env',
        'اجرای دستور npm run dev',
    ])

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/validate_doc.py (reported line 41)May include surrounding context.

python
ect page breaks
- Broken spacing
- Corrupted ZWNJ usage
"""

import argparse
import re
import sys
from typing import List, Dict, Tuple, Optional
from pathlib import Path


# Unicode ranges for Persian/Arabic script
PERSIAN_RANGE = re.compile(r'[؀-ۿݐ-ݿࢠ-ࣿﭐ-﷿ﹰ-]')
LATIN_RANGE = re.compile(r'[A-Za-z]')
DIGIT_PERSIAN = re.compile(r'[۰-۹]')
DIGIT_LATIN = re.compile(r'[0-9]')
ZWNJ = '‌'
ZWSP = '​'
LRM = '‎'
RLM = '‏'


class PersianDocValidator:
    """Validates Persian documents for RTL correctness."""

    def __init__(self):
        self.issues: List[Dict] = []
        self.warnings: List[Dict] = []

    def validate_text(self, text: str, context: str = "") -> Dict:
        """Validate a text string for RTL correctness.

        Returns a dict with:
        - valid: bool (True if no issues)
        - issues: list of found issues
        - warnings: list of warnings
        """
        self.issues = []
        self.warnings = []

        self._check_reversed_engl

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description states that the skill generates Persian documents, which is a language-specific constraint expressed in natural language. The file does not indicate that users can choose another language or explicitly opt into this locale restriction, so it may violate the language/locale policy.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill references local scripts that imply file read/write behavior, but it does not declare any explicit tool scope or permissions boundary. In an agent environment, undeclared capabilities increase the chance of overbroad file access or unsafe execution assumptions, making the skill harder to sandbox and review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description instructs the skill to be used whenever the user asks to create Persian documents and frames the skill around producing Persian output, but it does not mention confirming the user's preferred language or locale. This is a natural-language locale policy issue because it forces a specific language behavior rather than explicitly offering a choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The title explicitly scopes the skill to a 'Persian Document Generator,' which imposes a specific language/locale context. The file does not indicate that users can choose another language or opt into this locale restriction, so it appears to enforce a language-specific policy by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file frames the task as evaluating a "Persian document generation" output and requires RTL correctness as the baseline. This effectively enforces a specific language/locale behavior in the skill instructions without mentioning user selection, opt-in, or a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file repeatedly defines prompts and expected outputs that require documents to be generated in Persian, with Persian typography and RTL formatting. Because this natural-language constraint appears as a blanket language requirement and does not offer user opt-in or explain a region-specific compliance need, it matches the locale/language policy violation criteria.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · evals/evals.json (reported line 14)May include surrounding context.

json
{
      "id": 2,
      "eval_name": "persian_formal_letter",
      "prompt": "Generate a formal Persian business letter (نامه رسمی) with the following structure:\n\n- Sender: شرکت فناوری نوین، تهران\n- Date: ۱۴۰۵/۰۷/۱۴\n- Recipient: مدیرعامل شرکت\n- Subject: درخواست همکاری فنی\n- Body: 3-4 paragraphs discussing a technical partnership, mentioning API endpoints like https://api.partner.com/v2/connect and version numbers like v3.2.1\n- Closing: با احترام\n- Signature: تیم فنی\n\nThe letter must have correct RTL layout, proper formal Persian tone, and mixed technical content (URLs, version numbers) rendered correctly.",
      "expected_output": "A .docx file with:\n- Formal Persian letter structure\n- RTL direction throughout\n- Persian date format (۱۴۰۵/۰۷/۱۴)\n- URLs intact and readable\n- Version numbers correct (v3.2.1)\n- Professional typography\n- Correct signature block alignment",
      "files": []
    },

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file specifies 'Persian calendar preferred' and 'formal Persian prose' as default requirements for letter generation, which imposes a specific language/locale choice in natural-language guidance. Because the document does not present this as optional, user-selected, or limited to a clearly region-specific context, it conflicts with the policy against forcing a locale without opt-in.

Content

No source excerpt is available for this finding.