Back to skill

Security audit

fanqie-novel-publisher

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real Fanqie Novel publishing tool, but it needs Review because it stores account session cookies locally and uses high-impact browser automation without enough containment.

Install only if you are comfortable giving this skill access to local chapter manuscripts and authority over a Fanqie author session. Run it as a normal unprivileged user, prefer the interactive draft workflow, review content before publishing, protect or delete fanqie_cookies.json after use, and watch for generated screenshot files that may contain private manuscript or account data.

Vulnerability Patterns
  • 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
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/browser.py:92
Finding

Authentication Cookies Are Stored in an Unprotected Plaintext File

Content
View full analysis

Vulnerability Details

File Location: scripts/browser.py:92-97
Vulnerability Type: Plaintext storage of reusable session credentials
Risk Level: High

python
def save_cookies(self):
    """Save cookies to a file."""
    cookies = self.context.cookies()
    with open(self.cookie_path, 'w', encoding='utf-8') as f:
        json.dump(cookies, f, ensure_ascii=False, indent=2)
    print(f"[Cookie] Saved to {self.cookie_path}")

The cookie path is derived from a fixed filename in the script directory:

python
def __init__(self):
    self.cookie_path = Path(__file__).parent / COOKIE_FILE

Technical Analysis

After a successful login, the application retrieves every cookie from the active browser context and serializes the complete collection to scripts/fanqie_cookies.json. Browser session cookies are authentication credentials that can permit account access without knowledge of the account password.

The file is created using the process's default permissions. The code does not:

  • Encrypt the stored credentials.
  • Use an operating-system credential vault.
  • Explicitly restrict the file to the current user.
  • Validate the permissions of an existing cookie file.
  • Prevent the cookie file from being included in backups or source-control archives.
  • Remove expired credentials automatically.

The documentation states that cookies may remain valid for approximately 24 hours. Therefore, the exposure window is long enough for copied credentials to be reused.

Attack Path

  1. A user runs the login workflow and authenticates through the browser.
  2. scripts/login.py:47-48 calls self.browser.save_cookies().
  3. The complete authenticated cookie collection is written in plaintext to scripts/fanqie_cookies.json.
  4. Another local user, compromised process, backup service, synchronization client, or accidentally published project archive obtains the file.
  5. The attacker import ...[truncated 736 chars]
Remediation
View remediation

Remediation Suggestions

  1. Store session credentials in an operating-system credential manager, such as Windows Credential Manager, macOS Keychain, or a Linux Secret Service implementation.
  2. If file-based storage is unavoidable, encrypt the cookie data with a key that is not stored beside the encrypted file.
  3. Create the file atomically with owner-only permissions, such as mode 0600 on POSIX systems.
  4. Before reading an existing file, reject symbolic links, verify file ownership, and reject group- or world-readable permissions.
  5. Store credentials in a dedicated private application-data directory rather than the source tree.
  6. Add the credential filename to .gitignore and applicable backup or synchronization exclusions.
  7. Delete the file when the session expires and retain the existing deletion behavior on logout.
  8. Consider using Playwright storage state only if it receives the same encryption and permission protections, because storage-state files also contain reusable credentials.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/browser.py:41
Finding

Chromium Security Sandbox Is Explicitly Disabled

Content
View full analysis

Vulnerability Details

File Location: scripts/browser.py:41-49
Vulnerability Type: Unsafe browser security configuration
Risk Level: Medium

python
_browser_instance = self.playwright.chromium.launch(
    headless=BROWSER_CONFIG["headless"],
    slow_mo=BROWSER_CONFIG["slow_mo"],
    args=[
        '--disable-blink-features=AutomationControlled',
        '--disable-infobars',
        '--no-sandbox',
    ]
)

Technical Analysis

The application always starts Chromium with the --no-sandbox argument. The Chromium sandbox is an important defense-in-depth boundary that restricts the privileges and host resources available to browser renderer processes.

The browser loads remote content from https://fanqienovel.com. Even when the primary domain is trusted, pages may include remotely hosted scripts and other third-party resources. Disabling sandboxing increases the consequences of a browser-engine or renderer vulnerability because malicious content may have fewer containment boundaries to overcome.

Disabling the sandbox is not required by the declared chapter-publishing functionality. The additional automation-evasion arguments do not compensate for the missing isolation.

Attack Path

  1. The user invokes a workflow that starts the Playwright Chromium instance.
  2. Chromium is launched with --no-sandbox.
  3. The browser visits Fanqie pages and processes remote HTML, JavaScript, images, fonts, and potentially third-party resources.
  4. A compromised resource or malicious page triggers a vulnerability in the browser engine.
  5. Because Chromium's sandbox has been disabled, the compromised browser process has a weaker isolation boundary.
  6. The exploit may access resources available to the application account, including local chapter manuscripts and the plaintext session-cookie file.

Exploitation requires a compatible browser vulnerability or another compromise of content loaded by the ...[truncated 550 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the --no-sandbox argument and run Chromium with its normal sandbox enabled.
  2. Run the Skill as a dedicated, unprivileged operating-system user.
  3. Never execute the publisher as root or an administrator.
  4. If a deployment environment cannot support Chromium sandboxing, run the complete application in a strongly isolated container or virtual machine.
  5. In a containerized deployment, use a read-only root filesystem, narrowly scoped file mounts, dropped Linux capabilities, a non-root user, and appropriate seccomp or equivalent controls.
  6. Keep Playwright and its managed browser binaries patched to supported security versions.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/publisher.py:139
Finding

Diagnostic Screenshots May Persist Sensitive Author and Manuscript Data

Content
View full analysis

Vulnerability Details

File Location: scripts/publisher.py:139-144
Additional Locations: scripts/publisher.py:374-380, scripts/publisher.py:456-465, and scripts/works.py:317-322
Vulnerability Type: Insecure persistence of potentially sensitive diagnostic data
Risk Level: Low

Representative vulnerable error handling:

python
except Exception as e:
    result["message"] = f"Publishing error: {str(e)}"
    print(f"[Publish] Error: {e}")
    self.browser.page.screenshot(path="publish_error.png")

Other persistent screenshot operations include:

python
self.browser.page.screenshot(path="confirm_final.png")
self.browser.page.screenshot(path="confirm_error.png")
self.browser.page.screenshot(path="draft_final.png")
self.browser.page.screenshot(path="draft_no_button.png")
self.browser.page.screenshot(path="draft_error.png")
self.browser.page.screenshot(path="debug_create_chapter.png")

Technical Analysis

Error and ambiguous-result paths capture the complete browser viewport and write it to predictable filenames in the current working directory. At the time of capture, the browser may display:

  • Unpublished manuscript content.
  • Work titles and identifiers.
  • Account or dashboard information.
  • Publication status and moderation messages.
  • Other data visible in the author portal.

The screenshots use default filesystem permissions and are not deleted automatically. The code does not request diagnostic consent, redact sensitive page regions, use a private temporary directory, or define a retention period.

Predictable filenames also cause later screenshots to overwrite earlier ones, which can complicate incident handling and diagnostic integrity, although the primary security concern is unauthorized disclosure.

Attack Path

  1. A publishing, draft-saving, or work-navigation operation fails or produces an uncertain result.
  2. The application captures the enti ...[truncated 798 chars]
Remediation
View remediation

Remediation Suggestions

  1. Obtain explicit user consent before retaining diagnostic screenshots.
  2. Disable screenshot collection by default and expose it through an opt-in debugging setting.
  3. Capture only the relevant non-sensitive page region rather than the complete viewport.
  4. Redact manuscript text, work identifiers, account information, and other sensitive elements before saving.
  5. Store diagnostics in a dedicated private temporary directory with directory mode 0700 and file mode 0600 on POSIX systems.
  6. Generate collision-resistant filenames and prevent symbolic-link following.
  7. Automatically delete screenshots after a short retention period or when the process exits.
  8. Exclude diagnostic images from source control, backups, and synchronization services.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

This duplicate finding points to the same underlying issue: the subprocess launches clip through the shell for no clear reason. Even without immediate exploitability from the current code, this is an unsafe primitive that increases attack surface and future maintenance risk.

Content

Scanner excerpt · scripts/publisher.py (reported line 279)May include surrounding context.

python
elif system == "Windows":
                # Windows 使用 clip 命令,需要 utf-16le 编码
                proc = subprocess.Popen(['clip'], stdin=subprocess.PIPE, shell=True)
                proc.communicate(text.encode('utf-16le'))
                return True

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

This duplicate finding points to the same underlying issue: the subprocess launches clip through the shell for no clear reason. Even without immediate exploitability from the current code, this is an unsafe primitive that increases attack surface and future maintenance risk.

Content

Scanner excerpt · scripts/publisher.py (reported line 279)May include surrounding context.

python
elif system == "Windows":
                # Windows 使用 clip 命令,需要 utf-16le 编码
                proc = subprocess.Popen(['clip'], stdin=subprocess.PIPE, shell=True)
                proc.communicate(text.encode('utf-16le'))
                return True

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents and encourages operations requiring file access, network access, and shell execution, but it does not declare any explicit tool scope or permission boundaries. This creates an authorization ambiguity where an agent may invoke broader capabilities than intended, increasing the risk of unintended file access, credential exposure, or automated publishing actions against an external platform.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrases include broad terms like '发布章节' and '番茄登录', which are generic enough to match routine user requests and may cause the skill to activate unintentionally. Because this skill performs sensitive actions such as login automation and content publishing, accidental invocation could lead to unintended account actions, draft creation, or live publication.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language descriptions and user-facing console messages in Chinese, starting with the module docstring, and nowhere indicates that the skill is region-specific or that users may choose another language. Per the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Launching Chromium with --disable-blink-features=AutomationControlled and --disable-infobars is automation-evasion behavior beyond what is necessary for chapter publishing. In the context of automating a third-party writer backend, these flags can help conceal bot activity from platform defenses and facilitate unauthorized or policy-violating automation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code injects an init script to hide navigator.webdriver, which is a clear anti-detection technique unrelated to the core business need of publishing chapters. In a browser automation skill that logs into a third-party platform, this increases the likelihood of bypassing platform bot-detection and violating site controls, making the automation harder to audit and easier to repurpose for stealthy abuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and the entire interactive flow are written exclusively in Chinese and describe a fixed Chinese-language user experience. There is no indication that the user can choose another language or that the locale restriction is explicitly justified in this file, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The natural-language documentation and user-facing strings are entirely in Chinese and present the skill as operating in that language by default, with no opt-in or alternative locale described. Under the stated policy, forcing a specific language without user choice is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code performs state-changing remote actions (publish or save draft) immediately once called, without an explicit final user confirmation step inside the skill. In automation contexts, this increases the risk of accidental or unauthorized publication if upstream tooling invokes the function with wrong parameters or if the user did not intend the final action.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes a browser-based tool for logging in, viewing works, and publishing or drafting chapters on 番茄小说. This code additionally launches platform-specific system commands like pbcopy, clip, xclip, and xsel to write arbitrary chapter text into the host machine's clipboard, which is an OS-level capability not mentioned in the skill purpose. While used to support pasting into the editor, it affects global system state outside the target platform.

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

python
try:
            if system == "Darwin":  # macOS
                proc = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)
                proc.communicate(text.encode('utf-8'))
                return True

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

This subprocess call uses shell=True on Windows, which unnecessarily routes execution through the shell even though only clip is being invoked. While the current command is static, use of the shell broadens execution semantics and increases risk if the code is later modified or if environment/path handling is compromised; it is an unsafe pattern for a skill that handles user-supplied chapter content and runs on the host OS.

Content

Scanner excerpt · scripts/publisher.py (reported line 279)May include surrounding context.

python
elif system == "Windows":
                # Windows 使用 clip 命令,需要 utf-16le 编码
                proc = subprocess.Popen(['clip'], stdin=subprocess.PIPE, shell=True)
                proc.communicate(text.encode('utf-16le'))
                return 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/publisher.py (reported line 286)May include surrounding context.

python
elif system == "Linux":
                # Linux 优先尝试 xclip,其次 xsel
                try:
                    proc = subprocess.Popen(['xclip', '-selection', 'clipboard'], 
                                          stdin=subprocess.PIPE)
                    proc.communicate(text.encode('utf-8'))
                    return 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/publisher.py (reported line 293)May include surrounding context.

python
except FileNotFoundError:
                    # xclip 不可用,尝试 xsel
                    try:
                        proc = subprocess.Popen(['xsel', '--clipboard', '--input'], 
                                              stdin=subprocess.PIPE)
                        proc.communicate(text.encode('utf-8'))
                        return True

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

python
return True
                    except FileNotFoundError:
                        print("[剪贴板] 错误: 请安装 xclip 或 xsel")
                        print("  Ubuntu/Debian: sudo apt install xclip")
                        print("  Arch Linux: sudo pacman -S xclip")
                        print("  Fedora: sudo dnf install xclip")
                        return False

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

python
return True
                    except FileNotFoundError:
                        print("[剪贴板] 错误: 请安装 xclip 或 xsel")
                        print("  Ubuntu/Debian: sudo apt install xclip")
                        print("  Arch Linux: sudo pacman -S xclip")
                        print("  Fedora: sudo dnf install xclip")
                        return False

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

python
return True
                    except FileNotFoundError:
                        print("[剪贴板] 错误: 请安装 xclip 或 xsel")
                        print("  Ubuntu/Debian: sudo apt install xclip")
                        print("  Arch Linux: sudo pacman -S xclip")
                        print("  Fedora: sudo dnf install xclip")
                        return False

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
88% confidence
Finding

The file’s natural-language description and user-facing strings are entirely in Chinese, including operational guidance such as login instructions. Under the policy rule, forcing a specific language without offering a user choice or documenting a justified locale constraint is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code hard-codes Chinese UI text in selectors such as '登录', '工作台', '创建章节', and '定时发布', which means the skill appears to only function in a Chinese locale. The file does not offer any user opt-in or fallback for other languages, and no justification for the locale restriction is documented here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code contains natural-language strings and documentation that assume a Chinese-speaking user, starting with the module description and continuing throughout prompts and status messages. Under the policy, forcing a specific language without user opt-in can be a locale policy violation when no alternative or justification is provided.

Content

No source excerpt is available for this finding.