Skip to content

[BUG] es.exe: named pipe squatting hangs the client; unbounded viewport_count spins a core #12

Open

Description

@Firefly0619sec

Summary

Two local, low-severity robustness issues in es.exe:

  1. Pipe squatting: es.exe connects to \\.\pipe\Everything IPC Session <N> without verifying the server. Anyone who creates that pipe name first receives the search request and can leave the client hanging (or return forged results). The client does not fall back to the non-session pipe or to IPC2 in that state.
  2. Unbounded viewport_count: a reply that claims a very large result count makes es.exe spin through the full count reading an empty stream, pegging one core.

Both are local-only (same user, user runs es.exe). No memory corruption was observed.

Environment

  • ES 1.1.1.39 (x64)
  • Windows 10 19045 (x64)
  • Everything 1.5 service + GUI running
  • Session ID 1

Issue 1 — pipe squatting

ipc3_connect_pipe() builds the name as:

\\.\PIPE\Everything IPC Session <session_id>

and on failure retries without the session suffix. If a local process creates Everything IPC Session 1 first, es.exe connects to it, sends IPC3_COMMAND_SEARCH (frame: DWORD code; DWORD size; size bytes), and then waits forever for a reply — it never falls back.

Reproduction (PowerShell, listener side):

$pipe = New-Object System.IO.Pipes.NamedPipeServerStream(
    "Everything IPC Session 1",
    [System.IO.Pipes.PipeDirection]::InOut, 1,
    [System.IO.Pipes.PipeTransmissionMode]::Byte,
    [System.IO.Pipes.PipeOptions]::Asynchronous)
$pipe.WaitForConnection()
# read 8-byte header + payload, then simply do not reply

Then run es.exe notepad. Result: the request arrives at the fake server (code=7, payload contains the query string in plain text), and es.exe hangs.

Returning a syntactically valid reply also works — the client accepts a 22-byte empty result set (valid_flags, folder_count, file_count, viewport_offset, viewport_count, sort_count, property_request_count) and prints nothing, with no error. Filling in one item produces whatever path the server chooses. So this is also a result-forgery primitive, not just a hang.

Issue 2 — unbounded viewport_count

Reply header with folder_count = file_count = viewport_count = 0x7FFFFFFF and an otherwise empty stream: ipc3_result_list_init() stores the counts, _es_output_ipc3_results() loops viewport_count times, and each iteration reads past the end of the stream (reads are zero-filled), so the loop runs ~2^31 times. Observed: one core at 100% for minutes, no crash, no memory growth.

Other malformed inputs were handled safely in testing:

case result
property_count via VLQ overflow branch Error 7: bad IPC reply
item claims 200 bytes, 2 supplied prints AB, no crash
string length ~131070, 1 byte supplied prints A, no crash
64-bit layout claimed, 32-bit data empty, no crash

So the parser degrades safely in general; the gap is the missing sanity bound on viewport_count.

Suggested fixes

  • Client side: after connecting, verify the server (e.g. GetNamedPipeServerProcessId + image path/signature check) before sending the search request; if it fails, fall back to the non-session pipe rather than blocking.
  • Client side: do not loop viewport_count times when the stream is exhausted — break when is_error is set.
  • Optionally reject implausible viewport_count values (e.g. greater than a sane maximum).

Notes

  • The query text being visible to the server is expected by design (the server does the search); I mention it only because it makes the squatting primitive more useful to an attacker.
  • No memory-safety impact was found: five malformed-input cases all degraded safely.
  • Happy to test a patch.

Thanks for making the command-line interface open source — the code quality (no unsafe string functions, safe_size arithmetic, bounded buffers) made this audit pleasant.

Activity

  1. voidtools commented on Oct 30, 2026

    @voidtools
    Owner

    Thank you for the issue report Firefly0619sec,

    I'm not keen on verifying the server.
    Both es and Everything will be running as a standard user.
    Anyone can make a pipe server and that's fine.

    I have put on my TODO list for es to only allow the connection if the server is in the same session as the client.
    If possible... GetNamedPipeServerSessionId has flaws and only returns the SessionId for the first instance of the pipe server, not the connected pipe server. I will look into using GetNamedPipeServerProcessId, then get the session id from the process id.

    I have put on my TODO list to review breaking out of the viewport_count loop on stream->is_error.
    Looping the full viewport_count is currently done on purpose for formatting reasons.

  2. Firefly0619sec commented on Oct 30, 2026

    @Firefly0619sec
    Author

    Thanks David — that is a fair call, and I accept the threat model you describe (both ends running as a standard user). I will not push the server-verification idea further for that case.

    On the two TODO items:

    Same-session check. Deriving the session from GetNamedPipeServerProcessId() sounds right. You are also correct about GetNamedPipeServerSessionId() — it reports the first instance's session, not the session of the instance actually connected, so it cannot be used here.

    viewport_count loop. Thanks for the context that looping the full count is intentional for formatting. I withdraw that part: a break on stream->is_error would only make sense if the formatting pass can tolerate a partial list, and you know that trade-off better than I do.

    One note for the future: if a later version ever supports multi-user or remote IPC, a server check becomes worth revisiting; for a single-user desktop the complexity is not justified, so I agree with leaving it out for now.

    Thanks for taking the time to look at both.

  3. voidtools commented on Oct 30, 2026

    @voidtools
    Owner

    GetNamedPipeServerProcessId has the same flaw.
    It returns the process id of the first pipe instance, not the connected instance.

    My current plans are to add GetNamedPipeServerProcessId to ES and prevent new instances from being created once Everything has started.
    This will prevent Pipe squatting.
    It will take some time to implement and test.
    Both ES and Everything will need updating.

    I will review the viewport_count and see if I can improve it.
    There's only an issue if formatting expects x lines of results.

    I will never add remote IPC.
    IPC will be restricted to the current session only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions