T09 · Insecure Skill Coding Practices
- Location
scripts/schedule.py:41- Finding
API Credential Transmitted over Unencrypted HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/schedule.py, lines 41–49
Vulnerability Type: Plaintext transmission of sensitive information
Risk Level: HighVulnerable Code
python base_url = "http://api.aviationstack.com/v1/flights" params = { 'access_key': api_key, 'dep_iata': origin, 'arr_iata': dest, } if date: params['flight_date'] = date url = f"{base_url}?{urllib.parse.urlencode(params)}" try: with urllib.request.urlopen(url, timeout=10) as response: data = json.loads(response.read()) return dataTechnical Analysis
The schedule lookup embeds the value of
AVIATIONSTACK_API_KEYin the URL query string and sends the request to anhttp://endpoint. Because HTTP provides neither transport encryption nor server authentication, the API key, origin and destination airport codes, optional travel date, and returned schedule information can be observed or modified in transit.Query-string credentials may additionally be retained by intermediary proxy logs, monitoring systems, or other URL-recording infrastructure. Although contacting AviationStack is necessary for the declared schedule-search functionality, transmitting its credential over plaintext HTTP is not necessary and violates secure least-privilege handling of sensitive information.
Attack Path
- A user configures
AVIATIONSTACK_API_KEYand invokesscripts/schedule.py. - The script appends the key to the
access_keyquery parameter. - It sends the resulting URL to
api.aviationstack.comover unencrypted HTTP. - An attacker positioned on the local network, an untrusted Wi-Fi network, a compromised gateway, or an intermediary proxy captures the request.
- The attacker extracts and reuses the API key, or alters the API response before it reaches the script.
Impact Assessment
A network-positioned attacker can obtain the AviationStack API credentia ...[truncated 429 chars]
- A user configures
- Remediation
View remediation
Remediation Suggestions
- Replace the endpoint with
https://api.aviationstack.com/v1/flightsand retain normal TLS certificate and hostname verification. - If AviationStack supports credential-bearing authorization headers, use one instead of placing the key in the query string.
- Avoid printing, logging, persisting, or including the complete credential-bearing URL in exception and diagnostic output.
- Validate that redirects cannot downgrade the request from HTTPS to HTTP or forward credentials to an unexpected host.
- Rotate any API key previously used with the plaintext endpoint, because it may already have been exposed.
- Add an automated test or static-analysis rule that rejects plaintext HTTP endpoints used for credentials or other sensitive data.
- Replace the endpoint with
