Summary
xiaoheiFS allows admin users to upload arbitrary files to the plugins/payment/ directory using the AdminPaymentPluginUpload endpoint, which relies on a hardcoded password and performs no validation of uploaded content.
A background watcher automatically executes any new executable file in this directory, meaning an attacker who knows the static password can achieve remote code execution on the server.
Affected context
This vulnerability affects xiaoheiFS deployments (up to and including version 0.3.15) that expose the AdminPaymentPluginUpload functionality.
The issue appears when:
- The application is reachable over a network and the upload endpoint is accessible
- The hardcoded password (
qweasd123456) is unchanged and accepted as an administrative secret - The payment plugin directory (
plugins/payment/) is writable by the application - The background watcher (
StartWatcher) is running and configured to execute new executables found in that directory
Exploit preconditions
- Attack surface: HTTP(S) endpoint
AdminPaymentPluginUploadexposed by xiaoheiFS - Required access: Knowledge of the hardcoded admin password value; no per-deployment secret rotation is needed
- Trigger point: Uploading a malicious executable file (or script treated as executable) into
plugins/payment/via the upload API - Why exploitation is possible:
- The endpoint treats possession of the static password as sufficient proof of admin rights (CWE-798)
- Uploaded file content and type are not validated or restricted; arbitrary binaries or scripts are accepted (CWE-434)
- A background watcher automatically runs any newly detected executable file in the target directory without additional checks or approvals
Why this happens
The underlying bug is a combination of unrestricted file upload and hardcoded credentials.
From a CWE-434 perspective, the upload mechanism accepts any file and writes it into a directory that is later scanned for executables, with no validation, file type checking, or separation between data and code.
From a CWE-798 perspective, the system uses a single hardcoded password (qweasd123456) for privileged access, turning what should be an administrative control into a publicly guessable or easily disclosed secret.
The design choice to have StartWatcher automatically execute any new executable in the plugins directory effectively promotes uploaded files from data to executable code, closing the gap required for full remote code execution.
Potential impact
- Remote execution of arbitrary commands or binaries with the privileges of the xiaoheiFS process
- Full compromise of the xiaoheiFS application and underlying server, depending on process permissions
- Installation of persistent backdoors or additional malware via malicious "payment plugins"
- Tampering with payment processing logic, invoices, or financial data handled by the system
- Lateral movement to other systems within the same network or cloud environment
General mitigation guidance
Effective mitigation focuses on both the authentication model and how uploaded content is treated:
- Eliminate hardcoded secrets:
- Replace static, hardcoded passwords with configurable secrets stored in environment variables or a dedicated secret management system.
- Use per-deployment, unique credentials and support rotation without code changes.
- Restrict and validate uploads:
- Enforce strict allowlists for file types, sizes, and locations for any uploaded content.
- Treat uploaded files as untrusted data only—never as executable code or directly loadable modules.
- Store uploads outside of any directories that are searched or executed by the runtime.
- Remove auto-execution patterns:
- Avoid designs where new files in a directory are automatically executed.
- If plugin mechanisms are required, introduce signing, manifest validation, and explicit admin approval steps before activation.
- Harden runtime permissions:
- Run the application under a non-privileged account with minimal filesystem permissions.
- Ensure plugin directories are not world-writable and cannot affect system-wide executables.
- Strengthen administrative access controls:
- Require robust authentication (e.g., unique admin accounts, strong passwords, MFA) for administrative endpoints.
- Limit network exposure of admin APIs (IP allowlists, VPN, admin-only interfaces).
How teams detect issues like this
Detection can focus on both code-level anti-patterns and runtime anomalies:
- Static analysis and code review:
- Flag usage of hardcoded secrets or passwords in source code, particularly around authentication checks (CWE-798 patterns).
- Identify upload handlers that:
- Accept arbitrary file types
- Write directly into executable or plugin directories
- Lack file content inspection, signature checks, or extension validation (CWE-434 patterns).
- Review any background tasks or watchers that execute files discovered in directories based on file presence alone.
- Configuration and policy enforcement:
- Enforce security policies disallowing automatic execution of files from writable directories.
- Require security review for plugin architectures and dynamic module loading mechanisms.
- Runtime monitoring:
- Monitor the
plugins/payment/directory (or equivalent) for newly created binaries or scripts. - Use host-based intrusion detection to alert on unexpected process executions originating from plugin directories.
- Track access to administrative endpoints and alert on unusual upload patterns, especially from untrusted IP ranges.
- Automated tooling:
- Integrate application security testing tools that can detect hardcoded secrets and suspicious upload paths in CI.
- Use secret-scanning tools against code repositories to detect embedded credentials.

