{"id":"CVE-2026-84312","aliases":["EUVD-2026-97963","GHSA-44xr-mrhh-qm78","GO-2026-6773"],"status":"published","title":"Nginx UI: Casdoor SSO callback uses a constant `state` parameter (login CSRF)","description":"Nginx UI is a web user interface for the Nginx web server. Prior to 2.4.1, GetCasdoorUri uses the configured Casdoor application name as a constant OAuth state value and CasdoorCallback does not compare the submitted state with a value bound to the initiating browser session. An unauthenticated attacker can cause a victim's browser to complete an attacker-controlled Casdoor authorization flow, and the callback can mint a Nginx UI session for the identity returned by that authorization code. This issue is fixed in version 2.4.1.","severity":{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-12","score":0.00172,"percentile":0.06723,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-287","CWE-352"],"published":"2026-10-12T21:16:56Z","modified":"2026-10-28T15:15:05Z","fixes":[{"ecosystem":"Go","package":"github.com/0xJacky/Nginx-UI","fixed_in":["1.9.10-0.20260703131214-23d1934099b0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"Go","package":"github.com/0xJacky/Nginx-UI","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.9.10-0.20260703131214-23d1934099b0"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/0xJacky/Nginx-UI","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.9.10-0.20260703131214-23d1934099b0"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/0xJacky/Nginx-UI","ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}]}],"products":[{"vendor":"0xjacky","product":"nginx-ui"}],"references":[{"url":"https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-44xr-mrhh-qm78","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/0xJacky/nginx-ui/commit/23d1934099b05b2a01589b48129dc3d3159d91c2","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/0xJacky/nginx-ui/releases/tag/v2.4.1","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-84312","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-44xr-mrhh-qm78"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/84xxx/CVE-2026-84312.json","tags":["advisory"]},{"url":"https://github.com/0xJacky/nginx-ui","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-84312","title":"Nginx UI: Casdoor SSO callback uses a constant `state` parameter (login CSRF)","description":"Nginx UI is a web user interface for the Nginx web server. Prior to 2.4.1, GetCasdoorUri uses the configured Casdoor application name as a constant OAuth state value and CasdoorCallback does not compare the submitted state with a value bound to the initiating browser session. An unauthenticated attacker can cause a victim's browser to complete an attacker-controlled Casdoor authorization flow, and the callback can mint a Nginx UI session for the identity returned by that authorization code. This issue is fixed in version 2.4.1.","status":"published","published":"2026-10-12T21:16:56.072Z","modified":"2026-10-14T11:36:49.978Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"cna"}],"cwes":["CWE-287","CWE-352"],"updated_at":"2026-11-02T14:20:08.391556Z"}],"euvd":[{"id":"EUVD-2026-97963","description":"Nginx UI is a web user interface for the Nginx web server. Prior to 2.4.1, GetCasdoorUri uses the configured Casdoor application name as a constant OAuth state value and CasdoorCallback does not compare the submitted state with a value bound to the initiating browser session. An unauthenticated attacker can cause a victim's browser to complete an attacker-controlled Casdoor authorization flow, and the callback can mint a Nginx UI session for the identity returned by that authorization code. This issue is fixed in version 2.4.1.","status":"published","published":"2026-10-12T21:16:56Z","modified":"2026-10-14T11:36:49Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"updated_at":"2026-11-02T17:27:16.356399Z"}],"ghsa":[{"id":"GHSA-44xr-mrhh-qm78","title":"Nginx UI: Casdoor SSO callback uses a constant `state` parameter (login CSRF)","description":"## Summary\n\nIn the Casdoor SSO flow, the OAuth `state` parameter is hard-coded to `settings.CasdoorSettings.Application` — a value identical for every user and every login. The callback handler accepts whatever `state` the client sends without comparing it to anything stored in the user agent, enabling a login-CSRF: an attacker can force the victim's browser to authenticate as the *attacker*.\n\n## Details\n\n`api/user/casdoor.go:92-117` (`GetCasdoorUri`):\n\n```go\nfunc GetCasdoorUri(c *gin.Context) {\n    clientId := settings.CasdoorSettings.ClientId\n    redirectUri := settings.CasdoorSettings.RedirectUri\n    state := settings.CasdoorSettings.Application      // ← constant\n    ...\n    c.JSON(http.StatusOK, gin.H{\n        \"uri\": fmt.Sprintf(\n            \"%s/login/oauth/authorize?client_id=%s\u0026response_type=code\u0026redirect_uri=%s\u0026state=%s\u0026scope=read\",\n            endpoint, clientId, encodedRedirectUri, state),\n    })\n}\n```\n\n`api/user/casdoor.go:24-90` (`CasdoorCallback`):\n\n```go\ntype CasdoorLoginUser struct {\n    Code  string `json:\"code\" binding:\"required,max=255\"`\n    State string `json:\"state\" binding:\"required,max=255\"`\n}\n\nfunc CasdoorCallback(c *gin.Context) {\n    var loginUser CasdoorLoginUser\n    if !cosy.BindAndValid(c, \u0026loginUser) { return }\n    ...\n    // state is NEVER compared to a per-session value\n    token, err := casdoorsdk.GetOAuthToken(loginUser.Code, loginUser.State)\n    ...\n    u, err := user.GetUser(claims.Name)        // username from Casdoor's JWT\n    ...\n    userToken, err := user.GenerateJWT(u)       // JWT minted for whatever user came back\n}\n```\n\nCompare with the OIDC implementation in `api/user/oidc.go:35-48`, which generates a random state, stores it in an `oidc_state` cookie, and validates it on the callback. Casdoor has no such check.\n\n## Proof of Concept\n\n1. Attacker initiates a Casdoor authorisation flow on their own browser, obtaining an authorisation `code` for *their* Casdoor account.\n2. Attacker hosts a page that auto-submits the captured `code` to the victim's nginx-ui:\n\n   ```html\n   \u003chtml\u003e\u003cbody\u003e\u003cform action=\"https://victim.example/api/casdoor_callback\" method=\"POST\"\n                     enctype=\"text/plain\" id=\"x\"\u003e\n     \u003cinput name='{\"code\":\"\u003cattacker_code\u003e\",\"state\":\"\u003cApp\u003e\",\"junk\":\"' value='\"}'\u003e\n   \u003c/form\u003e\n   \u003cscript\u003edocument.getElementById('x').submit()\u003c/script\u003e\n   \u003c/body\u003e\u003c/html\u003e\n   ```\n\n3. Server exchanges the attacker's `code`, looks up the username from `claims.Name` in the local user table, and mints a JWT for *that* row. The callback also sets the `_nginx_ui_secure_session` cookie via `middleware.EnsureSecureSessionCookie(c)` (`casdoor.go:84`) — meaning the victim is now silently authenticated as the attacker.\n4. Victim, believing they are using their own account, configures sites / TLS keys; the attacker reads them.\n\n## Impact\n\nLogin CSRF — the victim is forced to authenticate as the attacker, leading to data exfiltration of anything the victim subsequently uploads or configures. Particularly dangerous when nginx-ui is used by an organisation where Casdoor maps internal identities — the attacker can attribute their changes to the victim.\n\n## Patches\n\nMirror the OIDC implementation:\n\n```diff\n+ import (\n+    \"crypto/rand\"\n+    \"crypto/subtle\"\n+    \"encoding/hex\"\n+    ...\n+ )\n\n func GetCasdoorUri(c *gin.Context) {\n     ...\n-    state := settings.CasdoorSettings.Application\n+    b := make([]byte, 16)\n+    if _, err := rand.Read(b); err != nil {\n+        cosy.ErrHandler(c, err); return\n+    }\n+    state := hex.EncodeToString(b)\n+    c.SetSameSite(http.SameSiteLaxMode)\n+    c.SetCookie(\"casdoor_state\", state, 600, \"/\", \"\",\n+                cSettings.ServerSettings.EnableHTTPS, true)\n     ...\n }\n\n func CasdoorCallback(c *gin.Context) {\n+    expected, err := c.Cookie(\"casdoor_state\")\n+    if err != nil {\n+        c.AbortWithStatusJSON(http.StatusBadRequest,\n+            gin.H{\"message\":\"missing state cookie\"}); return\n+    }\n     var loginUser CasdoorLoginUser\n     if !cosy.BindAndValid(c, \u0026loginUser) { return }\n+    if subtle.ConstantTimeCompare([]byte(expected), []byte(loginUser.State)) != 1 {\n+        c.AbortWithStatusJSON(http.StatusBadRequest,\n+            gin.H{\"message\":\"invalid state\"}); return\n+    }\n     ...\n }\n```\n\n## Workarounds\n\nDisable Casdoor SSO until patched. The OIDC integration in `api/user/oidc.go` is correctly implemented and can be used as a substitute.\n\n## References\n\n* [`api/user/casdoor.go:92-117`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/casdoor.go#L92-L117)\n* [`api/user/casdoor.go:24-90`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/casdoor.go#L24-L90)\n* [`api/user/oidc.go:35-48`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/oidc.go#L35-L48) (correct implementation for comparison)\n\n## Credits\n\nVishal Shukla ([@shukla304](https://github.com/shukla304)) and Sechub.dev AI Agent.","status":"published","published":"2026-10-15T20:12:52Z","modified":"2026-10-28T15:04:17Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-287","CWE-352"],"updated_at":"2026-11-02T14:41:38.969831Z"}],"nvd":[{"id":"CVE-2026-84312","description":"Nginx UI is a web user interface for the Nginx web server. Prior to 2.4.1, GetCasdoorUri uses the configured Casdoor application name as a constant OAuth state value and CasdoorCallback does not compare the submitted state with a value bound to the initiating browser session. An unauthenticated attacker can cause a victim's browser to complete an attacker-controlled Casdoor authorization flow, and the callback can mint a Nginx UI session for the identity returned by that authorization code. This issue is fixed in version 2.4.1.","status":"published","published":"2026-10-12T22:17:05.263Z","modified":"2026-10-14T12:17:18.203Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"secondary"}],"cwes":["CWE-287","CWE-352"],"updated_at":"2026-11-02T14:12:56.72789Z"}],"osv":[{"id":"CVE-2026-84312","title":"Nginx UI: Casdoor SSO callback uses a constant `state` parameter (login CSRF)","description":"Nginx UI is a web user interface for the Nginx web server. Prior to 2.4.1, GetCasdoorUri uses the configured Casdoor application name as a constant OAuth state value and CasdoorCallback does not compare the submitted state with a value bound to the initiating browser session. An unauthenticated attacker can cause a victim's browser to complete an attacker-controlled Casdoor authorization flow, and the callback can mint a Nginx UI session for the identity returned by that authorization code. This issue is fixed in version 2.4.1.","status":"published","published":"2026-10-12T21:16:56.072Z","modified":"2026-10-28T02:30:24.557598694Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-287","CWE-352"],"updated_at":"2026-11-02T15:45:18.482949Z"},{"id":"GHSA-44xr-mrhh-qm78","title":"Nginx UI: Casdoor SSO callback uses a constant `state` parameter (login CSRF)","description":"## Summary\n\nIn the Casdoor SSO flow, the OAuth `state` parameter is hard-coded to `settings.CasdoorSettings.Application` — a value identical for every user and every login. The callback handler accepts whatever `state` the client sends without comparing it to anything stored in the user agent, enabling a login-CSRF: an attacker can force the victim's browser to authenticate as the *attacker*.\n\n## Details\n\n`api/user/casdoor.go:92-117` (`GetCasdoorUri`):\n\n```go\nfunc GetCasdoorUri(c *gin.Context) {\n    clientId := settings.CasdoorSettings.ClientId\n    redirectUri := settings.CasdoorSettings.RedirectUri\n    state := settings.CasdoorSettings.Application      // ← constant\n    ...\n    c.JSON(http.StatusOK, gin.H{\n        \"uri\": fmt.Sprintf(\n            \"%s/login/oauth/authorize?client_id=%s\u0026response_type=code\u0026redirect_uri=%s\u0026state=%s\u0026scope=read\",\n            endpoint, clientId, encodedRedirectUri, state),\n    })\n}\n```\n\n`api/user/casdoor.go:24-90` (`CasdoorCallback`):\n\n```go\ntype CasdoorLoginUser struct {\n    Code  string `json:\"code\" binding:\"required,max=255\"`\n    State string `json:\"state\" binding:\"required,max=255\"`\n}\n\nfunc CasdoorCallback(c *gin.Context) {\n    var loginUser CasdoorLoginUser\n    if !cosy.BindAndValid(c, \u0026loginUser) { return }\n    ...\n    // state is NEVER compared to a per-session value\n    token, err := casdoorsdk.GetOAuthToken(loginUser.Code, loginUser.State)\n    ...\n    u, err := user.GetUser(claims.Name)        // username from Casdoor's JWT\n    ...\n    userToken, err := user.GenerateJWT(u)       // JWT minted for whatever user came back\n}\n```\n\nCompare with the OIDC implementation in `api/user/oidc.go:35-48`, which generates a random state, stores it in an `oidc_state` cookie, and validates it on the callback. Casdoor has no such check.\n\n## Proof of Concept\n\n1. Attacker initiates a Casdoor authorisation flow on their own browser, obtaining an authorisation `code` for *their* Casdoor account.\n2. Attacker hosts a page that auto-submits the captured `code` to the victim's nginx-ui:\n\n   ```html\n   \u003chtml\u003e\u003cbody\u003e\u003cform action=\"https://victim.example/api/casdoor_callback\" method=\"POST\"\n                     enctype=\"text/plain\" id=\"x\"\u003e\n     \u003cinput name='{\"code\":\"\u003cattacker_code\u003e\",\"state\":\"\u003cApp\u003e\",\"junk\":\"' value='\"}'\u003e\n   \u003c/form\u003e\n   \u003cscript\u003edocument.getElementById('x').submit()\u003c/script\u003e\n   \u003c/body\u003e\u003c/html\u003e\n   ```\n\n3. Server exchanges the attacker's `code`, looks up the username from `claims.Name` in the local user table, and mints a JWT for *that* row. The callback also sets the `_nginx_ui_secure_session` cookie via `middleware.EnsureSecureSessionCookie(c)` (`casdoor.go:84`) — meaning the victim is now silently authenticated as the attacker.\n4. Victim, believing they are using their own account, configures sites / TLS keys; the attacker reads them.\n\n## Impact\n\nLogin CSRF — the victim is forced to authenticate as the attacker, leading to data exfiltration of anything the victim subsequently uploads or configures. Particularly dangerous when nginx-ui is used by an organisation where Casdoor maps internal identities — the attacker can attribute their changes to the victim.\n\n## Patches\n\nMirror the OIDC implementation:\n\n```diff\n+ import (\n+    \"crypto/rand\"\n+    \"crypto/subtle\"\n+    \"encoding/hex\"\n+    ...\n+ )\n\n func GetCasdoorUri(c *gin.Context) {\n     ...\n-    state := settings.CasdoorSettings.Application\n+    b := make([]byte, 16)\n+    if _, err := rand.Read(b); err != nil {\n+        cosy.ErrHandler(c, err); return\n+    }\n+    state := hex.EncodeToString(b)\n+    c.SetSameSite(http.SameSiteLaxMode)\n+    c.SetCookie(\"casdoor_state\", state, 600, \"/\", \"\",\n+                cSettings.ServerSettings.EnableHTTPS, true)\n     ...\n }\n\n func CasdoorCallback(c *gin.Context) {\n+    expected, err := c.Cookie(\"casdoor_state\")\n+    if err != nil {\n+        c.AbortWithStatusJSON(http.StatusBadRequest,\n+            gin.H{\"message\":\"missing state cookie\"}); return\n+    }\n     var loginUser CasdoorLoginUser\n     if !cosy.BindAndValid(c, \u0026loginUser) { return }\n+    if subtle.ConstantTimeCompare([]byte(expected), []byte(loginUser.State)) != 1 {\n+        c.AbortWithStatusJSON(http.StatusBadRequest,\n+            gin.H{\"message\":\"invalid state\"}); return\n+    }\n     ...\n }\n```\n\n## Workarounds\n\nDisable Casdoor SSO until patched. The OIDC integration in `api/user/oidc.go` is correctly implemented and can be used as a substitute.\n\n## References\n\n* [`api/user/casdoor.go:92-117`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/casdoor.go#L92-L117)\n* [`api/user/casdoor.go:24-90`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/casdoor.go#L24-L90)\n* [`api/user/oidc.go:35-48`](https://github.com/0xJacky/nginx-ui/blob/dev/api/user/oidc.go#L35-L48) (correct implementation for comparison)\n\n## Credits\n\nVishal Shukla ([@shukla304](https://github.com/shukla304)) and Sechub.dev AI Agent.","status":"published","published":"2026-10-15T20:12:52Z","modified":"2026-10-28T15:15:05.443671735Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-287","CWE-352"],"updated_at":"2026-11-02T15:46:36.434231Z"},{"id":"GO-2026-6773","title":"Casdoor SSO callback uses a constant state parameter (login CSRF) in github.com/0xJacky/Nginx-UI","description":"Casdoor SSO callback uses a constant state parameter (login CSRF) in github.com/0xJacky/Nginx-UI","status":"published","published":"2026-10-19T21:08:39Z","modified":"2026-10-19T21:31:37.806800912Z","updated_at":"2026-11-02T15:47:03.11707Z"}]}}
