T09 · Insecure Skill Coding Practices
- Location
scripts/_shopee_ams_common.py:18- Finding
Configurable API Gateway Can Exfiltrate LinkFox Credentials
- Content
View full analysis
dict: api_key = get_api_key() data = json.dumps(params).encode("utf-8") req = Request( endpoint, data=data, headers={ "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/1.0", "SESSION_ID": os.environ.get("SESSION_ID", ""), "MESSAGE_ID": os.environ.get("MESSAGE_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), }, method="POST", ) try: with urlopen(req, timeout=150) as response: return json.loads(response.read().decode("utf-8")) ``` ### Technical Analysis The destination receiving the `Authorization` credential is controlled through `LINKFOX_TOOL_GATEWAY` or `SHOPEE_API_BASE_URL`. The code does not validate: - The URL scheme. - The destination hostname. - Whether the destination belongs to LinkFox. - Whether redirects remain on an approved hostname. After accepting the environment-controlled URL, the code attaches the LinkFox API key and session metadata to every request. An attacker who can influence the process environment can therefore redirect credentials to an attacker-controlled HTTP server. Although transmitting an API key to the legitimate LinkFox gateway is necessary for the declared AMS functionality, allowing the credential destination to be changed without v ...[truncated 1215 chars]- Remediation
View remediation
