How to Prevent SSRF in .Net

别来无恙 提交于 2021-02-08 11:53:37

问题


I have a web form application and also an Web Api application hosted in different servers. For all CRUD operations the Web Form application uses the API. To call the API from web form app I have created a generic API requesting method using WebRequest Class. Things are working fine but when we scan the code using Veracode I am getting SSRF Server Side Request Forgery issue. I googled and some folks said to add validation to the request uri, I tried all the validations but Veracode is throwing error still. Please help me on this.

WebRequest request = WebRequest.Create(baseaddress+"/"+apiurl);  
request.Method = "GET";  
request.ContentType = "application/json"; 
WebResponse response = request.GetResponse(); // Veracode shows SSRF issue here

来源:https://stackoverflow.com/questions/58391775/how-to-prevent-ssrf-in-net

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