Summary
changedetection.io's backup restore feature previously trusted file paths and contents embedded in user-supplied ZIP archives, allowing attacker-controlled snapshot directories and files to be copied directly into the live datastore.
Under these conditions, an attacker could craft a backup that, once restored, causes the application to read and return contents of arbitrary local files via the history.txt parsing logic.
Affected context
This issue affects deployments of changedetection.io that:
- Allow users to upload and restore backup ZIP archives
- Restore backup contents directly into the live datastore using generic file copy operations
- Use
history.txtinside watch-specific directories as an input to generate watch history responses
The risk is most pronounced where backup ZIPs are not strictly validated and watch directories can contain attacker-crafted paths or files.
Exploit preconditions
- Attack surface: Application backup restore endpoint or functionality that accepts ZIP uploads.
- Required access: Ability to supply a crafted backup ZIP that the application will restore (e.g., authenticated user with restore permission).
- Trigger point: Invoking the backup restore process and then accessing watch history or related endpoints that read
history.txt. - Why exploitation is possible: The restore logic uses operations like
shutil.copytree(entry.path, dst_dir)without enforcing strict constraints on which files and paths are trusted. The application then automatically parseshistory.txtfrom the restored directory, potentially exposing targeted local file contents if the snapshot paths or contents are manipulated.
Why this happens
The root cause aligns with CWE-73: External Control of File Name or Path: the application allows external input (backup ZIP contents and directory structures) to influence which files are created and subsequently read.
By copying restored watch UUID directories directly into the live datastore, the system assumes that all files within those directories are safe and belong to the application's normal data model.
Because history.txt is then parsed and surfaced through the watch history property without strong validation of origin or content, an attacker-controlled path or file can cause the application to expose arbitrary local file data or unintended internal state.
Potential impact
- Unauthorized reading of sensitive local files accessible to the application process.
- Exposure of configuration data, secrets, tokens, or internal metadata stored on disk.
- Leakage of other users' watch data or historical change records.
- Enhanced reconnaissance for further attacks by revealing filesystem layout or application internals.
General mitigation guidance
Mitigation generally focuses on constraining file paths influenced by external input and treating restored backup content as untrusted until validated.
Common defensive patterns include:
- Enforcing strict whitelists for allowed directories and file names within restored backups (e.g., only specific, expected files under a controlled root).
- Normalizing and validating all restored paths to ensure they reside under an intended base directory and do not reference external locations.
- Treating
history.txtand similar artifacts as data-only inputs, validating their structure and content before use, and avoiding mixing them with arbitrary filesystem reads. - Isolating backup restore operations into temporary or staging locations, performing validation, and only then promoting validated content into the live datastore.
- Running the application with least privilege and limiting filesystem access to only what is operationally necessary.
How teams detect issues like this
Detection strategies can combine code-level and operational controls:
- Static analysis: Look for file operations (e.g.,
copytree,open,read) where the source or destination paths are derived from user input or archive contents without normalization and validation. - Code review signals: Pay attention to backup/restore or import/export logic that:
- Copies entire directory structures from untrusted archives directly into live data directories.
- Automatically trusts and parses files like
history.txtbased on their presence rather than explicit registration or validation. - Runtime monitoring: Instrument logging around backup restores, including the list of files and directories created, and compare against expected patterns.
- Policy enforcement: Introduce CI/CD checks that flag new code paths where external data controls filesystem paths, and optionally leverage automated security scanners that detect path manipulation and unsafe file handling.

