T07 · Tool Hijacking and Spoofing
- Location
scripts/register_mcporter.sh:4- Finding
Registration Wrapper Executes an Unverified Script Outside the Audited Project
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches a Baidu Netdisk MCP integration, but its registration path delegates to an unaudited outside script and its URL-upload feature has a credible internal-network request risk.
Review this before installing. Only use it with a Baidu token you are comfortable granting file-management access, avoid running the packaged registration wrapper until the missing/out-of-package installer script is resolved, and treat URL upload as risky unless the SSRF validation is fixed or restricted to trusted domains.
scripts/register_mcporter.sh:4Registration Wrapper Executes an Unverified Script Outside the Audited Project
server/netdisk.py:1084DNS-Rebinding Race Bypasses URL Upload SSRF Validation
server/pyproject.toml:6Runtime Dependencies Are Open-Ended and Not Integrity-Locked
Most of the description matches the code well: it is indeed a stdio MCP server for Baidu Netdisk, uses hot-reload-friendly credential loading on every tool call, falls back to a default credential file and environment variables, and exposes a broad official/legacy tool surface. The mismatch is that the description presents the toolset as available Netdisk operations, including official 2.0 tools and legacy aliases, but several named capabilities are not actually implemented. Specifically, file_semantics_search and file_sharelink_set return unsupported placeholders, and download returns a TODO response rather than performing downloads. This is a material description-versus-behavior gap for those capabilities, even though the primary purpose is otherwise accurately represented.
The declared description describes a concrete integration for Baidu Netdisk with MCP/stdIO server behavior and token-file credential management. The actual code shown is only a placeholder init.py with comments about import behavior and memory usage. It does not implement or expose the described functionality. Based on this chunk alone, the code's behavior does not match the declared purpose.
The declared description describes a functional integration for Baidu Netdisk operations with specific authentication and server behavior. The supplied code chunk does not implement any of that. It is only a placeholder/comment-only init.py file discussing import structure for model classes. This is a materially different purpose and lacks the described capabilities, so the description does not accurately represent the provided code chunk.
The declared description presents a full skill for interacting with Baidu Netdisk via an MCP server using token-file-based credentials. The supplied code chunk does not implement server behavior, file-based credential loading, hot reloading, or any Netdisk operations. Instead, it is a generated Python data model for an OAuth token response schema. While OAuth tokens are related to authentication and may be a supporting component of a Netdisk integration, this specific chunk's actual purpose is much narrower and materially different from the declared end-user functionality. Therefore, this is a description/behavior mismatch for the supplied code chunk.
The declared description presents a full skill for interacting with Baidu Netdisk via an MCP server and managing token-file credentials. The supplied code chunk is only an auto-generated OpenAPI model representing a quota response object. It stores typed fields and supports object construction/deserialization, but does not implement the described operational behavior. This is a material mismatch in primary purpose and capabilities, not merely an internal supporting detail.
This code chunk is infrastructure for OpenAPI client models, not a Baidu Netdisk skill implementation. It defines base model classes, schema composition/discriminator logic, validation helpers, primitive/model deserialization, and file deserialization to a temp file. While such utilities could support an API client somewhere else in the project, this chunk itself does not perform or expose the declared skill purpose. The only resource access shown is local temp-file creation for deserialized file responses, which is incidental and unrelated to the stated hot-reload token credential mechanism. Therefore the description does not accurately represent what this supplied code chunk actually does.
The declared description presents a full Baidu Netdisk MCP server with stdio transport and hot-reload token-file credential support for operational use. The supplied code chunk instead is a minimal test/self-check script. It writes a temporary token file, overrides urlopen with a fake responder, calls a few netdisk helper functions, asserts expected outputs, and prints PASS/results. While it is related to Baidu Netdisk and token-file usage, its primary purpose is verification of readonly helper behavior, not serving MCP requests or providing the described toolset. That is a material description-behavior mismatch.
The declared description says the skill provides Baidu Netdisk access via a stdio MCP server using hot-reload token file credentials. The supplied code instead is a standalone self-check script focused on testing the netdisk library's behavior: simulated rate-limit retries, pagination parameter echoing, has_more handling, and rejection of '..' path traversal. Although it does use a temporary token file and references Baidu Netdisk-related functions, those are used only in a mocked test context. The primary purpose and behavior of this chunk are therefore materially different from the declared operational server capability.
The declared description says the skill is for operating Baidu Netdisk via an MCP stdio server using token-file credentials. The supplied code chunk does not implement such a server or actual Netdisk functionality. Instead, it is a standalone validation script that monkeypatches the netdisk client with fake classes, writes a temporary dummy access token, runs search/doclist wrapper calls, verifies argument propagation and default has_more behavior, and prints a self-check result. While it is related to Netdisk and token-file configuration in a supporting/testing sense, its primary purpose is materially different from the declared runtime skill behavior.
The skill declares operational steps that read a local credential file, invoke external commands, and perform networked Baidu Netdisk actions, but it does not declare any explicit tool scope such as permissions or allowed-tools. In an agent environment, missing scope boundaries increases the chance of over-broad execution, unintended file access, and network use beyond what a reviewer expects.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
except CredentialError as exc:
return _error(str(exc))
except Exception as exc:
return _error(f"mkdir 执行失败: {exc}")
@mcp.tool()
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
except CredentialError as exc:
return _error(str(exc))
except Exception as exc:
return _error(f"mkdir 执行失败: {exc}")
@mcp.tool()
This code file defines tools that can move and rename files or directories in a user's Netdisk, which can materially affect user data organization and accessibility. While delete has an explicit confirm gate, these other mutating operations rely only on their functional purpose and short docstrings, without a visible confirmation prompt or stronger user-facing warning in the code/help text about unintended data changes.
The batch tools perform large-scale file operations, potentially affecting many user files in a single invocation. Although dry_run and some path-prefix controls exist, there is no explicit warning in the code/help text that these tools may cause broad, hard-to-reverse changes when run with real inputs.
This tool downloads data from a user-supplied URL, transmitting network metadata to third parties and storing the content in a local temporary file before uploading it to Netdisk. The code mentions SSRF protection, but it does not clearly disclose to users that invoking the tool causes outbound network access and transient local storage.
This code defines an endpoint that sends client_secret as a query parameter to a remote server, which is a safety-relevant network transmission of credentials. The file contains no confirmation prompt, logging/print disclosure, or explanatory warning in the docstrings that sensitive authentication data will be sent off-host.
The device-token endpoint includes client_secret in the request query parameters, which is a sensitive network operation. Although the method is part of an auth client, the code and method docstring do not warn the caller that secrets will be transmitted to an external service.
This endpoint sends both refresh_token and client_secret as query parameters to an external server, which is a sensitive authentication operation. The file lacks any user-facing disclosure or warning that invoking this method will transmit long-lived credentials/tokens off the local system.
This code defines methods that send the required access_token as a query parameter to a remote HTTPS endpoint, which is a network operation involving sensitive credential material. Although the docstring lists parameters, it does not warn users that their token will be transmitted to an external service, and there is no confirmation prompt or user-facing logging in this file.
This method sends the required access_token to a remote server as part of an HTTP GET request, which is a sensitive network action. The file includes no user-oriented warning that credentials are being sent externally, beyond the bare parameter listing in the generated docstring.
This method performs a remote API call and includes access_token in the query parameters, which is transmission of sensitive credential data. The code contains no confirmation, print/log notice, or explanatory warning that user credentials will be sent to an external service.
This method sends the required access_token and user-provided search key to a remote endpoint, which can expose credential material and user data over the network. The generated docstring describes arguments but does not disclose the privacy impact or external transmission to users.
The client sends access_token as a query parameter in outbound HTTP requests to https://pan.baidu.com, which involves transmitting credential material over the network. Although this is functionally required, the method documentation does not warn that credentials are being sent to a remote service.
The filemanagerdelete method performs a remote delete action against the file manager API, which is a destructive operation. In this file there is no confirmation prompt, warning message, logging, or explicit docstring warning that user files may be deleted when this method is invoked.
Within filemanagerdelete, the provided access_token is included in the request sent to the remote file-management API while also issuing a delete action. The combination of credential transmission and destructive behavior lacks any explicit cautionary language in the method documentation.