Skip to content
Info disclosure Disclosed report Intermediate

Unexpected access to process open files via file:///proc/self/fd/n

The file:// handler in libcurl did not block access to the /proc/self/fd pseudo-filesystem, so an application that fetches user-supplied URLs could be made to read any file the process already had open. This could expose privileged files such as /etc/shadow even after the process had dropped its privileges.

nyymi Follow

Originally disclosed on HackerOne

  • Disclosed after 13 months

Summary:

file_connect() routine (https://github.com/curl/curl/blob/1b71bc532bde8621fd3260843f8197182a467ff2/lib/file.c#L134) does not prevent access to /proc/self/fd pseudo filesystem. Application using libcurl and accepting URLs to fetch can be tricked to return content of any open file by passing a specially crafted file:///proc/self/fd/<number> URLs. Since the specific files are open by the application itself, they will always be accessible as long as the files remain open. This will bypass for example drop of privileges performed after opening the file(s).

Steps To Reproduce:

[add details for how we can reproduce the issue]

  1. Open a privileged file (for example /etc/shadow)
  2. Drop the process privileges
  3. Accept URL as user input
  4. Fetch URL with libcurl
  5. Send received data to user

Supporting Material/References:

Impact

Authorization bypass: Access to privileged files otherwise not accessible via file://

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the file:// handler in libcurl did not reject paths under /proc/self/fd, allowing a process to reopen its own already-open file descriptors regardless of later privilege drops.

Impact

An attacker could read privileged files that the process had opened before dropping privileges, bypassing the intended authorisation restriction.

What the attacker needed

Application fetches user-supplied URLs; target file already open in the process; Linux /proc filesystem available

How it was found

  1. Open a privileged file such as /etc/shadow.
  2. Drop the process privileges.
  3. Accept a URL from user input.
  4. Fetch that URL with libcurl.
  5. Send the received data back to the user.

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 report has not been written yet. The Original tab links to the source.

When a program opens a file, the operating system gives it a small number (a file descriptor) to refer to that file. On Linux, a special path under /proc lets a program reopen any of its own open files by that number. libcurl's file:// support did not stop these paths, so a user who supplied a URL could ask the program to hand back the contents of a file it had opened earlier, even one it was no longer allowed to read directly.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by nyymi

View all

51 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.