T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/cf_markdown.py:42
- Finding
- Website Credentials and Session Cookies Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Locations**: - `SKILL.md:61-62` - `scripts/cf_markdown.py:42-48` - `scripts/cf_markdown.py:95-96` **Vulnerability Type**: Plaintext sensitive data in process arguments **Risk Level**: Medium ### Vulnerable Code Documentation encourages users to provide credentials and session cookies directly on the command line: ```bash python3 scripts/cf_markdown.py --cookies-json '[{"name":"session","value":"abc","domain":"example.com"}]' python3 scripts/cf_markdown.py --authenticate-json '{"username":"u","password":"p"}' ``` The implementation parses these sensitive values directly from command-line arguments and includes them in the remote rendering request: ```python cookies = load_json_arg(args.cookies_json, "--cookies-json") if cookies is not None: body["cookies"] = cookies auth = load_json_arg(args.authenticate_json, "--authenticate-json") if auth is not None: body["authenticate"] = auth ``` The corresponding command-line options are declared as follows: ```python p.add_argument("--cookies-json", help="Raw JSON array for cookies") p.add_argument("--authenticate-json", help="Raw JSON object for authenticate") ``` ### Technical Analysis Command-line arguments are not an appropriate transport mechanism for secrets. Depending on the operating system and execution environment, arguments may be exposed through: - Shell history files - Process inspection utilities - Process-monitoring or endpoint-management software - CI/CD command logs - Debug output from wrappers and orchestration systems - Audit or telemetry systems that record process invocation details The affected arguments can contain usernames, passwords, and active session cookies. The script then sends those values to Cloudflare as part of the Browser Rendering request. Sending page authentication data to Cloudflare is functionally related to remote authenticated rendering and is not hidden behavior, but accepting the secrets directly through process argum ...[truncated 1779 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add file-based secret options such as `--cookies-file` and `--authenticate-file`, and read their contents only at runtime. 2. Support standard-input input modes so secrets do not appear in process arguments. 3. If environment-variable support is provided, use dedicated variables and document that CI systems must mask them. File descriptors or protected files are preferable where feasible. 4. Retain command-line JSON options only for non-sensitive testing, or deprecate them for authentication material. 5. Update `SKILL.md` to remove examples containing authentication data directly in command arguments. 6. Add an explicit warning that real passwords, tokens, and session cookies must not be supplied through command-line arguments. 7. Validate secret files before use and require restrictive permissions where supported, such as owner-only access. 8. Ensure request bodies and authentication fields are redacted from application logs, exception messages, debug output, and CI telemetry. 9. Recommend short-lived, narrowly scoped website sessions and revocation immediately after rendering when authenticated extraction is unavoidable. ]]>
