T09 · Insecure Skill Coding Practices
- Location
scripts/invoice_validate_client.py:67- Finding
Arbitrary API Endpoint Override Discloses Credentials and Invoice Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/invoice_validate_client.py:67-136, 399-403
Vulnerability Type: Unrestricted destination for authenticated sensitive-data transmission
Risk Level: HighVulnerable Code
python if api_url is None: api_url = DEFAULT_API_URL payload = { "platform": "api", "apiVersion": "1", "skillCode": SKILL_CODE, "skillVersion": SKILL_VERSION, } if validate_mode is not None: payload["validateMode"] = validate_mode if validate_mode is not None and validate_mode >= 2: if file_base64: payload["fileBase64"] = file_base64 else: payload["fphm"] = fphm payload["kprq"] = kprq if fpdm: payload["fpdm"] = fpdm if kjje: payload["kjje"] = kjje if jshj: payload["jshj"] = jshj if jym: payload["jym"] = jym headers = { "Content-Type": "application/json", "apiKey": api_key, } request_data = json.dumps(payload).encode("utf-8") request = urllib.request.Request( api_url, data=request_data, headers=headers, method="POST" ) try: with urllib.request.urlopen(request, timeout=60) as response: response_data = response.read().decode("utf-8") return json.loads(response_data)The destination is exposed as a command-line parameter:
python parser.add_argument( "--api-url", help="API endpoint URL", )Technical Analysis
The client accepts an unrestricted
--api-urlvalue and then sends both the user'sCLAWMATE_API_KEYand the complete invoice payload to that destination. It does not enforce HTTPS, validate the destination hostname, restrict destination ports, or verify that the configured endpoint belongs to the declared ClawMate service.The payload can contain invoice numbers, dates, amounts, check codes, or a complete Base64-encoded invoice. Base64 is transport encoding and provides ...[truncated 1613 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--api-urlfrom production-facing usage and use the fixed documented endpoint. - If endpoint configurability is required for development, place it behind an explicit development-only configuration and never attach production credentials.
- Parse the URL and require:
- The
httpsscheme. - An exact allowlisted hostname such as
www.clawmate.net. - The expected HTTPS port.
- The expected API path.
- No embedded user information.
- The
- Disable redirects or ensure credentials are never forwarded when the origin changes.
- Reject loopback, link-local, private, and non-allowlisted destinations.
- Use a dedicated TLS context with certificate and hostname verification enabled.
- Add automated tests confirming that HTTP URLs, alternate hosts, redirects, and local-network addresses are rejected before request construction.
- Remove
