Tainted flow: 'index_file' from os.environ.get (line 117, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
kept.append(s) index["sessions"] = kept with open(index_file, "w", encoding="utf-8") as f: json.dump(index, f, ensure_ascii=False, indent=2) print(f"[ultra-memory] session_index.json: {original_count} → {len(kept)} 条记录")- Confidence
- 88% confidence
- Finding
- `ULTRA_MEMORY_HOME` is derived from the `ULTRA_MEMORY_HOME` environment variable and is later used to construct `index_file`, which is opened for writing. If an attacker can influence the environment in which this cleanup script runs, they can redirect writes to an arbitrary filesystem location under their chosen base path, causing unauthorized file modification or corruption of other application data.
