Here where I work they use an application called checkmarx to analyze the security of the application
In one of these analyzes the application detected the following problems:
Reflected XSS All Clients:
The application's GetBarcosNaoVinculados embeds untrusted data in the generated output with Json, at line 1243 of .../Controllers/AdminUserController.cs. This untrusted data is embedded straight into the output without proper sanitization or encoding, enabling an attacker to inject malicious code into the output. The attacker would be able to alter the returned web page by simply providing modified data in the user inputusuarioId, which is read by the GetBarcosNaoVinculados method at line 1243 of .../Controllers/AdminUserController.cs. This input then flows through the code straight to the output web page, without sanitization.
public JsonResult GetBarcosNaoVinculados(string usuarioId)
.....
.....
return Json(barcosNaoVinculados, JsonRequestBehavior.AllowGet)
Elsewhere in the system it gives the same problem but with these two methods
The application's LoadCodeRve embeds untrusted data in the generated output with SerializeObject, at line 738 of .../BR.Rve.UI.Site/Controllers/InfoApontamentoController.cs. This untrusted data is embedded straight into the output without proper sanitization or encoding, enabling an attacker to inject malicious codeinto the output.The attacker would be able to alter the returned web page by saving malicious data in a data-store ahead oftime. The attacker's modified data is then read from the database by the Buscar method with Where, at line 78 of .../Repository/Repository.cs. This untrusted data then flows through the code straight tothe output web page, without sanitization.
public virtual IEnumerable<TEntity> Buscar(Expression<Func<TEntity, bool>>predicate)
return Dbset.Where(predicate);
public string LoadCodeRve()
return JsonConvert.SerializeObject(items);
It seems that it has to do with the treatment given to the JSON format, would anyone know how to treat this type of problem?