CVE-2022-38975
Description
DOM-based cross-site scripting vulnerability in EC-CUBE 4 series (EC-CUBE 4.0.0 to 4.1.2) allows a remote attacker to inject an arbitrary script by having an administrative user of the product to visit a specially crafted page.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
ec-cube/ec-cubePackagist | >= 4.0.0, <= 4.1.2 | — |
Affected products
2- Range: EC-CUBE 4.0.0 to 4.1.2
Patches
Vulnerability mechanics
Root cause
"Missing input validation allows directory traversal in file path handling."
Attack vector
The advisory describes a directory traversal vulnerability in EC-CUBE [ref_id=1]. An attacker can supply a filename or path containing `..` sequences (e.g., `../../etc/passwd`). Because the affected methods did not reject such sequences before resolving the path with `realpath()`, an attacker could probe for the existence of directories outside the intended base directory by observing response differences. The risk is rated low by the vendor, and no authentication bypass is required for the traversal itself.
Affected code
The vulnerability affects three files: `src/Eccube/Controller/Admin/Content/FileController.php`, `src/Eccube/Controller/Admin/Setting/Shop/PaymentController.php`, and `src/Eccube/Form/Type/Admin/ProductType.php` in EC-CUBE 4.0.0 to 4.1.2. The `checkDir()` method in `FileController.php` lacked a check for `..` characters before calling `realpath()`, and similar path traversal guards were missing in `PaymentController.php` and `ProductType.php` [ref_id=1].
What the fix does
The fix adds checks for `..` sequences in three locations. In `FileController.php::checkDir()` a `strpos($targetDir, '..') !== false` guard returns false early, preventing traversal before `realpath()` is called. In `PaymentController.php` the same `strpos($file, '..') === false` condition is added to the existing file-existence check, so filenames containing `..` are rejected. In `ProductType.php::validateFilePath()` a new loop checks each filename for `..` and sets a form error if found. These changes ensure that user-supplied path components cannot escape the intended base directory [ref_id=1].
Preconditions
- inputThe attacker must be able to supply a filename or path parameter to the affected administrative endpoints (e.g., file upload or image management).
- networkThe attacker must have network access to the administrative interface of an EC-CUBE installation running version 4.0.0 through 4.1.2.
Generated on Jun 12, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-pggw-rqfm-72rhghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-38975ghsaADVISORY
- jvn.jp/en/jp/JVN21213852/index.htmlghsax_refsource_MISCWEB
- www.ec-cube.net/info/weakness/20220909ghsaWEB
- www.ec-cube.net/info/weakness/20220909/mitrex_refsource_MISC
News mentions
0No linked articles in our index yet.