Back to skill

Security audit

Byted Tos Doc Process

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its TOS document-preview purpose, but it handles temporary document-access links unsafely and includes an unrestricted direct-URL fetch mode that should be reviewed before use.

Review this skill before installing in shared or sensitive environments. Use least-privilege, short-lived TOS credentials; avoid --direct-url unless the URL is a trusted TOS preview URL; do not paste signed preview URLs or tokens into chats, tickets, logs, or CI output; restrict network access where possible; and pin the tos dependency to a reviewed version.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/doc_preview_html_url.py:244
Finding

Unrestricted Direct URL Fetch Enables SSRF and Local File Disclosure

Content
View full analysis
str: """Fetch HTML directly from a user-provided URL (no SDK involved).""" print(f"[INFO] Fetching HTML from direct URL: {url}") req = Request(url) try: with urlopen(req) as resp: html_bytes = resp.read() except HTTPError as e: print( f"[ERROR] HTTP error when fetching direct HTML URL: " f"status={e.code}, reason={e.reason}", file=sys.stderr, ) sys.exit(1) except URLError as e: print(f"[ERROR] Failed to fetch direct HTML URL: {e.reason}", file=sys.stderr) sys.exit(1) except Exception as exc: print(f"[ERROR] Unexpected error when fetching direct HTML URL: {exc}", file=sys.stderr) sys.exit(1) return html_bytes.decode("utf-8", errors="replace") ``` ```python parser.add_argument( "--direct-url", dest="direct_url", type=str, default=None, help=( "If provided, skip SDK and use this HTML URL directly. " "Useful for debugging sample links such as the ones in official docs." ), ) ... if args.direct_url: # Direct URL mode: no SDK required. html = fetch_html_from_direct_url(args.direct_url) ``` ```python try: preview_link = extract_preview_link(html) except ValueError as exc: print(f"[ERROR] Failed to extract preview link from HTML: {exc}", file=sys.stderr) # Optionally dump a small prefix of HTML to help debugging print(html[:400], file=sys.stderr) sys.exit(1) try: token = extract_token_from_html(html) except ValueError as exc: print(f"[ERROR] Failed to extract token from HTML: {exc}", file=sys.stderr) # Optionally dump a small prefix of HTML to help ...[truncated 2571 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/doc_preview_html_url.py:325
Finding

Bearer-Like Preview Tokens and Signed URLs Are Printed in Plaintext

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/doc_preview_pdf.py:141
Finding

Download Size Limits Are Enforced Only After the Entire Response Is Written

Content
View full analysis
max_object_size: print( f"[ERROR] Output size ({size} bytes) exceeds MAX_OBJECT_SIZE={max_object_size}. " "Deleting local file.", file=sys.stderr, ) try: os.remove(output_path) except OSError: pass sys.exit(1) ``` Equivalent unbounded streaming followed by a post-download size check appears in the PNG, JPG, and generic processor scripts at the locations listed above. ### Technical Analysis `MAX_OBJECT_SIZE` is described as a safety guard, but it is evaluated only after the server closes the response and all bytes have been written to disk. It therefore does not constrain peak disk usage. A malicious, compromised, misconfigured, or redirected endpoint can return: - A ...[truncated 1527 chars]
Remediation
View remediation
max_object_size: raise ValueError("Response exceeds MAX_OBJECT_SIZE") out_f.write(chunk) total += len(chunk) ``` 2. Validate `Content-Length` before writing when it is present, while retaining the streaming counter because the header may be absent or inaccurate. 3. Set explicit connection and read timeouts. 4. Download into a securely created temporary file and atomically rename it only after successful validation. 5. Apply filesystem quotas and process-level resource limits. 6. Validate `MAX_OBJECT_SIZE` before use and reject negative, zero, malformed, or unreasonably large values. 7. Centralize the bounded-download logic in one shared helper to prevent inconsistent fixes across PDF, PNG, JPG, and generic processing scripts. 8. Consider validating the response media type before retaining output. 9. Abort and delete the partial temporary file immediately when any limit is exceeded. ]]>

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Third-Party TOS Dependency Is Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
``` 3. Generate and enforce cryptographic hashes using a locked requirements file and: ```bash pip install --require-hashes -r requirements.lock ``` 4. Use a trusted internal package mirror or explicitly configured package index. 5. Run dependency vulnerability and provenance scanning in CI. 6. Review release notes and source changes before updating the pinned version. 7. Prevent dependency installation at runtime where possible; build dependencies into a controlled, immutable environment. 8. Use short-lived STS credentials with narrowly scoped permissions so a compromised dependency has minimal cloud access. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior exceeds the declared purpose by describing remote HTML fetching, token extraction/decoding, and potentially direct URL handling beyond simple pre-signed URL generation. This mismatch is dangerous because reviewers and users may approve or invoke the skill under a narrower trust model while it actually performs more powerful network and parsing actions that can expose data or contact attacker-controlled resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The documented behavior exceeds the declared purpose by describing remote HTML fetching, token extraction/decoding, and potentially direct URL handling beyond simple pre-signed URL generation. This mismatch is dangerous because reviewers and users may approve or invoke the skill under a narrower trust model while it actually performs more powerful network and parsing actions that can expose data or contact attacker-controlled resources.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README instructs agents to generate pre-signed URLs and make HTTP requests, but it does not warn that these URLs commonly carry time-bound authorization in query parameters. In an agent setting, such URLs are likely to be logged, echoed in chat, stored in traces, or forwarded to third-party tools, which can expose temporary access to protected documents and derived previews.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The sample output includes what appears to be a full preview token and a fully usable preview URL, effectively normalizing disclosure of bearer-style access material in documentation and logs. If a real token or similarly structured example is copied from production output, anyone with access to the README, CI logs, chat transcripts, or telemetry could reuse it to access previewed document content until expiry.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This reference explains how to generate pre-signed URLs and decode the final HTML preview URL token, but does not warn that either URL can directly grant access to document contents until expiration. In this skill's context, those URLs are effectively bearer tokens to potentially sensitive documents, so users may mistakenly paste them into logs, tickets, chats, or analytics systems and unintentionally leak document access.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill demonstrates access to environment variables and outbound network operations, but it does not declare any tool scope or permission boundaries. In an agent setting, this increases the chance that a caller or orchestrator will invoke the skill without realizing it can read secrets and fetch remote content, leading to unintended credential exposure or SSRF-like network access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description scopes the skill to generating pre-signed URLs for document preview/conversion. However, the Quick Start code goes beyond URL generation by fetching the signed URLs with urlopen and writing the resulting PDF/PNG to local files, which is a materially broader behavior than the manifest states.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest emphasizes pre-signed URL generation for preview/conversion, but this section documents a workflow that causes processed pages to be saved to a destination bucket via x-tos-save-bucket and x-tos-save-object. That is a remote write/export capability, not just URL generation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script prints the extracted token and decoded preview URL directly to stdout. In this skill’s context, those values are effectively bearer-style access artifacts for document preview resources, so they can be exposed through terminal history, CI/CD logs, chat transcripts, notebook outputs, or other shared logging systems and reused by unintended parties until expiry.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation instructs users to supply TOS credentials via environment variables but does not include any caution about treating those credentials as secrets, avoiding logging them, or using least-privilege/short-lived credentials. In a skill centered on generating signed access URLs, omission of credential-handling guidance increases the chance of accidental disclosure through shell history, debug output, screenshots, or insecure runtime environments.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency specification uses an unpinned package name only, which allows future installs to resolve to any available version of the tos package. This creates a supply-chain risk because a breaking, vulnerable, or malicious upstream release could be pulled in without review, and this skill handles pre-signed URL generation for document processing where dependency integrity matters.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
tos