T09 · Insecure Skill Coding Practices
- Location
scripts/track_flight.py:34- Finding
API Credential Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/track_flight.py:34-41
Vulnerability Type: Plaintext transmission of sensitive credentials
Risk Level: Highpython base_url = "http://api.aviationstack.com/v1/flights" params = { 'access_key': api_key, 'flight_iata': flight_number.upper() } response = requests.get(base_url, params=params, timeout=10)Technical Analysis
The script sends the AviationStack API key through an unencrypted HTTP request. Because
access_keyis a query-string parameter, the credential is visible to any network intermediary capable of observing the request. It may also be retained in proxy, gateway, monitoring, or server access logs.HTTP provides neither transport confidentiality nor server authenticity. An on-path attacker can therefore read the API key, observe requested flight numbers, modify the API response, or impersonate the API endpoint. The documentation acknowledges that the selected free tier is HTTP-only, but disclosure does not mitigate the underlying credential exposure.
The external API request is necessary for the declared flight-tracking function. Transmitting its credential without TLS, however, is not a safe least-exposure implementation.
Attack Path
- A user configures
AVIATIONSTACK_API_KEYand runs the flight-tracking script. - The script constructs an HTTP request whose URL query contains both the API key and flight number.
- An attacker controlling or monitoring a local network, wireless access point, router, transparent proxy, ISP path, or other intermediary captures the plaintext request.
- The attacker extracts the
access_keyquery parameter and reuses the credential against AviationStack. - The attacker can consume the account quota or perform other operations permitted by that API key.
- An active on-path attacker can additionally alter the returned JSON, causing the script to display false flight status, loca ...[truncated 610 chars]
- A user configures
- Remediation
View remediation
Remediation Suggestions
- Require an HTTPS-capable AviationStack plan or migrate to a flight-data provider that supports TLS for all account tiers.
- Refuse to send the API key when the configured endpoint uses
http://. - Where supported by the provider, place credentials in an authorization header rather than a URL query string to reduce exposure in URL logs.
- Keep certificate verification enabled and do not introduce options such as
verify=False. - Rotate any API key previously used by this implementation because it may already have traversed or been retained by untrusted intermediaries.
- Add a regression test that verifies the endpoint scheme is HTTPS before any request is issued.
- Clearly document the network destination and data transmitted, but do not treat documentation alone as an adequate security control.
