T09 · Insecure Skill Coding Practices
- Location
scripts/notify_order_complete.py:117- Finding
Unrestricted Webhook Destination Enables Sensitive Trading Data Disclosure and Blind SSRF
- Content
View full analysis
Vulnerability Details
File Location:
scripts/notify_order_complete.py, lines 117–127
Vulnerability Type: Unrestricted outbound webhook / sensitive information exposure / blind server-side request forgery (SSRF)
Risk Level: MediumVulnerable Code
python def _send_webhook(target: str, master_order_id: str, message: str) -> None: if not target or target == "-": raise ValueError("webhook channel requires target URL") payload = json.dumps({"message": message, "masterOrderId": master_order_id}).encode("utf-8") req = request.Request(target, data=payload, headers={"Content-Type": "application/json"}, method="POST") try: with request.urlopen(req, timeout=15) as resp: if resp.status >= 400: raise RuntimeError(f"webhook returned status {resp.status}") except (HTTPError, URLError, TimeoutError) as e: raise RuntimeError(f"webhook request failed: {e}")The sensitive message supplied to this function is assembled from private order information in
_format_result, including the master order ID, trading symbol, direction, status, filled quantity, average price, total value, maker rate, completion progress, and potentially the order reason.Technical Analysis
The webhook destination is supplied by the caller and passed directly to
urllib.request.Requestandrequest.urlopen. Validation only checks whether the target is nonempty and not equal to-. The implementation does not:- Require HTTPS.
- Restrict destinations to approved notification providers.
- Reject loopback, private, link-local, multicast, or cloud metadata addresses.
- Restrict URL schemes explicitly.
- Disable redirects or validate each redirect destination.
- Minimize or redact the trading data sent in the webhook body.
- Require separate confirmation of the destination and disclosed fields.
Consequently, a caller capable of selecting the webhoo ...[truncated 2650 chars]
- Remediation
View remediation
Remediation Suggestions
-
Use an explicit destination allowlist
- Permit only administrator-configured notification hostnames.
- Match normalized hostnames exactly rather than using suffix or substring checks.
- Do not allow callers to supply arbitrary destinations unless a separate privileged configuration explicitly enables that capability.
-
Require secure transport
- Accept only
httpsURLs. - Reject URLs containing embedded credentials.
- Verify TLS certificates using the platform trust store.
- Do not fall back to plaintext HTTP.
- Accept only
-
Prevent SSRF
- Resolve the destination before connecting.
- Reject loopback, private, link-local, multicast, reserved, unspecified, and cloud metadata address ranges for both IPv4 and IPv6.
- Revalidate the actual connection destination to reduce DNS-rebinding risk.
- Disable redirects where possible. If redirects are required, apply the full scheme, hostname, port, and IP validation process to every redirect target.
- Restrict destination ports to those required by approved providers.
-
Minimize disclosed information
- Send only a minimal event identifier and terminal status by default.
- Make detailed fields opt-in.
- Redact order IDs and financial values where the notification recipient does not need them.
- Avoid sending free-form
reasoncontent without sanitization and an explicit need.
-
Require explicit authorization
- Display the normalized destination hostname and exact fields that will be transmitted.
- Require explicit user confirmation before enabling webhook delivery.
- Keep
stdoutor direct authenticated status queries as the default notification mechanism.
-
Apply outbound network controls
- Run the Skill with an egress policy that permits only QuantumExecute, required public market-data services, and approved notification providers.
- Block access to loopback ...[truncated 405 chars]
-
