Skip to main content
Menu
Advisories

Nginx log advanced-indexing toggle and destructive index rebuild lack interactive secure-session step-up

GHSA-9HFJ-63Q2-JHJWPublished Updated GitHub

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 → persist IndexingEnabled=false + StopServices().
  • POST /api/nginx_log/index/rebuild → RebuildIndex launches an async rebuild; a full rebuild (empty path) calls nginx_log.DestroyAllIndexes then 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

  1. Entry: POST /api/nginx_log/settings/advanced_indexing/enable with 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: no RequireSecureSession on the nginx_log group; sibling settings writes elsewhere require it.
  1. settings.Update persists IndexingEnabled and InitializeServices/StopServices() start or halt log indexing on the controller and, via Proxy, child nodes.
  2. Entry (destructive): POST /api/nginx_log/index/rebuild with no JSON body → request.Path = "" → full rebuild.
  • Guard: currentStatus.NginxLogIndexing in-progress check and per-path IsTaskInProgress. Bypass proof: NginxLogIndexing is set true only inside the async performAsyncRebuild goroutine AFTER the handler returns, so the first destructive call is not blocked; the per-path guard is gated on request.Path != "" and is skipped for a full rebuild.
  1. Sink: goroutine → performAsyncRebuild(indexer, "") → nginx_log.DestroyAllIndexes(ctx) (internal/nginx_log/modern_services.go:695) then full reindex.
  2. 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

Affected versions

References

GitHub · 0xJacky/nginx-ui