A AegiFlow
MEDIUMCVSS 6.3

CVE-2026-62323

Cloudreve WOPI view sessions can write files and WOPI access token secret is ignored

Published
2026-07-24
Modified
2026-07-24
Aliases
GHSA-c3jm-gv5r-9wcp
Sources
github-advisory

Summary

## Summary Cloudreve WOPI access tokens are generated as ` . `, but the WOPI middleware validates only the session id prefix and never compares the supplied token to the stored token. In addition, a WOPI viewer session does not store or enforce the requested viewer action. A session created for a view or preview action can still call WOPI write routes if the underlying file is writable by the session user. ## Impact A WOPI integration that is only expected to view a user's file can modify that file through the WOPI write endpoints. If the WOPI URL or session id leaks, the random token suffix does not protect the session because any suffix is accepted for an existing session id. This affects deployments that configure WOPI viewers for user files. The attacker primitive is strongest when a malicious or compromised WOPI viewer receives a view-only URL and then writes content back to Cloudreve. ## Affected version Verified in source and runtime on latest master commit `ba2e870bbd17f1918dd2321de861e453f696d6a3` and latest observed tag `4.16.1`. ## Technical details Cloudreve creates WOPI viewer sessions in `pkg/filemanager/manager/viewer.go`: ```go sessionID := uuid.Must(uuid.NewV4()).String() token := util.RandStringRunesCrypto(128) sessionCache := &ViewerSessionCache{ ID: sessionID, Uri: file.Uri(false).String(), UserID: m.user.ID, ViewerID: viewer.ID, FileID: file.ID(), Version: version, Token: fmt.Sprintf("%s.%s", sessionID, token), } ``` The token includes a 128-character random suffix, but `middleware.ViewerSessionValidation()` only uses the prefix before the dot: ```go accessToken := strings.Split(c.Query(wopi.AccessTokenQuery), ".") if len(accessToken) != 2 { ... } sessionRaw, exist := store.Get(manager.ViewerSessionCachePrefix + accessToken[0]) ``` The middleware checks that the file id matches the loaded session, but it never compares `c.Query("access_token")` with `session.Token`. As a result, ` .anything` is accepted. The WOPI routes are exposed without normal session authentication and rely on this middleware: ```go wopi := noAuth.Group("file/wopi", middleware.HashID(hashid.FileID), middleware.ViewerSessionValidation()) wopi.GET(":id", controllers.CheckFileInfo) wopi.GET(":id/contents", controllers.GetFile) wopi.POST(":id/contents", controllers.PutFile) wopi.POST(":id", controllers.ModifyFile) ``` The write routes are not protected by a session-level write check. `CreateViewerSessionService` accepts `preferred_action`, but `ViewerSessionCache` has no action or write-permission field and `CreateViewerSession` does not persist the chosen action. The requested action is only used to generate the WOPI source URL: ```go wopiSrc, err := wopi.GenerateWopiSrc(c, s.PreferredAction, targetViewer, viewerSession) ``` `WopiService.PutContent()` checks only the underlying filesystem upload capability: ```go file, err := m.Get(c, uri, dbfs.WithRequiredCapabilities(dbfs.NavigatorCapabilityUploadFile), dbfs.WithNotRoot()) ``` It does not check whether the WOPI session was created for an edit action. ## Reproduction The following sequence was verified against a disposable local Cloudreve instance built from the affected commit. 1. Configure a WOPI viewer in Cloudreve. 2. Create a user-owned file, for example `cloudreve://my/wopi.txt`, containing `original content`. 3. Create a viewer session with `preferred_action` set to `view`: ```http PUT /api/v4/file/viewerSession HTTP/1.1 Authorization: Bearer Content-Type: application/json { "uri": "cloudreve://my/wopi.txt", "version": "", "viewer_id": "poc-wopi", "preferred_action": "view" } ``` Observed response: ```json { "session": { "id": "a2d03f1b-e310-4b2a-9baf-38556fa2d5d1", "access_token": "a2d03f1b-e310-4b2a-9baf-38556fa2d5d1. " } } ``` 4. Replace the token suffix with any value: ```http GET /api/v4/file/wopi/4xc

Affected packages

EcosystemPackageAffected versionsFixed versions
Gogithub.com/cloudreve/Cloudreve/v44.0.0-20260626022433-f3347130ac48
Gogithub.com/cloudreve/Cloudreve/v3

Remediation: Upgrade to 4.0.0-20260626022433-f3347130ac48 or later.

References

Includes data from the GitHub Advisory Database, licensed under CC-BY 4.0.

CVE® is a registered trademark of The MITRE Corporation. CVE content reproduced under the CVE Terms of Use; copyright designation © MITRE.