开发者

Open Redirect or Header Manipulation issues from Fortify scan on asp.net

开发者 https://www.devze.com 2023-02-28 01:22 出处:网络
We did a Fortify sca开发者_JAVA百科n 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 belo

We did a Fortify sca开发者_JAVA百科n 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?


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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消