T09 · Insecure Skill Coding Practices
- Location
SKILL.md:177- Finding
Predictable and Colliding Todo Identifiers Can Modify or Delete Unrelated Tasks
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:177-180, 241-244, 355-358, 382-386
Vulnerability Type: Non-unique predictable identifiers and unsafe record selection
Risk Level: MediumVulnerable Code
python # Generate ID todo_id = datetime.now().strftime("%Y%m%d%H%M")[:10]The generated identifier is subsequently trusted by status and progress update operations:
python for todo in data["todos"]: if todo["id"] == todo_id: todo["status"] = new_statuspython for todo in data["todos"]: if todo["id"] == todo_id: # Check progress type prog = todo.get("progress")Deletion removes every task with the supplied identifier:
python def delete_todo(todo_id): """Delete a todo""" data = load_todos() data["todos"] = [t for t in data["todos"] if t["id"] != todo_id] save_todos(data)Technical Analysis
datetime.now().strftime("%Y%m%d%H%M")produces a 12-character value in the formYYYYMMDDHHMM. Truncating it to ten characters producesYYYYMMDDHH, so all todos created during the same hour receive the same identifier.This contradicts the documented requirement that
idbe unique. Update operations stop after finding the first matching identifier, meaning they can modify an unintended task. The deletion operation filters out all matching records and therefore deletes every task created during the same hour.The identifier is also predictable because it is derived solely from the current local time. No uniqueness check is performed before the task is appended.
Attack Path
- A legitimate task is created during a particular hour and receives an identifier such as
2026091614. - Another task is created during the same hour, whether accidentally or by a user able to add tasks.
- The second task receives the same identifier.
- A status or progress update using that identifier changes the first matching task rather than necessarily changing the intended task.
...[truncated 719 chars]
- A legitimate task is created during a particular hour and receives an identifier such as
- Remediation
View remediation
Remediation Suggestions
- Replace the timestamp-derived identifier with a collision-resistant value:
python from uuid import uuid4 todo_id = str(uuid4())- If sortable identifiers are required, combine a high-resolution timestamp with a cryptographically random suffix.
- Before insertion, verify that the generated identifier is not already present.
- For update and deletion operations, require exactly one matching record. Reject the operation if zero or multiple records match.
- Change deletion to locate and remove one uniquely identified record rather than filtering out every matching record.
- Add tests that create multiple tasks in the same second and verify that all identifiers remain unique.
