Cross-Site Scripting Attacks: What You Need to Know Now

Prabh Nair
15 Nov 202322:20

Summary

TLDRIn this 'Coffee with PR' session, the host delves into the world of application security, focusing on Cross-Site Scripting (XSS). The video explains the difference between client-side and server-side scripts, illustrating how XSS exploits client trust in servers. It differentiates between stored and reflected XSS attacks, providing examples and discussing their impacts. The host also covers prevention strategies, such as using HTTP-only and secure flags in cookies, and emphasizes the importance of secure coding practices and regular security assessments. The session ends with a teaser for the next video on Cross-Site Request Forgery (CSRF), inviting viewers to explore the nuanced differences between XSS and CSRF.

Takeaways

  • 😀 The session focuses on application security, specifically discussing cross-site scripting (XSS) and its differences from CSRF.
  • 🎥 The speaker introduces the series with a focus on subscriber feedback requesting more content on application security.
  • 👤 XSS is a client-side vulnerability where an attacker injects malicious scripts into web content that is executed on the user's browser.
  • 💻 The script explains the difference between client-side and server-side scripts, emphasizing that XSS is a client-side issue.
  • 🔍 The speaker uses a diagram to illustrate how an attacker might exploit a vulnerability in a forum by injecting a malicious script that gets executed when a user visits the site.
  • 📈 The video outlines the two types of XSS: stored and reflected, providing an example of each and explaining how they work.
  • 🛡 To mitigate XSS, the speaker recommends using HTTP-only and secure flags in cookies to enhance security.
  • 🔒 The HTTP-only flag prevents client-side scripts from accessing cookie data, while the secure flag ensures cookies are sent over HTTPS, protecting against man-in-the-middle attacks.
  • 🔎 The script discusses methods for identifying XSS vulnerabilities, including manual testing, code review, and the use of automated scanning tools.
  • 🛠 Prevention strategies include output encoding, implementing content security policies, and regular security assessments.
  • ❓ The script anticipates common interview questions related to XSS, such as explaining the concept, differentiating between stored and reflected XSS, and demonstrating reflective XSS with a simple script.

Q & A

  • What is the main focus of the 'Coffee with PR' session discussed in the script?

    -The main focus of the 'Coffee with PR' session is discussing cross-site scripting (XSS) as part of the application security series.

  • What is the difference between client-side and server-side scripts as explained in the script?

    -Client-side scripts are executed on the user's browser and are used to improve website performance and user experience, such as form validation, image sliders, and interactive maps. Server-side scripts run on the server, fulfilling user requests, authenticating users, and processing data, with only the results sent to the client browser.

  • How does cross-site scripting exploit the trust between the client and the server?

    -Cross-site scripting exploits the trust a client has in the server by injecting malicious scripts into web content. When the client's browser renders the web page, the malicious script is executed on the client side, potentially leading to data theft or other malicious activities.

  • What is the stored cross-site scripting attack as described in the script?

    -Stored cross-site scripting is an attack where malicious scripts are permanently stored on the server and served to users viewing the content. An example is when an attacker posts a comment containing a malicious script on a blog, and every user who views the comment section has the script executed on their browser.

  • How does reflected cross-site scripting differ from stored cross-site scripting?

    -Reflected cross-site scripting occurs when a malicious script is embedded in a URL and sent directly to the client via a phishing link. The script is not stored on the server but is executed immediately upon clicking the link, making it a non-persistent attack.

  • What are the two types of cross-site scripting attacks mentioned in the script?

    -The two types of cross-site scripting attacks mentioned are stored and reflected. Stored attacks involve scripts permanently stored on the server, while reflected attacks involve scripts embedded in URLs and executed immediately upon user interaction.

  • How can HTTP only and secure flags in cookies help prevent cross-site scripting attacks?

    -HTTP only flags restrict client-side script access to cookie data, preventing it from being stolen by malicious scripts. Secure flags ensure cookies are sent only over secure channels like HTTPS, reducing the risk of cookie theft in man-in-the-middle attacks.

  • What are some methods to identify if an application is vulnerable to cross-site scripting?

    -Methods to identify vulnerabilities include manual testing with malicious payloads, code reviews to find places where user input could be rendered as HTML, and using automated scanning tools to detect potential XSS vulnerabilities.

  • What are the prevention strategies discussed in the script for cross-site scripting?

    -Prevention strategies include output encoding to validate and properly handle user input, implementing content security policies, following secure coding practices, regular patching and updating of servers, conducting regular penetration testing, and using web application firewalls.

  • What are some common questions asked in application security jobs related to cross-site scripting?

    -Common questions include explaining what cross-site scripting is and how it works, differentiating between stored and reflected XSS, identifying vulnerable code, demonstrating reflected XSS with a script, and discussing the implementation of content security policies.

Outlines

00:00

🔐 Introduction to Cross-Site Scripting (XSS)

The speaker introduces the topic of Cross-Site Scripting (XSS) as part of an application security series. They mention receiving feedback from subscribers requesting more content on this topic. The session aims to differentiate XSS from Cross-Site Request Forgery (CSRF), with a detailed discussion on CSRF planned for the next video. The speaker encourages viewers to subscribe to the channel for updates on similar topics and to check their LinkedIn profile for more information.

05:00

💻 Understanding Scripts and Their Role in XSS

The paragraph explains the concept of scripts, which are activities run on both the server and client sides. Scripts are responsible for actions and automations within a system, such as graphical representations and popups on websites. The speaker distinguishes between client-side scripts, which execute on the user's browser, and server-side scripts, which run on the server. An example of client-side scripting is form validation, while server-side scripting involves user authentication, data retrieval, and processing. The paragraph sets the stage for understanding XSS as a client-side vulnerability.

10:01

🛡️ How Cross-Site Scripting Works

This section delves into how XSS works, with an emphasis on the attacker's ability to inject malicious scripts into web content served to users. The speaker uses a diagram to illustrate an example where a hacker exploits a server's vulnerability to input validation by injecting a script into a forum. When a user visits the forum and clicks on the injected script, it executes on their browser, potentially leading to data theft or system crashes. The paragraph explains the concept of stored XSS, where the malicious script is permanently stored on the server and served to users viewing the content.

15:02

👀 Identifying and Preventing XSS Attacks

The speaker discusses how to identify vulnerabilities to XSS by looking for places where user input is expected, such as text fields and URL parameters. They explain the difference between stored and reflected XSS attacks, using examples to illustrate each. The paragraph also covers prevention strategies, including the use of HTTP-only and secure flags in cookies, output encoding, and implementing content security policies. The speaker emphasizes the importance of regular security assessments, secure coding practices, and the use of web application firewalls to block malicious inputs.

20:02

📝 Conclusion and Future Discussion on CSRF

In the concluding paragraph, the speaker summarizes the key points about XSS and sets the stage for the next video, which will focus on Cross-Site Request Forgery (CSRF). They highlight the differences between XSS and CSRF, emphasizing that XSS involves executing malicious scripts in the user's browser, while CSRF tricks the user into performing unwanted actions on a web application. The speaker invites feedback and encourages viewers to watch the upcoming video for a deeper understanding of CSRF and its distinctions from XSS.

Mindmap

Keywords

💡Cross-site Scripting (XSS)

Cross-site Scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web applications. These scripts are then executed on the client-side, potentially leading to data theft, session hijacking, or defacement of the website. In the context of the video, XSS is the main theme, with the script explaining how it differs from CSRF and providing examples of how an attacker might exploit a vulnerable server to inject malicious scripts into a website's content.

💡Client-side Script

A client-side script is a piece of code that runs on the user's browser, as opposed to server-side scripts which run on the server. The video explains that client-side scripts are responsible for actions like form validation, image sliders, and interactive maps, enhancing user experience by executing on the user's device after the web page has loaded. An example from the script is the chat popup or discount popup seen when visiting a website, which is a result of client-side scripting.

💡Server-side Script

Server-side scripts are executed on the server and are responsible for fulfilling user requests, such as user authentication and data retrieval from databases. The video uses the example of entering a username and password, which gets sent to the server for validation, to illustrate server-side scripting. These scripts are crucial for creating interactive websites and interfaces with databases.

💡Input Validation

Input validation is the process of checking user inputs to ensure they are valid and safe to process. The video emphasizes the importance of input validation in preventing XSS attacks, as it involves verifying and sanitizing inputs to avoid malicious scripts from being executed. An example given is how a server might accept any input without verification, making it vulnerable to an attacker injecting a script.

💡HTTP-only Flag

The HTTP-only flag is a security measure used to prevent client-side scripts from accessing cookie data. As explained in the video, when a cookie is marked as HTTP-only, it can only be accessed by the server, not by client-side scripts, which helps mitigate the risk of XSS attacks. This is a key strategy for enhancing web application security by protecting sensitive data from being stolen.

💡Secure Flag

The secure flag in cookies ensures that cookies are sent over secure channels, such as HTTPS, and not over unencrypted HTTP. The video discusses how this flag reduces the risk of cookie theft by man-in-the-middle attacks, as it instructs the browser to only send the cookie if the request is made over a secure protocol. This is another essential measure for robust web application security.

💡Stored XSS

Stored XSS, as mentioned in the video, occurs when malicious scripts are permanently stored on the server and served to users viewing the stored information. An example given is an attacker posting a comment containing a malicious script on a blog, which then executes on the browsers of users viewing the comment section, illustrating how stored XSS can affect multiple users.

💡Reflected XSS

Reflected XSS, as explained in the video, is a type of attack where the malicious script is not stored on the server but is instead embedded in a URL and sent directly to the client. The video provides an example of a hacker sending a URL containing a script to a user; when the user clicks the link, the server processes the script on the client's browser without the user's knowledge, potentially leading to system compromise.

💡Content Security Policy (CSP)

Content Security Policy is a security measure discussed in the video that helps prevent XSS attacks by specifying which sources the browser should consider valid for executing scripts. By implementing CSP, websites can instruct browsers to only execute scripts from trusted sources, thus preventing the execution of malicious scripts injected by attackers.

💡Cross-Site Request Forgery (CSRF)

Although not the main focus of the video, CSRF is mentioned as a separate security vulnerability that should be distinguished from XSS. CSRF involves tricking a user into executing unwanted actions on a web application without their knowledge, typically by exploiting trust that the server has in the user. The video suggests that understanding the differences between XSS and CSRF is important for comprehensive web application security.

Highlights

Introduction to the session on application security focusing on cross-site scripting.

Differentiation between cross-site scripting and cross-site request forgery.

Explanation of scripts, their types, and their roles in client and server-side operations.

Definition and example of client-side scripting, including form validation and interactive elements.

Definition and example of server-side scripting, including user authentication and data processing.

How cross-site scripting works and the difference between stored and reflected XSS.

Stored XSS example involving a hacker injecting a script into a forum.

Reflected XSS example where a malicious script is sent via email and executed upon clicking a link.

Impact of XSS attacks, including data theft, website defacement, and server crashes.

Identification of XSS vulnerabilities through user input fields and URL parameters.

Use of HTTP-only and Secure flags in cookies to prevent XSS attacks.

Explanation of HTTP-only flag to restrict client-side script access to cookies.

Explanation of Secure flag to ensure cookies are sent over secure channels.

Vulnerability detection methods including manual testing and code review.

Prevention strategies for XSS including output encoding and content security policy.

Importance of regular patching, updating, and security assessments for web applications.

Common interview questions related to XSS and how to approach them.

Comparison between Cross-Site Scripting and Cross-Site Request Forgery.

Invitation for feedback and suggestions for future video topics on application security.

Transcripts

play00:00

hello team welcome to my session on

play00:01

coffee with PR and today we're going to

play00:04

discuss about cross-side scripting it is

play00:06

part of my application security Series

play00:08

so there was a lot of feedback I was

play00:10

receiving from the subscriber and please

play00:12

do some videos on that area so I thought

play00:14

let me start this initiative so in this

play00:16

video we're going to discuss about

play00:17

Crosset scripting and how it is

play00:19

different from Crosset request FY in my

play00:21

next video I'm going to discuss about in

play00:23

detail about the cross request fery my

play00:26

name is bra ner for more information do

play00:28

check my Lin profile and if you're new

play00:30

to the channel do subscribe to my

play00:32

YouTube channel and click on the Bell

play00:33

icon to make sure you should not miss my

play00:35

future videos on a similar topic so

play00:37

without wasting a time let's start with

play00:39

the first part thank

play00:42

[Music]

play00:56

you okay before we going to discuss

play00:59

about what is cross-site scripting let's

play01:02

first understand the concept of scripts

play01:04

see when you're talking about script is

play01:06

basically um is the activity which is

play01:09

run on the server and on the client side

play01:12

you know if you want to perform any

play01:14

action or if you want to perform any

play01:16

activity in the system okay any kind of

play01:19

automations and all that it is basically

play01:21

done with the help of script okay so

play01:25

example like you know when you visit any

play01:26

website some graphical representation

play01:28

that show on the browser site right

play01:29

right capture you know popup so this is

play01:32

basically done through the help of

play01:33

script only script is the one which

play01:35

basically pop up Suddenly visit one

play01:38

website you can see the chat popup so

play01:40

that is basically because of the script

play01:41

now when we talking about script script

play01:44

is actually two type one is basically

play01:47

called as a client side script and one

play01:49

is basically called as a server side

play01:51

script first of all you need to remember

play01:52

cross-site scripting is a client side

play01:55

vulnerability so client side script is a

play01:57

script which is running on the client

play01:59

side and server side script is running

play02:00

on the server s side so here you can see

play02:01

the client side script refer to a script

play02:03

that are executed on the user browser

play02:05

rather than the server how suppose this

play02:08

is the user we have okay and there is a

play02:13

system okay he visit one website which

play02:16

is called suppose infos

play02:20

train.com infos tr.com page is basically

play02:23

loaded in his

play02:27

browser okay infos in page loaded in his

play02:30

browser now he can see some popup of

play02:33

chat he can see the discount popup he

play02:36

can see the graphical representation so

play02:38

this is basically running on the browser

play02:40

because of the client side script it

play02:41

means script which is running on the

play02:43

client side browser so example like form

play02:46

validation so example like when we

play02:47

browse the page we get a registration

play02:49

page portal where you need to enter

play02:51

details if you feel some values in valid

play02:54

and all that immediately there itself it

play02:55

stop it's a invalid value right sometime

play02:58

registration page is there it ask for

play02:59

the invalid valid value so because there

play03:00

is a client side script which is running

play03:02

on the client site okay so we have a

play03:04

image slider you know image is basically

play03:06

change we have an interactive map we

play03:08

have animation so the execution is the

play03:10

script is execute on the user device

play03:12

after the web page has been loaded and

play03:14

it was there because it is used to

play03:16

improve the performance of the uh

play03:18

website and it is basically used to give

play03:20

a good environment to the user so this

play03:22

is called as a client side script on the

play03:24

other side the server s side script is a

play03:27

web server technology in which user

play03:28

request is full fill uh you know by the

play03:32

by the server how so example like this

play03:34

is the client we

play03:40

have and this is basically my

play03:44

server now please try to understand okay

play03:47

so user basically requests for a

play03:50

page the page is basically

play03:56

load

play03:58

okay on client

play04:02

device so the page was load now here we

play04:05

have some scripts offer offer like this

play04:08

kind of a script was there offer click

play04:12

to claim so client what he did he click

play04:15

on this particular link it mean he

play04:17

requested server please open the script

play04:20

for me so there's a script which is

play04:21

running on the server side which review

play04:23

which receive the request and then they

play04:25

process the script on the server site

play04:27

and according to that it provide the

play04:28

result back to the user so the script

play04:30

which is running on the server side that

play04:32

is basically called as a server side

play04:34

scripting example when you enter usern

play04:36

and password that information goes to

play04:37

server server is the one which validate

play04:38

that password authenticate the password

play04:40

there's a script which is running on the

play04:42

server so sometime what happen we create

play04:44

a script in such a way to Target the

play04:46

server we create a script in such a way

play04:48

to Target the client but this is

play04:49

basically where the script running on

play04:51

the server side so it is often used to

play04:53

create interactive website and to the

play04:55

interface to database and execution is

play04:58

the script is executed on the the server

play05:00

and only result is sent to the client

play05:01

browser okay so user authentication

play05:05

retrieving displaying data from the

play05:06

database processing user data so these

play05:08

are the examples we have for the server

play05:10

site scripting

play05:13

okay okay so now you understood about

play05:16

cross side scripting sorry you

play05:18

understood about the client side and

play05:20

server side now now let's understand how

play05:23

cross-site scripting works so first we

play05:25

basically go by the description so if

play05:27

you see the description it say attacker

play05:29

inject the malitia script into the web

play05:31

content that is then served to user and

play05:33

when user browser render the web pay the

play05:35

malitia script is executed on the client

play05:37

side that is a user browser to

play05:39

understand this in detail let me explain

play05:41

you with the help of diagram okay so

play05:43

this is basically my

play05:46

client okay so we have a client

play05:51

here okay and uh let me change the

play05:57

color and this is basically my server

play06:07

now just imagine this this basically a

play06:09

server is just like a

play06:12

forum a very known Forum people use to

play06:15

post lot of content there lot of people

play06:17

visit the Forum and review the content

play06:19

and all that so now what happened we

play06:22

have a hacker

play06:25

here we have a

play06:28

hacker

play06:33

or

play06:34

researcher what he found that server is

play06:38

basically accepting server is basically

play06:41

accepting any input it mean the server

play06:44

is vulnerable for

play06:47

input

play06:51

validation now when we say input

play06:53

validation input validation mean without

play06:55

verifying it process the input example

play06:57

if I say it to my friend 1+ one I said

play06:59

so I told him 1+ 1 is three he said yes

play07:01

you right three but without verifying he

play07:03

just reply and say yes but when I say 1+

play07:06

1 3 no no no it's not 1 + 1 3 it is 1 +1

play07:10

2 understood so here he verified the

play07:12

input and he react so here we understood

play07:14

server accepting all the input without

play07:16

any verification okay so what hacker did

play07:18

hacker basically discovered like this

play07:21

website is basically have a great

play07:23

reputation in the market a lot of people

play07:24

visit this page so in this particular

play07:27

page he injected one

play07:31

script like this

play07:37

way

play07:40

dumps

play07:42

100% so now what happen

play07:44

server accept this particular input and

play07:47

now that server on server that script is

play07:50

pop up on that Forum now this is the

play07:53

client is preparing for some

play07:55

certification he visit this particular

play07:58

website

play08:00

and the server basically load the

play08:05

page

play08:07

page okay for the

play08:14

user so now what happened the page was

play08:17

loaded on the client side now when the

play08:20

page load he can see there is a popup

play08:22

Dump Dump

play08:24

Dump what he did he click on that link

play08:28

it mean he want want to see what is this

play08:30

dump all about that request is basically

play08:33

sent to the

play08:36

server

play08:41

request sent

play08:44

to server server without verifying it

play08:47

process the script and the script was

play08:51

executed on the client site and it lead

play08:54

to like server got client got hang the

play08:57

credential was stolen that script has

play08:59

has basically installed the thren so if

play09:01

you notice in this attack what happened

play09:02

hacker basically inject the script on

play09:04

the

play09:05

server script is now pop up on the page

play09:08

client visit the page he brows the page

play09:11

on his browser he click on the link the

play09:12

link request spent to the server server

play09:14

thought user want to open that server

play09:16

without verifying he process back on the

play09:18

client and based on that server trust

play09:21

client basically open the script and

play09:23

that basically crash the client system

play09:25

so here we exploit the trust okay of the

play09:28

server sorry export the trust of the

play09:30

client toward the server see Crosset

play09:32

scripting is basically occur okay

play09:35

because of two things one the data enter

play09:39

a web application through untrusted

play09:41

source and second is data is included in

play09:43

the dynamic content which is sent to the

play09:45

web user without being validated from

play09:48

the malicious content so this is the

play09:50

example what we have seen was the

play09:51

example of the stored crossed scripting

play09:54

so crossed scripting are exit on the

play09:55

client side the vulnerability enabled

play09:57

the attack can present in both servers

play09:59

and client but I'm talking about the

play10:01

vulnerability in the server without

play10:02

verifying input but by the end of the

play10:03

day it is a client side attack because

play10:04

we want to crash the client by

play10:07

exploiting a trust toward the server so

play10:09

attacker inject a script into the

play10:11

comment section of a Blog which

play10:12

basically steal cookies from any user

play10:15

viewing the content okay so that is how

play10:17

it works now when we're talking about

play10:19

impact what is happen is impact is that

play10:22

script when it running on the client

play10:23

site it can identify the theft it can uh

play10:26

do the data theft it can defas the

play10:28

website also because the script which he

play10:31

request for open might be it is Target

play10:33

on the server it crashed the server also

play10:35

server thought client has requested

play10:36

client thought server has requested so

play10:38

that is how this attack is basically

play10:40

initiated so when we're talking about

play10:42

cross-site scripting we have a two type

play10:45

of crossed scripting one is basically

play10:47

called reflected and one is basically

play10:49

stored the example which I shown you

play10:52

right now was the example of the stored

play10:54

crossed scripting because in a stored

play10:56

crossed scripting the Malicia scripts

play10:58

permanently is stored on the server and

play11:00

serve to user view that the stored

play11:02

information so attacker post a comment

play11:05

containing a malicious script on the

play11:06

blog and every user who view the comment

play11:09

section of the blog will have a script

play11:11

execute on the browser the same example

play11:13

we have discussed right so we have a we

play11:15

have a client

play11:18

here okay we have a

play11:21

server client basically post the script

play11:23

on the server use sorry hacker basically

play11:26

post the script on the server now user

play11:30

is there he basically visit the page

play11:32

page is loaded on a client browser and

play11:34

that script crashed the system okay so

play11:37

this is basically what is happened in

play11:38

the case of um stored cross scripting

play11:42

but here in this attack we are waiting

play11:44

for the user to click on the link okay

play11:46

but if my target is very specific so in

play11:49

that case I will basically perform the

play11:52

uh reflective Crosset scripting okay so

play11:54

how it works so example like here is a

play11:57

hacker

play11:59

this is the

play12:03

hacker okay he know his Target is

play12:06

specific domain okay the domain is

play12:09

basically

play12:12

suppose kk.com and there is a user is

play12:16

basically name is user at

play12:19

theate

play12:21

kk.com okay so instead of sending a

play12:25

script directly or sending a posting a

play12:28

script on the server he sent the script

play12:31

by the URL on his email so this is

play12:33

basically where we sent the URL here we

play12:35

have he sent a script on an email like

play12:37

this way

play12:40

HTTP okay gmail.com so he basically used

play12:44

one legitimate domain slash he add the

play12:51

script he add the script just give me a

play12:55

second he add the script like uh script

play13:01

scpt hi and

play13:04

script so this is the script he

play13:07

basically inserted with this URL and

play13:10

sent a fishing email to this user which

play13:14

is called kk.com so when user receive a

play13:16

email he click on the link when he click

play13:18

on the link it redirect to

play13:21

Gmail Gmail received the complete URL

play13:24

gmail.com with script so Gmail thought

play13:27

user has requested for the script

play13:29

without verifying he process script back

play13:31

on the client system and by this way the

play13:33

client system basically got crashed so

play13:35

here we are not posting any script on

play13:37

the server okay we using a script

play13:40

embedded in the website web page web URL

play13:43

sorry and we sent the script directly to

play13:45

the client okay by a fishing link user

play13:48

click on the link it basically request

play13:51

server to open the

play13:52

script if server is vulnerable for the

play13:54

input validation it revert back the

play13:56

script on the client system so this is

play13:59

how the cross-site scripting reflective

play14:01

cross scripting work that's why it's

play14:03

called reflective it is a URL Bas it's

play14:05

also called as a non-persistent stored

play14:07

attack is called as a persistent and

play14:09

reflected is called as a non-persistent

play14:12

that's why we say malitia script

play14:13

embedded in the URL executed immediately

play14:15

upon clicking the link and the script is

play14:18

not stored on the server so attacker

play14:19

send a link containing a malitia script

play14:21

and a URL parameter when user click the

play14:24

link the server include the script in

play14:25

the response execute in the user browser

play14:28

so let me discuss how to identify

play14:31

whether you are vulnerable or not see

play14:33

when we talking about Crosset scripting

play14:36

we look for many places where the user

play14:37

input is expected like example where the

play14:40

entering the text fields we basically

play14:42

enter the search bar in the search bar

play14:44

we also enter the scripts forms we have

play14:48

user registration forms we have there we

play14:49

enter then we have a URL parameters in

play14:52

HTTP header we add there so this is how

play14:54

the we enter the script script alert

play14:56

script so this is the message which is

play14:58

display okay

play15:00

so sometime what happen we also need to

play15:01

check how the application is basically

play15:03

handle and render the user input if I

play15:05

enter some suppose how to test so there

play15:07

is a user form we have okay in which we

play15:10

have a username and password in which I

play15:12

will try to enter this particular script

play15:15

if I enter the script and click on

play15:16

submit and I'm getting a pop called xss

play15:18

it means the server is vulnerable for

play15:19

Crosset scripting if it's say invalid

play15:22

value it mean it is protect from Cross

play15:23

scripting so this is how you can able to

play15:25

check how the application handle the

play15:27

input sometime we have to review the

play15:28

code and search for the place where the

play15:30

input from HTTP request could possibly

play15:32

make in a way of HTML output so these

play15:35

are basically the parameters we have

play15:37

that we consider so the question is now

play15:39

how to basically secure so to secure the

play15:42

things we basically use HTTP only and

play15:45

secure flag in a cookie preventing

play15:47

settings okay so this is something we

play15:49

are using Okay so let's discuss this in

play15:53

detail so first we're going to discuss

play15:55

about uh HTTP only flag

play15:59

see if you see the statement HTTP only

play16:01

flag is used to enhance security by

play16:04

restricting

play16:05

access to cookies data from a client

play16:08

side

play16:09

script so question is how it work see

play16:12

when any

play16:13

cookie is basically set with the HTTP

play16:17

only or HTTP only flag okay it is

play16:21

basically tell the browser that

play16:23

particular cookie should only be

play16:25

accessed by the

play16:26

server it mean this is basically a

play16:28

client we have and he basically access

play16:31

this particular site okay so this is the

play16:34

site we have so this cookie is basically

play16:36

access for this site only this cookie

play16:37

cannot be misplaced or misused by any

play16:39

other user because cookie is the way by

play16:41

which we can able to track the session

play16:43

because it's a HTTP is a stateless

play16:45

protocol so any attempt to access the

play16:47

cookie from a client side script which

play16:49

is called Java is basically block and

play16:51

this is particularly important in the

play16:53

content of cross side scripting attack

play16:55

so if any attacker manage to inject a

play16:58

delicious script into the web page they

play17:01

won't able to access the cookie marked

play17:03

with the HTTP only which basically

play17:05

prevent the script from stealing the

play17:07

cookie data because when the script is

play17:09

basically running on the client side the

play17:11

script is trying to Fest the cookie so

play17:13

here it basically prevent that so that

play17:15

is why it is one of the most effective

play17:17

Technique we are using in the Crosset

play17:18

scripting second is basically we using a

play17:21

secure the flag so secure flag is used

play17:23

to ensure cookies are sent over the

play17:25

secure channel so how it works is

play17:28

normally what happen um you know when

play17:30

when cookie set with secure flag overall

play17:33

okay when cookies is basically set with

play17:35

the secure flag it instruct the browser

play17:37

to only send the cookie if the request

play17:39

has been made over the secure protocol

play17:41

such as https and this mean the cookie

play17:44

will not sent over the unencrypted HTTP

play17:46

which reduce the risk of cookie theft by

play17:48

man in the middle attack so summar is

play17:50

that HTTP only flag is primarily about

play17:54

protecting the um cookie data from from

play17:58

being accessed by unauthorized client

play18:00

side script and thereby mitigating the

play18:03

impact of Crosset scripting attack and

play18:05

the secure flag Ure that cookies are

play18:07

only transmit over the secure encrypted

play18:09

connection protecting against the man in

play18:11

the middle attack and both are the

play18:13

essential for the robust web application

play18:16

security

play18:18

posture so the question is basically how

play18:21

to review so when we talking about the

play18:23

vulnerability detections okay so we

play18:25

identify the user input source as a set

play18:28

when user input the source and all that

play18:30

input the value so that need to be

play18:31

verified we also do the manual testing

play18:34

on accss payload where we have a

play18:35

security review the code and search for

play18:37

all the PRS where input from HTTP

play18:39

request could make it possible for HTML

play18:42

output and we also use some kind of

play18:45

automation scanning tool by which we can

play18:46

able to identify the vulnerability in

play18:48

the Crosset

play18:50

scripting so prevention strategies

play18:52

output encoding it mean whenever any

play18:54

user feed

play18:55

value it need to be verify it need to be

play18:58

properly validate and we also implement

play19:00

the content security policy which

play19:01

inspect the content along with that we

play19:04

also have a best practice like regularly

play19:07

patch and update your servers secure

play19:09

retaining for developers so they know

play19:10

what is cross scripting so according to

play19:12

that they write a code regular pen

play19:14

testing on the application to test the

play19:15

code and we also look for the monitoring

play19:18

and auditing of the application along

play19:20

with that we also have additional layer

play19:22

like uh we can have a secure coding

play19:24

practice use a web application firewall

play19:26

so V we basically installed before

play19:28

firewall like mode security and all that

play19:30

and through that we try to block such

play19:32

inputs and do the regular security

play19:34

assessment now sometime what happen when

play19:36

you're going for the application

play19:37

security jobs they also ask some

play19:40

questions so there are some questions

play19:41

which is basically asked based on a

play19:43

crossed scripting so example like there

play19:45

will be question on what is crosses

play19:46

scripting how does it works so you need

play19:48

to explain

play19:50

practicality and if you're able to

play19:51

explain them well with this video also

play19:53

it will be great second is can you

play19:55

explain the difference between stored

play19:56

cross scripting and reflected we already

play19:58

disc discussed how can access attack be

play20:00

preventative okay so this is a very

play20:02

frequent question asked in the jobs then

play20:04

there's a question on we'll give you the

play20:06

piece of code identify if it's

play20:07

vulnerable to accesses here they want to

play20:09

test your skills whether you know

play20:11

application security can you write a

play20:13

simple script demonstrate reflected

play20:14

across the scripting here they want to

play20:16

test whether you are depend on tool or

play20:17

do you have a special skill to send the

play20:19

malicious URL and how do you implement

play20:21

the content security policy here they

play20:23

want to learn about whether you have a

play20:25

development knowledge okay so that is

play20:27

what we have

play20:29

see uh we also have a comparison between

play20:31

the Crosset scripting and Crosset

play20:32

request fery uh I'm not going to discuss

play20:35

Crosset fery in this video I have a next

play20:36

video in which I'm going to explain the

play20:38

Crosset request fery my suggestion is

play20:40

that do watch that video also because by

play20:42

then you can able to understand the Thin

play20:44

Line difference between the cross

play20:45

scripting and cross request fery so

play20:47

cross scripting allow the attacker to

play20:49

inject malitia script into the web page

play20:51

which is view by the user and cross

play20:53

scripting cross request fery it's a

play20:56

vulnerability to take the user into

play20:57

executing wanted action on the web

play20:59

application so you can see like that in

play21:01

Crosser scripting we exploit the trust

play21:03

user has on the server because server is

play21:06

basically process the script and return

play21:08

back on the user machine but in the

play21:10

cross a request fery we exploit the

play21:12

trust server has on the user because

play21:14

whatever the user clicks Ser will trust

play21:15

that primary goal in the Crosset

play21:18

scripting is to execute malicious script

play21:20

in the user browser and in the Crosset

play21:22

fraudery perform the unauthorized access

play21:25

attack Vector in the Crosset scripting

play21:27

is malicious script are injected into

play21:28

the web content but in the cross request

play21:31

fery maltia requests are sent to the web

play21:33

application without user consent we'll

play21:35

discuss okay in my next video we're

play21:36

going to discuss user interaction does

play21:38

not require user interaction but here

play21:40

the user need to perform some action uh

play21:42

data validation access policy both are

play21:44

same dependency does not depend on the

play21:46

user being authenticated because he

play21:48

click unknowingly knowingly but in this

play21:50

in the cross request fery he has to rely

play21:52

on the link execute the content of user

play21:55

browser and domain where we execute

play21:56

request to Target site with the user

play21:58

credentials as I said we'll discuss this

play22:00

particular Topic in detail and then I'm

play22:03

going to discuss the same table in my

play22:04

Crosser request fery video okay then you

play22:07

get a better visibility so do let me

play22:09

know how do you find this video shall I

play22:10

made more videos on the application

play22:12

security and uh do share your feedback

play22:14

in the comment section and which help me

play22:16

to improve my content better thank you

play22:18

so much good day bye

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Web SecurityCross-Site ScriptingApplication SecurityInjection AttacksClient-Side VulnerabilityServer-Side ScriptingInput ValidationCookie SecuritySecure CodingCyber Threats
Benötigen Sie eine Zusammenfassung auf Englisch?