Summary
OpenCSG CSGHub's unauthenticated file resolve route may allow remote visitors to read files from private repositories. The risk arises when a user-controlled identity value in a file path is trusted while the portal uses its server-side API key to access repository content.
Affected context
The issue concerns the unauthenticated file resolve route in OpenCSG CSGHub through v2.6.0-ce. It becomes risky when the route accepts a percent-encoded current_user parameter in a file path and forwards the request using the portal's server API key, without ensuring the requester is authorized to access the target private repository. Affected content may include files in private model, code, or space repositories.
Exploit preconditions
- Attack surface: The file resolve route is reachable remotely without authentication.
- Required access: No authenticated account is described as necessary; the route must be accessible to the requester.
- Trigger point: The route processes a file path containing a percent-encoded
current_userparameter. - Why exploitation is possible: The portal forwards the request with its server API key, potentially treating a user-controlled identity value as sufficient authorization for private repository content.
Why this happens
The underlying issue is an authorization decision based on a user-controlled key or identity value. If a request parameter can influence which repository files the server retrieves, while the server's API key supplies its own authority, the route may fail to bind access to the actual requester's permissions. This matches CWE-639: Authorization Bypass Through User-Controlled Key.
Potential impact
- An unauthenticated remote user may be able to read files from private repositories.
- Confidential model, code, or space repository content could be exposed.
- Disclosed files could contain sensitive project information or credentials, depending on repository contents.
- Exposure could undermine the privacy expectations of repository owners and users.
General mitigation guidance
Defensive design generally separates the portal's service credentials from the requester's authorization context.
Common patterns include:
- Deriving repository access from a verified authenticated principal rather than a user-controlled path value.
- Enforcing authorization checks for every requested repository and file before using server-side credentials.
- Restricting unauthenticated routes to resources explicitly intended to be public.
- Validating and canonicalizing paths and parameters before they influence resource selection.
- Limiting the scope and permissions of server-side API credentials.
How teams detect issues like this
Review route handlers and service calls for cases where user-controlled path or identity values select private resources while shared server credentials perform the retrieval. Static analysis and code review can look for missing authorization checks between resource selection and data access.
Operational monitoring can flag unauthenticated resolve requests involving private repositories, unusual encoded identity parameters, and mismatches between the requester and the identity used for authorization. Policy checks can require explicit authorization enforcement on routes that access private content.

