Skip to content
SSRF Write-up Intermediate

NTLM Credential Theft in Python Windows Applications

Three Python web frameworks on Windows (Gradio, Jupyter Server and Streamlit) performed file system checks on user-supplied paths before validating them, so a path pointing at a remote SMB share made the server authenticate outwards. An unauthenticated attacker could capture the Windows user's NTLMv2 hash and crack it or relay it to another host.

Naveen Sunkavally Follow

Published on horizon3.ai

Attack Blogs, Disclosures

Naveen Sunkavally, on horizon3.ai

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a check-order flaw: file system calls such as is_dir or isfile were made on unvalidated user input before confirming the path stayed within the permitted directory, and on Windows a UNC path triggers an outbound SMB authentication.

Impact

An unauthenticated attacker could capture the NTLMv2 hash of the user running the app and then crack it or relay it, potentially gaining remote code execution on another host; this only works if outbound SMB traffic is not blocked.

What the attacker needed

App runs on Windows; attacker can receive outbound SMB; no auth needed for Gradio file endpoint; Streamlit static file sharing enabled

The fix

Gradio, Jupyter Server and Streamlit were fixed in versions 4.20, 2.14.1 and 1.37.0 respectively, and defenders should also block outbound SMB traffic.

How it was found

  1. Run the vulnerable framework on a Windows host.
  2. Start a fake SMB server with a tool such as responder on the attacker machine.
  3. Send a request whose path parameter is a UNC path pointing at the attacker's SMB server.
  4. Capture the NTLMv2 hash of the Windows user running the application.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a Windows program is given a network path (one starting with two backslashes or forward slashes), Windows automatically tries to log in to that remote machine, sending a scrambled proof of the user's password called an NTLM hash. These Python apps checked whether a supplied path was a folder before confirming it stayed inside an allowed directory, so an attacker could point them at a server they control. The attacker then receives that hash and can try to guess the password offline or pass the hash to another machine.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by Naveen Sunkavally

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.