Back to skill

Security audit

iFLYTEK Face Compare

Security checks for vulnerabilities and agentic risk

Overview

This face-comparison skill does what it says, but it sends sensitive face images to a third-party API and has avoidable credential/logging exposure risks that users should review first.

Install only if you are comfortable sending the selected face images to iFlytek for remote biometric processing. Use dedicated, restricted iFlytek credentials, avoid running it on images without consent, and avoid logging or sharing failures until signed URL and exception redaction are improved.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/index.py:66
Finding

Signed API Credentials May Be Disclosed Through Query Strings and Exception Logging

Content
View full analysis

Vulnerability Details

File Location: scripts/index.py:66-77, scripts/index.py:223-228, and scripts/index.py:260-264
Vulnerability Type: Sensitive authentication data exposure through URL query parameters and unsanitized error logging
Risk Level: Medium

Vulnerable Code

python
authorization_origin = "api_key=\"%s\", algorithm=\"%s\", headers=\"%s\", signature=\"%s\"" % (
    self.api_key, "hmac-sha256", "host date request-line", signature_sha
)

authorization = base64.b64encode(
    authorization_origin.encode('utf-8')
).decode(encoding='utf-8')

values = {
    "authorization": authorization,
    "host": host,
    "date": date
}

return api_url + "?" + urlencode(values)
python
signed_url = self.create_signed_url(self.host_url, "POST")

print("Calling face compare API...")
response = requests.post(
    signed_url,
    json=request_body,
    timeout=self.timeout
)
response.raise_for_status()
python
except requests.exceptions.RequestException as e:
    print(f"Network request error: {str(e)}")
    return {
        "success": False,
        "error": f"Network request error: {str(e)}"
    }

Technical Analysis

The script constructs an authentication value containing the iFlytek API key, HMAC algorithm metadata, signed headers, and request signature. It Base64-encodes this value and places it in the request URL's query string.

Base64 is an encoding mechanism and provides no confidentiality. URL query strings are commonly captured by application diagnostics, HTTP clients, proxies, gateways, monitoring platforms, and log aggregation systems. Although HTTPS protects the request while it is in transit, it does not prevent the complete URL from being recorded at either endpoint or by local instrumentation.

The exception handler compounds this exposure by printing and returning the raw requests.exceptions.RequestException. Such exceptions ...[truncated 2355 chars]

Remediation
View remediation

Remediation Suggestions

  1. Sanitize network exceptions

    • Do not print or return the raw RequestException.
    • Return only safe information such as the exception class, a generic message, and a sanitized HTTP status code.
    • Never include request URLs, query parameters, authorization values, signatures, API keys, or secrets in user-visible errors.
    python
    except requests.exceptions.RequestException as e:
        safe_error = f"Face comparison request failed: {type(e).__name__}"
        print(safe_error)
        return {
            "success": False,
            "error": safe_error
        }
    
  2. Redact signed URLs

    • If diagnostic URL logging is necessary, parse the URL and replace authorization, signature, and other credential-bearing parameters with [REDACTED].
    • Apply the same redaction to application logs, proxy logs, tracing systems, and error-reporting platforms.
  3. Use safer authentication transport when supported

    • Follow the provider's official authentication specification.
    • If iFlytek supports equivalent authentication headers, send authorization metadata in headers instead of the query string.
    • If query-string authentication is mandatory, ensure that the signed URL is never printed, returned, persisted, or captured by telemetry.
  4. Limit credential exposure

    • Use API credentials dedicated to this Skill.
    • Apply provider-side quotas, endpoint restrictions, and the narrowest available permissions.
    • Rotate credentials if signed URLs may already have appeared in logs.
  5. Harden biometric-data handling

    • Clearly disclose that both facial images are transmitted to iFlytek for processing.
    • Obtain appropriate user consent and document provider retention and privacy terms.
    • Avoid logging image payloads, API responses containing unnecessary personal data, or full request bodies.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill requires environment secrets and makes networked API calls, but it does not declare an explicit tool scope such as permissions or allowed-tools. That weakens platform-level transparency and control, making it easier for a user or orchestrator to invoke a skill that accesses secrets and external services without a clearly declared capability boundary.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill processes face images, which are highly sensitive biometric data, yet the description does not clearly warn users that the images will be transmitted to a third-party iFlytek face recognition service. This creates a meaningful privacy and compliance risk because users may provide personal images without informed consent or awareness of external data transfer.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · scripts/index.py (reported line 41)May include surrounding context.

python
self.app_id = app_id
        self.api_key = api_key
        self.api_secret = api_secret
        self.host_url = "https://api.xf-yun.com/v1/private/s67c9c78c"
        self.timeout = 120

    def create_signed_url(self, api_url: str, method: str = "POST") -> str:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill sends face images, which are highly sensitive biometric data, to a third-party API but provides no explicit user warning, consent flow, or privacy notice at the point of use. In this skill context, the external transmission is the core function, which makes the omission more dangerous because users may unknowingly expose biometric data to remote processing and storage outside their control.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

This code performs an outbound HTTP request containing two face images to an external service. While external transmission is necessary for the feature, biometric data materially raises the security and privacy impact; if users are unaware, or if the provider mishandles data, sensitive identifiers are exposed beyond the local environment.

Content

Scanner excerpt · scripts/index.py (reported line 236)May include surrounding context.

python
signed_url = self.create_signed_url(self.host_url, "POST")

            print("Calling face compare API...")
            response = requests.post(
                signed_url,
                json=request_body,
                timeout=self.timeout