Cloudreve 4.16.1 has an OAuth scope authorization bypass in the admin storage policy routes. An OAuth bearer token scoped to Admin.Read but not Admin.Write can call POST /api/v4/admin/policy/oauth/signin and update OneDrive storage policy credentials.
The route is inside the admin group that requires Admin.Read, but it does not add the local Admin.Write guard used by sibling policy mutation routes. Its handler persists attacker-supplied secret and app_id values into the selected OneDrive storage policy before returning an OAuth URL.
An OAuth application that was granted only read-only admin scope can modify persistent storage backend configuration for a OneDrive policy. This can break the storage backend, replace the stored application secret and app ID, and redirect future OAuth setup for that policy to attacker-controlled application parameters. The attack crosses the intended OAuth scope boundary because Admin.Write is required for sibling storage policy mutation routes.
Preconditions:
Admin.Read but not Admin.Write.Send the following request with that read-only admin scoped token:
POST /api/v4/admin/policy/oauth/signin HTTP/1.1
Authorization: Bearer <admin OAuth token scoped to Admin.Read only>
Content-Type: application/json
{"id":1,"secret":"attacker-secret","app_id":"attacker-app-id"}
Expected secure result: the request is rejected with an insufficient-scope error because it changes storage policy credentials.
Actual result: the request reaches AdminOdOAuthURL, and GetOauthRedirectService.GetOAuth() persists the supplied values to the storage policy.
routers/router.go applies RequiredScopes(types.ScopeAdminRead) to the authenticated admin route group. Sibling policy mutation routes add local RequiredScopes(types.ScopeAdminWrite) guards, for example policy create, policy update, CORS creation, OAuth callback, and policy delete.
The OneDrive OAuth signin route is missing that local write-scope guard:
oauth.POST("signin",
controllers.FromJSON[adminsvc.GetOauthRedirectService](adminsvc.GetOauthRedirectParamCtx{}),
controllers.AdminOdOAuthURL,
)
The handler performs a persistent write in service/admin/policy.go:
policy.Settings.OauthRedirect = routes.MasterPolicyOAuthCallback(dep.SettingProvider().SiteURL(c)).String()
policy.SecretKey = service.Secret
policy.BucketName = service.AppID
policy, err = storagePolicyClient.Upsert(c, policy)
The request fields secret and app_id come directly from the caller.
A focused scope test confirmed that a request context with only Admin.Read fails CheckScope(c, types.ScopeAdminWrite), while Admin.Write implies Admin.Read. Therefore write routes must add RequiredScopes(types.ScopeAdminWrite) explicitly. The vulnerable route does not do so, and the handler writes the policy fields shown above.
Add middleware.RequiredScopes(types.ScopeAdminWrite) to oauth.POST("signin", ...) before the JSON handler. Consider auditing other admin test routes that perform outbound network or mail actions under only Admin.Read, but this persistent credential update should be fixed first.
| Software | From | Fixed in |
|---|---|---|
github.com/cloudreve/Cloudreve/v4
|
- | 4.17.0 |
github.com/cloudreve/Cloudreve/v3
|
- | 3.0.0-20250225100611-da4e44b77af4.x |
A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.
CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.
A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.
Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.
Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.
SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.