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

主宰稳场 提交于 2019-12-20 02:17:17

问题


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.



来源:https://stackoverflow.com/questions/5743285/open-redirect-or-header-manipulation-issues-from-fortify-scan-on-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!