Elastic X-Pack Security versions 5.0.0 to 5.4.0 contain a privilege escalation bug in the run_as functionality. This bug prevents transitioning into the specified user specified in a run_as request. If a role has been created using a template that contains the _user properties, the behavior of run_as will be incorrect. Additionally if the run_as user specified does not exist, the transition will not happen.
https://www.elastic.co/community/security
https://www.elastic.co/blog/elasticsearch-5-4-1-and-5-3-3-released
https://discuss.elastic.co/t/elastic-stack-5-4-1-and-5-3-3-security-updates/87952