| Título | elunez eladmin 2.7 (master through commit 646c58c) Path Traversal (CWE-22) |
|---|
| Descrição | eladmin (elunez) up to 2.7 and master through commit 646c58c contains a path traversal
vulnerability in its code generator that allows any authenticated user to write files outside
the project directory and, in source deployments, to inject stored XSS.
Vulnerability class: Path Traversal (CWE-22), with CWE-73 (external control of file name or
path) as a secondary weakness.
Affected component: eladmin-generator, file GenUtil.java, functions getAdminFilePath() and
getFrontFilePath(). The parameters GenConfig.moduleName, GenConfig.path and GenConfig.apiPath
are concatenated into filesystem paths without normalization or containment checks, and are
then passed to FileUtil.touch() and FileWriter.
Affected endpoints: PUT /api/genConfig stores the values; POST /api/generator/{tableName}/0
and POST /api/generator/{tableName}/2 write the files. The generator endpoints enforce no
permission - any authenticated user, including an account with an empty authority list, can
call them. The type=2 branch is not blocked by the documented generator.enabled=false switch,
because that switch only guards type=0; type=2 starts from %TEMP%\eladmin-gen-temp\<table>\
(backend under eladmin\<moduleName>, which can escape with ..; frontend fixed under
eladmin-web\src\...), does not touch path/apiPath, and returns the directory as a zip.
Impact (file write): an authenticated user can create arbitrary directories and write or
overwrite files outside the project directory with the privileges of the JVM. A single request
writes ten files: eight backend .java files under moduleName (resolved against
System.getProperty("user.dir") for type=0, or against %TEMP%\eladmin-gen-temp\<table>\eladmin
for type=2) and the two frontend files index.vue and <name>.js under path / apiPath (type=0)
or under %TEMP%\eladmin-gen-temp\<table>\eladmin-web\src\... (type=2). Because the generator is
designed to write into source trees, pointing path at an existing view directory overwrites
that page (verified: a 18129-byte view file was replaced by a 4460-byte generated file), which
either breaks the build or silently removes functionality. Generated file names are constrained
to a fixed set (Entity/Dto/Mapper/Controller/QueryCriteria/Service/ServiceImpl/Repository .java,
index.vue, <name>.js), so the primitive is file write/overwrite rather than arbitrary file
naming.
Impact (stored XSS): the generated content is derived from attacker-controlled template
variables. In particular apiAlias is interpolated once in the frontend template, inside a
JavaScript string literal, so a crafted value is written into the generated Vue file and -
after the next frontend build - executes in an administrator's browser session when the
affected page is opened. This was verified end to end and allows reading the administrator's
session token (ELADMIN-TOEKN cookie) and calling any administrative API. Precondition: the
frontend source is present on the host and rebuilt from source, which is normal for
development and CI environments.
Not claimed: backend Java injection through the author template variable was also tested. The
generated file is syntactically valid, but two of the eight generated files share the same
package, the injected class collides and the build fails, so code execution is not claimed.
CVSS 3.1: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H (8.1, High)
Proof of concept, full HTTP requests and screenshots:
https://gist.github.com/meikeneng/eecf22a51199aa7abd81d7fa0a21c533
Product: https://github.com/elunez/eladmin
Vendor/project website: https://eladmin.vip
Reproduction:
1. Authenticate as any user (verified with an account whose authority list is empty).
2. PUT /api/genConfig with moduleName set to a traversal sequence (four .. reach the drive root
from the working directory), path set to the target directory, cover set to true. The server
derives apiPath from path, so the apiPath value in the body is ignored.
3. POST /api/generator/sys_role/0 writes the files. type=0 resolves moduleName against
System.getProperty("user.dir"); type=2 uses %TEMP%\eladmin-gen-temp\<table>\ instead, is not
blocked by generator.enabled=false, and does not write to path/apiPath.
4. Verify that the ten files (eight .java plus index.vue and <name>.js) now exist outside the
project directory.
Note: this vector was reported to the vendor as issue #928 on 2026-11-11. The project tracker
also contains issue #908, which reports a related but different parameter (tableName) whose
vector is not reachable; neither has been fixed. |
|---|
| Fonte | ⚠️ https://gist.github.com/meikeneng/eecf22a51199aa7abd81d7fa0a21c533 |
|---|
| Utilizador | meikeneng (UID 93777) |
|---|
| Submissão | 11/11/2026 11h38 (há 25 dias) |
|---|
| Moderação | 06/12/2026 13h37 (25 days later) |
|---|
| Estado | Aceite |
|---|
| Entrada VulDB | 450824 [elunez eladmin até 2.7 eladmin-generator GenUtil.java getAdminFilePath/getFrontFilePath moduleName/path/apiPath Travessia de Diretório] |
|---|
| Pontos | 20 |
|---|