Skip to content

fix(pprof): add read/write timeouts to diagnostic HTTP server#150

Merged
jongio merged 1 commit into
mainfrom
auto/secops/2026-05-17
May 17, 2026
Merged

fix(pprof): add read/write timeouts to diagnostic HTTP server#150
jongio merged 1 commit into
mainfrom
auto/secops/2026-05-17

Conversation

@jongio

@jongio jongio commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

The pprof diagnostic HTTP server used http.ListenAndServe with the default
http.Server settings, which means no read or write timeouts. A malicious
local process could exhaust the server's connection pool via a slowloris-style
attack (CWE-400, CVSS 3.1 Low — requires local access).

Changes

Replaced the bare http.ListenAndServe call with an explicit http.Server
that sets:

Timeout Value Purpose
ReadHeaderTimeout 10 s Limits time to read request headers
ReadTimeout 30 s Limits total time to read the full request
WriteTimeout 60 s Limits time to write the response
IdleTimeout 120 s Limits how long idle keep-alive connections persist

The server remains opt-in (requires --pprof flag) and bound to 127.0.0.1.

CWE Reference

  • CWE-400: Uncontrolled Resource Consumption
  • Severity: Low (localhost-only, opt-in diagnostic tool)

The pprof HTTP server used http.ListenAndServe with no timeouts,
leaving it vulnerable to slowloris-style connection exhaustion
(CWE-400). Replace with an explicit http.Server that sets
ReadHeaderTimeout, ReadTimeout, WriteTimeout, and IdleTimeout.

The server remains opt-in (--pprof flag) and bound to 127.0.0.1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jongio jongio added automated Filed by automated analysis secops Security operations labels May 17, 2026
@jongio jongio merged commit 6b11f8a into main May 17, 2026
3 checks passed
@jongio jongio deleted the auto/secops/2026-05-17 branch May 17, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Filed by automated analysis secops Security operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant