-->

Open Redirect or Header Manipulation issues from F

2019-02-24 12:26发布

问题:

We did a Fortify scan on our ASP.net application. We found that there many header manipulation issues. All the issues are pointing to Response.Redirect(). Please have a look at the below code where I encoded the parameters. Even then the below code is counted as header manipulation issue.

            int iCount = 0;
            foreach (string Name in Request.QueryString.Keys)
            {
                iCount++;
                if (iCount > 1)
                {
                    url += "&";
                }
                url += Name;
                if (Request.Params[Name]!=null)
                {
                    url += "=" + AntiXss.UrlEncode(Request.Params[Name]);
                }
            }
            Response.redirect(Server.UrlPathEncode(page.root) + "\Test.aspx?" + url);

Can some body let me know what else is required to change here to resolve the issue?

回答1:

Take off the Server.UrlPathEncode(page.root) portion and use Server.Transfer() instead of Response.Redirect().

Server.Transfer() transfers the user to another page on the same site and poses little to no danger of accidentally directing someone to another site.

Response.Redirect() is good for when you want to redirect someone to another site.

Also, Fortify doesn't tend to like Request.Params[] due to its possible ambiguity. A careful attacker may be able, on some servers, to send a UTF-7 or non-printing version of a name as one of the request variables and let the name of the variable contain the actual XSS injection, or overwrite the GET-request value with a cookie of the same name. Make sure both the name and value are htmlencoded, and consider using Request.QueryString[parametername] instead of Request.Params[parametername] to avoid more issues with Fortify.

Hopefully this gets you past your Fortify issues!



回答2:

It appears that Fortify percieves Name as user defined and that will triger "Manupulation" error. If it's true try to use predefined list if possible.