Cross-Site Scripting Injection Vulnerability: Secure Coding Practices for Improved Web Application Safety
While security vulnerabilities evolve, secure coding practices aim to protect users and reduce organizational liability. OWASP offers a list of secure coding practices to guide software developers to adopt a security-first mindset that prepares software developers to write secure code that considers application security risks from their first line of code.
The Cross-Site Scripting Injection Vulnerability allows malicious hackers to inject and execute harmful scripts on a user’s browser. Three real-world examples of harmful data breaches caused by Cross-Site Scripting Injection Vulnerabilities are the British Airways data breach in 2018, the Fortnite data breach in 2019, and the eBay data breach in 2016 (Anderson, 2023).
Because of the widespread effects of this security vulnerability, in the React framework, the React DOM escapes any values in JSX before rendering them in the React DOM. While React, by nature, protects applications from malicious Cross-Site Scripting Injection attacks that allow malicious attackers to session hijack, steal user information, or redirect users to malicious web pages instead of the intended webpage, there are times when a software developer needs to manipulate the DOM with refs to interact with the external system, such as an API, outside of the rules defined by React.
Software developers can implement CSP headers to catch attacks in the browser and sanitize any data from the API with a library to identify and remove malicious HTML and URLs. In the eBay data breach, software engineers failed to sanitize their url parameters before navigating users to a new page, hackers exploited the Cross-Site Scripting Injection Vulnerability to redirect users to malicious web pages to steal eBay users’ sensitive payment details and account information. If eBay had properly sanitized the url parameters prior to injecting them into the source code, attackers would have been unable to redirect users to a new page.
The harmful effects of Cross-Site Scripting Injection attacks highlight the importance of secure coding practices in web application development. By providing comprehensive employee training that encourages secure coding practices as outlined by organizations like OWASP, organizations form positive relationships with users and stakeholders while raising the safety of modern web applications.
Reference:
Anderson, B. (2023. 3 Dangerous Cross-Site Scripting Attacks of the Last Decade. readwrite. https://readwrite.com/3-dangerous-cross-site-scripting-attacks-of-the-last-decade/
Comments
Post a Comment