Details
The model serializes that configuration with AES:
Config *dns.Config `json:"config,omitempty" gorm:"serializer:json[aes]"`
DNS domains, records, and DDNS
api/dns/router.go registers DNS domain, record, and DDNS mutations without secure-session middleware:
group.POST("/domains", CreateDomain)
group.POST("/domains/:id", UpdateDomain)
group.DELETE("/domains/:id", DeleteDomain)
group.POST("/domains/:id/records", CreateRecord)
group.PUT("/domains/:id/records/:record_id", UpdateRecord)
group.DELETE("/domains/:id/records/:record_id", DeleteRecord)
group.PUT("/domains/:id/ddns", UpdateDDNSConfig)
group.DELETE("/domains/:id/ddns", DeleteDDNSConfig)
Those handlers call the DNS provider service and modify DDNS jobs:
record, err := svc.CreateRecord(c.Request.Context(), domainID, toRecordInput(payload))
...
record, err := svc.UpdateRecord(c.Request.Context(), domainID, recordID, toRecordInput(payload))
...
if err := cron.AddOrUpdateDDNSJob(domainID, cfg.IntervalSeconds); err != nil {
Nginx control and configuration-side effects
api/nginx/router.go registers several server/Nginx mutation endpoints without RequireSecureSession():
r.POST("nginx/reload", Reload)
r.POST("nginx/restart", Restart)
r.POST("nginx/stub_status", ToggleStubStatus)
r.POST("nginx/performance", UpdatePerformanceSettings)
r.POST("nginx/modules/refresh", RefreshModulesCache)
The handlers perform control actions or persist Nginx-related changes:
func Reload(c *gin.Context) {
nginx.Control(nginx.Reload).Resp(c)
}
func Restart(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "ok",
})
go nginx.Restart()
}
if json.Enable {
err = performance.EnableStubStatus()
} else {
err = performance.DisableStubStatus()
}
...
reloadOutput, err := nginx.Reload()
err := performance.UpdatePerfOpt(&perfOpt)
Site and stream advanced/batch mutations
api/sites/router.go leaves these site mutations before the secure-session group:
r.PUT("sites", BatchUpdateSites)
r.POST("sites/:name/advance", DomainEditByAdvancedMode)
r.POST("auto_cert/:name", AddDomainToAutoCert)
r.DELETE("auto_cert/:name", RemoveDomainFromAutoCert)
r.POST("site_navigation/order", UpdateSiteOrder)
r.POST("site_navigation/health_check/:id", UpdateHealthCheck)
DomainEditByAdvancedMode() persists the site's Advanced mode:
_, err = s.Where(s.Path.Eq(path)).Update(s.Advanced, json.Advanced)
AddDomainToAutoCert() writes certificate automation settings including DNS credential ID, domains, challenge method, and ACME user:
err = certModel.Updates(&model.Cert{
Name: name,
Domains: json.Domains,
AutoCert: model.AutoCertEnabled,
DnsCredentialID: json.DnsCredentialID,
ChallengeMethod: json.ChallengeMethod,
KeyType: helper.GetKeyType(json.KeyType),
ACMEUserID: json.ACMEUserID,
})
api/streams/router.go protects normal stream save/delete operations, but leaves batch update and advanced-mode outside:
r.PUT("streams", BatchUpdateStreams)
...
r.POST("streams/:name/advance", AdvancedEdit)
AdvancedEdit() persists the stream's Advanced mode:
_, err = s.Where(s.Path.Eq(path)).Update(s.Advanced, json.Advanced)
Safe local proof
I did not access any external Nginx UI deployment. The following proof only inspects the checked-out source tree and confirms that:
RequireSecureSession()is a real OTP-gated 10-minute step-up mechanism;- high-risk control routes are intentionally protected elsewhere;
- the affected route groups are authenticated but outside
RequireSecureSession(); - the affected handlers perform persistent or server-control side effects.
Run:
python3 reports/nginx-ui-missing-secure-session-step-up-poc.py
Observed output:
{
"all_affected_groups_present": true,
"all_controls_present": true,
"all_side_effects_present": true,
"commit": "4948fba8744e82c3d7003f68ee164e9f49421066",
"result": "VULNERABLE_SOURCE_CONFIRMED",
"target": "0xJacky/nginx-ui"
}
The full local proof output is available in my workspace as tmp/nginx-ui-missing-secure-session-step-up-poc-output.txt.
HTTP reproduction outline
This is a local-only reproduction outline for an isolated Nginx UI test instance, consistent with the project's security policy:
- Create a test user with OTP enabled.
- Log in as that user and keep only the normal authenticated session/JWT.
- Do not obtain or send a fresh
X-Secure-Session-ID. - Verify the expected protected control behavior:
POST /api/config
Authorization: <otp-user-session>
Content-Type: application/json
{ "name": "example.conf", "content": "server { listen 80; }" }
Expected result: 401 Unauthorized because config edits require RequireSecureSession().
- Attempt an affected operation with the same OTP-enabled session and no
X-Secure-Session-ID, for example:
POST /api/dns_credentials
Authorization: <otp-user-session>
Content-Type: application/json
{
"name": "attacker-controlled-test",
"provider": "cloudflare",
"provider_code": "cloudflare",
"token": "test-token"
}
Expected secure behavior: 401 Unauthorized, matching the secure-session requirement for other sensitive configuration changes.
Actual behavior from source review: the request reaches AddDnsCredential() because the DNS credential router is under AuthRequired() but does not apply RequireSecureSession().
The same missing step-up applies to the other route groups listed above.
Impact
If an attacker obtains the authenticated web session/JWT for a 2FA-enabled Nginx UI user, the secure-session boundary should limit what they can do until they also pass a fresh OTP/passkey challenge. The current route map leaves major administrative actions outside that boundary.
Depending on the victim user's privileges and deployment configuration, this can allow the attacker to:
- add, edit, or remove DNS provider credentials;
- alter certificate and ACME automation;
- create, modify, delete, or restore automatic backup jobs;
- configure S3 backup destinations and trigger S3 connection tests;
- alter DNS domains, records, or DDNS schedules through configured providers;
- restart or reload Nginx;
- enable/disable stub-status and change performance settings;
- switch sites/streams into advanced mode or change site automation bindings.
This undermines the value of the secure-session step-up for OTP-enabled accounts. I am not claiming pre-authentication access or remote code execution from this issue. The issue is missing step-up authorization for sensitive authenticated mutations.
Suggested fix
Recommended mitigation:
- Apply
middleware.RequireSecureSession()to all high-impact authenticated mutation routes that alter server, Nginx, certificate, DNS, backup, credential, or automation state. - At minimum, protect:
- auto-backup create/modify/delete/restore/test-S3;
- DNS credential create/edit/delete;
- certificate and ACME user mutations;
- DNS domain, record, and DDNS mutations;
- Nginx reload/restart/stub-status/performance/module-cache mutation routes;
- site/stream advanced-mode, batch, auto-cert, navigation order, and health-check mutations.
- Add regression tests mirroring the existing config/site/stream security tests:
- OTP-enabled user without
X-Secure-Session-IDreceives401; - OTP-enabled user with a valid secure-session ID succeeds;
- non-OTP users retain existing behavior if that is the intended product policy.
- Consider centralizing "sensitive mutation" routing to make future omissions harder.