Nginx log advanced-indexing toggle and destructive index rebuild lack interactive secure-session step-up
Description
The nginx-log advanced-indexing controls — POST /api/nginx_log/settings/advanced_indexing/enable|disable and POST /api/nginx_log/index/rebuild — have no interactive secure-session (OTP/passkey) step-up. The enable/disable routes persist an indexing setting and start/stop background services; the rebuild route launches a destructive full re-index that first calls DestroyAllIndexes. Every equivalent settings-persisting write elsewhere in Nginx-UI is gated by RequireSecureSession.
Root Cause
InitRouter for nginx_log mounts these routes under AuthRequired() + Proxy() only (bare g group, routers.go:132), with no RequireSecureSession:
POST /api/nginx_log/settings/advanced_indexing/enable→EnableAdvancedIndexing→settings.Update(func(){ NginxLogSettings.IndexingEnabled = true })+InitializeServices..../disable→DisableAdvancedIndexing→ persistIndexingEnabled=false+StopServices().POST /api/nginx_log/index/rebuild→RebuildIndexlaunches an async rebuild; a full rebuild (empty path) callsnginx_log.DestroyAllIndexesthen re-indexes.
Impact
Persistent indexing-settings drift and loss of log observability when disabled (I:L), plus destruction of existing search index data and heavy CPU/IO/disk consumption on a full rebuild (A:L) — all without the step-up that guards equivalent settings writes. Via Proxy() the actions reach child cluster nodes.
Proof of Concept
POST /api/nginx_log/settings/advanced_indexing/disable HTTP/1.1
Authorization: Bearer <valid JWT, no fresh X-Secure-Session-ID>
POST /api/nginx_log/index/rebuild HTTP/1.1
Authorization: Bearer <valid JWT>
(empty body → full rebuild → DestroyAllIndexes + reindex)Attack Chain
- Entry:
POST /api/nginx_log/settings/advanced_indexing/enablewith a valid JWT of a 2FA-enabled admin without fresh step-up.
- Guard:
AuthRequired()+Proxy()on the bare group (api/nginx_log/router.go;routers.go:132). Bypass proof: noRequireSecureSessionon the nginx_log group; sibling settings writes elsewhere require it.
settings.UpdatepersistsIndexingEnabledandInitializeServices/StopServices()start or halt log indexing on the controller and, via Proxy, child nodes.- Entry (destructive):
POST /api/nginx_log/index/rebuildwith no JSON body →request.Path = ""→ full rebuild.
- Guard:
currentStatus.NginxLogIndexingin-progress check and per-pathIsTaskInProgress. Bypass proof:NginxLogIndexingis set true only inside the asyncperformAsyncRebuildgoroutine AFTER the handler returns, so the first destructive call is not blocked; the per-path guard is gated onrequest.Path != ""and is skipped for a full rebuild.
- Sink: goroutine →
performAsyncRebuild(indexer, "")→nginx_log.DestroyAllIndexes(ctx)(internal/nginx_log/modern_services.go:695) then full reindex. - Impact: all search indexes destroyed (I:L — regenerable) + heavy reindex / degraded log search (A:L).
Bypass Evidence
git show v2.8.4:api/nginx_log/router.go confirms the three routes present with no step-up middleware on release v2.8.4. The nginx_log indexing routes are NOT in the GHSA-5v7c-xpfp-p65m covered route list and are not a GHSA-h246 cluster suspect.
Affected Versions
<= 2.8.4 (verified byte-identical v2.8.4 → HEAD; no post-release fix).
Suggested Fix
Mount the advanced-indexing enable/disable and index/rebuild routes under RequireSecureSession (and RejectInDemo for the destructive rebuild), matching the step-up policy applied to equivalent settings-persisting writes.
--- Reported by zx (Jace) — GitHub: @manus-use