Skip to content

When user switching is configured insecurely (allowing switching from an anonymous user), Actuator's AuthenticationAuditListener will NPE when exiting the switch #15767

@Darkvater

Description

@Darkvater

Our application has an anonymous landing page that allows one to impersonate multiple users. The first impersonation works, the second in the same session fails because of an NPE.

SwitchUserFilter tries to exit the impersonated user before doing the next impersonation. As the previous user is anonymous the originalUser will be NULL (SwitchUserFilter:284 is not executed as obj is a string with value "anonymousUser") and as such the
audit listener fails with an NPE (AuthenticationAuditListener:106).

This is using spring-boot 1.5.7 and corresponding spring-security 4.2.3 but looking at the code this is still there in the latest 1.5.18 release.
A potential workaround is to have no audit listener, or a custom one.

Note: will provide simple example later

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions