Back to skill

Security audit

Byted Tos Image Process

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed TOS image-processing helper, but users should install it only with scoped cloud credentials and reviewed dependency versions.

Install only in an environment where the agent is intended to access the named TOS buckets. Use short-lived, least-privilege STS credentials, set TOS_ENDPOINT to an official HTTPS TOS endpoint, pin the tos package to a reviewed version, and avoid exposing the generic processor to untrusted task input.

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)

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned Third-Party SDK Dependency

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1
Vulnerability Type: Unpinned dependency / supply-chain exposure
Risk Level: Medium

Vulnerable Code

text
tos

The installation instructions also resolve the package without a version constraint:

bash
pip install tos

Technical Analysis

The project installs the tos package without specifying an exact version or verifying an artifact hash. Consequently, the code installed during deployment can differ from the code tested during the audit.

Because every executable script imports tos and passes TOS access credentials to tos.TosClientV2, a compromised, malicious, or unexpectedly incompatible future package release would execute in the same Python process and gain access to:

  • TOS_ACCESS_KEY
  • TOS_SECRET_KEY
  • TOS_SECURITY_TOKEN
  • TOS bucket and object identifiers
  • Local files and other environment variables available to the process

No evidence shows that the currently resolved tos package is malicious. The vulnerability is the absence of reproducible dependency controls, which unnecessarily increases supply-chain risk.

Attack Path

  1. An attacker compromises a future release of the tos package, a configured package index, or the dependency publication process.
  2. A user follows the documented pip install tos command or deploys from requirements.txt.
  3. The package installer retrieves the attacker-controlled release because no version or hash is constrained.
  4. A skill script imports the installed package.
  5. Malicious package initialization or SDK code executes locally and receives the TOS credentials passed to TosClientV2.
  6. The compromised dependency can exfiltrate credentials, access TOS objects within the credential scope, or execute arbitrary code with the invoking user's operating-system permissions.

Impact Assessment

Successful exploitation provides arbitrary Python cod ...[truncated 274 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin the SDK to a reviewed exact version, for example tos==<reviewed-version>.
  • Generate a lock file containing transitive dependency versions.
  • Require package hashes during installation, such as with pip install --require-hashes -r requirements.txt.
  • Install only from an explicitly trusted package repository.
  • Add automated dependency vulnerability and provenance scanning.
  • Review and deliberately update the lock file instead of automatically resolving the latest release.
  • Continue using narrowly scoped, short-lived STS credentials to limit the impact of dependency compromise.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/image_process.py:50
Finding

TOS Credentials May Be Used with an Unvalidated or Plaintext Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/image_process.py:50-63
Vulnerability Type: Unvalidated credential-bearing network destination
Risk Level: Medium

Vulnerable Code

python
def create_client() -> tos.TosClientV2:
    ak = get_env("TOS_ACCESS_KEY")
    sk = get_env("TOS_SECRET_KEY")
    endpoint = get_env("TOS_ENDPOINT")
    region = get_env("TOS_REGION")
    security_token = os.getenv("TOS_SECURITY_TOKEN")

    print(f"[INFO] Initializing TOS client for endpoint={endpoint}, region={region} ...")
    return tos.TosClientV2(
        ak=ak,
        sk=sk,
        endpoint=endpoint,
        region=region,
        security_token=security_token,
    )

The same client-construction pattern is duplicated in all scripts. The endpoint is accepted directly from TOS_ENDPOINT without requiring HTTPS or restricting the hostname to an approved TOS service domain.

Technical Analysis

TOS operations are necessarily networked and require credentials, but allowing an unrestricted destination exceeds the minimum safe configuration needed to reach the official service.

If TOS_ENDPOINT uses http://, signed requests and any STS security token can traverse the network without TLS confidentiality or server authentication. If it points to an attacker-controlled host, the SDK may send credential-bearing signed requests to that host.

The TOS secret key is ordinarily used to calculate request signatures and is not expected to be transmitted directly. Nevertheless, a malicious endpoint can observe the access-key identifier, request authorization material, object identifiers, request metadata, and potentially the STS token. Depending on signature validity rules, observed requests may also be replayable for a limited period.

This issue affects the equivalent create_client implementation in:

  • scripts/image_blindwatermark.py
  • scripts/image_format.py
  • scripts/image_info.py

...[truncated 1140 chars]

Remediation
View remediation

Remediation Suggestions

  • Parse TOS_ENDPOINT before client construction and require the https scheme.
  • Reject embedded credentials, fragments, unexpected ports, IP literals, loopback addresses, and link-local addresses unless explicitly required.
  • Restrict the hostname to an administrator-configured allowlist of official TOS endpoints.
  • Keep endpoint configuration separate from less-trusted task inputs.
  • Fail closed if endpoint validation or TLS certificate validation fails.
  • Prefer short-lived STS credentials with policies limited to the necessary source and destination buckets and object prefixes.
  • Centralize client construction in one validated helper to prevent security checks from diverging across the six scripts.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/image_process.py:136
Finding

Output Size Limit Is Enforced Only After the Entire Remote Object Is Written

Content
View full analysis

Vulnerability Details

File Location: scripts/image_process.py:136-157
Vulnerability Type: Ineffective resource limit / local disk exhaustion
Risk Level: Medium

Vulnerable Code

python
try:
    client.get_object_to_file(
        bucket=bucket,
        key=key,
        file_path=output_path,
        process=args.process,
    )
except TosServerError as e:
    print(
        f"[ERROR] TOS server error: code={e.code}, status={e.status_code}, "
        f"request_id={e.request_id}, message={e.message}",
        file=sys.stderr,
    )
    sys.exit(1)
except TosClientError as e:
    print(f"[ERROR] TOS client error: {e}", file=sys.stderr)
    sys.exit(1)

max_object_size = int(os.getenv("MAX_OBJECT_SIZE", "262144"))
size = os.path.getsize(output_path)
if size > 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 post-download checks appear in the specialized processing scripts. image_info.py additionally parses the downloaded file before performing its size comparison.

Technical Analysis

get_object_to_file writes the entire server response to the selected local path before MAX_OBJECT_SIZE is evaluated. The check therefore does not prevent excessive network transfer, disk consumption, processing time, or temporary exhaustion of the target filesystem.

Although oversized files are deleted afterward in most scripts, deletion occurs too late if the disk becomes full during the transfer. If deletion fails, the exception is suppressed, leaving the oversized file behind. The generic --process interface and flexible resize parameters can request transformations whose output size is not bounded in advance.

In scripts/image_info.py, the local ...[truncated 1144 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not use get_object_to_file when a strict local size bound is required.
  • Stream the response in bounded chunks, track the cumulative byte count, and abort immediately when the configured maximum is exceeded.
  • Write into a securely created temporary file on a quota-controlled filesystem, then atomically rename it after successful validation.
  • Remove partial files in a finally block and report cleanup failures instead of suppressing them.
  • Where supported, reject responses whose declared Content-Length exceeds the limit before reading the body, while retaining streaming enforcement because the header cannot always be trusted.
  • Validate resize dimensions, quality settings, and generic process operations against explicit upper bounds.
  • Apply server-side processing/output limits and execution timeouts.
  • Validate MAX_OBJECT_SIZE as a positive integer and set a deployment-specific ceiling that cannot be increased by less-trusted task input.
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The declared description presents a broader image-processing skill with multiple supported operations (image info, conversion, resizing, watermarking). The supplied code chunk only builds and executes a TOS image/blindwatermark process. Its sole purpose is applying blind watermark parameters and saving the result either locally or back into TOS. Because the implemented functionality is materially narrower than the declared purpose and omits several specifically claimed capabilities, the description does not accurately represent the actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The code chunk is specifically a format-conversion script (image/format) for objects in TOS. It builds a process string for the format operation, downloads the transformed object to a local file or persists it back to TOS, and handles SDK/environment setup and errors. The declared description claims broader image processing support—image info retrieval, resizing, and watermarking—but none of those operations are implemented in this supplied code. Resource access is consistent with TOS image objects, and there are no suspicious unrelated behaviors, but the declared functionality materially overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The code chunk is narrowly scoped to image information retrieval. Every execution path invokes the TOS SDK with process="image/info" only, then parses and outputs the returned JSON. While saving the result locally or back to TOS is consistent with handling the response, the declared description claims broader image processing and transformation features—specifically format conversion, resizing, and watermarking—that are not implemented in this code. This is a description-to-behavior mismatch because the declared purpose materially overstates the available capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The code chunk is narrowly focused on resizing images in TOS via the SDK. It constructs a process=image/resize,... request and either downloads the processed image to a local file or persists it back to TOS. There is no functionality in this script for retrieving image metadata/info, converting formats, or applying watermarks. Therefore, the declared description overstates the capabilities represented by this supplied code chunk. The local file output behavior is also an additional resource interaction not mentioned in the description, though still related to image transformation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The code chunk is narrowly focused on constructing a TOS process=image/watermark request and executing it against a TOS object. It supports watermark parameter passing, local output, and saving the transformed object back to TOS. There is no implementation for getting image info, converting formats, or resizing. The resource scope (TOS objects via official SDK) is consistent with the description, but the declared functionality materially overstates the implemented capabilities in this code chunk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The reference explicitly documents a generic ImageProcess entry point that accepts arbitrary TOS process strings, which expands the effective capability surface beyond the narrower set of advertised operations. In an agent setting, this can enable unreviewed transformations or newly introduced backend features to be invoked through the skill, undermining least-privilege assumptions and making downstream safety validation incomplete.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill demonstrates access to sensitive environment variables for cloud credentials but does not declare any tool scope or permission boundaries. In an agent setting, undocumented env access increases the chance of over-privileged execution and secret exposure because operators cannot clearly constrain or review what the skill needs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest describes image processing for TOS objects in terms of analysis and transformation operations like info, conversion, resizing, and watermarking. This script also supports saving the processed result back to TOS via get_object(..., save_bucket=..., save_object=...), which is a remote write operation not conveyed by the manifest description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest frames the skill as providing image analysis/transformation capabilities for TOS objects, and this file is specifically documented and named as an image-info getter. However, the code supports saving the returned JSON locally via get_object_to_file and writing it back to TOS via save_bucket/save_object, which introduces persistence side effects beyond simply retrieving image information.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes image processing for TOS objects with capabilities like info, conversion, resizing, and watermarking, which implies transformation of image content. However, this entrypoint also persists results back to TOS via save_bucket/save_object, introducing remote object creation/write behavior that is not stated in the manifest description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes image analysis and transformation for TOS objects, which naturally covers invoking TOS image-processing operations, but this script also supports writing the processed result back into TOS using save_bucket and save_object. That remote persistence behavior is a state-changing storage operation not clearly conveyed by the manifest's processing-focused description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest describes image processing for TOS objects such as getting info, converting, resizing, and watermarking, which implies transformation capability, but this script also supports saving the result back into TOS via save_bucket/save_object. That introduces remote write behavior to object storage, which is a broader operational effect than a purely processing-focused description suggests.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation includes blind watermark embedding/extraction, a capability not disclosed in the manifest description. Even if not inherently dangerous, undocumented hidden-content functionality creates a mismatch between declared and actual behavior, which can be abused for covert data marking or extraction workflows that users and reviewers did not expect.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency is specified as just 'tos' with no version pin or constraint, which can lead to non-reproducible installs and accidental uptake of a compromised or breaking upstream release. In a skill that processes remote objects via a cloud SDK, a malicious or vulnerable future package version could affect integrity, availability, or data handling within the image-processing workflow.

Content

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

text
tos