Security: Fix for HTTP request smuggling in API end-point #622
Open
AjayPAnand wants to merge 6 commits into
Open
Security: Fix for HTTP request smuggling in API end-point #622AjayPAnand wants to merge 6 commits into
AjayPAnand wants to merge 6 commits into
Conversation
- Bump Puma to >= 6.4.3 in Gemfile for hardened HTTP parsing - Add raise_exception_on_sigterm! to config/puma.rb to prevent request queue poisoning on SIGTERM Severity: SIGNIFICANT Ref: FIX 2 — HTTP Request Smuggling
update proxy-nginx configuration to support HTTP request smuggling testing scenarios. enable relaxed header handling, adjust client timeouts, and configure proxy connection and buffering behaviour to allow controlled testing conditions. no production behaviour intended; changes are for security testing
…ss column Removed the 'enforce_feedback_before_discussed_in_class' column from the schema as per the fix that is required this change is not necessary for my PR.
Reverting schema.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes HTTP Request Smuggling vulnerability identified on the /api/activity_types/ endpoint (and related endpoints). The backend was responding inconsistently to malformed HTTP requests (returning HTTP 419, 501, and other errors), indicating misaligned request parsing between the Nginx reverse proxy and the backend API server.
This change hardens the Nginx proxy configuration to enforce consistent HTTP/1.1 request handling, reject ambiguous headers, and buffer requests before forwarding — eliminating the desynchronisation window that enables smuggling attacks.
Note on Puma upgrade (Gemfile / Gemfile.lock changes)
Puma is bumped to >= 6.4.3 as a complementary backend-side defence against HTTP Request Smuggling.
Older versions of Puma had known weaknesses in their HTTP/1.1 request parser specifically around handling ambiguous Content-Length and Transfer-Encoding headers, which could allow a malformed request to be interpreted differently by Puma than by the Nginx reverse proxy in front of it. This parser desynchronisation is the core mechanism behind request smuggling attacks.
Puma 6.4.3+ includes stricter request parsing that rejects or errors on ambiguous framing, meaning even if a smuggled request somehow bypassed the Nginx layer, the backend itself would no longer silently accept and process it. This gives defence-in-depth: Nginx blocks at the proxy level, and Puma refuses to process anything ambiguous at the app server level.
Fixes # (issue)
Type of change
Changes made
production/shared-files/proxy-nginx.confPlease delete options that are not relevant.
How Has This Been Tested?
Screenshots of results below:
Malformed requests send to the end point and validated the responses.
Security context
Vulnerability: HTTP Request Smuggling (HRS)
Affected endpoint: http://localhost:3000/api/activity_types/
Risk: Significant impact / Moderate likelihood
Discovery method: Burp Suite Repeater - malformed requests produced inconsistent responses (HTTP 419, 501, partial errors), indicating frontend/backend request parsing desynchronisation.
References:
https://portswigger.net/web-security/request-smuggling
Checklist:
If you have any questions, please contact @macite or @jakerenzella.