T09 · Insecure Skill Coding Practices
- Location
scripts/resume_scorer.py:677- Finding
Hard-Coded External Output Path Causes Unconditional File Overwrite
- Content
View full analysis
Vulnerability Details
File Location:
scripts/resume_scorer.py, lines 677–678
Vulnerability Type: Hard-coded external path and unsafe file overwrite
Risk Level: Mediumpython output_path = "C:/Users/UncleC/Desktop/AIresumejudge/.workbuddy/skill_output_test.md" with open(output_path, "w", encoding="utf-8") as f:Technical Analysis
The command-line entry point writes every generated report to a developer-specific absolute path. Opening the destination in
wmode immediately creates the file or truncates an existing file without asking for confirmation.The destination is neither selected by the caller nor safely scoped to the project or current working directory. Consequently, running the scorer has an undocumented filesystem side effect outside its core résumé-scoring purpose. The fixed path also makes the CLI non-portable: on systems where the parent directory does not exist, report generation fails with an unhandled exception.
The destination cannot be directly changed through résumé input, so this is not an arbitrary-path write vulnerability. Exploitation requires the fixed path to resolve to an existing target, or an attacker to prepare that path or redirect it using filesystem links where platform permissions permit.
Attack Path
- An attacker or local user prepares the hard-coded destination path, potentially arranging for the final path to resolve to a file whose contents should be preserved.
- A victim invokes
python scripts/resume_scorer.py <resume_text_or_file>. - The application completes résumé scoring and reaches the fixed output operation.
- Python opens the destination with
wmode, truncating any existing file. - The generated report replaces the previous contents. If the directory is absent, the program instead terminates during output with an unhandled filesystem error.
Impact Assessment
The write occurs with the privileges of the user executing the skill. It can destroy or replace data ...[truncated 508 chars]
- Remediation
View remediation
Remediation Suggestions
- Return the generated report through standard output by default and avoid implicit writes outside the project.
- Add an explicit command-line option such as
--output PATHwhen file output is required. - Resolve and validate the requested destination before writing. Apply an allowlist or workspace boundary if the skill must only write within an approved directory.
- Use exclusive creation mode (
x) by default, or check for an existing destination and require an explicit--forceoption before replacement. - Do not create missing parent directories without informed user consent.
- Write to a securely created temporary file in the destination directory and atomically rename it after successful generation.
- Catch filesystem exceptions and return a clear error without leaving a partial output file.
- Remove the developer-specific absolute path from production code and document all filesystem side effects.
