Back to skill

Security audit

Agent Accounting

Security checks for vulnerabilities and agentic risk

Overview

This accounting skill is mostly coherent, but it handles sensitive tax and invoice data with under-scoped live submission, credential, and report-safety controls.

Review carefully before installing in any real accounting environment. Use only demo or simulation mode until live tax submission destinations are allowlisted, HTTPS-only, and confirmed immediately before sending; avoid uploading sensitive invoice images to cloud OCR unless the data-sharing terms are acceptable; protect or disable local token caching; and fix dashboard HTML escaping before opening reports built from untrusted OCR or invoice data.

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

T09 · Insecure Skill Coding Practices

Error
Location
core/golden_tax.py:759
Finding

Arbitrary Tax Filing Endpoint Can Receive Credentials and Confidential Tax Records

Content
View full analysis
dict: """通用第三方接口(百望云/企享云)""" if not self.api_key or not self.base_url: logger.warning(f"{self.mode} API未配置,降级模拟申报") return self._simulate_submit(tax_return, tax_type) url = f"{self.base_url}/tax/submit" payload = { "appKey": self.api_key, "taxType": tax_type.value, "period": tax_return.period.period_str, "taxId": tax_return.company.tax_id, "xmlContent": tax_return.to_xml(), } try: resp = requests.post(url, json=payload, headers={"Authorization": f"Bearer {self.api_secret}"}, timeout=15) ``` The destination originates from a constructor parameter or the environment without validation: ```python self.api_key = api_key or os.environ.get("TAX_API_KEY", "") self.api_secret = api_secret or os.environ.get("TAX_API_SECRET", "") self.base_url = base_url or os.environ.get("TAX_API_BASE_URL", "") ``` ### Technical Analysis The filing adapter sends highly sensitive business information to an unrestricted `base_url`. The transmitted payload includes: - The company tax identifier. - Filing period and tax type. - Complete XML tax returns. - Revenue, costs, expenses, tax liabilities, and company identity embedded in the XML. - The provider API key in the JSON body. - The provider secret as a bearer token. The implementation does not require HTTPS, validate the hostname or port, restrict the destination to an approved tax provider, reject embedded URL credentials, or disable redirects. Consequently, a caller or process capable of modifying `TAX_API_BASE_URL` can redirect confidential tax information and service credentials to an ...[truncated 1426 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
core/baidu_ocr.py:94
Finding

Baidu OAuth Access Token Is Persisted in Plaintext Without Enforced File Permissions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
web/dashboard.py:379
Finding

Unescaped OCR and Accounting Data Enables Persistent Script Injection in Generated Dashboards

Content
View full analysis
= 0.85 else ("yellow" if inv.confidence >= 0.6 else "red") invoice_rows += f""" {i} {inv.invoice_type.value[:8]} {inv.invoice_code} {inv.invoice_number} {inv.invoice_date.isoformat() if inv.invoice_date else '-'} {inv.seller_name[:12]} ¥{inv.amount:,.2f} ¥{inv.tax_amount:,.2f} {inv.confidence:.0%} """ ``` The generated rows are inserted directly into the dashboard template: ```python return cls.TEMPLATE.format( company_name=company.name, period=f"{date.today().year}年{date.today().month}月", update_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), ... invoice_rows=invoice_rows, voucher_rows=voucher_rows, voucher_detail_section=detail_html, ... risk_alerts_html=risk_html, ) ``` Other unescaped fields include accounting-entry summaries, account names, company names, filing messages, serial numbers, balance-sheet names, and risk messages. ### Technical Analysis Data originating from invoices, OCR output, imported accounting records, and filing responses is directly concatenated into an HTML document. No HTML contextual escaping is applied before interpolation. String slicing such as `seller_name[:12]` is not a security control. A compact payload can still close the current element or introduce an event handler. Similar unsafe interpolation occurs in multiple dashboard sections. The generated dashboard is explicitly intended to be opened in a web browser. Therefore, attacker-controlled markup can bec ...[truncated 1705 chars]
Remediation
View remediation
`. 5. Add a restrictive Content Security Policy that disallows inline event handlers and limits scripts and connections to approved origins. 6. Remove inline JavaScript or use nonces/hashes if inline execution remains necessary. 7. Consider packaging Chart.js locally with a reviewed, pinned version instead of loading it dynamically from a CDN. 8. Validate and normalize fields, but do not use validation as a substitute for output encoding. 9. Add regression tests for payloads involving element termination, event handlers, SVG payloads, quotes, ampersands, and `` sequences. ]]>

T08 · Insecure Dependencies

Note
Location
requirements.txt:6
Finding

Unpinned Dependency Ranges Prevent Reproducible and Verifiable Installations

Content
View full analysis
=2.28.0 # 图像处理(上传票据图片前预处理,可选) Pillow>=9.0.0 # Excel报表导出(可选) openpyxl>=3.0.10 # 环境变量管理(可选,也可直接设置系统环境变量) python-dotenv>=1.0.0 ``` ### Technical Analysis All dependencies use unrestricted lower-bound version constraints. A fresh installation may therefore select any future version that satisfies the minimum requirement. The project does not provide a lockfile, exact reviewed versions, or package hashes. The package names and declared package source are not themselves suspicious, and no dependency-confusion or typosquatting package was identified. The weakness is that installations are not reproducible or cryptographically tied to reviewed artifacts. ### Attack Path 1. A future compatible dependency version is compromised, malicious, or introduces a severe regression. 2. A user later executes `pip install -r requirements.txt`. 3. The resolver selects the affected version because it satisfies the broad `>=` constraint. 4. Installation or import executes the dependency’s code with the privileges of the user running the Skill. 5. The dependency can access data and resources available to that Python process. ### Impact Assessment A compromised resolved dependency would execute with the same local privileges as the Skill. Depending on the affected package, this could expose invoice files, environment credentials, tax data, generated reports, and files accessible to the user account. This finding represents supply-chain exposure rather than evidence that any currently named dependency is malicious. ]]>
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (40)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

代码与描述存在明显范围不一致。声明描述的是一个端到端“代理记账自动化系统”,包含做账、报表、报税、风险控制等完整财务流程;而给出的代码块仅实现票据OCR识别这一子能力,且核心是百度OCR API接入、token缓存、结果解析和本地降级。它并没有展示分录生成、总账/凭证处理、报表汇总、税务申报、风险预警等声明中的关键功能。代码访问的外部资源(百度OCR接口)与“票据OCR识别”部分一致,但不足以支撑整体声明,因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a broad end-to-end accounting automation platform, including OCR recognition, classification, journal entry generation, voucher creation, trial balance, financial reports, tax filing, and risk alerts. The supplied code chunk only covers a narrow subset: rule-based accounting entry generation from already-structured Invoice objects, voucher batching, voucher balance validation, and account lookup. While this aligns with part of the declared purpose (智能分录/凭证编制), it materially under-delivers relative to the claimed primary scope in this chunk. There is no evidence here of OCR execution, report generation, tax submission, tax system integration, or risk analysis. 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
99% confidence
Finding

The declared description promises a comprehensive accounting automation platform with OCR, intelligent posting, reporting, tax filing, and risk monitoring. However, the provided code chunk is only a placeholder package initializer with a comment ('Web dashboard package') and no functional logic. This is a clear description-behavior mismatch because the actual code does not implement any of the core declared capabilities or even enough supporting code to substantiate the claimed purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes executing tax filing workflows and full end-to-end automation without prominently warning that it may generate filing XML, interact with external tax service providers, or affect financial records. In a bookkeeping/tax context, lack of clear user warning and consent can lead to unauthorized submissions, incorrect filings, or disclosure of sensitive taxpayer information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README promotes OCR processing and third-party tax filing integrations for highly sensitive financial and tax data, but it does not disclose privacy, retention, cross-border transfer, or third-party sharing risks. In an accounting automation context, users may reasonably assume local-only handling unless warned, which can lead to unintended exposure of invoices, payroll, banking, and tax information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The one-click 'full' workflow is documented as including tax filing, yet the README does not warn that executing it may generate filing artifacts or trigger steps that affect official tax submission workflows. In a tax/accounting skill, this is more dangerous than usual because users may run demos in production-like environments and unintentionally create or submit compliance-relevant data.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 108)May include surrounding context.

bash
$env:TAX_API_KEY="your_tax_api_key"
$env:TAX_API_BASE_URL="https://api.your-provider.com/v1"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill advertises and demonstrates capabilities that access environment variables, local files, and external services, but it does not declare an explicit tool/permission scope. In an agent environment, missing scope boundaries can allow broader-than-expected execution and make it harder for users or the platform to understand what sensitive resources the skill may touch.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

The skill includes configuration for transmitting data to a third-party tax API endpoint, which is a real external data transfer path. In this financial context, outbound transmission is sensitive because invoices, tax amounts, and business identifiers may be sent to external providers, creating confidentiality and compliance risk if not tightly controlled.

Content

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

md
支持第三方申报服务商对接(百望云/航信/企享云):
- `$env:TAX_API_KEY="your_tax_api_key"`
- `$env:TAX_API_BASE_URL="https://api.your-provider.com/v1"`

高风险自动阻止申报,输出修正建议。

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are broad everyday accounting requests such as '这个月报税' or '生成财务报表', which raises the chance of accidental invocation. In this skill's context, unintended activation is more dangerous because the documented workflow includes tax calculation, file generation, dashboard opening, and possible third-party filing integration affecting sensitive financial data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code persists the Baidu access token to a predictable file under the user's home directory for up to 30 days without visible controls on file permissions, encryption, or user disclosure. If the local environment is shared or compromised, the token could be reused to access the OCR service, incur charges, or facilitate unauthorized processing under the victim account.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill uploads invoice images and PDFs containing potentially highly sensitive financial and personal data to a third-party OCR provider, but the code shows no user-facing consent, disclosure, or policy control around that transfer. In an accounting automation skill, this is more dangerous because documents may include tax IDs, company details, bank data, and invoice contents, creating privacy, compliance, and data-governance risk.

Content

No source excerpt is available for this finding.

Tainted flow: 'url' from requests.post (line 394, 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 · core/baidu_ocr.py (reported line 348)May include surrounding context.

python
key, content = "image", _file_to_base64(image_path, url_encode=True)

            url = f"{BAIDU_FINANCE_OCR_URL}?access_token={token}"
            resp = requests.post(
                url,
                headers={"Content-Type": "application/x-www-form-urlencoded"},
                data=f"{key}={content}",

Tainted flow: 'url' from requests.post (line 394, 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 · core/baidu_ocr.py (reported line 395)May include surrounding context.

python
key, content = "image", _file_to_base64(image_path, url_encode=True)

            url = f"{BAIDU_VAT_INVOICE_URL}?access_token={token}"
            resp = requests.post(
                url,
                headers={"Content-Type": "application/x-www-form-urlencoded"},
                data=f"{key}={content}&seal_tag=false",

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring describes the skill entirely in Chinese and presents it as the default behavior, with no indication that users may choose another language or that the skill is intentionally limited to a China-specific deployment context. Under the policy, forcing a specific language without opt-in or explicit justification is a natural-language locale violation.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

The code sends detailed tax filing data, including taxpayer ID and XML filing content, to a remotely configurable endpoint using requests.post. Because base_url can come from environment/configuration and there is no allowlist or destination validation, misconfiguration or malicious configuration could exfiltrate highly sensitive tax data to an attacker-controlled service.

Content

Scanner excerpt · core/golden_tax.py (reported line 739)May include surrounding context.

python
}

        try:
            resp = requests.post(url, json=payload, timeout=15)
            resp.raise_for_status()
            data = resp.json()
            if data.get("code") == "0000":

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code sends tax return payloads containing company tax ID and full XML filing content to an external service via requests.post. Although the module docstring describes third-party adapters generally, the code path itself lacks a user confirmation or explicit disclosure immediately before transmission of sensitive filing data.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

This generic submission path posts taxpayer identifiers, reporting period data, and full XML tax return contents to any configured base_url while also sending the API secret as a bearer token. Since the destination is fully configurable and not constrained to trusted hosts, an attacker who influences configuration could capture both sensitive filing data and authentication credentials.

Content

Scanner excerpt · core/golden_tax.py (reported line 774)May include surrounding context.

python
"xmlContent": tax_return.to_xml(),
        }
        try:
            resp = requests.post(url, json=payload,
                                  headers={"Authorization": f"Bearer {self.api_secret}"},
                                  timeout=15)
            resp.raise_for_status()

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

The module docstring and all user-facing enum values/comments are written exclusively in Chinese, indicating the skill is designed around a single language/locale. There is no visible indication in this file that users can choose another language or that the locale restriction is documented as an explicit, justified regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module's natural-language documentation is entirely Chinese and describes behavior for Chinese invoice categories, but it does not state that the skill is region-specific or provide any opt-in/choice of language or locale. Under the policy for natural-language violations, forcing a specific language without user choice can be a locale-policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file-level docstring and class/method descriptions are entirely in Chinese, indicating a language-specific skill experience. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The cmd_filing command is described as testing a Golden Tax filing workflow, which is a safety-sensitive financial operation, but this file provides no explicit warning or confirmation around filing-related behavior. Even though it uses mode="simulate", the user-facing command listing and docstring do not clearly disclose that the workflow handles filing artifacts and should not be confused with a real submission path.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s top-level description and subsequent user-facing output strings are Chinese-only, which effectively forces a specific language/locale. The policy allows locale constraints only when documented and justified or when users are offered a choice, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module description and generated dashboard content are entirely in Chinese, and the HTML template explicitly sets the document language to zh-CN. This is a natural-language locale restriction with no indication of user opt-in, language selection, or a documented region-specific requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The adapter automatically reads TAX_API_KEY, TAX_API_SECRET, and TAX_API_BASE_URL from environment variables. Accessing credentials is safety-relevant, and while the constructor docstring mentions these parameters, it does not clearly warn users that the skill will pull secrets from the process environment by default.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.