Skip to content

3X-UI Vulnerable to Authenticated Arbitrary File Write via Database Import and Xray Log Path Manipulation

High severity GitHub Reviewed Published Jun 12, 2026 in MHSanaei/3x-ui • Updated Aug 24, 2026

Package

gomod github.com/mhsanaei/3x-ui/v2 (Go)

Affected versions

<= 2.9.4

Patched versions

None
gomod github.com/mhsanaei/3x-ui/v3 (Go)
<= 3.3.0
3.3.1

Description

Summary

An authenticated administrator can abuse the database import functionality to achieve arbitrary file write on the host by modifying Xray configuration values stored in the database. This can be leveraged to obtain code execution and persistent access as the user running Xray (including root when Xray is running as root).

Details

The database import functionality trusts attacker-controlled configuration values without sufficient validation.

An authenticated administrator can export the SQLite database, modify xrayTemplateConfig.log.access to point to an arbitrary file, and import the modified database back into the panel. The attacker can then inject controlled content into an inbound client's email field. When a connection is processed, Xray writes the attacker-controlled content to the configured access log path.

Because the log path is fully attacker-controlled, this behavior results in arbitrary file write as the user running Xray. Depending on the target file and service privileges, this can be used to obtain code execution and persistent host access.

PoC

  1. Authenticate as a panel administrator.
  2. Export the panel database.
  3. Modify xrayTemplateConfig.log.access to point to a writable target file (e.g. ~/.ssh/authorized_keys).
  4. Inject an attacker-controlled SSH public key into an inbound client's email field.
  5. Import the modified database.
  6. Trigger a connection through the modified inbound.
  7. Xray writes the attacker-controlled content to the specified file, allowing SSH access as the user running Xray.

A complete PoC is available and can be provided privately.

Impact

Type: Authenticated Arbitrary File Write -> Privilege Escalation / Code Execution

Any authenticated 3X-UI administrator can write attacker-controlled content to arbitrary files accessible by the Xray process. This allows compromise of the account running Xray and may lead to full host compromise depending on deployment configuration and service privileges.

In environments where Xray runs as root, successful exploitation results in persistent root access.

Patches

Fixed in v3.3.1.

resolveXrayLogPaths (internal/web/service/xray.go) now confines the Xray log.access and log.error paths to the panel's log folder: any configured value is reduced to its base filename under config.GetLogFolder(). Absolute paths (such as /etc/cron.d/... or ~/.ssh/authorized_keys) and .. traversal can no longer make Xray write outside the log folder, while "" and "none" continue to disable logging. The confinement is applied during Xray configuration generation, so it covers every way the template can be set — the database import and the built-in raw Xray configuration editor alike.

Workarounds

None other than upgrading. Until you can update to v3.3.1, restrict panel administrator access to fully trusted operators.

Notes

The underlying issue is the unrestricted log path rather than the database import alone: an administrator can set the same xrayTemplateConfig.log.access / log.error value directly through the built-in raw Xray configuration editor, which is why the fix hardens the value at configuration-generation time to cover every vector. The client email field is also independently validated (control characters, spaces, and slashes are rejected), which constrains what can be written into a log line; the reliable primitive is therefore arbitrary file write (creation, append, or corruption) at an attacker-chosen path, with code execution dependent on a suitable writable target and the privileges of the Xray process.

References

@MHSanaei MHSanaei published to MHSanaei/3x-ui Jun 12, 2026
Published by the National Vulnerability Database Jun 25, 2026
Published to the GitHub Advisory Database Aug 24, 2026
Reviewed Aug 24, 2026
Last updated Aug 24, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(47th percentile)

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

External Control of File Name or Path

The product allows user input to control or influence paths or file names that are used in filesystem operations. Learn more on MITRE.

CVE ID

CVE-2026-55477

GHSA ID

GHSA-jm48-m3rr-9hgg

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.