T09 · Insecure Skill Coding Practices
- Location
scripts/run_full.py:24- Finding
Predictable Shared Temporary Files Enable Information Disclosure and Symlink-Based File Overwrite
- Content
View full analysis
3 else '/tmp' os.makedirs(out_dir, exist_ok=True) here = os.path.dirname(os.path.abspath(__file__)) parsed_json = os.path.join(out_dir, 'gtyt_parsed.json') diff_xls = os.path.join(out_dir, '两表金额差异对比.xls') ``` `scripts/parse_tables.py:82`: ```python out_path = sys.argv[3] if len(sys.argv) > 3 else '/tmp/gtyt_parsed.json' ``` `scripts/parse_tables.py:186-187`: ```python with open(out_path, 'w', encoding='utf-8') as f: json.dump(output, f, ensure_ascii=False, indent=2) ``` `scripts/build_diff_report.py:22-23, 169`: ```python out_path = sys.argv[2] ``` ```python wb.save(out_path) ``` `scripts/mark_bill_diff.py:27-29, 69`: ```python bill_path = sys.argv[1] parsed_path = sys.argv[2] out_path = sys.argv[3] ``` ```python wbcopy.save(out_path) ``` ### Technical Analysis The default execution path writes sensitive reconciliation artifacts into the globally shared `/tmp` directory using fixed, predictable filenames. These files include: - `gtyt_parsed.json` - `两表金额差异对比.xls` - A predictably named marked billing workbook The intermediate JSON contains store names, SKU identifiers, quantities, unit prices, financial totals, and discrepancy details. File creation uses ordinary path-based writes without: - A private per-run temporary directory - Exclusive file creation - Symbolic-link rejection - Explicit restrictive permissions - Atomic output replacement - Unique per-run filenames On a multi-user system, an attacker can predict these paths and create symbolic links before the Skill runs. Standard file-writing operations generally ...[truncated 2013 chars]- Remediation
View remediation
