1、Invalid character found in the request target [/?a=fetch&content=<php>die(@md5(HelloThinkCMF))</php>]. The valid characters are defined in RFC 7230 and RFC 3986

tomcat版本是8.5.57

解决方法:

Tomcat在 8.5版本后,在http解析时做了严格限制。requestTargetAllow 只能配置|、{、} 这三个字符,对于其他的(例如" < > [ \ ] ^ ` { | } .),依旧报错,如果使用了|{}之外的其他字符,那就还需要如下配置。
1.在tomcat安装路径中conf/catalina.properties中最后添加2行:

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

2.在conf/server.xml中的<Connector>节点中,添加2个属性(可以接收任意特殊字符的组合,自行配置):

relaxedPathChars="|{}[],\"
relaxedQueryChars="|{}[],\"

 

相关文章:

  • 2022-02-07
  • 2021-08-11
  • 2022-01-20
  • 2022-12-23
  • 2021-12-13
  • 2021-04-09
  • 2021-07-05
  • 2021-05-02
猜你喜欢
  • 2021-05-19
  • 2021-04-20
  • 2021-06-06
  • 2021-08-17
  • 2021-07-19
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案