Back to skill

Security audit

DataWorks Open API

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for managing Alibaba Cloud DataWorks, but it asks agents to use broad cloud credentials with unpinned packages and unsafe documentation-fetching helpers that can weaken trust in API metadata.

Install only after reviewing the supply-chain and credential posture. Prefer short-lived or least-privilege RAM/STS credentials, avoid static keys in configs or shell history, pin SDK and MCP package versions, restrict MCP TOOL_NAMES or TOOL_CATEGORIES, avoid NODE_ENV=development unless you intend to use pre-release tool definitions, and do not rely on generated API metadata from the helper scripts unless TLS verification is fixed or the source is otherwise verified.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_api_overview.py:37
Finding
TLS Certificate Verification Can Be Disabled in API Overview Retrieval<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_api_overview.py:37-59` **Vulnerability Type**: Improper TLS certificate validation **Risk Level**: Medium ### Vulnerable Code ```python def fetch_page(url: str, timeout: int) -> str: """Fetch page HTML. Tries urllib first, falls back to curl on SSL errors.""" import ssl import subprocess headers = { "User-Agent": ( "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/131.0.0.0 Safari/537.36" ), } # Try with default SSL context first for ctx in [None, ssl.create_default_context(), ssl._create_unverified_context()]: try: req = urllib.request.Request(url, headers=headers) kwargs: dict = {"timeout": timeout} if ctx is not None: kwargs["context"] = ctx with urllib.request.urlopen(req, **kwargs) as resp: return resp.read().decode("utf-8") except (urllib.error.URLError, ssl.SSLError): continue ``` The script also accepts an unrestricted custom endpoint: ```python parser.add_argument("--url", default=DEFAULT_URL, help="Help doc URL") ``` ### Technical Analysis The request sequence eventually uses `ssl._create_unverified_context()`. This disables certificate-chain and server-identity verification after verified HTTPS attempts fail. Consequently, a TLS failure does not cause the operation to fail closed. The downloaded page is parsed into API names and descriptions and saved for subsequent Agent use. Although the script does not directly execute downloaded code or transmit credentials, forged documentation can influence later authenticated cloud operations. The unrestricted `--url` argument also permits retrieval from arbitrary schemes and hosts without an Alibaba Cloud hostname allowlist. ### Attack Path 1. An Agent or user runs `scripts/fetch_api_overview.py ...[truncated 908 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `ssl._create_unverified_context()` and fail closed when certificate verification fails. 2. If private certificate authorities must be supported, accept an explicit CA bundle and construct a verified context with `ssl.create_default_context(cafile=...)`. 3. Require HTTPS for `--url`. 4. Allowlist expected hosts such as `help.aliyun.com`, unless arbitrary endpoints are an explicitly required feature. 5. Validate redirects so an approved initial URL cannot redirect to an untrusted host or non-HTTPS scheme. 6. Apply response-size limits and validate the expected document structure before writing generated output. 7. Emit a clear error explaining how to configure a trusted CA instead of silently weakening TLS. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/list_openapi_meta_apis.py:22
Finding
TLS Certificate Verification Can Be Disabled in OpenAPI Metadata Retrieval<![CDATA[ ## Vulnerability Details **File Location**: `scripts/list_openapi_meta_apis.py:22-38` **Vulnerability Type**: Improper TLS certificate validation **Risk Level**: Medium ### Vulnerable Code ```python def fetch_json(url: str, timeout: int) -> dict: """Fetch JSON from URL. Tries urllib first, falls back to curl on SSL errors.""" import ssl import subprocess headers = {"User-Agent": "codex-skill"} # Try with default SSL context first for ctx in [None, ssl.create_default_context(), ssl._create_unverified_context()]: try: req = urllib.request.Request(url, headers=headers) kwargs: dict = {"timeout": timeout} if ctx is not None: kwargs["context"] = ctx with urllib.request.urlopen(req, **kwargs) as resp: return json.loads(resp.read().decode("utf-8")) except (urllib.error.URLError, ssl.SSLError): continue ``` ### Technical Analysis The final context in the retry loop disables TLS certificate verification. If the ordinary verified requests fail, the function can accept metadata from a server whose certificate is invalid, self-signed, expired, or issued for another hostname. The retrieved JSON contains API definitions used by the Skill’s dynamic discovery workflow. The metadata is persisted to disk and may guide construction of later authenticated API requests. This creates an integrity risk even though the discovery request itself contains no authorization header or secret. The command-line `product-code` and `version` values are inserted into the path of a fixed Alibaba Cloud host, so this script has less SSRF exposure than the custom URL accepted by `fetch_api_overview.py`. The confirmed issue remains the deliberate TLS downgrade. ### Attack Path 1. An Agent or user runs `scripts/list_openapi_meta_apis.py`. 2. A man-in-the-middle attacker or malicious proxy causes the verified requests to fail. 3. The code reach ...[truncated 654 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Delete the `ssl._create_unverified_context()` retry path. 2. Treat certificate validation failures as fatal. 3. Support private trust roots only through an explicit, user-supplied CA bundle. 4. Validate the final redirect host and require HTTPS throughout the redirect chain. 5. Validate the downloaded JSON against the expected OpenAPI metadata schema before saving or using it. 6. Consider signing, checksumming, or pinning trusted metadata snapshots where reproducibility is important. ]]>

T08 · Insecure Dependencies

Warning
Location
references/mcp_server.md:18
Finding
Unpinned Third-Party Packages Are Installed and Executed with Cloud Credentials<![CDATA[ ## Vulnerability Details **File Locations**: - `SKILL.md:102-115` - `SKILL.md:163-165` - `SKILL.md:192-194` - `SKILL.md:247-249` - `references/mcp_server.md:6-9` - `references/mcp_server.md:18-28` - `references/mcp_server.md:36-46` **Vulnerability Type**: Unpinned dependency installation and execution **Risk Level**: Medium ### Vulnerable Code `SKILL.md` recommends resolving the latest package versions: ```markdown **Recommend using the latest SDK version.** The DataWorks SDK is updated frequently with new APIs, bug fixes, and model changes. Check the latest version from the package registry before installing: - Node.js: `https://www.npmjs.com/package/@alicloud/dataworks-public20240518` - Python: `https://pypi.org/project/alibabacloud-dataworks-public20240518/` - Java: `https://central.sonatype.com/artifact/com.aliyun/alibabacloud-dataworks_public20240518` Prefer the official Alibaba Cloud SDK. Two styles are supported: ### Style 1: Generalized call (recommended, covers all APIs) Use `@alicloud/openapi-client` to call any DataWorks API without importing product-specific SDK classes. This is the approach used by the MCP Server source code (`src/tools/callTool.ts`). ```bash npm install @alicloud/openapi-client @alicloud/openapi-util @alicloud/tea-util @alicloud/credentials ``` ``` Additional unpinned installation commands include: ```bash npm install @alicloud/dataworks-public20240518 ``` ```bash pip install alibabacloud_dataworks_public20240518 ``` ```bash npm install -g alibabacloud-dataworks-mcp-server ``` The MCP configuration executes the package while providing credentials: ```json { "mcpServers": { "alibabacloud-dataworks-mcp-server": { "command": "npx", "args": ["alibabacloud-dataworks-mcp-server"], "env": { "REGION": "cn-shanghai", "ALIBABA_CLOUD_ACCESS_KEY_ID": "<YOUR_ACCESS_KEY_ID>", "ALIBABA_CLOUD_ACCESS_KEY_SECRET": "<YOUR_ACCESS_KEY_SECRET>" } } } } ``` ### Technic ...[truncated 2253 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every direct dependency to an exact reviewed version. 2. Commit appropriate lockfiles and enforce integrity verification during installation. 3. Avoid recommending “latest” versions for security-sensitive SDK and MCP components. 4. Replace global installation with a project-local, locked dependency. 5. Configure MCP startup to use a local binary, or use `npx --no-install`, so startup cannot fetch an unreviewed release. 6. Review and pin transitive dependencies through lockfiles, automated vulnerability scanning, and controlled update procedures. 7. Run the MCP server in a restricted environment with minimal filesystem and network access. 8. Use temporary, narrowly scoped Alibaba Cloud credentials rather than long-lived account keys. 9. Restrict MCP exposure with `TOOL_CATEGORIES` and `TOOL_NAMES` to the minimum APIs required for the task. 10. Apply Alibaba Cloud IAM policies that deny unrelated administrative and destructive operations. 11. Rotate credentials immediately if a dependency compromise is suspected. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The supplied code is a documentation scraper/indexer, not a DataWorks operator. It downloads an Alibaba Cloud help page, parses `window.__ICE_PAGE_PROPS__`, extracts API names/descriptions from HTML tables, and saves an overview as markdown and JSON. While this partially aligns with the description's mention of runtime API discovery from official docs, it does not implement the central claimed capability of operating DataWorks through official SDKs or executing APIs across the listed product areas. It also does not consume OpenAPI metadata, only a single help-doc page. Therefore the actual behavior is materially narrower and different from the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The code is related to one narrow part of the description—runtime discovery of OpenAPI metadata—but it does not implement the declared primary purpose of operating DataWorks services across development, workflows, integration, quality, lineage, or workspace management. It merely downloads an API docs JSON document from Alibaba's metadata service, parses API names, and writes artifacts locally. There are no SDK calls, no DataWorks action execution, no authentication, and no workflow/data-management operations. This makes the actual behavior materially narrower and different from the declared skill purpose.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The README explicitly instructs users to export long-lived static Alibaba Cloud access key credentials, but it does not warn about secret handling, shell history leakage, least-privilege use, or preferring short-lived credentials. In an agent-oriented skill, this increases the chance operators will paste powerful credentials into insecure environments or logs, leading to credential compromise and unauthorized cloud access.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill documents capabilities that require network access, shell execution, environment-variable access, and likely file writes, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, that omission weakens least-privilege controls and can allow broader-than-expected execution against cloud APIs using sensitive credentials.

Session Persistence

Medium
Category
Rogue Agent
Content
If execution fails at any step, escalate to the next level:

1. **Cookbook** — check `references/cookbook.md` first. It contains verified API patterns, pitfalls, error recovery, the full end-to-end lifecycle (Create → Submit → Deploy → Run → Monitor), and reusable code snippets. Most common issues are already documented there.
2. **Official help docs** — read the API overview and per-API doc pages.
   - If an API call fails or the request/error is not understood, fetch the API directory page to locate the relevant API documentation:
     `https://help.aliyun.com/zh/dataworks/developer-reference/api-dataworks-public-2024-05-18-dir`
Confidence
60% confidence
Finding
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.

Session Persistence

Medium
Category
Rogue Agent
Content
```python
req = models.ListResourceGroupsRequest(project_id=PROJECT_ID, page_number=1, page_size=10)
resp = client.list_resource_groups(req)
groups = resp.body.paging_info.to_map().get('ResourceGroupList', [])
RESOURCE_GROUP_ID = groups[0].get('Id')
# e.g. "Serverless_res_group_<account-id>_<group-id>"
```
Confidence
75% confidence
Finding
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.

Session Persistence

Medium
Category
Rogue Agent
Content
```python
req = models.ListResourceGroupsRequest(project_id=PROJECT_ID, page_number=1, page_size=10)
resp = client.list_resource_groups(req)
groups = resp.body.paging_info.to_map().get('ResourceGroupList', [])
RESOURCE_GROUP_ID = groups[0].get('Id')
# e.g. "Serverless_res_group_<account-id>_<group-id>"
```
Confidence
75% confidence
Finding
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.

Session Persistence

Medium
Category
Rogue Agent
Content
```python
req = models.ListResourceGroupsRequest(project_id=PROJECT_ID, page_number=1, page_size=10)
resp = client.list_resource_groups(req)
groups = resp.body.paging_info.to_map().get('ResourceGroupList', [])
RESOURCE_GROUP_ID = groups[0].get('Id')
# e.g. "Serverless_res_group_<account-id>_<group-id>"
```
Confidence
75% confidence
Finding
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.

Session Persistence

Medium
Category
Rogue Agent
Content
```python
req = models.ListResourceGroupsRequest(project_id=PROJECT_ID, page_number=1, page_size=10)
resp = client.list_resource_groups(req)
groups = resp.body.paging_info.to_map().get('ResourceGroupList', [])
RESOURCE_GROUP_ID = groups[0].get('Id')
# e.g. "Serverless_res_group_<account-id>_<group-id>"
```
Confidence
75% confidence
Finding
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.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This cookbook repeatedly sets `timezone: "Asia/Shanghai"` in workflow trigger examples, which imposes a specific locale/timezone behavior in natural-language configuration. The file does not indicate that this is optional, region-specific, or something the user should choose based on their environment.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This cleanup recipe demonstrates `DeleteDataQualityRule` and `DeleteDataQualityEvaluationTask`, which remove configuration objects permanently. Although irreversibility is mentioned elsewhere in the document, this destructive recipe itself lacks an explicit warning at the point of action that running it will permanently delete data quality assets.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
This markdown file instructs users to place `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` into the MCP server configuration, but it does not include any warning about the sensitivity of these credentials or the risks of exposing them to an AI-connected tool. For markdown files, SQP-2 applies when the description omits warnings about behaviors that could affect privacy or system integrity, and credential use is a clear sensitive operation.

Unsafe Defaults

Medium
Category
Tool Misuse
Content
The MCP Server dynamically fetches tool definitions from:
- `https://dataworks.data.aliyun.com/pop-mcp-tools` (production)
- `https://pre-dataworks.data.aliyun.com/pop-mcp-tools` (pre-release, when `NODE_ENV=development`)

This means the tool list always reflects the latest available DataWorks APIs.
Confidence
92% confidence
Finding
The server dynamically switches to a pre-release tool-definition endpoint when NODE_ENV=development, causing security-relevant behavior and available tool surface to depend on an environment flag rather than an explicit trusted configuration. If that pre-release source is less stable, less reviewed, or compromised, an agent could discover and invoke unintended APIs or schemas, expanding attack surface and enabling unsafe operations.

External Transmission

Medium
Category
Data Exfiltration
Content
> Constants: **PRODUCT_CODE** = `dataworks-public`, **API_VERSION** = `2024-05-18` (defined in SKILL.md)

## API & metadata
- OpenAPI product page: `https://api.aliyun.com/product/{PRODUCT_CODE}`
- API overview (help docs): `https://help.aliyun.com/zh/dataworks/developer-reference/api-{PRODUCT_CODE}-{API_VERSION}-overview`
- API list (metadata JSON): `https://next.api.aliyun.com/meta/v1/products/{PRODUCT_CODE}/versions/{API_VERSION}/api-docs.json`
- Single API definition: `https://next.api.aliyun.com/meta/v1/products/{PRODUCT_CODE}/versions/{API_VERSION}/apis/{ApiName}/api.json`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
> Constants: **PRODUCT_CODE** = `dataworks-public`, **API_VERSION** = `2024-05-18` (defined in SKILL.md)

## API & metadata
- OpenAPI product page: `https://api.aliyun.com/product/{PRODUCT_CODE}`
- API overview (help docs): `https://help.aliyun.com/zh/dataworks/developer-reference/api-{PRODUCT_CODE}-{API_VERSION}-overview`
- API list (metadata JSON): `https://next.api.aliyun.com/meta/v1/products/{PRODUCT_CODE}/versions/{API_VERSION}/api-docs.json`
- Single API definition: `https://next.api.aliyun.com/meta/v1/products/{PRODUCT_CODE}/versions/{API_VERSION}/apis/{ApiName}/api.json`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
The script explicitly falls back to ssl._create_unverified_context(), which disables TLS certificate verification and allows man-in-the-middle interception or tampering of fetched documentation. Because the fetched content is then parsed and written into output artifacts that may drive later API usage or developer decisions, an attacker on the network path could silently poison the generated data.

Tainted flow: 'timeout' from os.getenv (line 210, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Content
# Fallback: use curl
    print("urllib SSL failed, falling back to curl...")
    result = subprocess.run(
        ["curl", "-fsSL", "-H", f"User-Agent: {headers['User-Agent']}", url],
        capture_output=True, text=True, timeout=timeout,
    )
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Missing User Warnings

Medium
Confidence
99% confidence
Finding
The code explicitly falls back to ssl._create_unverified_context(), which disables certificate verification for HTTPS requests. That permits man-in-the-middle interception or response spoofing, allowing an attacker on the network path to feed malicious or falsified API metadata that this script then saves as trusted output.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Fallback: use curl
    print("urllib SSL failed, falling back to curl...")
    result = subprocess.run(
        ["curl", "-fsSL", "-H", f"User-Agent: {headers['User-Agent']}", url],
        capture_output=True, text=True, timeout=timeout,
    )
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Fallback: use curl
    print("urllib SSL failed, falling back to curl...")
    result = subprocess.run(
        ["curl", "-fsSL", "-H", f"User-Agent: {headers['User-Agent']}", url],
        capture_output=True, text=True, timeout=timeout,
    )
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Tainted flow: 'timeout' from os.getenv (line 58, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Content
# Fallback: use curl
    print("urllib SSL failed, falling back to curl...")
    result = subprocess.run(
        ["curl", "-fsSL", "-H", f"User-Agent: {headers['User-Agent']}", url],
        capture_output=True, text=True, timeout=timeout,
    )
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The troubleshooting instructions direct the user to `help.aliyun.com/zh/...` pages and frame them as the required official help path. This imposes a specific locale in the skill's natural-language guidance without stating that Chinese is optional or offering an alternative language choice.

Context-Inappropriate Capability

Low
Confidence
84% confidence
Finding
The manifest describes a DataWorks API discovery skill using official docs and SDK metadata, and this helper script is documented as fetching and parsing help pages. However, on SSL failures it spawns an external subprocess to run curl, which is a broader execution capability than simple in-process HTTP retrieval and is not justified by the script's stated parsing purpose.

Static analysis

No suspicious patterns detected.