Back to skill

Security audit

alibabacloud-cloud-firewall-acl-manager

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Alibaba Cloud firewall backup and restore tool, but its logs and Excel files can contain sensitive firewall details.

Install only for operators who intentionally manage Alibaba Cloud Cloud Firewall ACLs. Use a dedicated RAM user or role with the documented custom policy instead of broad full access when feasible, protect generated backup workbooks as sensitive security configuration, and avoid running restores in environments where stdout is broadly logged unless verbose API parameter/response output is acceptable.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/address_book/base.py:232
Finding
Unredacted Firewall Configuration Logged During Address-Book Restore## Vulnerability Details **File Location**: `scripts/address_book/base.py:232-237` **Vulnerability Type**: Sensitive information exposure through verbose logging **Risk Level**: Medium ```python print(f" [{self.name}] [{idx+1}] restoring: {record_name}") print(f" API params: {api_params}") try: result = call_api_fn(ak, sk, endpoint, self.restore_api, api_params, security_token) print(f" API response: {result}") ``` ### Technical Analysis The generic address-book restoration routine prints the complete API parameter dictionary and API response without redaction. Depending on the selected plugin, these objects can contain: - Private IP addresses and network ranges - Internal DNS server addresses and domain names - VPC, vSwitch, endpoint, connector, and address-book identifiers - Account-related identifiers - Firewall boundary assignments and internal topology details The AccessKey secret and security token are passed separately to `call_api_fn` and are not directly included in `api_params`. Therefore, the reviewed code does not directly print authentication credentials. Nevertheless, the logged configuration is sensitive operational information. Because standard output is commonly retained by CI systems, agent transcripts, shell capture tools, or centralized logging services, this behavior can disclose more information than is required to report restore progress. ### Attack Path 1. An operator runs an address-book, ACK connector, or private DNS restore. 2. The Skill constructs an API request containing internal infrastructure configuration. 3. The complete `api_params` object and API response are written to standard output. 4. A CI logger, terminal recorder, agent platform, or log aggregation service retains that output. 5. An attacker or unauthorized user with access to those logs extracts internal IP ranges, DNS details, resource identifiers, and firewall topology information. 6. The disclosed information can support infrastructure mappi ...[truncated 549 chars]
Remediation
## Remediation Suggestions 1. Remove logging of complete request and response objects from normal operation. 2. Log only the minimum information needed to track progress, such as: - Plugin name - Record index - Sanitized record name - API action - Success or failure status - Error code and request ID 3. Implement an allowlist-based sanitization function rather than attempting to block only known sensitive keys. 4. Redact private IP addresses, CIDR ranges, DNS names, account IDs, VPC and vSwitch IDs, endpoint identifiers, security tokens, signatures, and AccessKey identifiers. 5. Place detailed diagnostics behind an explicit debug option that is disabled by default. 6. Display a warning before debug logging and ensure debug output still redacts credentials and tokens. 7. Review all other restore implementations for equivalent verbose output and apply a shared sanitized logging utility consistently. A safer pattern would be: ```python print(f" [{self.name}] [{idx + 1}] restoring: {record_name}") result = call_api_fn( ak, sk, endpoint, self.restore_api, api_params, security_token ) print( f" API result: code={result.get('Code', 'OK')}, " f"request_id={result.get('RequestId', '')}" ) ```

T09 · Insecure Skill Coding Practices

Note
Location
scripts/diff_restore.py:106
Finding
Differential Restore Leaves Sensitive Temporary Excel Files on Disk## Vulnerability Details **File Location**: `scripts/diff_restore.py:106-113` **Vulnerability Type**: Unsafe lifecycle management of sensitive temporary files **Risk Level**: Low ```python tmp_dir = tempfile.mkdtemp(prefix="cfw_diff_restore_") tmp_file = os.path.join(tmp_dir, f"missing_{plugin.sheet_name}.xlsx") with pd.ExcelWriter(tmp_file) as writer: sub.to_excel(writer, sheet_name=plugin.sheet_name, index=False) print(f" >>> restoring only the {len(missing)} missing policies (temporary file: {tmp_file})") plugin.restore(ak=ak, sk=sk, region=region, call_api_fn=call_api, excel_file=tmp_file, security_token=security_token) ``` ### Technical Analysis The differential restore routine creates a temporary directory and writes missing firewall policies to an Excel workbook. Neither the workbook nor its containing directory is removed after restoration. Cleanup is also absent from exception-handling paths. The retained workbook can include policy names, source and destination networks, ports, actions, directions, resource identifiers, and other firewall configuration details. It does not contain the AccessKey secret or security token based on the reviewed data flow. `tempfile.mkdtemp()` normally creates a directory accessible only to the current operating-system user, which limits immediate cross-user exposure. However, the data remains available indefinitely to later processes running under the same account and may be collected by backup, forensic, monitoring, or workspace archival systems. Printing the exact path also makes discovery easier for any party with access to execution logs. ### Attack Path 1. An operator starts a differential ACL restoration. 2. The Skill compares the backup with live policies and selects missing rows. 3. The selected firewall policies are written to `/tmp/cfw_diff_restore_*/missing_*.xlsx`. 4. Restoration succeeds or terminates with an exception. 5. Because no cleanup occurs, the workbook remains on disk. 6. ...[truncated 780 chars]
Remediation
## Remediation Suggestions 1. Replace `tempfile.mkdtemp()` with `tempfile.TemporaryDirectory()` so cleanup occurs automatically. 2. Keep temporary-file creation and restoration inside the context manager. 3. Add a `try/finally` safeguard if resources must outlive a single context. 4. Do not print the complete temporary path during normal operation. 5. Explicitly set restrictive permissions where platform behavior cannot be assumed. 6. Avoid copying temporary workbooks into persistent workspaces, logs, or artifact directories. 7. Document that original user-supplied backup workbooks contain sensitive security configuration and should also be protected with appropriate filesystem permissions. A safer implementation would be: ```python with tempfile.TemporaryDirectory(prefix="cfw_diff_restore_") as tmp_dir: tmp_file = os.path.join(tmp_dir, f"missing_{plugin.sheet_name}.xlsx") with pd.ExcelWriter(tmp_file) as writer: sub.to_excel(writer, sheet_name=plugin.sheet_name, index=False) print(f" >>> restoring only the {len(missing)} missing policies") plugin.restore( ak=ak, sk=sk, region=region, call_api_fn=call_api, excel_file=tmp_file, security_token=security_token, ) ```
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (55)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description presents the skill as centered on backup/restore/management of ACL policies and related configurations, with export and analysis as additional functions. The supplied code chunk is much narrower: it is an ACL policy analysis and single-policy change module. It accurately covers hit analysis, duplicate rule detection, shadow rule detection, compliance audit, add policy, and enable/disable policy, and it matches the stated limitation of no delete/cleanup. However, the major declared capabilities—backup, restore, differential restore, export, and management of address books/sync nodes—are not implemented anywhere in this chunk. Because those are central parts of the declared purpose rather than minor omissions, the description does not accurately represent what this supplied code chunk actually does.

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
| Hit analysis / zero-hit detection | `python scripts/acl_manager.py hit` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill invokes local scripts that rely on environment-based credentials, filesystem access, and outbound network calls to Alibaba Cloud APIs, but it does not declare any explicit tool scope such as allowed-tools or permissions. That omission weakens least-privilege controls and makes it harder for a hosting agent to constrain what the skill may access at runtime, increasing the blast radius if the skill is misused or composed with other unsafe behavior.

Session Persistence

Medium
Category
Rogue Agent
Content
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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
"yundun-cloudfirewall:DescribeVpcFirewallControlPolicy",
        "yundun-cloudfirewall:CreateVpcFirewallControlPolicy",
        "yundun-cloudfirewall:ModifyVpcFirewallControlPolicy",
        "yundun-cloudfirewall:DescribeVpcFirewallAclGroupList",
        "yundun-cloudfirewall:DescribeAckClusterConnectors",
        "yundun-cloudfirewall:CreateAckClusterConnector",
        "yundun-cloudfirewall:DescribePrivateDnsEndpointList",
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.

Static analysis

No suspicious patterns detected.