Gradio – Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret

0
6

Gradio – Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret

Gradio applications running outside of Hugging Face Spaces automatically enable “mocked” OAuth routes when OAuth components (e.g. gr.LoginButton) are used. When a user visits /login/huggingface, the server retrieves its own Hugging Face access token via huggingface_hub.get_token() and stores it in the visitor’s session cookie. 

If the application is network-accessible, any remote attacker can trigger this flow to steal the server owner’s HF token. The session cookie is signed with a hardcoded secret derived from the string “-v4”, making the payload trivially decodable.

Joshua Martinelle
– Read more