My Code :-
router.post('/loadDetails', async (req, res) => {
try {
var resultData = await ltgService.postRequest(req.body, 'myconfig/loadAllSDetails');
res.send(resultData);
}
catch(error) {
res.status(500).send(error.message);
}
})
Here i am getting vulnerability while passing input and output as
The application's router.post embeds untrusted data in the generated output with send, at line 626 of routes\myConfigRouter.js
. 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 input body, which is read by the router.post method at line 625 of routes\myConfigRouter.js
. This input then flows through the code straight to the output web page, without sanitization.
This can enable a Reflected Cross-Site Scripting (XSS) attack.
I am passing req.body
with sanitize method like below but its not working
sanitize(req.body);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/g0dNhc9
Comments
Post a Comment