Back to skill

Security audit

Bailian Subagent

Security checks for vulnerabilities and agentic risk

Overview

This skill is a real subagent-delegation helper, but it normalizes sending cloud credentials to another model context and delegating destructive database operations without clear safeguards.

Review carefully before installing. Use this only if you are comfortable delegating work to Bailian and do not put raw access keys, session tokens, passwords, or production database authority into subagent prompts. Prefer read-only, short-lived, scoped credentials handled outside model text, and require explicit review before any SQL write, schema change, or destructive operation.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:47
Finding
External Subagent Delegation Can Expose Cloud Credentials## Vulnerability Details **File Location**: `SKILL.md`, lines 47-51 **Vulnerability Type**: Sensitive credential transmission through externally processed task prompts **Risk Level**: High ### Vulnerable Code ```markdown Include all required context in the task string — subagent starts fresh with no memory: - Credentials / endpoints (if needed) - Exact steps to follow - Expected output format - Error handling instructions ``` ### Technical Analysis The Skill explicitly instructs the main agent to place credentials in the `task` string supplied to the Bailian subagent. This prompt is processed outside the main agent's local trust boundary and may be retained in provider logs, request traces, debugging systems, telemetry, or generated output. Secrets should never be embedded in natural-language prompts. The instruction does not require redaction, short-lived credentials, secret references, user confirmation, or restrictions on credential scope. It therefore exceeds the minimum privileges necessary for task delegation: the subagent could receive reusable cloud credentials even where a narrowly scoped server-side tool invocation would be sufficient. The nearby DataWorks example identifies the relevant variables as Alibaba Cloud access credentials: ```python config = Config( access_key_id='${ALICLOUD_ACCESS_KEY_ID}', access_key_secret='${ALICLOUD_ACCESS_KEY_SECRET}', endpoint='dataworks.cn-hangzhou.aliyuncs.com', region_id='cn-hangzhou' ) ``` These are placeholders rather than literal credentials, but the preceding instruction encourages resolving or copying such credentials into externally transmitted task text. ### Attack Path 1. A user or attacker causes the Skill to delegate a DataWorks or MaxCompute operation. 2. Following the Skill instructions, the main agent includes the required endpoint and cloud credentials in the `sessions_spawn` task string. 3. The task prompt is transmitte ...[truncated 1106 chars]
Remediation
## Remediation Suggestions - Remove the instruction to include credentials in the subagent task string. - Never expose access keys, session tokens, passwords, or other secrets to model prompts or outputs. - Execute authenticated operations through a trusted server-side tool that resolves credentials internally and never returns them to either agent. - Use short-lived, operation-specific credentials when delegation is unavoidable. - Restrict credentials to the required project, datasource, API actions, and time window. - Pass opaque secret references or approved tool handles instead of secret values. - Add automatic prompt and output redaction for access keys, tokens, and environment-variable values. - Require explicit user confirmation before transmitting any potentially sensitive context to an external model provider. - Ensure provider-side prompt logging and retention are disabled or minimized where supported. - Rotate any credentials that may previously have been sent through this workflow and review cloud audit logs for unauthorized use.

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:35
Finding
Delegation of Destructive SQL Operations Without Least-Privilege Safeguards## Vulnerability Details **File Location**: `SKILL.md`, lines 35-40 **Vulnerability Type**: Excessive cloud database authority and unsafe delegation of destructive operations **Risk Level**: High ### Vulnerable Code ```markdown **Good candidates:** - DataWorks / MaxCompute SQL execution (DROP/CREATE/INSERT/SELECT) - Batch data processing or transformation - Fetching and summarizing news / RSS feeds - Writing boilerplate code or scripts - Long document analysis or summarization ``` ### Technical Analysis The Skill recommends delegating DataWorks and MaxCompute SQL execution, explicitly including destructive or state-changing commands such as `DROP`, `CREATE`, and `INSERT`. It does not impose read-only access, SQL allowlists, statement validation, transaction controls, environment separation, query previews, or explicit approval before destructive execution. This design violates least privilege because a token-saving subagent intended for general task offloading is granted a path to production-capable database operations. The subagent's generated SQL can be influenced by ambiguous user input, malicious delegated content, or ordinary model error. Supplying broad cloud credentials compounds the issue by allowing generated statements to execute with all permissions held by the associated identity. ### Attack Path 1. An attacker submits a request, document, or delegated instruction that appears to require DataWorks or MaxCompute processing. 2. The main agent selects this Skill and delegates the operation to the Bailian subagent. 3. The delegated context causes the subagent to generate a destructive statement such as `DROP`, or an unauthorized `INSERT` or `CREATE`. 4. Because the Skill contains no mandatory query validation or confirmation gate, the generated statement proceeds to execution. 5. Data or database objects are deleted, replaced, corrupted, or created under the authority of the supplied cloud identity. 6. F ...[truncated 758 chars]
Remediation
## Remediation Suggestions - Default all delegated database access to read-only credentials. - Remove `DROP` and other destructive statements from the set of recommended delegation targets. - Enforce a server-side SQL allowlist rather than relying on prompt instructions. - Parse and validate every SQL statement before execution; reject multi-statement queries and prohibited commands. - Require an explicit user confirmation step displaying the exact normalized SQL, target project, datasource, and affected objects before any write or schema operation. - Use separate identities for read, write, and administrative operations. - Scope each identity to the minimum required project, tables, and API actions. - Use short-lived credentials and revoke them immediately after the approved operation. - Add row, cost, and execution-time limits, along with transaction or rollback protections where supported. - Separate development and production environments and prohibit subagent-issued destructive SQL in production. - Record immutable audit events for approvals, generated SQL, target resources, execution results, and the identity used.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Missing User Warnings

High
Confidence
98% confidence
Finding
The instructions encourage sending credentials and endpoints to a subagent without warning about privacy, retention, or exposure risks. That omission is materially unsafe because users or operators may assume delegation is routine and fail to recognize that secrets are being transferred into a separate model context with potentially different controls.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The 'verified' DataWorks pattern normalizes direct use of cloud access keys in code provided to a spawned subagent, materially expanding the subagent's effective privileges into cloud resource access. This is especially dangerous in a subagent skill because it couples delegation with credentialed execution guidance, enabling destructive or unauthorized SQL operations against DataWorks/MaxCompute resources.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger language is broad and includes generic phrases about saving tokens or delegating large tasks, which can cause the skill to activate in situations not intended by the user. In the context of a skill that may pass work, context, and even credentials to a subagent, unintended invocation increases the chance of accidental sensitive-data sharing or unreviewed delegated actions.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The skill explicitly instructs operators to include credentials and endpoints in the subagent task string, which forwards secrets into another model context and broadens access beyond simple task delegation. Because this skill is specifically designed to spawn external/subordinate model runs, the guidance creates a direct path for unnecessary secret exposure, logging, retention, or misuse by the subagent.

Ssd 3

Medium
Confidence
97% confidence
Finding
Natural-language guidance to include credentials and endpoints in prompts is itself a dangerous secret-handling pattern because it operationalizes insecure secret transfer into model conversations. In this skill's context, the danger is amplified because the entire purpose is to offload tasks to another agent, making prompt-based secret propagation likely and repeatable.

Static analysis

No suspicious patterns detected.