Security Questions Flashcards
What is Cross-Site Scripting (XSS)?
XSS is a vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.
How can you prevent XSS attacks in ASP.NET applications?
Use input validation, output encoding, and implementing Content Security Policy (CSP).
Explain Cross-Site Request Forgery (CSRF).
CSRF is an attack where an attacker tricks a user into performing actions they didn’t intend to, often by embedding malicious requests in images or links.
What’s the purpose of using anti-forgery tokens in ASP.NET applications?
Anti-forgery tokens prevent CSRF attacks by ensuring that requests originate from the same application.
Discuss secure coding practices in .NET applications.
Secure coding practices involve input validation, proper error handling, least privilege principle, and regular security testing.
Explain the concept of SQL Injection and how to prevent it.
SQL Injection occurs when an attacker manipulates input to execute malicious SQL queries. Prevent it by using parameterized queries or ORMs.
What is OAuth, and how can it enhance security in your .NET application?
OAuth is a protocol for authorization. It enhances security by allowing third-party applications to access resources without exposing credentials.
How does the principle of “least privilege” contribute to secure coding?
Least privilege limits access rights to the minimum necessary for a user or application to perform its function, reducing attack surface.
What’s the importance of input validation in preventing security vulnerabilities?
Input validation ensures that user inputs meet expected criteria, preventing malicious data from compromising the application.
Explain the concept of “defense in depth” in software security.
Defense in depth involves implementing multiple layers of security mechanisms to protect an application, reducing the likelihood of a single point of failure.
Discuss the significance of error handling in secure coding.
Proper error handling prevents sensitive information leakage and provides attackers with less information to exploit.
How can you securely store sensitive configuration settings like API keys?
Store sensitive configuration settings in environment variables, Azure Key Vault, or using the Secret Manager tool.
What is data encryption?
Data encryption involves converting data into a secure format using algorithms to prevent unauthorized access.
Explain the difference between symmetric and asymmetric encryption.
Symmetric encryption uses a single key for both encryption and decryption, while asymmetric encryption uses a pair of keys (public and private).
How can you ensure data privacy when storing sensitive data in a database?
Use encryption to protect data at rest and in transit, and implement access controls to restrict database access.