Vulnerabilities in pkg:golang/github.com/mhsanaei/3x-ui/v2

PACKAGE
Advisory Identifier: GHSA-jm48-m3rr-9hgg
Advisory Summary

CVE-2026-55477 is a HIGH (CVSS 7.2) 3x-ui vulnerable to authenticated arbitrary vulnerability (CWE-20: Improper Input Validation) affecting Github.com/mhsanaei/3x ui/v3 libraries in the Go ecosystem. The issue involves 3x-ui vulnerable to authenticated arbitrary file write via database import and xray log path manipulation. Remediation is available by upgrading affected packages to version 3.3.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/mhsanaei/3x-ui/v2

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/mhsanaei/3x-ui/v2. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-jm48-m3rr-9hgg CVE-2026-55477 HIGH 3X-UI Vulnerable to Authenticated Arbitrary File Write via Database Import and Xray Log Path Manipulation

CVE-2026-55477 at a Glance

CVE Identifier CVE-2026-55477
GHSA Identifier GHSA-jm48-m3rr-9hgg
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/mhsanaei/3x ui/v3
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-55477

To remediate this vulnerability, upgrade all affected Github.com/mhsanaei/3x ui/v3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/mhsanaei/3x-ui/v3 fixed: 3.3.1
Upgrade github.com/mhsanaei/3x-ui/v3 to 3.3.1
github.com/mhsanaei/3x-ui/v2 fixed: Latest secure release
Upgrade github.com/mhsanaei/3x-ui/v2 to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/mhsanaei/3x-ui/v3

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-55477, inspect your project dependencies for Github.com/mhsanaei/3x ui/v3:

inspect dependencies for github.com/mhsanaei/3x-ui/v3

Analyze the terminal output to locate any version of Github.com/mhsanaei/3x ui/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.3.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where 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. In Github.com/mhsanaei/3x ui/v3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# 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.

CVE-2026-55477 Affected Github.com/mhsanaei/3x ui/v3 Versions

2 component(s)
Fixed Versions:
3.3.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/mhsanaei/3x-ui/v3
Go
< 3.3.1
3.3.1
github.com/mhsanaei/3x-ui/v2
Go
≤ 2.9.4

References

Frequently Asked Questions

What is CVE-2026-55477?
CVE-2026-55477 is a security vulnerability in Github.com/mhsanaei/3x ui/v3 involving 3X-UI Vulnerable to Authenticated Arbitrary File Write via Database Import and Xray Log Path Manipulation under CWE-20: Improper Input Validation.
Which Github.com/mhsanaei/3x ui/v3 versions are affected?
Affected versions include releases prior to 3.3.1 across affected packages: github.com/mhsanaei/3x-ui/v3, github.com/mhsanaei/3x-ui/v2.
What version fixes CVE-2026-55477?
Upgrading to 3.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/mhsanaei/3x-ui/v3 affected?
Yes, github.com/mhsanaei/3x-ui/v3 is affected in releases prior to 3.3.1. Upgrade your dependency to 3.3.1 or later.
Is github.com/mhsanaei/3x-ui/v2 affected?
Yes, github.com/mhsanaei/3x-ui/v2 is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-55477?
CVE-2026-55477 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-55477?
CVE-2026-55477 is classified under CWE-20: 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.).
How can I check Go dependencies for CVE-2026-55477?
Run the dependency tree command: 'inspect dependencies for github.com/mhsanaei/3x-ui/v3'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jm48-m3rr-9hgg",
  "modified" : "2026-08-24T21:05:14Z",
  "published" : "2026-08-24T21:05:14Z",
  "aliases" : [ "CVE-2026-55477" ],
  "summary" : "3X-UI Vulnerable to Authenticated Arbitrary File Write via Database Import and Xray Log Path Manipulation",
  "details" : "# Summary\n\nAn 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).\n\n# Details\n\nThe database import functionality trusts attacker-controlled configuration values without sufficient validation.\n\nAn 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.\n\nBecause 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.\n\n# PoC\n\n1. Authenticate as a panel administrator.\n2. Export the panel database.\n3. Modify `xrayTemplateConfig.log.access` to point to a writable target file (e.g. `~/.ssh/authorized_keys`).\n4. Inject an attacker-controlled SSH public key into an inbound client's `email` field.\n5. Import the modified database.\n6. Trigger a connection through the modified inbound.\n7. Xray writes the attacker-controlled content to the specified file, allowing SSH access as the user running Xray.\n\nA complete PoC is available and can be provided privately.\n\n# Impact\n\nType: Authenticated Arbitrary File Write -> Privilege Escalation / Code Execution\n\nAny 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.\n\nIn environments where Xray runs as root, successful exploitation results in persistent root access.\n\n# Patches\n\nFixed in **v3.3.1**.\n\n`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.\n\n# Workarounds\n\nNone other than upgrading. Until you can update to v3.3.1, restrict panel administrator access to fully trusted operators.\n\n# Notes\n\nThe 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/mhsanaei/3x-ui/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.3.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.3.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/mhsanaei/3x-ui/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.9.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MHSanaei/3x-ui/security/advisories/GHSA-jm48-m3rr-9hgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-55477"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MHSanaei/3x-ui/commit/80e168787ed608e83a065033ee94c8bfc3025ce7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MHSanaei/3x-ui"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MHSanaei/3x-ui/releases/tag/v3.3.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-73" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-24T21:05:14Z",
    "nvd_published_at" : "2026-06-25T16:16:40Z"
  }
}