Back to skill

Security audit

fn-knock MCP Server

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-built for managing a local gateway, but it gives an AI-accessible MCP server broad admin power with weak safety framing and risky secret setup guidance.

Install only if you trust the source of the MCP package and the fn-knock deployment. Use a pinned, audited package or local reviewed source, avoid putting the HMAC secret directly in shell history, prefer a secret manager or tightly permissioned credential file, disable or avoid automatic secret extraction unless you explicitly approve it, and require manual confirmation before route, tunnel, firewall, backup, session, or auth changes.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:18
Finding

Unverified and Unpinned Third-Party Package Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 18-26
Vulnerability Type: Unverified third-party dependencies and unpinned package installation
Risk Level: Medium

bash
pip install mcp requests
# or with uv
uv tool install fn-knock-mcp  # (if published to PyPI)

If installing from source:

bash
cd fn_knock_mcp
pip install -e .

Technical Analysis

The installation instructions retrieve mcp, requests, and potentially fn-knock-mcp without pinning versions or verifying package hashes. The comment stating “if published to PyPI” indicates that the availability and provenance of fn-knock-mcp are not established by the audited project.

The project contains only SKILL.md; it does not include the referenced MCP implementation, package metadata, dependency lockfile, integrity hashes, or source directory. Consequently, the actual behavior of the package installed under the fn-knock-mcp name cannot be compared with the documented behavior.

Python packages can execute code during installation or when the MCP server is started. Because the documented server is expected to receive an HMAC administrator secret and communicate with the fn-knock administrative API, compromise or takeover of any installed package could expose a highly privileged authentication credential.

Attack Path

  1. An attacker publishes, takes over, or compromises one of the referenced registry packages, particularly the unverified fn-knock-mcp package name.
  2. A user follows the documented pip or uv installation command without a pinned version or integrity verification.
  3. The package executes attacker-controlled code during installation, import, or MCP startup.
  4. The malicious code reads FN_KNOCK_HMAC_SECRET, the credentials file, or other files accessible to the current user.
  5. The attacker exfiltrates the secret or directly sends authenticated requests to the local fn-knock administrator API ...[truncated 741 chars]
Remediation
View remediation

Remediation Suggestions

  1. Include the complete MCP implementation and package metadata in the reviewed project so its behavior can be audited.
  2. Remove the speculative fn-knock-mcp registry installation command until the package name, publisher, and canonical distribution location are verified.
  3. Pin all dependencies to reviewed versions and provide a lockfile with cryptographic hashes.
  4. Use hash-enforced installation, such as pip install --require-hashes -r requirements.txt.
  5. Publish and document the canonical source repository and verified package publisher.
  6. Install the MCP server in a dedicated virtual environment under a non-privileged service account.
  7. Perform dependency vulnerability and provenance checks before releases.
  8. Restrict the runtime account so dependency compromise does not provide access to unrelated user files or credentials.

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:34
Finding

Administrator Secret Exposed Through Shell Command Arguments and Environment

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 34-41 and 174-178
Vulnerability Type: Unsafe handling of a privileged HMAC secret
Risk Level: Low

bash
export FN_KNOCK_HMAC_SECRET="your-secret-here"
bash
mkdir -p ~/.config/fn-knock
echo "HMAC_SECRET=your-secret-here" > ~/.config/fn-knock/credentials
chmod 600 ~/.config/fn-knock/credentials
bash
mkdir -p ~/.config/fn-knock
echo "HMAC_SECRET=42e0a9e578284ad8313752293a3079680b377c249e0e3306527442b363a4cd78" \
  > ~/.config/fn-knock/credentials

Technical Analysis

The documentation instructs users to substitute an administrator HMAC secret directly into interactive shell commands. Commands containing the real value may be retained in shell history, terminal logs, session recordings, or troubleshooting output.

Exporting the secret also places it in the shell environment. It will be inherited by child processes unless explicitly removed, increasing the number of processes that can access the credential. A compromised MCP dependency running as the same user would likewise be able to read the environment variable or credentials file.

The credentials-file approach is functionally necessary for persistent authentication, and applying mode 600 is an appropriate least-privilege measure. However, the file is initially created through shell redirection before the subsequent chmod command executes. Its initial permissions depend on the user's current umask, creating a short interval in which it could be more broadly readable than intended. The fixed 64-character value in the later example resembles a usable secret and should be clearly marked as invalid test data to discourage reuse.

Attack Path

  1. A user replaces the placeholder with the real fn-knock administrator secret and runs the documented export or echo command.
  2. The command is retained in shell history, terminal capture, or operational logs; altern ...[truncated 1261 chars]
Remediation
View remediation

Remediation Suggestions

  1. Avoid placing the secret directly in shell command text. Read it without terminal echo:
    bash
    read -rsp "fn-knock HMAC secret: " FN_KNOCK_HMAC_SECRET
    echo
    export FN_KNOCK_HMAC_SECRET
    
  2. For file-based storage, establish restrictive permissions before creating the file:
    bash
    install -d -m 700 ~/.config/fn-knock
    umask 077
    read -rsp "fn-knock HMAC secret: " secret
    echo
    printf 'HMAC_SECRET=%s\n' "$secret" > ~/.config/fn-knock/credentials
    unset secret
    
  3. Prefer an operating-system credential store or a secret manager where supported.
  4. Ensure the MCP process receives only the required credential and does not expose it to unrelated child processes.
  5. Explicitly state that example secret values are invalid placeholders and must never be reused.
  6. Never print, log, or include the secret in diagnostic messages.
  7. Document credential rotation procedures for cases where shell history or environment exposure is suspected.
  8. Restrict automatic secret extraction to loopback addresses, reject redirects, require explicit user consent, and ensure extracted values are never transmitted or logged.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

In addition to file-based persistence, the surrounding context advertises automatic secret extraction from the local fn-knock UI when running on localhost. That combination lowers friction for obtaining and persisting an admin credential, which is risky because the credential can then be reused to perform extensive administrative actions through the MCP server.

Content

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

方式 B — 凭证文件

bash
mkdir -p ~/.config/fn-knock
echo "HMAC_SECRET=your-secret-here" > ~/.config/fn-knock/credentials
chmod 600 ~/.config/fn-knock/credentials

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

In addition to file-based persistence, the surrounding context advertises automatic secret extraction from the local fn-knock UI when running on localhost. That combination lowers friction for obtaining and persisting an admin credential, which is risky because the credential can then be reused to perform extensive administrative actions through the MCP server.

Content

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

方式 B — 凭证文件

bash
mkdir -p ~/.config/fn-knock
echo "HMAC_SECRET=your-secret-here" > ~/.config/fn-knock/credentials
chmod 600 ~/.config/fn-knock/credentials

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

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

Content

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

bash
mkdir -p ~/.config/fn-knock
echo "HMAC_SECRET=your-secret-here" > ~/.config/fn-knock/credentials
chmod 600 ~/.config/fn-knock/credentials

方式 C — 自动检测(仅限本地运行 fn-knock)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This skill exposes numerous high-impact administrative actions including firewall resets, backup import, route changes, tunnel control, session kicking, and security setting modification, but the documentation does not clearly warn users that these operations can disrupt connectivity, weaken defenses, or cause destructive state changes. In an AI-tooling context, lack of explicit safety framing increases the chance that an agent or user invokes dangerous actions without informed confirmation.

Content

No source excerpt is available for this finding.

Rp1

Low
Category
MCP Rug Pull
Confidence
60% confidence
Finding

pip install without ==version installs the latest release, which could include malicious changes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Several setup instructions are presented only in Chinese within an otherwise English README, which creates a language/locale policy issue because users are not offered a language choice or opt-in. SQP-3 applies to natural-language content in any file type when the skill forces a specific language without user choice.

Content

No source excerpt is available for this finding.