T09 · Insecure Skill Coding Practices
- Location
scripts/logeasy_search.py:10- Finding
Hardcoded LogEase Administrator Credentials Distributed Across the Project
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This LogEase search skill exposes administrator access details and ships broader privileged API tooling than a read-only log search skill needs.
Do not install this as-is in a real environment. Rotate the exposed LogEase admin password, replace it with a scoped read-only token from a secret store, require HTTPS with certificate validation, and remove or isolate the generic OpenAPI mutation servers before use.
scripts/logeasy_search.py:10Hardcoded LogEase Administrator Credentials Distributed Across the Project
scripts/logeasy_search.py:10Administrator Credentials and Sensitive Log Queries Transmitted Over Plaintext HTTP
rizhiyi-mcp/src/custom_tools_server.ts:102Generic MCP Tool Permits Unrestricted Privileged LogEase Mutations
rizhiyi-mcp/src/client.ts:8LogEase HTTP Client Silently Disables TLS Certificate Verification
form-data 4.0.2 is flagged for CRLF injection in multipart construction and unsafe randomness for boundary generation. If attacker-controlled field names or filenames are inserted into multipart requests, this can corrupt request structure, smuggle headers/content, or enable downstream request manipulation against APIs the agent communicates with.
The request target is derived from LOGEASE_BASE_URL, an environment-controlled value, and the script automatically attaches hardcoded Basic Auth credentials to that request. An attacker who can influence the environment can redirect the request to an attacker-controlled host and capture the admin credentials, especially because the default scheme is plain HTTP and there is no host allowlist or TLS verification policy.
req = urllib.request.Request(url, headers=headers)
try:
with urllib.request.urlopen(req, timeout=60) as resp:
result = json.loads(resp.read().decode('utf-8'))
except urllib.error.HTTPError as e:
body = e.read().decode('utf-8', errors='replace')
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}
try:
r = requests.get(
LOGEASE_URL + '/api/v3/search/sheets/',
params=params,
auth=HTTPBasicAuth(LOGEASE_USERNAME, LOGEASE_PASSWORD),
The skill embeds plaintext administrative credentials and a direct internal API endpoint in documentation, which creates immediate secret exposure and privileged access risk. Anyone who can view the skill can reuse those credentials to query sensitive logs, pivot into internal systems, or harvest operational/security data.
Publishing plaintext username/password pairs without any warning or protective handling is a direct secret disclosure issue. Because the credentials appear to be for an internal admin account, exploitation could expose large volumes of sensitive logs and facilitate broader internal reconnaissance.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
}
```
请确保将 `/path/to/your/rizhiyi-mcp/dist/log-tools-server.js` 替换为实际的 npm 安装路径。
- **Rizhiyi 服务器信息**:Rizhiyi 服务器需要认证连接,请在 .env 文件或环境变量中配置相应的服务器 URL 和 API Key。
2. **在智能体中使用**:
配置完成后,您的 AI 智能体即可通过自然语言指令或特定的工具调用语法来使用 `rizhiyi-mcp` 提供的功能。例如,您可以指示智能体“使用日志分析工具查询过去一小时的错误日志”。效果如图:
This API package includes broad identity and access-management operations such as account enable/disable, password changes, API key management, role handling, permissions, user groups, and related administrative actions. For a skill with unknown purpose, bundling such expansive privileged functionality increases the chance of misuse, over-privileged integrations, and destructive actions if the agent or caller is compromised.
The schema exposes infrastructure-management and remote-control capabilities such as agent configuration changes, agent start/stop/restart, file/script/plugin upload, pipeline changes, backups/restores, storage configuration, and search task control. In a skill without an explicitly justified operational purpose, this creates a powerful control plane that could be abused for service disruption, hostile reconfiguration, data exfiltration, or post-compromise lateral movement.
The schema documents multiple unauthenticated login and token-management endpoints, including password reset, token refresh/revoke, and token verification. In an agent skill with no stated purpose, exposing these capabilities materially expands identity attack surface and could enable account takeover workflows, token abuse, or user enumeration if the backing implementation is weak or misconfigured.
This endpoint explicitly supports implicit deletion semantics: sending only an id deletes a collection input, while other payload combinations create or update configurations. In an agent skill context, ambiguous destructive behavior is dangerous because an LLM-driven client or automation may unintentionally delete monitoring inputs or alter log collection coverage, causing loss of visibility or service-impacting misconfiguration.
This endpoint documents a dangerous overloaded behavior: sending only an id deletes an existing collection configuration, while sending input creates or updates one. In generated tooling or agentic use, the same update operation can silently become a delete if fields are omitted, increasing the risk of accidental destructive changes and loss of log collection coverage.
Index deletion is a highly destructive operation with likely data-loss and storage-impact consequences, and the spec provides no explicit caution or differentiation between metadata deletion and underlying data destruction. In agentic or autogenerated clients, this increases the chance of irreversible destructive calls being made without adequate operator awareness or safeguards.
The client constructs an HTTPS agent with rejectUnauthorized: false when no agent is provided, which disables TLS certificate validation by default. This enables man-in-the-middle attacks, allowing an attacker on the network path to intercept or modify API traffic, including credentials and returned data, without being detected.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import { TrendForecastModule } from './modules/trend-forecast.js';
import { AnomalyDetectionModule } from './modules/anomaly-detection.js';
// 加载环境变量
dotenv.config({ path: ['.env.local', '.env'] });
// 配置HTTP客户端(从环境变量读取)
const baseURL = process.env.LOGEASE_BASE_URL ?? 'http://127.0.0.1:8090';
const authHeader = process.env.LOGEASE_AUTH_HEADER || (process.env.LOGEASE_API_KEY ? `apikey ${process.env.LOGEASE_API_KEY}` : undefined);
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import { TrendForecastModule } from './modules/trend-forecast.js';
import { AnomalyDetectionModule } from './modules/anomaly-detection.js';
// 加载环境变量
dotenv.config({ path: ['.env.local', '.env'] });
// 配置HTTP客户端(从环境变量读取)
const baseURL = process.env.LOGEASE_BASE_URL ?? 'http://127.0.0.1:8090';
const authHeader = process.env.LOGEASE_AUTH_HEADER || (process.env.LOGEASE_API_KEY ? `apikey ${process.env.LOGEASE_API_KEY}` : undefined);
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import { TrendForecastModule } from './modules/trend-forecast.js';
import { AnomalyDetectionModule } from './modules/anomaly-detection.js';
// 加载环境变量
dotenv.config({ path: ['.env.local', '.env'] });
// 配置HTTP客户端(从环境变量读取)
const baseURL = process.env.LOGEASE_BASE_URL ?? 'http://127.0.0.1:8090';
const authHeader = process.env.LOGEASE_AUTH_HEADER || (process.env.LOGEASE_API_KEY ? `apikey ${process.env.LOGEASE_API_KEY}` : undefined);
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import { TrendForecastModule } from './modules/trend-forecast.js';
import { AnomalyDetectionModule } from './modules/anomaly-detection.js';
// 加载环境变量
dotenv.config({ path: ['.env.local', '.env'] });
// 配置HTTP客户端(从环境变量读取)
const baseURL = process.env.LOGEASE_BASE_URL ?? 'http://127.0.0.1:8090';
const authHeader = process.env.LOGEASE_AUTH_HEADER || (process.env.LOGEASE_API_KEY ? `apikey ${process.env.LOGEASE_API_KEY}` : undefined);
TLS certificate validation can be disabled via LOGEASE_TLS_REJECT_UNAUTHORIZED='false', causing HTTPS connections to accept invalid or attacker-controlled certificates. This enables man-in-the-middle interception or modification of authenticated API traffic, including exposure of authorization headers and tampering with requests and responses.
The lockfile pins @modelcontextprotocol/sdk to 1.9.0, and the provided advisories include a ReDoS issue and missing DNS rebinding protections. In an MCP skill context, this is more dangerous than a generic library issue because the SDK is likely part of the network-facing control plane, so parser abuse or rebinding-based access to local services could affect the agent host.
axios 1.8.4 is reported with multiple advisories including SSRF-related proxy bypass and other request-handling issues. In an MCP/agent integration, outbound HTTP clients are commonly used to reach APIs, so SSRF, credential leakage, or response-hijack behaviors become materially more dangerous because the agent may have network reachability and secrets unavailable to external users.
fast-uri 3.0.6 is flagged for multiple host-confusion and SSRF-related parsing issues. This is especially relevant in an agent skill that may transform or validate URLs from untrusted sources, because malformed hostnames or IPv6 forms can bypass security checks and redirect requests to unintended internal targets.
js-yaml 4.1.0 is affected by several CPU-exhaustion issues involving merge keys and complex YAML structures. This is particularly relevant because the project directly depends on js-yaml and also includes OpenAPI/YAML tooling, suggesting untrusted YAML or API descriptions may be parsed, which makes parser-level DoS substantially more plausible.
A second vulnerable copy of @modelcontextprotocol/sdk is present transitively through mcp-sequentialthinking-tools at version 1.1.1, carrying the DNS rebinding advisory. Even if the top-level SDK is upgraded, this nested copy can preserve the exposure if the transitive package invokes the affected network server/client behavior.
path-to-regexp 8.2.0 is flagged for ReDoS/DoS via crafted route patterns. Although exploitation often depends on attacker influence over route definitions rather than request paths alone, Express/router internals make this an important availability risk if dynamic route generation or externally supplied path templates are used anywhere in the skill stack.
The manifest permits use of @modelcontextprotocol/sdk 1.9.0, which static analysis identifies as having known advisories including ReDoS and missing DNS rebinding protections. In an MCP server context, this is more dangerous than a generic library issue because the package likely participates in request handling and protocol exposure, so exploitation could lead to denial of service or network-origin trust bypass depending on deployment.