Summary
BC Security Empire does not adequately validate multipart filename values in upload endpoints, allowing authenticated operators to use path traversal sequences to escape intended directories.
This may let an attacker write malicious or otherwise sensitive files to arbitrary locations on the C2 server, potentially enabling code execution depending on file type, permissions, and server behavior.
Affected context
The vulnerability occurs in Empire deployments that expose upload functionality and use client-supplied multipart filename values to determine server-side file paths. It becomes risky when an authenticated operator can submit filenames containing traversal elements and the application does not reliably canonicalize paths or enforce containment before writing.
Exploit preconditions
- Attack surface: Multipart upload endpoints on the Empire C2 server
- Required access: Valid authentication with permissions to use the affected upload functionality
- Trigger point: Server-side handling of the multipart filename during file creation
- Why exploitation is possible: Insufficient filename validation may allow traversal sequences to bypass the intended upload directory and redirect writes to other filesystem locations
Why this happens
The underlying bug is improper limitation of a user-controlled file path, which maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The insecure pattern occurs when an application derives a filesystem destination from a multipart filename without treating the value as untrusted path input. If canonicalization, containment checks, and safe filename handling are incomplete or performed in the wrong order, attacker-controlled path components can escape the designated storage directory.
Potential impact
- An attacker may overwrite application or operating-system files accessible to the service account.
- Malicious files could be placed where the C2 server may load, execute, or serve them.
- The vulnerability could enable code execution under the privileges of the Empire process.
- Sensitive files may be damaged, replaced, or made unavailable.
- The C2 server could be used as a foothold for further compromise.
General mitigation guidance
Mitigation generally focuses on removing client control over filesystem destinations and enforcing defense-in-depth around uploads.
Common defensive patterns include:
- Generate server-side filenames and ignore directory components supplied by clients.
- Canonicalize candidate paths and require them to remain within a dedicated upload directory.
- Apply strict allowlists for permitted filename characters and file types.
- Store uploads outside executable or application-controlled directories where practical.
- Use least-privilege service accounts and restrictive filesystem permissions.
- Treat uploaded content as untrusted and apply independent validation before processing or serving it.
- Enforce request authorization and audit upload activity.
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules that identify filesystem writes built from multipart or request-derived filename values.
- Code review checks for missing canonicalization, containment validation, or server-generated filenames.
- Tests that submit traversal-oriented filenames and verify that writes remain inside the intended directory.
- Runtime monitoring for uploads followed by writes outside approved storage paths.
- File-integrity monitoring on application, configuration, and executable directories.
- Policy enforcement requiring dedicated upload directories, non-executable storage, and least-privilege filesystem access.
Automated security review tools may help identify path construction and unchecked file-write patterns, but findings should be validated against deployment-specific behavior.

