Welcome! Log In Create A New Profile

Advanced

Removing Null Character from Query Parameter

June 25, 2020 11:33AM
Nginx Upstream returning 400 Bad Request if null character is being passed in the request as part of uri or query params.

Is there a way Null Character can be removed from request before proxying it to upstream.

Its only known from access logs that null character is being passed in request as \x00 and causing the failure

How to identify the Null Character and remove it ?

Tried below options but its not able to identify the null character

if ($args ~* (.*)(\x00)(.*)) {
set $args $1$3;
}


Nginx returning below error

Error Log

2020/06/25 20:20:43 [info] 19838#19838: *11985 client sent invalid request while reading client request line, client: 10.49.120.61, server: test.com, request: "HEAD /folder/Test.m3u8?uid=abc123 HTTP/1.0"


Access log

10.49.120.61 | - | test.com | [25/Jun/2020:20:20:43 +0530] | - | "HEAD /folder/Test.m3u8?uid=abc123\x00 HTTP/1.0" | 400 | 0 | "-" | "-" | 0.001 | - | - | - | "- - - -" | http | - | -| "-"
Subject Author Posted

Removing Null Character from Query Parameter

anish10dec June 25, 2020 11:33AM

Re: Removing Null Character from Query Parameter

Maxim Dounin June 25, 2020 12:50PM

Re: Removing Null Character from Query Parameter

anish10dec June 25, 2020 02:02PM

Re: Removing Null Character from Query Parameter

Maxim Dounin June 25, 2020 02:20PM

Re: Removing Null Character from Query Parameter

jeffdyke June 25, 2020 09:22PM

Re: Removing Null Character from Query Parameter

anish10dec June 26, 2020 01:59AM

Re: Removing Null Character from Query Parameter

anish10dec June 26, 2020 11:11AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready