Securing .NET Flashcards

(59 cards)

1
Q

Why was .NET expected to be secure?

A

Thought to eliminate all security issues, but it didn’t.

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

What is a key lesson for .NET managed code?

A

Don’t store secrets in code or web.config files.

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

How should encryption be handled in .NET?

A

Use System.Security.Cryptography namespace classes.

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

Why validate input in .NET?

A

Ensures correctness before trusting user input.

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

What vulnerabilities does managed code mitigate?

A

Buffer overruns and issues with fully trusted mobile code.

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

What is an example of risky mobile code?

A

ActiveX controls, mitigated by managed code.

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

How does traditional Windows security work?

A

Checks only the principal’s identity for trust.

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

What enhances Windows security?

A

Restricted tokens and least privilege, available since Windows 2000.

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

How does .NET differ from traditional security?

A

Assigns trust levels to code based on system policy and evidence.

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

What is evidence in .NET security?

A

Properties like digital signatures or code’s site of origin.

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

How does evidence affect .NET code?

A

Security policies use it to grant permissions.

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

Why is .NET security important today?

A

Users run code from unknown authors on the internet.

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

How does .NET handle untrusted code?

A

Restricts code capabilities, not user privileges.

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

What is an example of restricted code?

A

Web page scripts with limited capabilities.

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

What does .NET generalize?

A

Code trust, balancing security and functionality.

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

Why avoid lazy programming in .NET?

A

Trust model doesn’t guarantee secure code.

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

What is FxCop?

A

A Microsoft tool to check .NET assemblies for design guideline conformance.

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

What does FxCop flag?

A

Lack of strong names or unspecified permission requests.

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

What output does FxCop produce?

A

XML reports on assembly compliance.

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

Since when is FxCop integrated with Visual Studio?

A

Visual Studio 2010 and later.

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

Does FxCop guarantee secure code?

A

No, but it’s a good starting point.

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

How does .NET prevent spoofing?

A

Uses strong names for assembly identity.

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

What is a strong name in .NET?

A

Text name, version, culture, public key, and digital signature.

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

How is a strong name created?

A

Using sn.exe with syntax SN -k keypair.snk.

25
What does a strong name key pair contain?
Private and public keys for signing/verifying assemblies.
26
Why protect strong name key files?
Prevent unauthorized use of signing keys.
27
Where are strong-named assemblies stored?
In the global assembly cache (GAC).
28
How are assemblies added to the GAC?
Using Mscorcfg.msc or gacutil.exe.
29
What is gacutil.exe?
A tool to manage the global assembly cache.
30
Why use the 64-bit gacutil.exe?
Required for 64-bit operating systems.
31
What are assembly permission requests?
Declarations of permissions needed by .NET code.
32
Why request permissions in .NET?
Informs CLR of code’s required capabilities.
33
Are permission requests mandatory?
No, they are optional.
34
What happens during a permission Demand?
CLR verifies all calling code has required permissions.
35
What is a stack walk in .NET?
CLR checks the call stack for permission compliance.
36
Why request permissions explicitly?
Increases likelihood of proper code execution.
37
What happens if permissions are not granted?
Code needs extra error-handling for failures.
38
What is RequireMinimum in .NET?
Defines the minimum permission set an app needs.
39
What occurs if minimum permissions aren’t met?
CLR raises a PolicyException, and the app won’t run.
40
What is UnmanagedCode permission?
Allows calling unmanaged code, a highly privileged action.
41
What determines UnmanagedCode permission?
Flags on the SecurityPermission class.
42
What risks does unmanaged code pose?
Can perform any action based on user account privileges.
43
Why restrict code trust in .NET?
Protects highly trusted users from risky code.
44
How does .NET balance security and functionality?
Grants permissions based on code evidence, not user.
45
What is a digital signature in strong naming?
Verifies assembly integrity and authorship.
46
Why store business logic assemblies in GAC?
Ensures trusted, strong-named code execution.
47
What is the CLR?
Common Language Runtime, manages .NET code execution.
48
Why validate input correctness?
Prevents exploitation of untrusted data.
49
What is a benefit of managed code?
Reduces buffer overrun vulnerabilities.
50
Why avoid custom encryption?
System.Security.Cryptography is more secure and tested.
51
What is a web.config file?
Configuration file for .NET web applications.
52
Why not store secrets in code?
Easily accessible to attackers if code is compromised.
53
What is a PolicyException?
Raised when minimum permissions aren’t granted.
54
How does .NET handle web scripts?
Restricts their capabilities for safe execution.
55
What is Mscorcfg.msc?
.NET Configuration tool for managing assemblies.
56
Why use strong names for excel.exe?
Prevents spoofing by verifying file identity.
57
What is the role of system policy in .NET?
Grants permissions based on code evidence.
58
Why is evidence-based trust flexible?
Allows nuanced security decisions for unknown code.
59
How does .NET improve on ActiveX security?
Limits code trust, unlike ActiveX’s user-based trust.