Summary
PyMoDAQ components can execute arbitrary code when a user opens or browses crafted HDF5, dock-layout, or XML settings files. This can happen when file content is passed to unsafe deserialization or expression-evaluation routines.
PyMoDAQ components can execute arbitrary code when a user opens or browses crafted HDF5, dock-layout, or XML settings files. This can happen when file content is passed to unsafe deserialization or expression-evaluation routines.
Affected context
The issue affects PyMoDAQ before 4.4.13 and the pymodaq_data, pymodaq_gui, and pymodaq_utils packages in the release ranges specified in the advisory: before 5.1.15, 5.2.x before 5.2.14, and 5.3.x before 5.3.10. Risk arises in file-handling paths that deserialize pickled objects from HDF5 string nodes or evaluate expressions in HDF5 attributes and XML settings. The Dashboard Load layout action also processes .dock files through an unpickling path.
The issue affects PyMoDAQ before 4.4.13 and the pymodaq_data, pymodaq_gui, and pymodaq_utils packages in the release ranges specified in the advisory: before 5.1.15, 5.2.x before 5.2.14, and 5.3.x before 5.3.10. Risk arises in file-handling paths that deserialize pickled objects from HDF5 string nodes or evaluate expressions in HDF5 attributes and XML settings. The Dashboard Load layout action also processes .dock files through an unpickling path.
Exploit preconditions
- Attack surface: User-facing handling of HDF5 files, .dock layout files, or XML settings files
- Required access: An attacker must be able to provide or influence a crafted file; the description does not indicate that prior access to the application is required
- Trigger point: A user opens or browses the file, reads the relevant HDF5 node, loads a dashboard layout, or processes the XML settings
- Why exploitation is possible: The affected code deserializes pickle data or evaluates expressions from file content that may be attacker-controlled
- Attack surface: User-facing handling of HDF5 files, .dock layout files, or XML settings files
- Required access: An attacker must be able to provide or influence a crafted file; the description does not indicate that prior access to the application is required
- Trigger point: A user opens or browses the file, reads the relevant HDF5 node, loads a dashboard layout, or processes the XML settings
- Why exploitation is possible: The affected code deserializes pickle data or evaluates expressions from file content that may be attacker-controlled
Why this happens
The vulnerability combines unsafe deserialization and expression evaluation. HDF5 string values and .dock file data reach pickle.loads(), which can construct attacker-controlled objects during deserialization (CWE-502). Expressions in HDF5 attributes and XML settings are evaluated by application code, creating an eval-injection weakness (CWE-95). In both cases, file content is treated as trusted executable input rather than constrained data.
The vulnerability combines unsafe deserialization and expression evaluation. HDF5 string values and .dock file data reach pickle.loads(), which can construct attacker-controlled objects during deserialization (CWE-502). Expressions in HDF5 attributes and XML settings are evaluated by application code, creating an eval-injection weakness (CWE-95). In both cases, file content is treated as trusted executable input rather than constrained data.
Potential impact
- Arbitrary code could run with the permissions of the process handling the file.
- An attacker may be able to access or alter data available to that process.
- The affected application or workstation could be compromised when a crafted file is opened.
- Additional systems or resources could be exposed if the process has broader privileges.
- Arbitrary code could run with the permissions of the process handling the file.
- An attacker may be able to access or alter data available to that process.
- The affected application or workstation could be compromised when a crafted file is opened.
- Additional systems or resources could be exposed if the process has broader privileges.
General mitigation guidance
Defensive patterns focus on treating all user-provided files as untrusted:
- Avoid pickle and dynamic expression evaluation for file formats that may contain attacker-controlled data.
- Prefer non-executable, schema-constrained formats and parsers that do not instantiate arbitrary objects.
- Validate file structure and expected values before processing, while recognizing that validation alone does not make unsafe deserialization safe.
- Reduce exposure by limiting which users and workflows can supply files, and handle untrusted files in isolated processes with minimal privileges.
- Apply least privilege to the application and restrict its access to sensitive files and services.
Defensive patterns focus on treating all user-provided files as untrusted:
- Avoid pickle and dynamic expression evaluation for file formats that may contain attacker-controlled data.
- Prefer non-executable, schema-constrained formats and parsers that do not instantiate arbitrary objects.
- Validate file structure and expected values before processing, while recognizing that validation alone does not make unsafe deserialization safe.
- Reduce exposure by limiting which users and workflows can supply files, and handle untrusted files in isolated processes with minimal privileges.
- Apply least privilege to the application and restrict its access to sensitive files and services.
How teams detect issues like this
- Use static analysis to identify
pickle.loads()and dynamic evaluation of values originating from files or other untrusted sources. - Review HDF5, dock-layout, and XML parsing paths for deserialization or evaluation that occurs before effective validation.
- Add code-review checks for executable serialization formats and for data flows from user-supplied files into interpreters or object constructors.
- Enforce policies that prohibit unsafe deserialization and expression evaluation in file-processing code; automated review tools can help flag these patterns.
- Use static analysis to identify
pickle.loads()and dynamic evaluation of values originating from files or other untrusted sources. - Review HDF5, dock-layout, and XML parsing paths for deserialization or evaluation that occurs before effective validation.
- Add code-review checks for executable serialization formats and for data flows from user-supplied files into interpreters or object constructors.
- Enforce policies that prohibit unsafe deserialization and expression evaluation in file-processing code; automated review tools can help flag these patterns.

