Vuln-Code 3 {Python}
This code is one of the challenges intigriti posts on twitter. Source below
code
Source for the code , the original post on twitter.
Vulnerability
The code seems to be vulnerable to the two vulnerabilities:
Client side Vulnerability
Cross-Site-Scripting attack can be used on the application's front-end due to the *email* parameter that is being fetched at line 10 without and being used without any sanitization. Making it to embed malicious javascript.
Server Side Vulnerability
The application allows imposes risk of RCE due to the same *email* parameter being vulnerable and used without sanitization , the vulnerability that leads to such scenario is Server-Side-Template-Injection. Even a small payload like: {{5*5}} would result in evaluating that.
Remedy
Proper sanitization will help in doing so , but how:
Avoid directly injecting user input into your templates. Instead, use Flask's built-in mechanisms to handle user input safely:
we could use render_template method to change:
and the template may look like this:
Last updated