Back to skill

Security audit

Bi2 Report Generator

Security checks for vulnerabilities and agentic risk

Overview

This report generator has a coherent business-report purpose, but it embeds Feishu app credentials and can send sensitive reports externally without clear per-run user control.

Review this skill carefully before installing. It is not clearly malicious, but it should not be used with real business data unless the Feishu secret is removed and rotated, Feishu sending is made explicit and opt-in, recipients and output paths are confirmed, unknown users fail closed, and the remote Chart.js dependency is removed or pinned with integrity controls.

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

Error
Location
generator.py:128
Finding

Hard-Coded Feishu Application Credentials

Content
View full analysis

Vulnerability Details

File Location: generator.py:128-133
Vulnerability Type: Hard-coded application secret
Risk Level: High

python
app_id = "cli_a92550a0def91bb4"
app_secret = "gKxq8vGTcr13awNezls7Uh6kqhv4AEwB"

# Obtain token
token_url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
token_resp = requests.post(token_url, json={"app_id": app_id, "app_secret": app_secret})

Technical Analysis

A plaintext Feishu application identifier and secret are embedded directly in distributable source code. Anyone who can read the Skill package, source repository, deployment artifact, backup, or execution environment can recover and reuse these credentials independently of the intended application.

The credential is transmitted to Feishu's official token endpoint, which is necessary for the documented authentication flow and is not evidence of transmission to an unknown party. The vulnerability is the static inclusion and uncontrolled distribution of a reusable secret, rather than the destination of the request.

The permissions available to an attacker would be bounded by the scopes and tenant access granted to this Feishu application. The surrounding code demonstrates that a resulting tenant token is used to upload files and send messages.

Attack Path

  1. An attacker obtains read access to the Skill package, source repository, deployment bundle, or a copy of generator.py.
  2. The attacker extracts the hard-coded app_id and app_secret.
  3. The attacker submits those credentials to Feishu's tenant-token endpoint.
  4. If the credentials remain valid, Feishu returns a tenant access token.
  5. The attacker invokes any Feishu APIs authorized for the application, potentially including file upload and message delivery.
  6. The attacker repeats token issuance until the secret is revoked or rotated.

Impact Assessment

Successful exploitation could allow unauthorized u ...[truncated 575 chars]

Remediation
View remediation

Remediation Suggestions

  1. Revoke and rotate the exposed Feishu application secret immediately; merely deleting it from the current source does not invalidate copies in prior artifacts or history.
  2. Store credentials in an approved secret manager or protected environment variables, and retrieve them only when Feishu delivery is explicitly requested.
  3. Fail closed when credentials are absent rather than falling back to embedded defaults.
  4. Restrict the Feishu application's scopes to the minimum permissions required for file upload and message delivery.
  5. Apply recipient restrictions, audit logging, rate limits, and credential-use monitoring.
  6. Ensure secrets are excluded from source control, packages, logs, exception messages, and generated reports.
  7. Add automated secret scanning to development and release pipelines.
  8. Handle HTTP errors safely by adding request timeouts, status validation, and sanitized error reporting.

T08 · Insecure Dependencies

Warning
Location
report_template.html:7
Finding

Unpinned Third-Party JavaScript Executes When Reports Are Opened

Content
View full analysis

Vulnerability Details

File Location: report_template.html:7
Vulnerability Type: Unpinned remote dependency without integrity verification
Risk Level: Medium

html
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

Technical Analysis

The generated report loads and executes Chart.js directly from a third-party CDN. The URL does not specify an exact package version and does not include a Subresource Integrity hash. Consequently, the JavaScript executed by report viewers can change after the Skill has been reviewed or deployed.

A compromise of the CDN, package publishing account, dependency resolution path, or upstream package could cause attacker-controlled JavaScript to execute in the report's browser context. The audited template does not use Chart.js, so this remote dependency is unnecessary for the report's currently implemented functionality and exceeds the minimum external access required.

Attack Path

  1. An attacker compromises the relevant package release channel, CDN delivery path, or upstream publishing account.
  2. The unversioned chart.js resource resolves to altered JavaScript.
  3. A recipient opens a generated HTML report while connected to the network.
  4. The browser retrieves the altered script from the CDN.
  5. The script executes with access to the report's DOM and browser capabilities allowed by the document context.
  6. The script may read report content, modify displayed figures, initiate network requests, or present deceptive user-interface elements.

This attack requires compromise or malicious modification of the external dependency path; the audited project itself does not contain such a payload.

Impact Assessment

Exploitation could expose confidential business information rendered in the report, including sales, profitability, customer, inventory, accounts-receivable, and forecast data. Malicious JavaScript could also falsify report contents, redirect ...[truncated 319 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the Chart.js import because the audited template does not use the library.
  2. If Chart.js becomes necessary, bundle a reviewed local copy with the Skill so report behavior remains stable and auditable.
  3. If remote loading is unavoidable, pin an exact version rather than resolving the latest package.
  4. Add a verified Subresource Integrity hash and the appropriate crossorigin attribute.
  5. Introduce a restrictive Content Security Policy that limits script execution and outbound network destinations.
  6. Review and update dependencies through a controlled process with vulnerability monitoring and integrity verification.
  7. Prefer a fully self-contained report when it may contain sensitive internal business data.

T09 · Insecure Skill Coding Practices

Warning
Location
generator.py:86
Finding

Unknown Users Silently Fall Back to Another User's Report Directory

Content
View full analysis

Vulnerability Details

File Location: generator.py:86
Vulnerability Type: Insecure user-to-directory fallback and cross-user data isolation failure
Risk Level: Medium

python
output_path = os.path.join(USER_FOLDERS.get(user, USER_FOLDERS["Richard"]), filename)

Technical Analysis

The report generator maps a supplied user name to a hard-coded output directory. If the identifier is unknown, malformed, differently cased, or misspelled, the code does not reject the request. It silently selects Richard's directory instead.

This behavior violates user isolation because reports intended for an unrecognized user are written into a different named user's directory. It also conflicts with the declared design in which the Feishu user determines the report's save path. The default is not necessary for report generation and should be replaced with explicit identity validation.

The filename is date- and version-based rather than uniquely tied to the authorized request. Multiple writes to the same fallback path can therefore overwrite an existing report.

Attack Path

  1. A caller invokes generate_report with an unmapped user identifier, whether intentionally or through an input error.
  2. USER_FOLDERS.get fails to find the supplied identifier.
  3. The expression selects USER_FOLDERS["Richard"] as the default.
  4. The generator creates that directory if necessary and writes the report into it.
  5. Richard, or any process with access to that directory, can receive or inspect a report intended for another user.
  6. If the generated filename matches an existing report, the normal write operation may replace the existing file.

Impact Assessment

Exploitation or accidental triggering can disclose confidential business reports across user boundaries. Exposed information may include financial results, customer rankings, inventory, accounts receivable, and forecasts.

The issue does not create new operatin ...[truncated 282 chars]

Remediation
View remediation

Remediation Suggestions

  1. Reject unknown user identifiers with an explicit error instead of selecting a default user.
  2. Resolve the authenticated Feishu identity through an authoritative server-side mapping rather than trusting an arbitrary caller-provided display name.
  3. Normalize identifiers only according to a documented policy and avoid ambiguous case-insensitive matching.
  4. Verify that the resolved output directory belongs to the authenticated recipient before writing.
  5. Apply filesystem permissions that prevent users from reading or modifying one another's report directories.
  6. Use collision-resistant filenames or exclusive file creation to prevent unintended overwrites.
  7. Log the authenticated identity, resolved destination, and report identifier without recording sensitive report contents.
  8. Add tests for unknown, empty, misspelled, and unauthorized user identifiers to confirm that all such requests fail closed.
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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (13)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This function uploads a local file to Feishu and sends it to a recipient without any user-facing warning or consent flow. In the context of a report generator handling business data, silent network transmission creates a clear confidentiality risk and could leak sensitive internal reports outside the expected local workflow.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases are short and broad enough that normal conversation about BI2 reports or business analysis could activate the skill unintentionally. Because the skill can read screenshots, generate files, save them to disk, and send outputs over Feishu, accidental invocation could cause unintended processing and disclosure of sensitive business data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly saves generated reports to local user-specific directories, uploads them, sends messages via Feishu, and deletes temporary files, but it does not clearly warn users that business data will be written to disk and transmitted externally. In this context, the data includes internal financial and customer information, so silent persistence and exfiltration behaviors materially increase confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The report is written directly to a hard-coded user-specific desktop path without confirmation or user-selected output location. In an agent/skill context, silent writes to local user folders can surprise users, overwrite files, or disclose sensitive business content to other local processes or synced desktop services.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file advertises itself as a report generator, but it also contains capability to authenticate to Feishu, upload a local file, and send it to a recipient. Hidden or unrelated exfiltration-capable functionality increases risk because users may invoke the skill expecting local report generation while sensitive files can be transmitted off-host.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The code performs external authentication to Feishu using embedded credentials, enabling subsequent outbound transmission. In a skill whose visible purpose is local HTML report generation, undisclosed external connectivity materially increases the risk of data exfiltration and also exposes hard-coded app credentials in source code.

Content

Scanner excerpt · generator.py (reported line 133)May include surrounding context.

python
# 获取 token
    token_url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
    token_resp = requests.post(token_url, json={"app_id": app_id, "app_secret": app_secret})
    token = token_resp.json().get("tenant_access_token")
    
    if not token:

Tainted flow: 'headers' from requests.post (line 140, network input) → requests.post (network output)

Medium
Category
Data Flow
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.

Content

Scanner excerpt · generator.py (reported line 147)May include surrounding context.

python
with open(file_path, "rb") as f:
        files = {"file": (file_name, f, "application/octet-stream")}
        data = {"file_type": "stream"}
        upload_resp = requests.post(upload_url, headers=headers, files=files, data=data)
    
    upload_data = upload_resp.json()
    file_key = upload_data.get("data", {}).get("file_key")

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This request sends a file message to Feishu, completing external delivery of a locally generated report to a recipient. Because the skill context is report generation rather than messaging, this outbound transmission is more dangerous: users may not expect sensitive business data to leave the machine or tenant via automated send behavior.

Content

Scanner excerpt · generator.py (reported line 165)May include surrounding context.

python
}
    params = {"receive_id_type": "open_id"}
    
    send_resp = requests.post(send_url, headers=headers, params=params, json=send_data)
    send_data_resp = send_resp.json()
    
    return {

Tainted flow: 'headers' from requests.post (line 140, network input) → requests.post (network output)

Medium
Category
Data Flow
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.

Content

Scanner excerpt · generator.py (reported line 165)May include surrounding context.

python
}
    params = {"receive_id_type": "open_id"}
    
    send_resp = requests.post(send_url, headers=headers, params=params, json=send_data)
    send_data_resp = send_resp.json()
    
    return {

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The HTML document explicitly sets lang="zh-CN", and the visible UI text throughout the template is also fixed in Chinese. Under the natural-language policy rules, forcing a specific language/locale without user opt-in or documented justification is a policy concern.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The inline comment '填充数据' states that data is being populated into the report, implying the generated HTML reflects the supplied business data. In reality, html_content is assigned directly from the template and written out without using the data argument, so the comment misrepresents the actual behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template loads Chart.js from a third-party CDN at runtime, creating an unnecessary external trust and network dependency for a local report template. If the CDN response is tampered with, blocked, or swapped for a malicious version, the page could execute attacker-controlled JavaScript in the report viewer's browser.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script formats the report date with toLocaleDateString('zh-CN'), which enforces a Chinese locale choice in code. The file does not provide an opt-in, fallback, or explanation that this is a region-specific requirement.

Content

No source excerpt is available for this finding.