We have an application which is already in production where an IDOR vulnerability was detected in an endpoint "CustomerKey". This contains customer ID which when used brute force allowed for session take over in our app.
Now we can't encrypt this as it might make the app slow as the CustomerKey is being used many times in the JS as well as backend. Our app allows many users to login at the same time we are using signalR in the app as well.
Some sample backend code where this CustomerKey is being used :
[HttpPost]
[AllowAnonymous]
public JsonResult UpLoadLog(string CustomerKey, string message)
{
try
{
var log = message.Split(new string[] { "\r\n" },
StringSplitOptions.RemoveEmptyEntries);
foreach (string s in log)
{
Logger.Write(LogType.Info, this.GetType(), "UpLoadLog", CustomerKey + ": "
+ s.TrimStart('\r', '\n'), null);
}
}
catch (Exception ex)
{
Logger.Write(LogType.Fatal, this.GetType(), "UpLoadLog", ex.Message, ex);
}
HttpContext.Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
return null;
}
[AuthorizeUser]
public ActionResult Customer(string CustomerKey, string FeedData, string FeedInfo)
{
if (string.IsNullOrEmpty(CustomerKey))
{
var owinContext = Request.GetOwinContext();
CustomerKey = owinContext.Get<string>("CustomerKey");
FeedData = owinContext.Get<string>("FeedData");
FeedInfo = owinContext.Get<string>("FeedInfo");
}
ViewBag.CustomerKey = CustomerKey;
ViewBag.FeedData = FeedData;
ViewBag.FeedInfo = FeedInfo;
ViewBag.UseSignalR = true;
ViewBag.isOffline = true;
return View("Offline", "CustomerLayout");
}
Sample js code where CustomerKey is being used:
var UpLoadLog = function (log, isAsync) {
if (isAsync== null || isAsync== undefined)
isAsync= true;
jQuery.ajax({
type: "POST",
async: isAsync,
contentType: "application/json;charset=utf-8",
url: rooturl + "Authentication/UpLoadLog",
data: JSON.stringify({ CustomerKey: jQuery("#customerKey").val(), message: "\r\n\r\n" + log + "\r\n\r\n" }),
dataType: "json",
success: function (response, status, jqXHR) {
},
error: function (jqXHR, status, error) {
}
});
LogMessages = "\r\n\r\n";
};
The app also contains a hidden field in the layout where the value of CustomerKey is being used
<input type="hidden" id="customerkey" value="@ViewBag.CustomerKey"/>
What I need help is how can I resolve this vulnerability without making huge changes in the application?