Overview
UlakPDF’s FastAPI-based management and analytics backend (stats-api) relies on identity headers forwarded by Nginx from Shibboleth SP (X-Remote-User for scoped eppn, and X-Remote-Mail for mail). During authorization checks in require_admin(), an empty X-Remote-User header triggered a silent fallback to X-Remote-Mail before matching against ADMIN_EPPNS.
Affected Component
stats-api/app.py
Root Cause
The helper function _user_id() prioritized x_remote_user, but fell back to x_remote_mail whenever x_remote_user was empty. In SAML federations such as YETKİM, mail is an unscoped attribute not subject to ScopeMatchesShibMDScope validation, and some IdPs omit eppn by policy.
Before (Vulnerable)
# stats-api/app.py
def _user_id(x_remote_user, x_remote_mail):
return (x_remote_user or x_remote_mail or "").strip().lower()
def require_admin(x_remote_user=None, x_remote_mail=None):
user = require_user(x_remote_user, x_remote_mail) # invokes _user_id
if not ADMIN_EPPNS or user not in ADMIN_EPPNS:
raise HTTPException(403, "Forbidden")
return user
Because require_admin() accepted the X-Remote-Mail fallback value as the user identifier when X-Remote-User was empty, an IdP could supply an administrator’s email address in mail while omitting eppn, bypassing eppn-based scope enforcement.
After (Patched)
# stats-api/app.py
def require_admin(
x_remote_user: str | None = Header(default=None),
) -> str:
user = _first_value(x_remote_user)
if not user:
raise HTTPException(403, "admin access requires eppn (X-Remote-User)")
if not ADMIN_EPPNS or user not in ADMIN_EPPNS:
raise HTTPException(403, f"{user} is not an admin")
return user
Impact
- Authorization Bypass: Even when Shibboleth SP enforces strict scope validation on
eppn, omittingeppnand asserting an unscopedmailattribute matching anADMIN_EPPNSentry allows unauthorized administrative access. - Chained Exploitation: Together with CVE-2026-88907, any federation IdP can gain administrative control over
stats-apiendpoints and sensitive usage records.
Remediation
Remove the X-Remote-Mail fallback from administrative authorization paths and strictly require a valid X-Remote-User (eppn) header in require_admin(), returning HTTP 403 Forbidden whenever it is absent.
References
- CVE-2026-88916 Record
- CWE-863: Incorrect Authorization
- Shibboleth AttributeFilter & Scoping Documentation
- USOM Advisory:
TR-26-1170