Skip to content

🐛 fix appsec bypass with invalid content-length#321

Merged
mathieuHa merged 1 commit into
mainfrom
fix-appsec-bypass
Apr 27, 2026
Merged

🐛 fix appsec bypass with invalid content-length#321
mathieuHa merged 1 commit into
mainfrom
fix-appsec-bypass

Conversation

@maxlerebourg
Copy link
Copy Markdown
Owner

No description provided.

@mathieuHa mathieuHa self-assigned this Apr 26, 2026
@mathieuHa mathieuHa self-requested a review April 26, 2026 17:17
Copy link
Copy Markdown
Collaborator

@mathieuHa mathieuHa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

HTTP/1.1 allows chunked transfer encoding, where Content-Length is absent or misleading. An attacker can craft a request with a body but no valid Content-Length, and the code before would skip AppSec analysis completely on that body. This could be an AppSec bypass vector.

A bit of context for users:

An attacker could bypass AppSec inspection entirely by sending a request with a body but setting Content-Length: 0 (or omitting the header entirely, which defaults to -1 in Go's http.Request). Since ContentLength <= 0 was falsy in the condition, the body would never be forwarded to AppSec for analysis, even though it contained potentially malicious payload.

@mathieuHa mathieuHa changed the title 🐛 fix appsec bypass 🐛 fix appsec bypass with invalid content-lenght Apr 27, 2026
@mathieuHa mathieuHa changed the title 🐛 fix appsec bypass with invalid content-lenght 🐛 fix appsec bypass with invalid content-length Apr 27, 2026
@mathieuHa mathieuHa merged commit 1f6a899 into main Apr 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants