r/Python • • 12m ago

Resource 4 subtle backend & URL security bugs in Python/HTTP services

Most security tutorials focus on SQLi and XSS, while real production backend bugs often hide in standard-library edge cases and HTTP client internals.

While adapting real open-source backend defects into reproducible test cases, these four stood out for how easy they are to miss in review:

  1. posixpath.normpath UNC bypasses: Normalizing paths with leading double slashes (//server/share) behaves differently than single slashes under POSIX rules, which can bypass naive prefix checks on file paths or URLs.
  2. Unrewindable redirect streams: Sending a request with a streaming body that hits a 307/308 redirect—the HTTP client retries the request, but the stream is already exhausted, causing silent empty bodies or hangs.
  3. TLS connection pool reuse: Reusing pooled connections across different hostnames or subtly different TLS/auth contexts when pool keys don't include the full security boundary.
  4. Query smuggling: Inconsistent parsing of delimiters (; vs &) or encoded characters between a reverse proxy and the upstream app.

If you want to inspect the mechanics or try fixing stripped-down versions of these in the browser, they're up in our Backend & URL Security guide here: https://bugger.in/guides

Have you ever been bitten by a standard-library URL or path-normalization quirk in prod?

0 Upvotes

0 comments sorted by