T09 · Insecure Skill Coding Practices
- Location
scripts/kis_common.py:43- Finding
Credentials and Financial Data Can Be Transmitted to an Arbitrary Configured Server
- Content
View full analysis
= 10 else '01', 'base_url': section.get('BASE_URL', 'https://openapi.koreainvestment.com:9443'), } ``` ```python url = f"{cfg['base_url']}/oauth2/tokenP" body = { "grant_type": "client_credentials", "appkey": cfg['app_key'], "appsecret": cfg['app_secret'], } headers = {"Content-Type": "application/json"} resp = requests.post(url, json=body, headers=headers, timeout=10) ``` ```python url = f"{cfg['base_url']}{path}" headers = { "Content-Type": "application/json; charset=utf-8", "authorization": f"Bearer {token}", "appkey": cfg['app_key'], "appsecret": cfg['app_secret'], "tr_id": tr_id, "custtype": "P", } resp = requests.get(url, headers=headers, params=params, timeout=10) ``` ```python url = f"{cfg['base_url']}{path}" headers = { "Content-Type": "application/json; charset=utf-8", "authorization": f"Bearer {token}", "appkey": cfg['app_key'], "appsecret": cfg['app_secret'], "tr_id": tr_id, "custtype": "P", } if use_hashkey: try: hk_resp = requests.post( f"{cfg['base_url']}/uapi/hashkey", headers=headers, json=body, timeout=5 ) if hk_resp.status_code == 200: headers['hashkey'] = hk_resp.json().get('HASH', '') except: pass resp = requests.post(url, headers=headers, json=body, timeout=10) ``` ### Technical Analysis The application treats `BASE_URL` from the configuration file as trusted without validating its scheme, hostname, or port. It then sends the KIS application key and secret to that origin during token issuance ...[truncated 2000 chars]- Remediation
View remediation
