T09 · Insecure Skill Coding Practices
- Location
scripts/sms_client.py:44- Finding
Caller-Controlled Base URL Can Expose EngageLab Credentials and SMS Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/sms_client.py:44-54
Vulnerability Type: Arbitrary credential forwarding through an unrestricted API base URL
Risk Level: Mediumpython def __init__(self, dev_key: str, dev_secret: str, base_url: str = BASE_URL): auth = base64.b64encode(f"{dev_key}:{dev_secret}".encode()).decode() self._headers = { "Content-Type": "application/json", "Authorization": f"Basic {auth}", } self._base_url = base_url.rstrip("/") def _request(self, method: str, path: str, payload: Optional[dict] = None) -> Union[dict, list]: url = f"{self._base_url}{path}" resp = requests.request(method, url, headers=self._headers, json=payload)Technical Analysis
The constructor accepts an unrestricted
base_urland stores a Base64-encodeddev_key:dev_secretvalue in the Authorization header. Every subsequent request sends that header to the configured URL without validating its scheme or hostname.Base64 is the encoding required by HTTP Basic authentication, but it does not protect the credentials from a receiving server. Although encoding the credentials is necessary for the declared EngageLab functionality and the code does not print them to stdout, permitting an arbitrary destination exceeds the minimum network privileges required. The documented service uses only
https://smsapi.engagelab.com.Exploitation requires an attacker to influence application configuration, constructor arguments, or code that creates the client. There is no evidence that the Skill automatically obtains an attacker-controlled URL, so the issue is conditional rather than an unconditional exfiltration mechanism.
Attack Path
- A user or integrating application supplies valid EngageLab credentials to
EngageLabSMS. - An attacker influences the
base_urlargument, directly or through an exposed configuration value. - The attacker sets it to a server u ...[truncated 1207 chars]
- A user or integrating application supplies valid EngageLab credentials to
- Remediation
View remediation
Remediation Suggestions
- Remove the public
base_urloverride if production operation only requires the documented EngageLab endpoint. - If configurability is required, parse and validate the URL before storing it:
- Require the
httpsscheme. - Require the exact hostname
smsapi.engagelab.com. - Reject embedded user information, unexpected ports, fragments, and alternate hosts.
- Require the
- Keep test endpoint support separate from the production client. Test transports should use dedicated non-production credentials and should never inherit production Authorization headers.
- Prefer a
requests.Sessionconfigured for the approved origin and avoid forwarding Authorization headers when the destination origin changes. - Set explicit connection and response timeouts to prevent requests from hanging indefinitely.
- Document that credentials must be loaded from an environment variable or secret manager rather than source code, logs, prompts retained in history, or command-line arguments.
- Add tests confirming that HTTP URLs, lookalike domains, subdomains, alternate ports, and unrelated HTTPS hosts are rejected before any request is sent.
- Remove the public
