Back to skill

Security audit

bls-skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Baidu Log Service query helper, with credential-handling risks users should manage carefully.

Install only if you intend to let the skill query Baidu Log Service with your BLS credentials. Prefer environment variables or a locked-down credential file over passing --sk on the command line, and use a least-privilege BLS identity limited to the projects and logstores you want queried.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/bls_query.py:330
Finding

Secret Key Exposure Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/bls_query.py:88-90, 330-331
Vulnerability Type: Command-line credential exposure
Risk Level: Medium

Vulnerable Code

python
ak = getattr(args, "ak", None)
sk = getattr(args, "sk", None)

# 1. Command line args
if ak and sk:
    return ak, sk
python
parser.add_argument("--ak", help="Access Key ID (also configurable through BCE_BLS_ACCESS_KEY)")
parser.add_argument("--sk", help="Secret Access Key (also configurable through BCE_BLS_SECRET_KEY)")

The corresponding usage is documented in SKILL.md:18-21:

text
1. Command-line arguments --ak / --sk
2. Environment variables BCE_BLS_ACCESS_KEY / BCE_BLS_SECRET_KEY
3. Configuration file ~/.bce_bls/credentials

Technical Analysis

The CLI accepts the BCE secret access key through the --sk command-line option and gives command-line credentials the highest resolution priority. Secrets supplied this way may be exposed through:

  • Shell history files.
  • Process listings such as /proc/<pid>/cmdline or process-monitoring tools.
  • Terminal session recording.
  • CI/CD logs or command tracing.
  • Endpoint monitoring and telemetry that records process arguments.

Authenticated BLS access legitimately requires credentials, so reading a dedicated credential file or environment variable is within the Skill's declared scope. Exposing the secret through process arguments, however, is not required for that functionality and increases local credential exposure.

The secret key is otherwise used locally to generate an HMAC signature. The reviewed network code does not directly transmit the secret key and restricts requests to hard-coded Baidu BLS endpoints over HTTPS.

Attack Path

  1. A user follows the documented usage and runs the Skill with --ak and --sk.
  2. The complete command, including the secret key, is retained in shell history, automation logs, process telemetry, or a live process argument list.
  3. A local user, monitoring ag ...[truncated 1098 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the --sk command-line option and stop documenting command-line secret-key usage.
  2. Prefer a securely permissioned credential file, operating-system keyring, or interactive hidden prompt using getpass.getpass().
  3. If environment variables remain supported, document that they may be exposed by CI diagnostics, crash reports, or process-environment inspection and should be scoped to the child process where possible.
  4. Verify credential-file security before reading it:
    • Reject files not owned by the current user.
    • Reject group- or world-readable files.
    • Recommend mode 0600 and a private parent directory.
  5. Use a short-lived, least-privilege IAM credential restricted to the required BLS read/query actions and resources.
  6. Avoid printing credentials or Authorization headers in errors and debug logs.
  7. Rotate credentials that have previously been passed through command-line arguments and remove exposed values from shell history and automation logs.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The code substantially matches the core BLS scope: it accesses Baidu Log Service, lists projects, lists logstores, retrieves index details, and runs log queries through the API. However, the declared description includes two capabilities not implemented in this chunk: (1) generating BLS retrieval/SQL queries from a user's described intent, and (2) querying logstore details specifically, whereas the code only lists logstores and describes index configuration. There are no obvious unrelated or dangerous undeclared capabilities beyond normal credential resolution and request signing needed to access BLS. Because the description claims functionality that the code does not actually provide, this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill explicitly describes use of credentials from environment variables and invoking BLS APIs, but it declares no permissions or allowed-tools scope. That means the runtime may grant broader-than-necessary access to environment secrets and network operations without an auditable, least-privilege boundary, increasing the risk of unintended secret access or outbound requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Natural-language strings shown to users, including error hints and CLI descriptions, are written in Chinese, and the tool does not provide any language-selection or opt-in mechanism. Under the stated policy, forcing a specific language without user choice is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file contains user-facing documentation where multiple section titles, region names, and parameter descriptions are in Chinese, while the rest of the document is in English. That creates an implicit language constraint without user opt-in or a stated justification, which matches the language/locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill documentation is presented only in Chinese, with no indication that users may choose another language or locale. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document begins and continues entirely in Chinese, with no indication that users may choose another language or locale. This can violate a language/locale policy when skills are expected to avoid forcing a specific language without explicit opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code reads access keys and secret keys from environment variables and from ~/.bce_bls/credentials, which is a sensitive credential source. Although the docstrings describe the resolution order, there is no explicit warning to users about the sensitivity of these secrets or the risks of supplying them via command-line arguments or local files.

Content

No source excerpt is available for this finding.