Back to skill

Security audit

Dtc Report

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real DTC business report generator, but it needs review because it reads sensitive local business data and creates HTML reports with unsafe script and injection exposure.

Install only if you trust the local DTC data directory and understand that the generated HTML may contain confidential customer, sales, warehouse, revenue, profit, and budget information. Before use, require explicit input/output paths, escape all spreadsheet-derived text in HTML, remove or pin the Chart.js CDN dependency with integrity protection, and add confirmation before writing or overwriting reports.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_report.py:1853
Finding

Stored HTML and JavaScript Injection Through Unescaped Spreadsheet Data

Content
View full analysis
0 else 0 current_data = current_dict.get(name, {'revenue': 0, 'profit': 0}) current_rev = current_data['revenue'] current_prof = current_data['profit'] current_gross_margin = ( current_prof / current_rev * 100 ) if current_rev > 0 else 0 html += f''' {i} {name} {fmt(rev)} {cumulative_gross_margin:.2f}% {fmt(current_rev)} {current_gross_margin:.2f}% ''' for i, (name, rev, prof) in enumerate(top_sales, 1): html += f''' {i} {name} {fmt(rev)} {fmt(prof)} ''' for i, (name, vol) in enumerate(top_sales_d_volume, 1): html += f''' {i} {name} {fmt_num(vol)} ''' for country, data in sorted( warehouse_data['by_country'].items(), key=lambda x: x[1]['inbound_containers'], reverse=True ): container_pct = ( data['inbound_containers'] / total_containers * 100 ) if total_con ...[truncated 4381 chars]
Remediation
View remediation
{i} {html_text(name)} {fmt(rev)} ''' ``` 2. Replace manual HTML concatenation with a template engine configured for automatic escaping, such as Jinja2 with autoescaping enabled. 3. Keep trusted markup separate from untrusted text. For action lists, escape each action before joining it with application-generated `
` elements: ```python actions = '
'.join( f'• {html_text(action)}' for action in rec['actions'] ) ``` 4. Use `json.dumps()` for all values embedded in JavaScript and never place raw spreadsheet content directly into script blocks. 5. Validate expected spreadsheet fields. Names, regions, and labels should have reasonable length limits and reject control characters, while escaping must remain the primary defense. 6. Correct all maintained copies: - `scripts/generate_report.py` - `scripts/generate_report_backup.py` - `scripts/generate_report_old.py` - `scripts/ai_analysis.py` 7. Add regression tests with values such as: ```text "> ``` The test should verify that these strings appear as escaped text and cannot create executable elements. 8. Add a restrictive Content Security Policy to generated reports as defense in depth. Avoid allowing inline scripts or inline event handlers where feasible. ]]>

T03 · Remote Payload Retrieval and Execution

Warning
Location
scripts/generate_report.py:1239
Finding

Mutable Remote JavaScript Is Retrieved and Executed When Reports Are Opened

Content
View full analysis
DTC {period} 经营分析报告 ``` The generated report retains the same remote dependency: ```html ``` ### Technical Analysis The generated HTML executes JavaScript retrieved from jsDelivr every time the report is opened with network access. The package reference does not specify an exact Chart.js version and does not include a Subresource Integrity hash. As a result, the effective code executed by the report can change after the Skill package has been reviewed. The remote script runs in the report's document context and can access its DOM, including financial metrics, customer rankings, sales information, warehouse data, and business findings. HTTPS protects the connection in transit but does not ensure that the CDN response or selected package version remains identical to the code originally reviewed. This creates a supply-chain trust boundary around a report containing sensitive business information. ### Attack Path 1. The Skill generates an HTML report containing the remote `
Remediation
View remediation
``` 2. If a CDN must be used, pin an exact version instead of using the mutable package alias: ```html ``` 3. Generate and verify the Subresource Integrity hash from the exact approved asset. Update the version and hash only through a controlled dependency-review process. 4. Add a restrictive Content Security Policy. If the dependency is vendored locally, prefer: ```html ``` Adapt the policy to the report's actual deployment model while keeping `connect-src` disabled unless explicitly required. 5. Ensure reports can render without network access. This reduces data leakage, availability, and supply-chain risks. 6. Apply the correction to the primary, backup, and old generators, then regenerate the committed HTML report so it no longer contains the unsafe reference. 7. Establish dependency inventory and update procedures that record: - The exact Chart.js version. - The source and cryptographic checksum. - The review date. - The reason for each upgrade. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (50)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad end-to-end report-generation skill with multiple analytical modules and professional HTML output. The supplied code chunk is a narrow data-processing helper focused on customer and sales analysis: parsing a period, reading specific Excel workbooks, deduplicating customer counts by segment, aggregating revenue/profit by customer and salesperson, and extracting D-segment volume. This is plausibly a supporting component of the larger skill, but considered on its own, it does not match the declared primary capability set. There is no evidence here of report rendering, AI enhancement, budget/management report integration, overseas warehouse analysis, or full经营分析 assembly. Therefore the description materially overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The description presents a comprehensive AI-enhanced DTC operating report generator covering many report modules and multiple data sources. The supplied code does something much narrower: customer vintage analysis and HTML formatting for two subsection tables. While customer/sales analysis could be one component of the larger declared skill, this chunk alone does not substantiate the broader declared purpose and instead has a materially more limited primary function. The resource access is also narrower than declared, using specific local Excel business data files rather than clearly pulling from management reports and budget data. Therefore this code chunk does not accurately represent the declared full-skill behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description and code are broadly aligned at a high level: this is indeed a DTC business analysis report generator that assembles many of the claimed modules and outputs HTML. It reads budget, business, customer, warehouse, trend, and optional AI-analysis data, then builds a multi-section report. However, there are material mismatches. First, the declared purpose suggests a general monthly/quarterly/annual reporting skill, but the implementation shown is strongly hard-coded to 2026 and especially Q1: budget reading only covers Jan–Mar columns, defaults often fall back to Q1, multiple functions explicitly filter out April+ data, and period parsing is limited. Second, the declaration says it pulls from management reports as well as business and budget data, but the code comments and implementation explicitly use '所有业务收入明细(非订单维度)' for revenue/profit instead of 管报. Third, the release-note style claims about fixes are only partially represented in this chunk and not fully verifiable here. Therefore the description overstates/generalizes the behavior enough to count as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The code’s overall purpose is broadly aligned with report generation for DTC operating analysis, including HTML output and modules like overview, budget-vs-actual, trends, customer/sales, warehouse, and key findings. However, there are material discrepancies between the description and the actual implementation shown. The description emphasizes automatic data retrieval from management reports, business data, and budget data, but this script mostly reads business-data Excel files and uses hardcoded budget constants; the management report directory is defined but not used in the visible logic. The description also suggests broad month/quarter/year support, yet the parsing and calculation logic is strongly tied to 2026 and Q1/March assumptions, including hardcoded March day-scaling and fixed budget values. Additionally, the advertised 'AI enhanced' / 'AI deep analysis' capability is not substantiated in the shown code beyond simple rule-based narrative generation and imported helper calls. Therefore, despite strong thematic overlap, the description overstates and misrepresents several important capabilities of this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

There is substantial overlap with the declared purpose: the script does generate an HTML DTC operating analysis report and includes overview, budget-vs-actual, trend, customer/sales, warehouse, and key findings sections. However, several material description-to-behavior mismatches remain. The description emphasizes automatic data retrieval from management reports, business data, and budget data, but the code reads core metrics from business-data spreadsheets and uses hardcoded budget numbers; the management report directory is defined but not actually used in this chunk. The description also advertises an AI-enhanced / AI deep analysis capability, yet the code only computes metrics and creates simple rule-based trend text, with no AI-specific processing shown. In addition, the implementation is not a general monthly/quarterly/annual generator as advertised; it is strongly tied to 2026 and Q1/first-quarter assumptions, with fixed budget constants and manually specified MoM baselines. Finally, the v1.6.0 release-note fixes named in the description are not evidenced here. Therefore the declared description overstates and misrepresents important aspects of the actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The description presents a full-featured report-generation skill with multiple analytical sections and automated data integration across several sources. The actual code chunk only implements budget-data ingestion from a local Excel workbook. It reads specific rows for box volume, outbound pieces, and revenue, and derives gross profit via a fixed 6% assumption. There is no report assembly, HTML generation, AI analysis, multi-module business analysis, or access to management/business datasets shown in this chunk. While reading budget data could be a supporting subcomponent of the larger skill, this code by itself does not accurately represent the declared end-user functionality, so the description and observed behavior are materially mismatched.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a comprehensive report-generation skill with multiple business-analysis modules, automatic multi-source data retrieval, and HTML report production. The supplied code instead implements only part of one module: overseas warehouse analysis, along with Top10 loss customer extraction. While some details align with the version notes—such as separate US Midwest classification and excluding April data in a trend calculation—the primary behavior of this code chunk is much narrower than the declared purpose. There is no report assembly, no HTML generation, no AI analysis, no budget/management data access, and no complete end-to-end report workflow. Therefore the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a full-featured report-generation skill for DTC operating analysis, including automated multi-source data extraction and professional HTML report output. The supplied code chunk does not implement that functionality. Instead, it is a narrow test utility focused only on reading warehouse data for a single quarter and printing a few values for manual verification. This is a materially different primary purpose: validation/debugging of warehouse data access rather than generation of a complete analysis report. There is no evidence in this chunk of HTML generation, AI analysis, multi-module report composition, or use of management and budget datasets. Therefore the description does not accurately represent what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a comprehensive reporting skill for generating business analysis reports from multiple enterprise data sources. In contrast, the supplied code chunk is only a test script for validating a warehouse data month-sorting fix in warehouse.py. It does not generate any report, does not assemble the described business modules, does not perform AI analysis, and does not produce HTML output. While warehouse-related fixes are mentioned in the description, this specific code is a narrow QA/debug utility rather than the declared end-user skill behavior, so the code chunk does not accurately represent the declared purpose.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 273)May include surrounding context.

md
- 📝 修改文件:`warehouse.py`、`generate_report.py`、`SKILL.md`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 279)May include surrounding context.

md
- 📝 修改文件:`warehouse.py`、`generate_report.py`、`SKILL.md`

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The surrounding comments and appendix describe unfinished-month handling as extrapolation to a full month, e.g. multiplying by 31/30. But at L0395-L0397 the code sets d_ratio = end_day / 31 and multiplies current D-segment revenue/profit by that fraction, reducing the value instead of extrapolating it, which is the opposite of the documented rule.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares file read/write-capable behavior through documented scripts and output generation, but does not constrain tool scope with explicit permissions or allowed-tools. In an agent environment, missing scope boundaries can let the skill access or modify files beyond what is necessary for report generation, increasing the blast radius if the skill is invoked unexpectedly or combined with prompt manipulation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger phrase '看看 DTC 的经营情况' is broad enough that ordinary conversation could unintentionally invoke a file-reading/report-generating skill. In an agent setting, accidental invocation can expose business data processing paths or cause unintended file access/output generation without clear user intent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The rule set defines contradictory scaling directions for unfinished-month D-segment metrics: earlier sections upscale actual partial-month revenue/gross profit by total_days / elapsed_days, while the later '天数折算规则' table uses actual_days / month_days. In a financial reporting skill, this inconsistency can systematically understate or overstate key metrics depending on which rule the agent follows, producing materially misleading business analysis and budget comparisons.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code hard-codes a local user workspace path and is designed to read business/order/customer data from that location without any visible consent, notice, or access scoping. In an agent-skill context, this creates a privacy and data-minimization risk because sensitive local data may be accessed implicitly and incorporated into downstream analysis or report output.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This logic enumerates Excel files, opens a customer revenue workbook, and analyzes customer-level revenue data without any explicit disclosure to the user that customer data will be ingested. Even though the purpose appears business-analytic rather than malicious, it exposes sensitive commercial information and could surface identifiable customer names and revenue changes in generated output unexpectedly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script is hard-wired to read from a specific local directory containing business and customer data, which increases the chance of unauthorized or unexpected access to sensitive commercial information when the skill runs in another user's environment. In an agent-skill context, automatic filesystem access without explicit disclosure or consent can violate least-privilege expectations and lead to privacy or confidentiality exposure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file includes its primary module description in Chinese and later emits Chinese user-facing status messages, which imposes a specific language on users. The policy allows fixed locale only when users can opt in or the regional constraint is clearly justified, neither of which is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script prints user-visible progress text in Chinese, and similar Chinese-only output appears elsewhere in the file. For all file types, forcing a language without opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The appendix states that D段箱量、出库件数、B/C段收入、D段收入 will be adjusted or estimated for incomplete months. However, the actual code earlier explicitly disables these adjustments and uses raw data directly, as noted in comments and implementation around L0529-L0538, and no corresponding adjustment logic exists for outbound or volume calculations. This is an active contradiction between embedded documentation and code behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script materializes a full business report containing sensitive commercial and customer data to a user-controlled filesystem path without any confirmation, classification warning, or path safety controls. In a shared workstation, synced folder, or unintended directory, this can lead to accidental disclosure of confidential data through persistence, backup, or broader-than-expected access.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The docstring at L0077-L0082 explicitly states that budget data comes from a specific Excel file and worksheet. However, the implementation at L0083-L0117 does not open or parse any file and instead returns a static literal dictionary, which directly contradicts the documented behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The generated HTML loads Chart.js from an external CDN, creating a runtime network dependency and a third-party script execution path in a report that may be opened in a privileged corporate browser context. If the CDN response is tampered with, blocked, or replaced, users can be exposed to script-based compromise, tracking, or report failure; the skill context makes this more concerning because the report appears intended for internal financial use and may be shared broadly.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The comments at L2135-L2137 imply month-over-month values are being read as prior-month data. In reality, L2137-L2140 assigns a hard-coded dictionary, so the implementation does not perform the documented data read and can diverge from source data.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.