I pass directly the user parameter in my response header. What I found out is not a good idea, as the user can manipulate the header, and this can lead to Cross Site script attacks and other types of multiple attacks.
https://www.fortify.com/vulncat/en/vulncat/python/header_manipulation.html
What I am doing to prevent this is checking the user input for "splitting the HTTP response", replacing the characters "\ r" and "\ n" with the empty string "". Is this enough, or should I check other characters. Any pointers would be very helpful.
This is my code.
if(response != null)
{
newResponse = response.replaceAll("[\r\n]", "");
}
This is enough to prevent this type of attack, or I should also check other characters.
source
share