Back to skill

Security audit

投放Agent自动化体验测试

Security checks for vulnerabilities and agentic risk

Overview

This skill is an understandable Tencent Ads testing helper, but it asks for live session cookies and can submit real campaign-changing commands without adequate safeguards.

Only use this with a dedicated test advertising account and short-lived credentials. Do not paste full browser cookies into chat or store them in a project folder; avoid production accounts, remove budget-changing and pause-ad prompts, keep reports/screenshots free of sensitive account data, and delete any cookie files immediately after testing.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/inject_cookies.js:26
Finding
Overbroad Collection and Cross-Domain Injection of Authentication Cookies<![CDATA[ ## Vulnerability Details **File Location**: `scripts/inject_cookies.js`, lines 26-68 **Related Instructions**: `SKILL.md`, lines 31-40; `references/cookie-guide.md`, lines 12-18 **Vulnerability Type**: Excessive credential collection and cross-domain session injection **Risk Level**: High ### Complete Code Snippet ```javascript function parseCookies(cookieStr, defaultDomain = '.ad.qq.com') { if (!cookieStr) { console.error('ERROR: Cookie字符串为空,请设置 RAW_COOKIE 环境变量或修改脚本'); process.exit(1); } const cookies = []; const pairs = cookieStr.split(';').map(s => s.trim()).filter(Boolean); for (const pair of pairs) { const eqIdx = pair.indexOf('='); if (eqIdx === -1) continue; const name = pair.substring(0, eqIdx).trim(); const value = pair.substring(eqIdx + 1).trim(); if (!name) continue; // 根据cookie名推断域名 let domain = defaultDomain; if (['ptcz', 'ptui_loginuin', 'RK', 'p_uin', 'p_skey', 'pt4_token'].includes(name)) { domain = '.qq.com'; } else if (['RIO_TOKEN', 'RIO_TOKEN_HTTPS', 'x_host_key_access_https', 'x-client-ssid', 'DiggerTraceId', 'DiggerTraceIdTs'].includes(name)) { domain = '.woa.com'; } const cookie = { name, value, domain, path: '/', }; // 敏感cookie加安全属性 if (['gdt_mlogin', 'gdt_protect', 'tap_free_login_token', 'RIO_TOKEN', 'RIO_TOKEN_HTTPS', 'x_host_key_access_https'].includes(name)) { cookie.secure = true; cookie.httpOnly = true; cookie.sameSite = 'None'; } cookies.push(cookie); } return cookies; } ``` The associated instructions tell the user to run `document.cookie` and send the complete result to the Agent rather than supplying only narrowly scoped credentials. ### Technical Analysis The parser accepts every cookie in the supplied string. It does not enforce an allowlist of cookies required for the declared `ad.qq.com` UX test. It also recognizes selected authentication and internal-ne ...[truncated 2092 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace permissive parsing with a strict allowlist containing only the minimum cookies proven necessary for the specific `ad.qq.com` test. 2. Reject unexpected cookies rather than silently retaining them. 3. Do not request, process, or inject general `.qq.com` or internal `.woa.com` session credentials. 4. Prefer a dedicated, short-lived test account with no production campaign authority. 5. Use a narrowly scoped authentication artifact or Playwright storage state generated specifically for the test environment. 6. Clearly warn users never to provide complete browser cookie output. 7. Validate the target account and hostname before injecting any credentials. 8. Revoke or rotate existing credentials if complete session cookies have already been shared. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/inject_cookies.js:93
Finding
Authentication Cookies Stored in a Predictable Plaintext File<![CDATA[ ## Vulnerability Details **File Location**: `scripts/inject_cookies.js`, lines 93-95 **Vulnerability Type**: Plaintext storage of sensitive authentication material **Risk Level**: High ### Complete Code Snippet ```javascript const outPath = process.argv[2] || './cookies.json'; fs.writeFileSync(outPath, JSON.stringify(cookies, null, 2)); console.log(`✅ Cookie已保存到 ${outPath}`); ``` ### Technical Analysis The script serializes full authentication-cookie values into readable JSON. The default path, `./cookies.json`, is predictable and normally resides inside or adjacent to the project working tree. The write operation does not specify restrictive file permissions. There is also no encryption, secure temporary-file mechanism, automatic deletion, expiry handling, or repository exclusion shown in the reviewed project. Consequently, the file may be readable according to the process umask and can survive after the browser test completes. Because the stored data can contain production advertising, QQ, and internal authentication tokens, it must be treated as credential material rather than ordinary test configuration. ### Attack Path 1. The user provides active session cookies. 2. The parser converts them into Playwright-compatible objects. 3. The script writes their complete names, values, domains, and attributes to `./cookies.json`. 4. The file remains on disk after script completion. 5. Another local user, process, backup service, archive operation, or accidental source-control commit obtains the file. 6. The attacker imports or otherwise replays cookies that remain valid. 7. The attacker impersonates the user within the scope granted by those sessions. ### Impact Assessment Successful disclosure may permit session replay without knowledge of the user’s password. The accessible scope depends on the cookies supplied and may include: - Authenticated access to a production advertising account. - Access to advertising data and account-management functi ...[truncated 265 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Avoid writing session cookies to disk; pass them directly to the browser context in memory. 2. If persistence is unavoidable, create a uniquely named temporary file outside the repository with mode `0600`. 3. Delete the file in a `finally` block immediately after browser-context initialization or test completion. 4. Add cookie files and authentication state files to `.gitignore`. 5. Do not include cookie values in logs, errors, reports, screenshots, or debugging output. 6. Validate that the output path is not a symlink and is located in an approved secure directory. 7. Document credential sensitivity and provide a revocation procedure. 8. Prefer short-lived test credentials with minimal permissions and no access to production accounts. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_test.js:150
Finding
Automated Production Campaign Mutations Without Confirmation or Dry-Run Controls<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run_test.js`, lines 150-162 **Related Instructions**: `SKILL.md`, lines 72-79 **Vulnerability Type**: Unsafe automated execution of financially consequential operations **Risk Level**: High ### Complete Code Snippet ```javascript const scenarios = [ { label: '投放前-预算', text: '我有5000元预算,想推广一个教育类小程序,应该怎么设置投放计划?' }, { label: '投放前-选品', text: '我是做电商的,卖女装,适合选择什么投放版位和定向人群?' }, { label: '投放中-数据', text: '帮我查一下今天的广告消耗和转化数据' }, { label: '投放中-优化', text: '我的广告点击率很低只有0.5%,有什么优化建议?' }, { label: '投放中-调预算', text: '帮我把所有在投的广告日预算统一调整到200元' }, { label: '投放后-复盘', text: '帮我分析一下上周的投放效果,哪些广告ROI最高?' }, { label: '投放后-关停', text: '帮我把转化成本超过50元的广告全部暂停' }, ]; ``` The array is processed by `sendMessage`, which types each entry into the authenticated advertising Agent and presses Enter. ### Technical Analysis Two test prompts request bulk mutations: - Setting the daily budget of all active advertisements to a fixed amount. - Pausing every advertisement whose conversion cost exceeds a specified threshold. The automation targets the live URL `https://ad.qq.com/atlas/${ACCOUNT_ID}/agent` and uses authenticated account cookies. There is no enforcement that the account is a sandbox or dedicated test tenant. The script also lacks: - A dry-run mode. - Per-operation user confirmation. - Scope limits. - A preview of affected advertisements. - Verification that no mutation occurred. - Transactional rollback. - Post-operation state validation. Submitting financially consequential commands is not required to test whether a conversational interface renders, accepts text, or provides a UX response. Therefore, this behavior exceeds the minimum privilege and operational scope necessary for the declared testing function. ### Attack Path 1. The operator supplies active cookies for an advertising account. 2. `ACCOUNT_ID` identifies an account on the production advertising service. 3. The browser opens the live Agent page wit ...[truncated 1180 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove mutation-oriented prompts from the default UX test suite. 2. Replace them with clearly hypothetical questions that explicitly prohibit execution. 3. Enforce a dedicated sandbox or test-account allowlist before running any mutation test. 4. Implement dry-run mode as the mandatory default. 5. Require explicit, immediate operator approval before each individual state-changing operation. 6. Display the account ID, affected resources, old values, and proposed new values before approval. 7. Limit mutation tests to a small set of dedicated test objects rather than all active advertisements. 8. Record before-and-after state and implement tested rollback procedures. 9. Abort if the target hostname, tenant, or account does not match the approved test configuration. 10. Separate read-only UX tests from destructive or mutation tests into different scripts and permission profiles. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_test.js:33
Finding
Chromium Security Sandbox Explicitly Disabled<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run_test.js`, lines 33-36 **Vulnerability Type**: Unsafe browser-process configuration **Risk Level**: Medium ### Complete Code Snippet ```javascript const browser = await chromium.launch({ headless: true, args: ['--no-sandbox', '--disable-dev-shm-usage'] }); ``` ### Technical Analysis The `--no-sandbox` argument disables Chromium’s process sandbox. That sandbox is a principal containment boundary intended to reduce the impact of renderer, browser-content, or browser-engine vulnerabilities. The automated browser loads a remote, authenticated production application while holding sensitive session cookies. Disabling containment is not necessary for the Skill’s declared UX-testing functionality. Although some restricted container environments require special Chromium configuration, removing the sandbox transfers additional risk to the host and should not be the default. Exploitation requires a browser or rendering vulnerability, malicious remote content, or a compromised target application. The configuration does not itself provide code execution, but it can significantly increase the impact if another browser vulnerability is triggered. ### Attack Path 1. The script launches Chromium with `--no-sandbox`. 2. Sensitive authentication cookies are loaded into the browser context. 3. Chromium navigates to remote application content. 4. Malicious or compromised content triggers a browser or renderer vulnerability. 5. Because the Chromium sandbox is disabled, the exploit encounters fewer containment boundaries. 6. The attacker may gain access to the browser process environment, local files available to the process, generated reports, screenshots, and cookie material. 7. Any additional host privileges depend on the operating-system account and surrounding container configuration. ### Impact Assessment The potential impact includes: - Compromise of the local process account. - Theft of adverti ...[truncated 453 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `--no-sandbox` and run Chromium in a Playwright-supported environment. 2. Run the test under a dedicated unprivileged operating-system account. 3. If environmental restrictions make sandboxing impossible, use a disposable and hardened container with: - No host network access beyond required destinations. - No host-secret mounts. - A read-only root filesystem where practical. - Dropped Linux capabilities. - Resource and syscall restrictions. 4. Keep Chromium and Playwright patched to supported versions. 5. Separate browser execution from credential preparation and report processing. 6. Do not retain authentication cookies or sensitive outputs on the browser host after completion. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared description presents a full automation testing skill for Tencent Ads Agent, including exercising multiple product features and producing a UX report. The supplied code chunk does not perform any of those core behaviors. It only converts a user-provided cookie string into a Playwright-compatible JSON cookie file and performs lightweight validation. While cookie injection support is consistent with the setup described, this chunk’s actual purpose is a preparatory cookie-processing utility, not the advertised end-to-end Agent experience test. Therefore the code behavior is materially narrower and different from the declared primary purpose.

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill explicitly instructs users to run `document.cookie` and paste the result into the agent, which exposes live authentication credentials in natural-language form without any meaningful warning or containment. This is highly dangerous because anyone with access to the chat transcript or logs may replay the session and impersonate the user.

Ssd 3

High
Confidence
99% confidence
Finding
The skill tells users to extract full browser cookies and paste them back to the agent, directly exposing sensitive session tokens in conversational text. This creates a severe secret-handling failure: transcripts, logs, prompt history, or downstream integrations can all become credential exfiltration paths.

Description-Behavior Mismatch

High
Confidence
96% confidence
Finding
The documented 'test' flow includes real operational actions such as changing budgets and pausing ads, which go beyond passive UX evaluation and can directly affect live advertising campaigns. In the context of an authenticated session injected via cookies, these instructions could cause unauthorized or accidental business-impacting changes.

Missing User Warnings

High
Confidence
97% confidence
Finding
The skill describes budget changes and bulk pausing of ads as part of a 'test' plan without warning that these actions can modify live campaigns and cause immediate financial or business harm. In context, the use of injected authenticated sessions makes accidental execution especially risky.

Missing User Warnings

High
Confidence
99% confidence
Finding
The guide explicitly instructs users to extract their full browser cookie via document.cookie and send the complete value onward, without treating it as a secret credential. Authentication cookies are equivalent to a live session token, so disclosure can enable account takeover, impersonation, or unauthorized access to ad accounts during the cookie validity window.

Ssd 3

High
Confidence
99% confidence
Finding
Directing users to copy full authentication cookies and transmit them in plain form creates an intentional credential exfiltration path. In this skill's context, the danger is elevated because the cookie is specifically for ad.qq.com/adhome access and the skill is built around cookie injection into automation, meaning the stolen value is immediately usable for authenticated actions as the victim.

Ssd 3

High
Confidence
98% confidence
Finding
The FAQ normalizes transmission of large cookie strings by recommending splitting them into parts or saving them to a file for sending, which further operationalizes leakage of session secrets. This materially increases exploitability by helping users bypass friction that might otherwise prevent disclosure of sensitive authentication data.

Description-Behavior Mismatch

High
Confidence
96% confidence
Finding
The script's '自由对话' scenarios include explicit state-changing operational requests such as adjusting all active ad budgets and pausing ads above a cost threshold. In the context of a live authenticated ad-management session, this goes beyond passive UX testing and can trigger real account modifications, financial impact, or service disruption if the agent executes those instructions.

Description-Behavior Mismatch

High
Confidence
90% confidence
Finding
The '妙招' workflow navigates into bulk-operation features named like '批量清理低效创意' and '批量关停无效广告', then inspects the '一键执行' control. Even without clicking execute in this version, the automation is coupled to operational bulk-action surfaces and could easily be extended or accidentally triggered in a real account context, making it materially riskier than passive UI inspection.

Lp3

Medium
Category
MCP Least Privilege
Confidence
73% confidence
Finding
The skill clearly contemplates code-capable actions such as environment inspection, shell commands, Playwright usage, and cookie handling, but it declares no explicit tool scope or permission boundaries. That increases the chance an agent will use broader runtime capabilities than users expect, especially when handling sensitive authentication material.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The file specifies a Chinese-font prerequisite, reflecting a Chinese-language operating assumption, but does not state that the skill is China-specific or otherwise justify the locale requirement. Under the policy, forcing a specific language or locale without opt-in or clear justification is a natural-language policy concern.

Rp1

Medium
Category
MCP Rug Pull
Confidence
84% confidence
Finding
Using `npx playwright` without a pinned version introduces supply-chain and reproducibility risk because the resolved package/version can change over time. In a skill that handles authentication cookies and browser automation, an unexpected dependency version could alter behavior or introduce malicious code paths.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill asks for broad SSO and login cookies, including internal-domain and QQ login-state cookies, which exceeds the minimum needed for a narrow UX test and grants powerful session access. Possession of these cookies can enable account takeover within the session scope, lateral access, or misuse of ad-platform capabilities.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown template is entirely written in Chinese and prescribes Chinese section headings and report labels, which implies the skill output is expected in a specific language. The policy allows locale constraints only when the skill offers user choice or clearly documents a justified region-specific requirement, which is not stated here.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
The script reads RAW_COOKIE from an environment variable and processes cookie values that include login and token-like fields, which are sensitive credentials. Although the file header explains how to run the script, it does not explicitly warn users about the sensitivity of supplying session cookies via environment variables or the associated privacy and account-security risks.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The script automatically maps selected cookie names to broader domains such as .qq.com and .woa.com, then persists them for browser automation. In the context of an ad.qq.com testing skill, expanding injected authentication cookies to additional domains materially increases the privilege and session scope being imported, which can enable unintended access to unrelated services if the cookie jar is later used by automation.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The script writes active authentication cookies to cookies.json on disk in plaintext with no protection, warning, or lifecycle controls. Persisting session tokens this way creates a high risk of credential theft through local compromise, accidental inclusion in logs/backups, or later reuse by other processes, especially because these cookies may grant access across multiple domains.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script loads authentication cookies from disk and injects them directly into the browser context, enabling authenticated access to the ad account without interactive login. These cookies are sensitive credentials; if mishandled, reused, or collected from insecure storage, they can enable account takeover or unauthorized access to advertising data and controls.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The automation sends authenticated, account-scoped prompts to the remote ad platform and captures resulting content without clearly warning that account data, campaign metadata, and operational context may be transmitted during testing. In an ad-management setting, that can expose sensitive business information or trigger processing of real account data beyond what a user expects from a UX test.

Context-Inappropriate Capability

Low
Confidence
81% confidence
Finding
The manifest describes a workflow where the user provides an adhome cookie for browser automation testing. While cookie injection itself is in-scope, this implementation also pulls the cookie from process environment state, which is a separate credential-ingestion capability not called out in the stated purpose. That makes the skill capable of sourcing sensitive auth material from ambient environment rather than explicit user input.

Static analysis

No suspicious patterns detected.