T09 · Insecure Skill Coding Practices
- Location
scripts/facebook_marketplace_search.py:17- Finding
Unrestricted Service Endpoint Override Can Expose Search and Location Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/facebook_marketplace_search.py, lines 17, 31-32, and 73
Vulnerability Type: Unrestricted outbound endpoint configuration and plaintext transmission
Risk Level: MediumVulnerable Code
python DEFAULT_BASE_URL = 'http://127.0.0.1:8787'python if os.getenv('MARKETPLACE_API_BASE_URL'): config['base_url'] = os.getenv('MARKETPLACE_API_BASE_URL')python r = requests.get( f"{cfg['base_url'].rstrip('/')}/search", params=params, timeout=cfg['timeout_seconds'] )Technical Analysis
The skill is documented as a client for a local Marketplace service, but the
MARKETPLACE_API_BASE_URLenvironment variable is accepted without validating its scheme, hostname, port, or locality. Consequently, the endpoint can be changed from the intended loopback service to an arbitrary remote server.The request includes the user-supplied search query, location, radius, price range, and other filters as URL query parameters. If an HTTP endpoint outside the loopback interface is configured, this information is transmitted in plaintext and may also be recorded in intermediary or server access logs.
The issue does not provide arbitrary code execution by itself. Exploitation requires an attacker or compromised component to influence the process environment or configuration used to invoke the skill.
Attack Path
- An attacker or compromised orchestration component sets
MARKETPLACE_API_BASE_URLto an attacker-controlled URL, such ashttp://attacker.example. - A user or agent invokes the skill with a Marketplace query and location.
- The script appends
/searchto the attacker-controlled base URL. - The request sends the query, location, and filtering preferences to the attacker-controlled server.
- The attacker collects the disclosed information and can return fabricated Marketplace results that the script presents as ...[truncated 571 chars]
- An attacker or compromised orchestration component sets
- Remediation
View remediation
Remediation Suggestions
- Parse the configured URL with
urllib.parse.urlparsebefore issuing a request. - Permit only loopback destinations such as
127.0.0.1,localhost, and::1by default. - Reject unsupported schemes, embedded credentials, malformed ports, fragments, and unexpected URL paths.
- Require HTTPS when remote service access is explicitly enabled.
- Introduce a separate, clearly named opt-in setting for remote endpoints rather than allowing them implicitly.
- Avoid sending sensitive parameters through plaintext HTTP or to untrusted services.
- Document that the configured service receives the query and location data.
- If remote redirects are unnecessary, disable them or validate every redirect target to prevent bypassing the hostname policy.
- Parse the configured URL with
