T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/subscription_tracker.py:284
- Finding
- Unverified Cancellation Email Recipient Inference## Vulnerability Details **File Location**: `scripts/subscription_tracker.py:284-295` **Vulnerability Type**: Untrusted recipient inference and potential sensitive-information disclosure **Risk Level**: Medium ### Vulnerable Code ```python def generate_cancellation_email(sub: dict) -> str: """Generate a cancellation email for a subscription.""" name = sub.get("name", "the service") # Guess email and company from name company = name.split()[0] if name else "the company" domain = company.lower().replace(" ", "") + ".com" email = f"support@{domain}" subject = f"Cancellation Request — {name} Subscription (Account #[YOUR ACCOUNT ID])" return EMAIL_TEMPLATE.format( email=email, subject=subject, company=company, name=name ) ``` ### Technical Analysis The cancellation recipient is derived from the first word of the user-controlled subscription name. The code assumes that the corresponding company owns a matching `.com` domain and that `support@<domain>` is its cancellation address. It performs no authoritative lookup, validation, allowlisting, or user confirmation. The generated message requests that users insert their full name, account email, and account/member ID. Consequently, an incorrect inferred recipient could receive sensitive account-identifying information. The documentation advises users to verify the address, but the generated output itself presents the guessed address as the `To` recipient and does not technically enforce verification. The script only generates text and does not send email itself. Exploitation therefore depends on a user or integrating agent sending the generated message without independently verifying the recipient. ### Attack Path 1. An attacker influences an imported subscription record or convinces the user to analyze a crafted record. 2. The attacker chooses a subscription name whose first word corresponds to a domain controlled ...[truncated 874 chars]
- Remediation
- ## Remediation Suggestions 1. Remove recipient inference from subscription names. 2. Add an explicit `support_email` field to the input schema and require the user to supply it. 3. Validate the address syntactically and reject malformed domains or control characters. 4. Label all unverified contact information prominently and omit the `To` field until verification is complete. 5. Require an explicit recipient-preview and confirmation step before any integrating agent sends an email. 6. Prefer the verified cancellation URL supplied by the subscription provider. 7. If provider contact mappings are supported, maintain a curated mapping tied to verified provider domains rather than deriving addresses heuristically. 8. Minimize sensitive content in templates and advise users not to include account identifiers unless the verified provider requires them.
