T09 · Insecure Skill Coding Practices
- Location
feishu_bot.py:267- Finding
Unrestricted Webhook Destination Enables Server-Side Request Forgery
- Content
View full analysis
Vulnerability Details
File Location:
feishu_bot.py:267-274
Vulnerability Type: Server-Side Request Forgery (SSRF) and unintended data disclosure
Risk Level: Mediumpython @staticmethod def send_webhook(webhook_url: str, msg_type: str, content: Union[str, Dict]) -> Dict: """Send message via webhook (no auth required)""" data = { "msg_type": msg_type, "content": {"text": content} if msg_type == "text" else content } resp = requests.post(webhook_url, json=data) return resp.json()Technical Analysis
The
send_webhookmethod passes a caller-controlledwebhook_urldirectly torequests.post. It does not enforce HTTPS, restrict destinations to documented Feishu webhook domains, validate the resolved IP address, or reject loopback, private, link-local, and reserved network ranges. Redirects are also accepted under therequestslibrary's default behavior without revalidating the resulting destination.Although webhook delivery is part of the declared functionality, accepting arbitrary destinations exceeds the minimum network privileges required for a Feishu-specific integration. If an agent derives this parameter from untrusted instructions or message content, an attacker can cause the trusted runtime to send requests to systems that are inaccessible from the attacker's own network position.
The request body contains caller-provided message content. Consequently, the same behavior can disclose that content to an unintended or attacker-controlled destination.
Attack Path
- An attacker provides an agent with a crafted URL, such as a loopback address, private network service, link-local endpoint, or attacker-controlled redirect.
- The agent passes that URL to
FeishuBot.send_webhook. - The method performs an HTTP POST from the trusted execution environment without destination validation.
- The target receives the supplied JSON body and may proc ...[truncated 1032 chars]
- Remediation
View remediation
Remediation Suggestions
- Restrict webhook destinations to documented Feishu/Lark webhook hosts using an exact hostname allowlist.
- Require HTTPS and reject URLs containing embedded credentials, unexpected ports, or malformed hostnames.
- Resolve the destination before connecting and reject loopback, private, link-local, multicast, unspecified, and reserved IPv4 and IPv6 ranges.
- Disable redirects with
allow_redirects=False, or validate the scheme, hostname, resolved address, and port again for every redirect. - Protect against DNS rebinding by ensuring that validation and connection use a consistently validated destination.
- Add an explicit policy or user-confirmation step before permitting delivery to any non-Feishu endpoint.
- Apply bounded request timeouts and limit the maximum response size.
- Treat webhook content as potentially sensitive and avoid sending it to destinations that have not been explicitly authorized.
