hashicorp / vault

A tool for secrets management, encryption as a service, and privileged access management
https://www.vaultproject.io/
Other
30.98k stars 4.19k forks source link

POST on `/auth/token/lookup` with specific payload causes internal server error #11306

Closed matusf closed 2 years ago

matusf commented 3 years ago

Describe the bug Making a POST request on /auth/token/lookup with specific payload causes internal server error

To Reproduce Hi, I was fuzzing vault and found this bug. To reproduce it, just run vault server -dev and make a request. The request is described in enclosed zip (single JSON file inside). The JSON has also the curl formated of the request, however, the request contains some wild unicode characters that your terminal may not like (at least mine does not :smile:). Therefore is better to use the resender utility that I made (along with the fuzzer). You may find it in my repo (github.com/matusf/openapi-fuzzer), with all installation instructions. Basically just run openapi-fuzzer-resender file.json to make the request.

auth-token-lookup.zip

See error from request: "{\"errors\":[\"no namespace\"]}\n" In logs:

[WARN]  core: error looking up namespace from the token's namespace ID: error="no namespace"

Expected behavior Response with non 500 status code.

Environment:

aphorise commented 2 years ago

Closing as issue was likely in RC version when issue was reported. Retested in 1.10.5 without any issues:

curl -v -X POST -d '{"token":"𰏲򛳏򞰑𫘛򱹯ᒢ􎚋.󥆆򫾠򊄌🻮"}' ${VAULT_ADDR}/v1/auth/token/lookup
  # < HTTP/2 403
  # # // ...
  # {"errors":["permission denied"]}

Thank you @matusf