Summary
EUSurvey's survey import function trusts file paths supplied by entries in an uploaded survey archive. An authenticated attacker with the Form Manager role may use a crafted archive to write a JSP file into the application directory, where Tomcat could execute it with the EUSurvey process's privileges.
Affected context
The vulnerability affects EUSurvey through version 1.6, before commit 0669a36, in the survey import workflow. The POST /noform/management/importSurvey endpoint passes archive entries to SurveyExportHelper and FileService; the issue arises when entry names are not constrained to the intended survey storage directory. A JSP written into a Tomcat-served application directory may be executed by the server.
Exploit preconditions
- Attack surface: The survey import endpoint.
- Required access: An authenticated account with the Form Manager role, plus the ability to submit a survey archive.
- Trigger point: The application processes archive entries during survey import.
- Why exploitation is possible: Archive entry names are trusted when files are written, potentially allowing paths to escape the survey storage directory and place a JSP in an executable application location.
Why this happens
The import workflow uses archive entry names to determine output paths without adequately ensuring that the resulting files remain beneath the intended storage directory. This is a path traversal flaw, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). When an attacker-controlled path is combined with a file-writing operation, it can cause files to be created outside the intended directory.
Potential impact
- An attacker may execute code in the EUSurvey process context if a written JSP is served and executed by Tomcat.
- The attacker could access or alter data available to that process.
- The application's confidentiality, integrity, or availability may be affected.
- Further compromise may be possible depending on the process's permissions and surrounding environment.
General mitigation guidance
Mitigation generally focuses on constraining file writes to an explicitly permitted storage location.
Common defensive patterns include:
- Treat archive entry names as untrusted and reject absolute paths, traversal components, and invalid path forms.
- Resolve and canonicalize destination paths, then verify they remain within the intended directory before writing.
- Use safe archive-extraction patterns and avoid allowing imports to write into executable application locations.
- Apply strict limits and validation to imported file types and archive contents.
- Run the application with least privilege and restrict write permissions on application directories.
How teams detect issues like this
High-level detection approaches include:
- Static analysis for archive extraction and file-writing code that uses entry names without containment checks.
- Code review for path normalization performed after a write, or checks that do not account for canonical paths and symbolic links.
- Tests and policy checks that verify imported files cannot be written outside designated storage locations.
- Monitoring for unexpected JSP files or other executable content created in application directories.
Automated code review tools may help identify risky file-handling patterns.

