Summary
MISP's JsonLogTool allowed site administrators to configure NDJSON error logs to be written to arbitrary filesystem paths, including web-accessible PHP files.
Because log entries may contain attacker-controlled data, an authenticated site administrator could inject PHP code through logged content and then trigger remote code execution via the web server.
Affected context
This vulnerability appears in MISP deployments where site administrators can define custom paths for NDJSON error logs produced by JsonLogTool.
It becomes risky when:
- The configured log destination resides in a web-accessible directory
- The target file is interpreted as executable code (e.g., PHP)
- Application logs include user-controlled or attacker-controlled data that can be written verbatim to the log file
Exploit preconditions
- Attack surface: Administrative web interface and any functionality that produces NDJSON error log entries.
- Required access: Authenticated access with site administrator privileges to configure log paths.
- Trigger point: Writing attacker-controlled content into the log file, followed by an HTTP request that causes the web server to interpret the log file as executable code.
- Why exploitation is possible: The application allowed arbitrary, unconstrained log file paths and extensions, enabling logs containing attacker-controlled data to be placed into executable files in web-accessible locations.
Why this happens
The root cause is a code injection pattern where configuration options allow attacker-controlled data to be treated as executable code.
By permitting an administrator to specify arbitrary log file paths and extensions, the application effectively allowed logs containing user input to be written into server-side script files.
This maps to CWE-94: Improper Control of Generation of Code, as the system failed to enforce strict separation between log data and executable code, enabling dynamic creation or modification of files that are later evaluated by the interpreter.
Potential impact
- Remote code execution with the privileges of the web server process
- Full compromise of the MISP application and its data
- Lateral movement to other components hosted on the same server
- Tampering with incident data, threat intelligence, or audit trails
- Planting persistent webshells for ongoing unauthorized access
General mitigation guidance
Effective mitigation focuses on hardening how log destinations and file types are configured.
Recommended defensive patterns include:
- Restricting log paths to a small set of dedicated, non-web-accessible logging directories
- Validating log configuration to require absolute paths and safe extensions (such as
.logor.ndjson), and rejecting executable or mixed extension segments - Prohibiting stream wrappers, path traversal sequences, and any mechanism that could redirect logs to unexpected locations
- Treating log data as untrusted and ensuring it is never written to files that can be interpreted as code by the application runtime
- Running the web server and application with least-privilege accounts and separating writable log locations from executable code directories
How teams detect issues like this
Organizations can detect similar issues with:
- Static analysis rules and configuration linting that flag dynamic or arbitrary log path configuration, especially when it may target web-accessible directories
- Code reviews that verify logging is confined to dedicated, non-executable directories and that file extensions are strictly validated
- Policy enforcement in deployment pipelines to block configuration changes that introduce executable file types or paths outside approved log directories
- Runtime monitoring or file integrity checks that detect creation or modification of executable files in web roots by logging subsystems

