简体   繁体   English

是否可以在GET请求中发送0x00?

[英]is it possible to send 0x00 in GET request?

I want to send hex data as GET request like somesite.com/page.php?test=hex_string. 我想将十六进制数据作为GET请求发送,例如somesite.com/page.php?test=hex_string。 The data is generated data in hardware and then a GET request is send to a php file. 数据是在硬件中生成的数据,然后将GET请求发送到php文件。

But when I have 0x00 (NULL) character in the request, it fails with 400 bad request message. 但是,当我在请求中有0x00(NULL)字符时,它将失败并显示400错误的请求消息。

Is there a way I could send NUL character in GET request? 有什么方法可以在GET请求中发送NUL字符吗?

Yes. 是。 /?hexdecimal_nullbyte=%00

It fails because web server on the other side prevents null-byte attacks . 它失败是因为另一侧的Web服务器可防止null-byte attacks So, the web server says you it's a 400 bad request , don't do this :) 因此,Web服务器说您的400 bad request400 bad request ,请不要这样做:)

I have the same problem before. 我以前有同样的问题。 The only solution I found is to convert those null bytes as a decimal before page.php reads it, then in that page.php I convert it back to byte before sending it to the hardware. 我发现的唯一解决方案是在page.php读取之前将这些空字节转换为十进制,然后在该page.php中将其转换回字节,然后再将其发送到硬件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM