Skip to content

cis-auth and cis-bff security audit

Date: 2026-10-25. Target: current local working tree, including pre-existing uncommitted changes. Application code and environment settings were not changed. Audit tests run locally with mocks and a loopback HTTP service; no attack requests were sent to deployed services.

Remediation status

The findings and original validation below describe the pre-remediation snapshot. Application-level fixes are now being verified; see application security remediation for the implemented changes, endpoint contract changes and current test results. LDAP transport, ingress/network controls and operational endpoint exposure are outside this development remediation scope, as requested. The original risk rating is not a post-fix assessment.

Executive assessment

Provisional risk: High for the reviewed code/configuration. Two High findings merit priority: cookie-authenticated CSRF against a mutating GET downstream of the BFF, and plaintext LDAP credential transport in the local UAT/production configuration. Additional Medium weaknesses affect abuse protection, information disclosure, logout guarantees and credential handling in logs. Production exposure depends on actual deployed code, network protections and ingress policy; none was independently verified.

There are 9 findings: 2 High, 6 Medium, 1 Low. This is a qualitative prioritization, not a CVSS calculation, certification, probability of compromise, or a count of independent exploit chains. The throttling and enumeration findings can reinforce each other and must not be added together as a numerical risk score. No Critical remote takeover was established in the paths examined; that is not proof one does not exist.

A defensible statement is: ?The authentication implementation has tested OAuth/session controls, but the current review found high-priority CSRF and credential-transport weaknesses, plus several session and abuse-control gaps. Production safety cannot be asserted until those are remediated and verified in the deployed environment.?

Scope and evidence strength

  • Inventoried/scanned production Java: cis-auth 114 files / 6,283 lines, cis-bff 43 files / 4,050 lines. Searches covered all 157 files for endpoint, authorization, injection, logging and transport indicators. Detailed reading concentrated on security configurations, authentication strategies, OAuth token/refresh adapters, client management, browser handlers, impersonation, revocation, BFF session storage, cookies, filters and proxying. This is not a line-by-line review of all 10,333 lines.
  • Inspected application YAML, build configuration, selected migrations and tests, local .env.dev/.env.uat/.env.prod security settings and examples with credentials/hosts withheld, and Compose ingress wiring. A local production-named file is not evidence of what production runs.
  • Traced one cis-api controller/service and resource-server boundary to establish the BFF GET-CSRF impact. Broader cis-api business authorization and password recovery remain outside this audit.
  • Reproduced means the supplied characterization test observed the behavior in current Java code. Source-confirmed means the code/configuration establishes the behavior, with explicit runtime prerequisites. Conditional gap means whether it violates the intended security guarantee depends on deployment or product policy.
  • Inventory fingerprints and test counts are in security-audit-evidence.json. Fingerprints identify this snapshot; they do not imply detailed review of every listed file.

Findings

AUTH-BFF-01 ? High: GET requests can perform authenticated changes without CSRF proof

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/service/chain/CookieSessionAuthHandler.java:47, cis-bff/src/main/java/com/dw/ngms/cis/bff/service/chain/CookieSessionAuthHandler.java:72, cis-api/src/main/java/com/dw/ngms/cis/web/rest/RelodgementResource.java:81. The BFF checks CSRF only for POST/PUT/PATCH/DELETE, then attaches the victim session access token to every forwarded GET. GET /api/v1/relodgement/deleteStep?stepId=... invokes deletion. Local UAT/production cookie settings use SameSite=Lax.

Attack conditions/impact: An attacker knows or predicts a valid target step ID and induces a logged-in user able to delete it to follow a top-level navigation to that BFF URL. Lax cookies can accompany top-level GET navigation. The downstream sees a valid bearer token and cannot tell that the browser request lacked user intent. Source requests/documents can be removed or locks altered through the existing service. Ownership/authorization checks still constrain the victim's effective privileges; this finding does not claim unauthenticated arbitrary deletion.

Validation: audit01_getDeleteIsRelayedWithVictimBearerWithoutCsrf reproduced bearer injection without a CSRF header. The controller/service path was read; a live database deletion and browser click were deliberately not performed.

Remediation: Move state changes to authenticated POST/DELETE routes with CSRF protection at the cookie boundary. Inventory remaining mutating GETs and temporarily block them for cookie authentication at the BFF. Update clients before removing legacy routes. Test malicious cross-origin navigation and valid same-origin mutations. Spring's CSRF model requires safe methods to be read-only.

AUTH-BFF-02 ? High: internal LDAP credentials lack transport encryption in reviewed configuration

Evidence: cis-auth/src/main/java/com/dw/ngms/cis/auth/config/LdapRealmConfig.java:33, cis-auth/src/main/java/com/dw/ngms/cis/auth/service/adapter/ActiveDirectoryLdapPortAdapter.java:43. Reviewed local cis-auth/.env.uat, .env.prod and corresponding examples enable LDAP with an ldap:// URL. The context source uses that URL and manager credentials without a TLS authentication strategy; user verification uses LDAP bind. No StartTLS configuration was found in these modules.

Attack conditions/impact: An adversary who can observe or intercept the auth-to-directory network path can capture LDAP bind credentials, including user passwords and manager credentials when used. This requires network position; it is not a demonstrated public Internet credential leak. An external encrypted tunnel could mitigate it, but none was verified.

Validation: Source/configuration confirmed; no packet capture, live AD connection or deployed TLS verification was performed.

Remediation: Use LDAPS with validated certificates or explicitly configured StartTLS; fail startup for insecure production directory URLs. Verify the actual AD endpoint, trust chain and negotiated transport in UAT before rollout. Spring LDAP documents TLS strategies.

AUTH-BFF-03 ? Medium: clients can choose the BFF rate-limit identity

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/web/filter/BffRateLimitingFilter.java:130. The first X-Forwarded-For value is accepted without checking a trusted proxy boundary and becomes the Redis counter key.

Attack conditions/impact: If ingress preserves or appends to user-supplied forwarded values, or the BFF is reachable directly, a caller changes that value per request to obtain new buckets. This weakens throttling for credential stuffing, enumeration and resource abuse. Per-account lockout is a separate control and is not automatically bypassed by this issue. Trusted ingress that overwrites the entire header can mitigate public exploitability.

Validation: audit02_samePeerChoosesDifferentRateLimitBucketsViaForwardedHeader reproduced distinct counters for the same remote address. Live Traefik sanitization was not verified.

Remediation: Establish trusted proxy CIDRs and normalized peer identity; strip externally supplied forwarding headers at the edge. Combine IP and normalized-account limits. Test spoofed/multiple header values through the real ingress. Spring explains forwarding-header trust.

AUTH-BFF-04 ? Medium: the public auth browser path bypasses BFF throttling

Evidence: cis-auth/src/main/java/com/dw/ngms/cis/auth/config/AuthorizationServerSecurityConfig.java:220, cis-auth/src/main/java/com/dw/ngms/cis/auth/service/strategy/BrowserAuthenticationProvider.java:39, cis-auth/src/main/java/com/dw/ngms/cis/auth/service/strategy/ExternalDbAuthStrategy.java:64. The browser posts credentials directly to cis-auth /login; the Redis limiter is only in cis-bff. No auth-side request throttler was found. compose/deploy/app.yml exposes auth through a host router without a repository-defined throttling middleware.

Attack conditions/impact: A caller can initiate a valid public authorization challenge and submit credentials directly to auth. CSRF tokens and login challenges are obtainable by that caller and do not limit attempt rates. Local external-account lockout remains effective for sequential wrong-password attempts, so this is principally password spraying, expensive hashing/LDAP load, and targeted lockout abuse; AD may apply its own controls. An external WAF/Traefik policy may mitigate it but was not inspected live.

Validation: Source/ingress gap confirmed; no brute-force or load test was performed. The browser handler's generic error message is a positive control and does not solve throttling.

Remediation: Apply bounded, shared rate limits to authorization initiation and credential verification at auth/ingress, with per-account and per-peer controls and operational monitoring. Verify that direct auth access cannot bypass them. OWASP discusses login throttling and lockout tradeoffs.

AUTH-BFF-05 ? Medium: password API errors disclose account existence and lock state

Evidence: cis-auth/src/main/java/com/dw/ngms/cis/auth/service/strategy/ExternalDbAuthStrategy.java:69, cis-auth/src/main/java/com/dw/ngms/cis/auth/service/strategy/ExternalDbAuthStrategy.java:72, cis-auth/src/main/java/com/dw/ngms/cis/auth/web/handler/OAuth2TokenEndpointErrorResponseHandler.java:59, cis-bff/src/main/java/com/dw/ngms/cis/bff/service/adapter/RestAuthServerClientAdapter.java:220. Missing users, incorrect passwords and locked users produce distinct descriptions/codes and remaining-attempt metadata; BFF password login propagates those distinctions, including lock-specific HTTP status.

Attack conditions/impact: Anonymous callers of /bff/auth/login can distinguish external-account names and lock state. Direct /oauth2/token use additionally requires an accepted client. The BFF supplies its confidential credentials, so that requirement does not protect the BFF login endpoint. Enumeration supports focused phishing, spraying and targeted lockout. Password verification is still required for successful sign-in. LDAP onboarding profile disclosure only follows successful directory credentials and is not classified as anonymous enumeration here.

Validation: Source-confirmed response chain; no real-user enumeration performed. Browser form errors are already more uniform.

Remediation: Return a uniform unauthenticated credential-error contract and put detailed counters/status in protected audit/support channels. Keep onboarding disclosures gated by completed authentication. Check bodies, status codes and timing differences. OWASP's generic-error guidance applies here.

AUTH-BFF-06 ? Medium: logout reports success when remote token revocation failed

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/service/adapter/RestAuthServerClientAdapter.java:141, cis-bff/src/main/java/com/dw/ngms/cis/bff/service/adapter/RestAuthServerClientAdapter.java:158, cis-bff/src/main/java/com/dw/ngms/cis/bff/facade/BffAuthenticationFacade.java:343. The adapter catches all revocation failures and returns normally; the facade deletes its Redis session and returns a successful local logout.

Attack conditions/impact: During an auth outage or revocation rejection, the browser cookie is cleared and its BFF session is deleted, but the remote access token and authorization/refresh token can survive. A previously stolen token may continue working until its expiry or another revocation. This does not mean the deleted BFF cookie still works. The failure is silent to callers and there is no durable retry in this path.

Validation: audit03_remoteRevocation503IsSilentlyAccepted made a loopback auth stub return HTTP 503 and observed a normal adapter return.

Remediation: Preserve local session termination while recording durable revocation work and surfacing a precise partial-logout result internally. Consider directly marking the access-token JTI revoked where appropriate, and retry complete authorization revocation safely. Test remote outage, Redis failure and recovery without resurrecting a deleted session.

AUTH-BFF-07 ? Medium: local logout and user-token revocation leave browser SSO usable

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/facade/BffAuthenticationFacade.java:343, cis-auth/src/main/java/com/dw/ngms/cis/auth/facade/SessionTerminationFacade.java:56, cis-auth/src/main/java/com/dw/ngms/cis/auth/web/filter/AuthorizationRealmFilter.java:71, cis-auth/src/main/java/com/dw/ngms/cis/auth/config/AuthorizationServerSecurityConfig.java:220. The auth server maintains an HTTP login session. BFF logout clears BFF cookies and revokes OAuth authorization; revoke-user removes token authorizations and publishes BFF eviction. Neither path invalidates auth HTTP sessions or records a browser-authentication cutoff. A same-realm existing principal is accepted at authorization initiation unless fresh login is requested.

Attack conditions/impact: After browser-based sign-in, someone using the still-open browser can restart authorization and receive a new BFF session without re-entering credentials while the account remains eligible. A stolen auth-session cookie can similarly survive token-only revocation. Account deactivation/policy checks at token issuance still prevent issuance for ineligible accounts. This is a conditional gap if logout/revoke-user is intended to terminate sign-in globally; local application logout semantics must be documented explicitly if intentional.

Validation: Source-confirmed split session lifecycles, not a live cross-origin browser reproduction.

Remediation: Define local versus global logout. For global logout/admin incident response, invalidate auth browser sessions or enforce a per-user authenticated-after cutoff at authorization/token issuance, and integrate a supported logout flow. Verify logout, revocation and multi-tab behavior end to end. Token blacklisting alone does not terminate SSO authentication.

AUTH-BFF-08 ? Medium: INFO audit logs contain reusable BFF session credentials

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/audit/BffAuditLogListener.java:27, cis-bff/src/main/java/com/dw/ngms/cis/bff/service/adapter/RedisBffSessionStoreAdapter.java:92, cis-bff/src/main/java/com/dw/ngms/cis/bff/facade/BffAuthenticationFacade.java:566. Session IDs are emitted in INFO audit logs and in event details such as sessionId, deletedSessionId, restoredAdminSessionId and sessionIds. The same value is the CIS_SESSION cookie credential. Some events log currently active sessions, so the concern is not limited to expired credentials.

Attack conditions/impact: A person or compromised log system that can read a current session ID can send it as a cookie to impersonate that browser session. /bff/auth/me can expose that session's CSRF token to a holder of the cookie, so CSRF does not compensate for credential theft. HttpOnly protects browser script access, not server log disclosure. Existing log access controls reduce exposure but do not make raw credential logging safe.

Validation: Source-confirmed logging and cookie consumption; no real session identifiers were collected or replayed.

Remediation: Replace raw session IDs in logging and audit details with a keyed hash or independent audit correlation ID. Restrict access/retention and assess whether prior logs contain still-active sessions. Preserve security event correlation without retaining reusable credentials.

AUTH-BFF-09 ? Low: BFF operational metrics are publicly authorized

Evidence: cis-bff/src/main/java/com/dw/ngms/cis/bff/config/BffSecurityConfig.java:64 permits /actuator/**. Reviewed UAT/production BFF settings expose health,info,metrics. The deploy router does not restrict those paths in this repository.

Attack conditions/impact: If reachable through deployed ingress, anonymous clients can inspect operational meter names and available measurements/tags. The exact data depends on installed meters; no credential/secret leak is asserted. when_authorized on health does not authorize the metrics endpoint. The rate limiter also skips actuator paths.

Validation: Source/configuration confirmed; deployed URLs were not probed.

Remediation: Permit only required health probes publicly, authenticate metrics or isolate the management listener/network, and confirm edge access policy. Recheck what external health responses disclose.

Additional risks requiring targeted validation

These are not counted as confirmed vulnerabilities above:

  • Impersonation return authority: BffAuthenticationFacade.exitImpersonation restores the administrator using only the current impersonated session and its server-side parent reference. If a lower-privilege impersonated cookie is stolen, /me can provide CSRF proof and exit may recover the original administrator session. Decide whether retaining that ability is acceptable; test a separate browser/actor binding or fresh admin authentication. This audit did not reproduce it or classify its severity.
  • Public revocation availability: the anonymous custom revoke-token endpoint acquires the global AUTH_SECURITY_LOCK before token lookup; lookups compare CLOB token columns. A load test should evaluate lock contention, unknown-token costs and request-size limits. No throughput collapse was demonstrated.
  • Concurrent browser password failures: the retry counter is entity read/modify/write without @Version, explicit user-row locking or an atomic database increment. Browser authentication does not use the token mutation filter. Concurrent lost updates may undermine retry counts; an Oracle concurrency regression is needed before claiming a lockout bypass.
  • Private-key encryption contract: AesPrivateKeyCipherAdapter claims GCM in its comment but calls Encryptors.text, and decryption failure returns the original input as a legacy fallback. Plan a versioned, authenticated-encryption migration and validate existing key formats rather than swapping the cipher in place. Actual plaintext legacy key rows were not inspected. Resolved Spring Security crypto is 7.1.1; it is a fixed version for CVE-2026-47842, so that CVE is not reported as an affected dependency. The advisory also describes compatibility implications of changing encryptor APIs.
  • Password grant remains reachable: a custom password grant and /bff/auth/login are still implemented. RFC 9700 section 2.4 disallows this grant in current OAuth security practice. Retire it through a planned client migration to Authorization Code + PKCE; this is a design debt, not proof of a password bypass. Administrative step-up/MFA was not established in these modules.
  • HTTP backend API route: reviewed BFF API routing uses HTTP inside the container network. A network observer there may see bearer tokens; validate service-network isolation or encrypted service transport. The HTTPS validation for the auth back-channel does not secure every API route.

Controls verified in inspected source

  • Admin client/key/session-management and impersonation URLs require administrative authorities. Impersonation derives caller identity from the authenticated principal and checks current administrator and target status/roles. No anonymous impersonation bypass was established.
  • Browser login has CSRF/session-fixation defenses, per-session bounded/expiring challenges, validated registered redirects, realm binding and generic form-login errors.
  • BFF authorization uses server-stored PKCE verifiers, random state bound to an HttpOnly browser cookie, atomic one-time transaction consumption and configured frontend return URLs.
  • Session mutations and unsafe cookie API requests verify session-bound CSRF values; cookie forwarding is stripped and cookie mode takes precedence over supplied bearer headers.
  • Access tokens use RSA signatures; auth decoding pins RS256 and verifies issuer/revocation/client availability. Refresh-time user policies/roles are reloaded. The BFF's unsigned parsing of back-channel token claims is not by itself classified as a signature bypass because those responses originate from the configured authenticated transport, and downstream APIs validate tokens.
  • Refresh rotation/replay family handling and Redis refresh leases exist. Revocation verification rejects unavailable Redis checks. Existing client validation, parameterized SQL/LDAP filters, enabled-client checks and redirect allowlists provide meaningful protections.

Validation and reproduction

The existing :cis-auth:test :cis-bff:test run succeeded. The final combined run including isolated audit tests also succeeded:

Module Reported tests Passed Skipped Failures/errors
cis-auth 88 80 8 0
cis-bff, including 3 audit tests 109 107 2 0

Skipped coverage includes Oracle mutation/transaction/migration tests and Redis integration tests. Passing characterization tests confirm the weaknesses, not their remediation. Most execution uses mocks/in-memory state; it does not prove production Oracle/Redis/AD integration or ingress security.

Audit-only source is under scripts/security-audit, attached to the test source set only when the init script is explicitly used:

./gradlew.bat -I scripts/security-audit/audit.init.gradle :cis-auth:test :cis-bff:test --console=plain
./gradlew.bat -I scripts/security-audit/audit.init.gradle :cis-bff:test --tests '*SecurityAuditEvidenceTest' --console=plain
./gradlew.bat :cis-auth:dependencyInsight --dependency spring-security-crypto --configuration runtimeClasspath --console=plain

The initial sandboxed test attempt could not access the external Gradle cache; the authorized retry succeeded. No production config or business data was changed.

Remediation order and remaining assurance work

  1. Close the mutating-GET CSRF path and enable authenticated directory transport; validate both in UAT.
  2. Fix rate-limit identity and add auth-side abuse controls. Remove unauthenticated account-status distinctions and session credentials from logs.
  3. Define global logout/revoke-session guarantees, make revocation failure visible/recoverable and restrict operational endpoints.
  4. Add regression tests that reject the reproduced behaviors after fixes, then exercise real Oracle/Redis/AD and browser flows. Verify ingress forwarding-header sanitization, network ACLs, deployed settings and image provenance.
  5. Perform a full resolved-dependency/container vulnerability scan, broader cis-api authorization/password-recovery audit and independent penetration test before making an organization-wide assurance claim.

No full SCA/container scan, external penetration test, packet capture, secret-history scan, production infrastructure review or live data inspection was performed. The one advisory check above cannot establish that all dependencies are vulnerability-free. This report does not assert that exploitation or compromise has occurred.