OWasp AJAX Security Cheat Sheet Flashcards

Real time AJAX security evaluation for learners based on content at https://cheatsheetseries.owasp.org/cheatsheets/AJAX_Security_Cheat_Sheet

1
Q

Client Side

What should be used instead of .innerHTML to prevent XSS problems?

A

Use .innerText, as it automatically encodes the text.

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

Client Side

Why should eval() or similar code evaluation tools be avoided?

A

eval() is considered harmful and usually signals a design problem.

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

Client Side

What does canonicalizing data to the consumer involve?

A

Encoding data before use to preserve logical meaning and prevent injection issues.

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

Client Side

Why is proper encoding important when building outputs like HTML, CSS, or JSON?

A

To ensure data is secure and retains its intended logical meaning.

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

Client Side

Why should client-side logic not be relied upon for security?

A

The user controls client-side logic and can manipulate it using browser plugins or other tools.

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

Client Side

What must be done with business logic to prevent bypasses?

A

Duplicate all critical business rules/logic on the server side.

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

Client Side

Why should writing serialization code be avoided?

A

Even a small mistake can lead to major security issues, and there are existing frameworks for this purpose.

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

Client Side

How should XML or JSON be built to prevent injection bugs?

A

Avoid building them dynamically or use encoding libraries or safe JSON/XML libraries to ensure safety.

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

Client Side

How can XSS and SQL injection be mitigated in data handling?

A

Encode and validate data properly, using safe libraries and frameworks.

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

Client Side

Why should secrets never be transmitted to the client?

A

Anything sent to the client can be accessed by the user.

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

Client Side

Where should encryption be performed?

A

On the server, using TLS/SSL for secure transmission.

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

Client Side

Why should security-impacting logic never be performed on the client side?

A

To avoid the risk of manipulation or bypasses, keeping security logic server-side ensures better protection.

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

Server Side

What should be used to prevent CSRF attacks?

A

Implement Cross-Site Request Forgery (CSRF) protection as detailed in the CSRF Prevention cheat sheet.

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

Server Side

How can JSON hijacking in older browsers be mitigated?

A

Review AngularJS’s JSON Vulnerability Protection mechanism and ensure JSON responses start with an object.

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

Server Side

Why should JSON strings begin with an object?

A

It prevents exploitation by ensuring responses are not wrapped in an array, e.g., {“result”:[…]} is safe, whereas [{“key”:”value”}] is not.

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

Server Side

Should server-side serialization code be written manually?

A

No, use an existing library that has been reviewed for security.

17
Q

Server Side

What should be done to input when services are called directly by users?

A

Validate inputs as though they are under user control, because they are.

18
Q

Server Side

Why avoid manually building XML or JSON?

A

Manual creation can lead to security issues like injection bugs; use a framework or a safe library instead.

19
Q

Server Side

What should be used to validate web services?

A

JSON and XML Schema, validated through a third-party library.