Security Questions Flashcards

1
Q

What is Cross-Site Scripting (XSS)?

A

XSS is a vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you prevent XSS attacks in ASP.NET applications?

A

Use input validation, output encoding, and implementing Content Security Policy (CSP).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain Cross-Site Request Forgery (CSRF).

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the purpose of using anti-forgery tokens in ASP.NET applications?

A

Anti-forgery tokens prevent CSRF attacks by ensuring that requests originate from the same application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Discuss secure coding practices in .NET applications.

A

Secure coding practices involve input validation, proper error handling, least privilege principle, and regular security testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the concept of SQL Injection and how to prevent it.

A

SQL Injection occurs when an attacker manipulates input to execute malicious SQL queries. Prevent it by using parameterized queries or ORMs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is OAuth, and how can it enhance security in your .NET application?

A

OAuth is a protocol for authorization. It enhances security by allowing third-party applications to access resources without exposing credentials.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does the principle of “least privilege” contribute to secure coding?

A

Least privilege limits access rights to the minimum necessary for a user or application to perform its function, reducing attack surface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the importance of input validation in preventing security vulnerabilities?

A

Input validation ensures that user inputs meet expected criteria, preventing malicious data from compromising the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain the concept of “defense in depth” in software security.

A

Defense in depth involves implementing multiple layers of security mechanisms to protect an application, reducing the likelihood of a single point of failure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Discuss the significance of error handling in secure coding.

A

Proper error handling prevents sensitive information leakage and provides attackers with less information to exploit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you securely store sensitive configuration settings like API keys?

A

Store sensitive configuration settings in environment variables, Azure Key Vault, or using the Secret Manager tool.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is data encryption?

A

Data encryption involves converting data into a secure format using algorithms to prevent unauthorized access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the difference between symmetric and asymmetric encryption.

A

Symmetric encryption uses a single key for both encryption and decryption, while asymmetric encryption uses a pair of keys (public and private).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you ensure data privacy when storing sensitive data in a database?

A

Use encryption to protect data at rest and in transit, and implement access controls to restrict database access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What’s hashing, and why is it used in security practices?

A

Hashing is the process of converting input into a fixed-size string of characters. It’s used to securely store passwords and verify data integrity.

17
Q

Discuss the purpose of a salt when hashing passwords.

A

A salt is random data added to the input before hashing, making it more difficult for attackers to use precomputed tables (rainbow tables) for cracking passwords.

18
Q

How can you mitigate XSS vulnerabilities in ASP.NET applications?

A

Use ASP.NET’s built-in request validation, HTML encoding, and validation controls to prevent user inputs from being treated as code.

19
Q

Explain how HttpOnly cookies help prevent XSS attacks.

A

HttpOnly cookies can’t be accessed through JavaScript, making it harder for attackers to steal session cookies through XSS.

20
Q

What’s the difference between reflected XSS and stored XSS?

A

Reflected XSS involves the injection of malicious code that’s immediately reflected back to the user. Stored XSS stores the malicious code on the server for later delivery.

21
Q

How can you protect your application from CSRF attacks?

A

Implement anti-CSRF tokens, validate Referer headers, and ensure that sensitive actions require user confirmation.

22
Q

Discuss the usage of Dependency Injection in .NET applications.

A

Dependency Injection (DI) helps manage class dependencies by injecting them from the outside, making testing and maintenance easier.

23
Q

Explain the use of async and await keywords in C#.

A

async and await are used for asynchronous programming, allowing non-blocking execution and improved responsiveness in applications.

24
Q

What’s the purpose of the Garbage Collector in .NET?

A

The Garbage Collector automatically manages memory by deallocating objects that are no longer needed, preventing memory leaks.

25
Q

How can you improve performance in a .NET application?

A

Use techniques like caching, optimizing database queries, and minimizing resource-intensive operations.

26
Q

What is the Open Web Application Security Project (OWASP), and why is it important for .NET developers?

A

OWASP is a community that focuses on improving software security. It provides resources, tools, and guidelines to help developers prevent security vulnerabilities in their applications.

27
Q

How can you prevent sensitive information exposure through error messages in your application?

A

Configure your application to display user-friendly error messages to users while logging detailed error information only in the backend. Avoid revealing technical details to users.

28
Q

Explain the importance of secure session management in web applications. How can you prevent session fixation attacks?

A

Secure session management is crucial to prevent unauthorized access to user data. Prevent session fixation by regenerating session IDs upon authentication and expiration.

29
Q

What are Content Security Policy (CSP) headers, and how can they enhance application security?

A

CSP headers define which resources can be loaded in a web page. They help prevent XSS attacks by restricting the sources from which content can be loaded.

30
Q

Discuss the security considerations when using third-party libraries or packages in your .NET application.

A

Third-party libraries can introduce security vulnerabilities. Regularly update and patch dependencies, and choose libraries with a strong security history.

31
Q

What is Secure Socket Layer (SSL)/Transport Layer Security (TLS), and how do they enhance data security in transit?

A

SSL/TLS protocols encrypt data transmitted between a client and a server, ensuring confidentiality and integrity during transit.

32
Q

Explain the concept of “input validation” and its role in preventing security vulnerabilities.

A

Input validation involves validating and sanitizing user inputs to prevent attacks like SQL injection, XSS, and data manipulation.

33
Q

How can you defend against XML External Entity (XXE) attacks in a .NET application?

A

Prevent XXE attacks by disabling external entity processing, using libraries that parse XML securely, and validating input against XML schema definitions.

34
Q

Discuss the role of the Same-Origin Policy (SOP) in web security. How can CORS headers relax SOP for specific scenarios?

A

SOP restricts web pages from making requests to a different domain. CORS headers relax this policy for legitimate cross-origin requests, maintaining security while allowing controlled data sharing.

35
Q

What are security headers in HTTP responses, and why should you implement them in your application?

A

Security headers (e.g., X-Frame-Options, X-XSS-Protection, Strict-Transport-Security) enhance security by instructing browsers on how to handle and render your application within the page’s context.

36
Q

Explain how role-based and claims-based authorization work in ASP.NET applications. How can you ensure that users have appropriate access rights?

A

Role-based authorization restricts access based on predefined roles, while claims-based authorization uses claims to grant specific permissions. Ensure that users are assigned appropriate roles or claims and that access is properly validated.