Sanitation for URL used in Header: Location?

前端 未结 1 1115
长发绾君心
长发绾君心 2021-01-13 19:32

In a multi-step form process, I am receiving a URL as a form field.

After processing, my PHP script redirects to that address using header(\"Location: ...\");<

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 20:08

    In old versions of PHP you had to worry about CRLF injection which is \r\n. This is a "header response splitting vulnerability." If you strip out these characters then you shouldn't have to worry. In the latest build of of PHP the header() function is safe, and will automatically take care of \r\n for you.

    0 讨论(0)
提交回复
热议问题