T09 · Insecure Skill Coding Practices
- Location
scripts/bone_age_api_client.py:47- Finding
Unrestricted API Host Allows Credential and Authentication Token Disclosure
- Content
View full analysis
Vulnerability Details
File Location:
scripts/bone_age_api_client.py:47-53,scripts/bone_age_api_client.py:63-65,scripts/bone_age_api_client.py:101-112, andscripts/bone_age_api_client.py:433; equivalent behavior exists in both example clients.
Vulnerability Type: Arbitrary authentication endpoint and missing transport validation
Risk Level: HighVulnerable Code
python def __init__(self, host: str): self.host = host.rstrip("/") self.token = None self.user = None self.tid = self._generate_tid() self.session = requests.Session() self.session.headers.update({"Content-Type": "application/json; charset=utf-8"})python def _url(self, path: str) -> str: return f"{self.host}{path}"python resp = self.session.post( self._url("/auth/local/login"), json={"username": username, "password": password_hash} ) result = resp.json() if result.get("ret"): data = result.get("data", {}) self.token = data.get("token") self.user = data.get("user") self.session.headers.update({"token": self.token})python parser.add_argument("--host", required=True)Equivalent configurable-host behavior appears at:
examples/third_party_integration.py:40-47,66-74, and198examples/c_end_integration.py:39-46,50-59, and282
Technical Analysis
The client accepts an arbitrary API host and concatenates it directly with authentication and business endpoint paths. It does not require HTTPS, verify that the destination is the declared
www.pipitu.netservice, reject embedded URL credentials, restrict ports, or otherwise enforce a destination allowlist.The password hash is not merely a non-sensitive digest. Because the remote service accepts the SHA-256 value directly as the password field, it is a reusable password-equivalent verifier. A hostile endpoint can capture it and replay it against the legi ...[truncated 1465 chars]
- Remediation
View remediation
Remediation Suggestions
- Hard-code or strictly allowlist
https://www.pipitu.netfor production use. - Parse the URL with a standard URL parser and reject:
- Schemes other than HTTPS
- Embedded usernames or passwords
- Unexpected ports
- IP-address literals
- Subdomains or suffix matches that are not exact approved hosts
- Disable cross-origin redirects for requests that carry credentials or tokens.
- If development endpoints are required, place them behind an explicit development-only option and require interactive confirmation before transmitting credentials.
- Separate authenticated and unauthenticated sessions so a token cannot accidentally be propagated to an unintended destination.
- Prefer a challenge-based authentication protocol instead of treating an unsalted SHA-256 password digest as a reusable credential.
- Add automated tests confirming that HTTP, lookalike domains, unexpected ports, and redirect-based destination changes are rejected.
- Hard-code or strictly allowlist
