Securing An ASP.NET Web Application/API Flashcards
What are buffer overflows?
When the amount of data in the buffer exceeds its storage capacity. That extra data overflows into adjacent memory locations and corrupts or overwrites the data in those locations.
How would you prevent buffer overflows?
Input validation.
What is an **XSS (Cross-Site Scripting) **attack?
When malicious script is injected into a trusted website.
How can you prevent **XSS (Cross-Site Scripting) **attacks?
- ValidateInput attribute
- HtmlEncoder
- AntiXssEncode class**
What are SQL Injection Attacks?
When an attackercan execute malicious SQL statements
How can you prevent SQL Injection Attacks?
- Input validation
- Query parameterisation
- Reduced privileges user
What is CORS?
Cross-Origin Resource sharing that allows restricted resources on one domain to be requested from another
How do we enable CORS on ASP.NET?
In startup.cs in ConfigureServices.
services.AddCors() can beused to add a policy and specify what you can accept.
What elements can we specify when adding a CORS policy?
- Origin (ie all or websites)
- Header (ie application/x-www-form-urlencoded , multipart/form-data , or text/plain)
- Method (get, post etc…)