Property
Languagepython
Severityhigh
CWECWE-79: Improper Neutralization of Input During Web Page Generation (‘Cross-site Scripting’)
OWASPA07:2017 - Cross-Site Scripting (XSS)
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelHigh

Description#

Directly returning formatted strings in Flask routes, especially with user input, can allow attackers to inject malicious HTML or JavaScript. Instead, use Flask’s template engine (render_template) to safely render responses and automatically escape user input.

Impact#

If exploited, attackers could execute arbitrary JavaScript in users’ browsers (cross-site scripting), leading to stolen session cookies, account compromise, defacement, or spreading malware to your users. This can damage user trust and expose sensitive data.