T09 · Insecure Skill Coding Practices
- Location
scripts/twilight_test.py:13- Finding
Hard-Coded Default RTSP Camera Credentials
- Content
View full analysis
Vulnerability Details
File Location:
scripts/twilight_test.py, line 13
Vulnerability Type: Hard-coded credentials and insecure default configuration
Risk Level: MediumComplete Code Snippet:
python RTSP_URL = os.getenv("RTSP_URL", "rtsp://admin:pass@192.168.1.247:554/stream2")Technical Analysis
The default RTSP URL contains the plaintext credential pair
admin:pass. When theRTSP_URLenvironment variable is absent, the script automatically supplies these credentials to ffmpeg and attempts to authenticate to a camera at the fixed private address192.168.1.247.Although environment-variable override support exists, the fallback does not fail securely. Embedding credentials in distributed source code exposes them to anyone who can read the package and encourages deployment with weak or shared camera credentials. Credentials embedded in a URL may also appear in process inspection, diagnostics, exception output, or logs produced by surrounding tooling.
Attack Path
- A user installs or obtains the Skill and runs
scripts/twilight_test.pywithout definingRTSP_URL. capture_photo()andcapture_audio()pass the hard-coded URL to ffmpeg as the input source.- ffmpeg connects to
192.168.1.247:554and attempts authentication with usernameadminand passwordpass. - If a reachable camera accepts those credentials, the process obtains its video frame and microphone audio stream.
- Anyone who learns that a deployed camera retained the same credentials may independently attempt RTSP authentication and access the exposed media streams.
Exploitation requires network access to a camera configured with the disclosed credential pair. The audited code does not bypass authentication, escalate operating-system privileges, or transmit captured raw media to an unrelated remote service.
Impact Assessment
Successful use of the disclosed credentials can grant the level of acce ...[truncated 588 chars]
- A user installs or obtains the Skill and runs
- Remediation
View remediation
Remediation Suggestions
- Remove the credential-bearing fallback and require
RTSP_URLto be explicitly configured. - Fail closed with a clear configuration error when the URL is absent.
- Obtain credentials from a protected secret store, restricted configuration file, or runtime secret injection mechanism rather than source code.
- Use a dedicated, least-privileged camera account that can access only the required RTSP stream instead of an administrative account.
- Require users to replace factory or example passwords with unique, strong credentials.
- Redact URL user information from application errors, diagnostics, and logs.
- Consider separating the endpoint from its credentials so secret values are less likely to be exposed as part of a complete URL.
- Rotate the disclosed credential on any camera where it has been used.
A safer configuration pattern is:
python RTSP_URL = os.getenv("RTSP_URL") if not RTSP_URL: raise RuntimeError("RTSP_URL must be configured securely")- Remove the credential-bearing fallback and require
