NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Gradio

CVE-2024-1729: Gradio apps vulnerable to timing attacks to guess password

mediumCVSS 3.0 5.9GHSA-hmx6-r76c-85g9

Gradio before 4.19.2 compares login passwords with a plain string comparison, which leaks timing. Someone who can reach a password-protected Gradio app can guess the password character by character. Upgrade to gradio 4.19.2. The maintainers know of no exploitation.

Published Feb 22, 2024 · Updated Apr 8, 2024 · Analysis Nov 2, 2026

What an attacker can do

The login function in gradio/routes.py checked the password with app.auth[username] == password. Python ends that comparison at the first differing character, so a guess with a longer correct prefix takes slightly longer to reject. By timing many requests, an attacker can recover the password one character at a time.

Gradio apps are not rate-limited by default, so the attacker can send millions of guesses. They need network access to the app's login endpoint and no account. They also need a username. The attack is noisy and slow over a real network, which is why the CVSS vector rates attack complexity as high. If it works, the attacker gets the password and can use the app, including whatever models, files or credentials it exposes. Apps that put their login on the public internet, such as shared demos, are the realistic target.

Who is affected

gradio below 4.19.2 when launched with authentication, for example launch(auth=("user", "pass")) or an auth list. Apps with no password are not affected by this flaw, since they have nothing to guess.

Check the installed version:

pip show gradio

gradio

Ecosystem
PyPI
Affected
< 4.19.2
Fixed in
4.19.2
Check
pip show gradio

How to fix it

Upgrade to gradio 4.19.2 or later:

pip install --upgrade "gradio>=4.19.2"

The fix commit replaces the equality check with compare_passwords_securely in gradio/route_utils.py, which uses hmac.compare_digest so the comparison time does not depend on where the strings differ. The advisory gives no workaround. Reasonable extra steps are to put the app behind a rate-limiting proxy and to change the password after an upgrade if you saw suspicious traffic.

How to tell if you were hit

Look in access logs for a very large number of POST requests to the login endpoint from one address or a small set of addresses, usually with the same username and varying passwords. Failed logins in bursts that last minutes or hours point to guessing. If you see that against an unpatched version, rotate the password. The maintainers state they know of no use of this against Gradio apps.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

This security policy is with regards to a timing attack that allows users of Gradio apps to potentially guess the password of password-protected Gradio apps. This relies on the fact that string comparisons in Python terminate early, as soon as there is a string mismatch. Because Gradio apps are, by default, not rate-limited, a user could brute-force millions of guesses to figure out the correct username and password.

Patches

Yes, the problem has been patched in Gradio version 4.19.2 or higher. We have no knowledge of this exploit being used against users of Gradio applications, but we encourage all users to upgrade to Gradio 4.19.2 or higher.

Fixed in: https://github.com/gradio-app/gradio/commit/e329f1fd38935213fe0e73962e8cbd5d3af6e87b

Questions

Is gradio 4.19.2 affected by CVE-2024-1729?

No. 4.19.2 is the patched version. Versions below it use a plain string comparison for the login password.

Does an app without authentication need patching for this?

This flaw only concerns the login check, so apps with no password are not exposed to it. Upgrading is still sensible, because it keeps you on a supported release.

Is it exploited in the wild?

The advisory says the maintainers have no knowledge of the exploit being used against Gradio users. It is not in CISA's KEV catalog.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Gradio vulnerabilities

All Gradio entries