SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Presented By:
VISHAL KUMAR
(CEH | CHFI | CISE | MCP)
Deep understanding on Cross-Site Scripting
and SQL Injection
CROSS SITE SCRIPTING
Outline
Introduction to XSS
Conditions for Cross site scripting
Cross site scripting – Risk and Damage
Types of XSS
Defending against Cross site scripting
Practice
CROSS SITE SCRIPTING
 Cross-site scripting (XSS) is a code injection attack that allows an attac
ker to execute malicious JavaScript in another user's browser.
 The attacker does not directly target his victim. Instead, he exploits a v
ulnerability in a website that the victim visits, in order to get the websit
e to deliver the malicious JavaScript for him. To the victim's browser, t
he malicious JavaScript appears to be a legitimate part of the website, a
nd the website has thus acted as an unintentional accomplice to the atta
cker.
1. Introduction to XSS
SattirxSecurity Preferred
CROSS SITE SCRIPTING
Scripting: Web Browsers can execute commands
 Embedded in HTML page
 Supports different languages (JavaScript, VBScript, ActiveX, etc.)
 Most prominent: JavaScript
“Cross-Site” means: Foreign script sent via a server to a client
 Attacker makes Web-Server deliver malicious script code
 Malicious script is executed in Client’s Web Browser
Attack:
 Steal Access Credentials, Denial-of-Service, Modify Web pages
 Execute any command at the client machine
1. Introduction to XSS
SattirxSecurity Preferred
CROSS SITE SCRIPTING
2. CONDITIONS FOR CROSS-SITE SCRIPTING
 A Web application accepts user input:
 Many web application accept the inputs from the user like search string,
 The input is used to create dynamic content
 The input is insufficiently validated
SattirxSecurity Preferred
Cross-Site Scripting
3. Risk Involve in Cross-Site Scripting
Denial-of-Service
 Crash Users 'Browser, Pop-Up-Floodding, Redirection
Access to authentication credentials for Web application
 Cookies, Username and Password
 Normal users (Personal data, Business data, Misuse of account)
 High privileged users (Control over Web application, web server and database)
Access to User`s machine
 Use ActiveX objects to control machine
 Upload local data to attacker`s machine
Spoil public image of company
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4. Types of Cross Site Scripting - XSS
While the goal of an XSS attack is always to execute malicious JavaScript in the victim's
browser, there are few fundamentally different ways of achieving that goal. XSS attacks
are often divided into three types:
1. Persistent or Stored XSS, where the malicious string originates from the website's d
atabase.
2. Reflected XSS, where the malicious string originates from the victim's request.
3. DOM-based XSS, where the vulnerability is in the client-side code rather than the se
rver-side code.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.1 Persistent or Stored XSS
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.1 Persistent or Stored XSS
1. The attacker uses one of the website's forms to insert a malicious string into the web
site's database.
2. The victim requests a page from the website.
3. The website includes the malicious string from the database in the response and sends
it to the victim.
4. The victim's browser executes the malicious script inside the response, sending the vi
ctim's cookies to the attacker's server.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.2 Reflected XSS
In a reflected XSS attack, the malicious string is part of the victim's request to the website. T
he website then includes this malicious string in the response sent back to the user. The diagra
m below illustrates this scenario:
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.2 Reflected XSS
1. The attacker crafts a URL containing a malicious string and sends it to the victim.
2. The victim is tricked by the attacker into requesting the URL from the website.
3. The website includes the malicious string from the URL in the response.
4. The victim's browser executes the malicious script inside the response, sending the victim's
cookies to the attacker's server.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.3. DOM-based XSS
DOM-based XSS is a variant of both persistent and reflected XSS. In a DOM-based XSS attack, the
malicious string is not actually parsed by the victim's browser until the website's legitimate JavaScript i
s executed. The diagram below illustrates this scenario for a reflected XSS attack:
SattirxSecurity Preferred
CROSS SITE SCRIPTING
4.3. DOM-based XSS
1. The attacker crafts a URL containing a malicious string and sends it to the victim.
2. The victim is tricked by the attacker into requesting the URL from the website.
3. The website receives the request, but does not include the malicious string in the response.
4. The victim's browser executes the legitimate script inside the response, causing the malicio
us script to be inserted into the page.
5. The victim's browser executes the malicious script inserted into the page, sending the victi
m's cookies to the attacker's server.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
5. Defending against Cross site scripting
Recall that an XSS attack is a type of code injection: user input is mistakenly interpreted as mali
cious program code. In order to prevent this type of code injection, secure input handling is need
ed. For a web developer, there are two fundamentally different ways of performing secure input
handling:
1. Encoding, which escapes the user input so that the browser interprets it only as data, not as
code.
1. Validation, which filters the user input so that the browser interprets it as code without mal
icious commands.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
5. Defending against Cross site scripting
While these are fundamentally different methods of preventing XSS, they share several commo
n features that are important to understand when using either of them:
 Context: Secure input handling needs to be performed differently depending on where in a p
age the user input is inserted.
 Inbound/outbound: Secure input handling can be performed either when your website receiv
es the input (inbound) or right before your website inserts the input into a page (outbound).
 Client/server: Secure input handling can be performed either on the client-side or on the se
rver-side, both of which are needed under different circumstances.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
5.1. Encoding
Encoding is the act of escaping user input so that the browser interprets it only as data, not as
code. The most recognizable type of encoding in web development is HTML escaping, which conv
erts characters like < and > into &lt; and &gt;, respectively.
The following pseudocode is an example of how user input could be encoded using HTML escapin
g and then inserted into a page by a server-side script:
If the user input were the string <script>...</script>, the resulting HTML would be as follows:
SattirxSecurity Preferred
CROSS SITE SCRIPTING
5.1. Encoding
Because all characters with special meaning have been escaped, the browser will not parse any p
art of the user input as HTML.
SattirxSecurity Preferred
CROSS SITE SCRIPTING
5.2. Validation
Validation is the act of filtering user input so that all malicious parts of it are removed, without
necessarily removing all code in it. One of the most recognizable types of validation in web devel
opment is allowing some HTML elements (such as <em> and <strong>) but disallowing others (such
as <script>).
There are two main characteristics of validation that differ between implementations:
 Classification strategyUser: input can be classified using either blacklisting or whitelisting.
 Validation outcomeUser: input identified as malicious can either be rejected or sanitized.
SQL Injection
Outline
Introduction to SQL Injection
How SQL Injection Work
What’s the worst an attacker can do with SQLi?
Types of SQL Injection
Prevention against SQL Injection
Practice
SQL Injection
1. Introduction to SQL Injection
SQL Injection (SQLi) refers to an injection attack wherein an attacker can ex
ecute malicious SQL statements (also commonly referred to as a malicious payl
oad) that control a web application’s database server (also commonly referred
to as a Relational Database Management System – RDBMS). Since an SQL Inje
ction vulnerability could possibly affect any website or web application that ma
kes use of an SQL-based database, the vulnerability is one of the oldest, most
prevalent and most dangerous of web application vulnerabilities.
By leveraging an SQL Injection vulnerability, given the right circumstances, an
attacker can use it to bypass a web application’s authentication and
SattirxSecurity Preferred
SQL Injection
1. Introduction to SQL Injection
authorization mechanisms and retrieve the contents of an entire database. SQL Injection can al
so be used to add, modify and delete records in a database, affecting data integrity.
To such an extent, SQL Injection can provide an attacker with unauthorized access to sensitive
data including, customer data, personally identifiable information (PII), trade secrets, intellectu
al property and other sensitive information.
SattirxSecurity Preferred
SQL Injection
2. How SQL Injection works
In order to run malicious SQL queries against a database server, an attacker must first find an i
nput within the web application that is included inside of an SQL query.
In order for an SQL Injection attack to take place, the vulnerable website needs to directly inc
lude user input within an SQL statement. An attacker can then insert a payload that will be inclu
ded as part of the SQL query and run against the database server.
The following server-side pseudo-code is used to authenticate users to the web application.
SattirxSecurity Preferred
SQL Injection
2. How SQL Injection works
The above script is a simple example of authenticating a user with a username and a password ag
ainst a database with a table named users, and a username and password column.
SattirxSecurity Preferred
SQL Injection
2. How SQL Injection works
The above script is vulnerable to SQL Injection because an attacker could submit malicious inpu
t in such a way that would alter the SQL statement being executed by the database server.
A simple example of an SQL Injection payload could be something as simple as setting the passw
ord field to password’ OR 1=1.
This would result in the following SQL query being run against the database server.
SattirxSecurity Preferred
SQL Injection
2. How SQL Injection works
Once the query executes, the result is returned to the application to be processed, resulting in
an authentication bypass. In the event of authentication bypass being possible, the application w
ill most likely log the attacker in with the first account from the query result — the first accou
nt in a database is usually of an administrative user.
SQL Injection
3. What’s the worst an attacker can do with SQL?
SQL is a programming language designed for managing data stored in an RDBMS, therefore SQL can
be used to access, modify and delete data. Furthermore, in specific cases, an RDBMS could also run
commands on the operating system from an SQL statement.
Keeping the above in mind, when considering the following, it’s easier to understand how lucrative a s
uccessful SQL Injection attack can be for an attacker.
 An attacker can use SQL Injection to bypass authentication or even impersonate specific users.
 One of SQL’s primary functions is to select data based on a query and output the result of that
query. An SQL Injection vulnerability could allow the complete disclosure of data residing on a
database server.
SattirxSecurity Preferred
SQL Injection
3. What’s the worst an attacker can do with SQL?
 Since web applications use SQL to alter data within a database, an attacker could use SQL
Injection to alter data stored in a database. Altering data affects data integrity and could
cause repudiation issues, for instance, issues such as voiding transactions, altering balances
and other records.
 SQL is used to delete records from a database. An attacker could use an SQL Injection vuln
erability to delete data from a database. Even if an appropriate backup strategy is employed,
deletion of data could affect an application’s availability until the database is restored.
 Some database servers are configured (intentional or otherwise) to allow arbitrary executio
n of operating system commands on the database server. Given the right conditions, an attac
ker could use SQL Injection as the initial vector in an attack of an internal network that sits
behind a firewall.
SattirxSecurity Preferred
SQL Injection
4. Types of SQL Injection (SQLi)
SQL Injection can be used in a range of ways to cause serious problems. By levering SQL Inject
ion, an attacker could bypass authentication, access, modify and delete data within a database.
SQL Injection can be classified into three major categories –
1. In-band SQLi,
 Error-based SQLi
 Union-based SQLi.
2. Inferential SQLi and
 Blind-boolean-based SQLi
 Blind-time-based SQLi
3. Out-of-band SQLi
SattirxSecurity Preferred
SQL Injection
4.1. In-band SQL injection (Classic SQLi)
In-band SQL Injection is the most common and easy-to-exploit of SQL Injection attacks. In-ban
d SQL Injection occurs when an attacker is able to use the same communication channel to both l
aunch the attack and gather results.
The two most common types of in-band SQL Injection are Error-based SQLi and Union-based
SQLi.
 Error-based SQL injection
 Error-based SQLi is an in-band SQL Injection technique that relies on error messages thr
own by the database server to obtain information about the structure of the database. In
some cases, error-based SQL injection alone is enough for an attacker to enumerate an ent
ire database. While errors are very useful during the development phase of a web applicati
on, they should be disabled on a live site, or logged to a file with restricted access instead.
SattirxSecurity Preferred
SQL Injection
4.1. In-band SQL injection (Classic SQLi)
 Union-based SQL injection
 Union-based SQLi is an in-band SQL injection technique that leverages the
UNION SQL operator to combine the results of two or more SELECT statem
ents into a single result which is then returned as part of the HTTP response.
SattirxSecurity Preferred
SQL Injection
4.2. Inferential SQLi (Blind SQLi)
Inferential SQL Injection, unlike in-band SQLi, may take longer for an attacker to exploit, how
ever, it is just as dangerous as any other form of SQL Injection. In an inferential SQLi attack,
no data is actually transferred via the web application and the attacker would not be able to see
the result of an attack in-band (which is why such attacks are commonly referred to as “blin
d SQL Injection attacks”). Instead, an attacker is able to reconstruct the database structu
re by sending payloads, observing the web application’s response and the resulting behavior of
the database server.
The two types of inferential SQL Injection are Blind-boolean-based SQLi and Blind-time-bas
ed SQLi.
SattirxSecurity Preferred
SQL Injection
4.2. Inferential SQLi (Blind SQLi)
 Boolean-based (content-based) Blind SQLi
 Boolean-based SQL Injection is an inferential SQL Injection technique that relies
on sending an SQL query to the database which forces the application to return a di
fferent result depending on whether the query returns a TRUE or FALSE result.
 Depending on the result, the content within the HTTP response will change, or rema
in the same. This allows an attacker to infer if the payload used returned true or f
alse, even though no data from the database is returned. This attack is typically
slow (especially on large databases) since an attacker would need to enumerate a da
tabase, character by character.
SattirxSecurity Preferred
SQL Injection
4.2. Inferential SQLi (Blind SQLi)
 Time-based Blind SQLi
 Time-based SQL Injection is an inferential SQL Injection technique that relies on
sending an SQL query to the database which forces the database to wait for a spec
ified amount of time (in seconds) before responding. The response time will indicate
to the attacker whether the result of the query is TRUE or FALSE.
 Depending on the result, an HTTP response will be returned with a delay, or returne
d immediately. This allows an attacker to infer if the payload used returned true or
false, even though no data from the database is returned. This attack is typically sl
ow (especially on large databases) since an attacker would need to enumerate a data
base character by character.
SattirxSecurity Preferred
SQL Injection
4.3. Out-of-band SQL Injection
Out-of-band SQL Injection is not very common, mostly because it depends on features being en
abled on the database server being used by the web application. Out-of-band SQL Injection occ
urs when an attacker is unable to use the same channel to launch the attack and gather results.
Out-of-band techniques, offer an attacker an alternative to inferential time-based techniques,
especially if the server responses are not very stable (making an inferential time-based attack u
nreliable).
SattirxSecurity Preferred
SQL Injection
5. What Can Be Done to Prevent SQL Injection Attacks?
The most important precautions are data sanitization and validation, which should already be in
place. Sanitization usually involves running any submitted data through a function (such as MyS
QL's mysql_real_escape_string() function) to ensure that any dangerous characters (like " ' ") a
re not passed to a SQL query in data.
Validation: Validation is slightly different, in that it attempts to ensure that the data submitte
d is in the form that is expected, the length of a piece of data submitted is not longer than the
maximum expected length.
But sanitization and validation are far from the whole story. Here are ten ways you can help pre
vent or mitigate SQL injection attacks:
SattirxSecurity Preferred
SQL Injection
5. What Can Be Done to Prevent SQL Injection Attacks?
 Trust no-one: Assume all user-submitted data is evil and validate and sanitize everything.
 Don't use dynamic SQL when it can be avoided: used prepared statements, parameterize
d queries or stored procedures instead whenever possible.
 Update and patch: vulnerabilities in applications and databases that hackers can exploit usin
g SQL injection are regularly discovered, so it's vital to apply patches and updates as soon a
s practical.
 Firewall: Consider a web application firewall (WAF) – either software or appliance based – to
help filter out malicious data. A WAF can be particularly useful to provide some security pro
tection against a particular new vulnerability before a patch is available.
SattirxSecurity Preferred
SQL Injection
5. What Can Be Done to Prevent SQL Injection Attacks?
 Use appropriate privileges: don't connect to your database using an account with admin-leve
l privileges unless there is some compelling reason to do so. Using a limited access account is
far safer, and can limit what a hacker is able to do.
 Keep your secrets secret: Assume that your application is not secure and act accordingly b
y encrypting or hashing passwords and other confidential data including connection strings.
 Don't divulge more information than you need to: hackers can learn a great deal about dat
abase architecture from error messages, so ensure that they display minimal information. Us
e the "RemoteOnly" customErrors mode (or equivalent) to display verbose error messages on
the local machine while ensuring that an external hacker gets nothing more than the fact tha
t his actions resulted in an unhandled error.
SattirxSecurity Preferred
SQL Injection
Real-Time Example
1. Cross-Site-Scripting
2. SQL Injection
SattirxSecurity Preferred

Weitere ähnliche Inhalte

Was ist angesagt?

Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Ikhade Maro Igbape
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting GuideDaisuke_Dan
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug BountiesOWASP Nagpur
 
SQL Injection attack
SQL Injection attackSQL Injection attack
SQL Injection attackRayudu Babu
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
OWASP Top 10 Web Application Vulnerabilities
OWASP Top 10 Web Application VulnerabilitiesOWASP Top 10 Web Application Vulnerabilities
OWASP Top 10 Web Application VulnerabilitiesSoftware Guru
 
Directory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksDirectory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksRaghav Bisht
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injectionashish20012
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & TestingDeepu S Nath
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingAnurag Srivastava
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing TechniquesAvinash Thapa
 
Sql injection
Sql injectionSql injection
Sql injectionZidh
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing Priyanka Aash
 

Was ist angesagt? (20)

Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting Guide
 
XSS
XSSXSS
XSS
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injection
 
Owasp Top 10 A1: Injection
Owasp Top 10 A1: InjectionOwasp Top 10 A1: Injection
Owasp Top 10 A1: Injection
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
CSRF Basics
CSRF BasicsCSRF Basics
CSRF Basics
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
SQL Injection attack
SQL Injection attackSQL Injection attack
SQL Injection attack
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
OWASP Top 10 Web Application Vulnerabilities
OWASP Top 10 Web Application VulnerabilitiesOWASP Top 10 Web Application Vulnerabilities
OWASP Top 10 Web Application Vulnerabilities
 
Directory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksDirectory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion Attacks
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injection
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & Testing
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration Testing
 
Security testing
Security testingSecurity testing
Security testing
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Sql injection
Sql injectionSql injection
Sql injection
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing
 

Ähnlich wie Deep understanding on Cross-Site Scripting and SQL Injection

IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...IRJET Journal
 
XSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareXSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareOmer Meshar
 
Cm7 secure code_training_1day_xss
Cm7 secure code_training_1day_xssCm7 secure code_training_1day_xss
Cm7 secure code_training_1day_xssdcervigni
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Irfad Imtiaz
 
Pantallas escaneo Sitio Web
Pantallas escaneo Sitio WebPantallas escaneo Sitio Web
Pantallas escaneo Sitio Webandres1422
 
Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2SURBHI SAROHA
 
Study of Cross-Site Scripting Attacks and Their Countermeasures
Study of Cross-Site Scripting Attacks and Their CountermeasuresStudy of Cross-Site Scripting Attacks and Their Countermeasures
Study of Cross-Site Scripting Attacks and Their CountermeasuresEditor IJCATR
 
xss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdfxss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdfyashvirsingh48
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docxsmile790243
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior
 
Owasp top 10 vulnerabilities 2013
Owasp top 10 vulnerabilities   2013Owasp top 10 vulnerabilities   2013
Owasp top 10 vulnerabilities 2013Vishrut Sharma
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilitiesAngelinaJasper
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptxhamidTalib2
 

Ähnlich wie Deep understanding on Cross-Site Scripting and SQL Injection (20)

IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
 
XSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareXSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malware
 
SeanRobertsThesis
SeanRobertsThesisSeanRobertsThesis
SeanRobertsThesis
 
Cm7 secure code_training_1day_xss
Cm7 secure code_training_1day_xssCm7 secure code_training_1day_xss
Cm7 secure code_training_1day_xss
 
Session7-XSS & CSRF
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRF
 
Cross site scripting
Cross site scripting Cross site scripting
Cross site scripting
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )
 
Pantallas escaneo Sitio Web
Pantallas escaneo Sitio WebPantallas escaneo Sitio Web
Pantallas escaneo Sitio Web
 
Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2
 
Study of Cross-Site Scripting Attacks and Their Countermeasures
Study of Cross-Site Scripting Attacks and Their CountermeasuresStudy of Cross-Site Scripting Attacks and Their Countermeasures
Study of Cross-Site Scripting Attacks and Their Countermeasures
 
Cross site scripting XSS
Cross site scripting XSSCross site scripting XSS
Cross site scripting XSS
 
xss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdfxss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdf
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docx
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scripting
 
Owasp top 10 vulnerabilities 2013
Owasp top 10 vulnerabilities   2013Owasp top 10 vulnerabilities   2013
Owasp top 10 vulnerabilities 2013
 
T04505103106
T04505103106T04505103106
T04505103106
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilities
 
XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptx
 
Xss 101
Xss 101Xss 101
Xss 101
 

Mehr von Vishal Kumar

Threat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceThreat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceVishal Kumar
 
The Complete Questionnaires About Firewall
The Complete Questionnaires About FirewallThe Complete Questionnaires About Firewall
The Complete Questionnaires About FirewallVishal Kumar
 
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)E-mail Security Protocol - 2 Pretty Good Privacy (PGP)
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)Vishal Kumar
 
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) Protocol
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) ProtocolE-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) Protocol
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) ProtocolVishal Kumar
 
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitPrivileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitVishal Kumar
 
Exploiting Client-Side Vulnerabilities and Establishing a VNC Session
Exploiting Client-Side Vulnerabilities and Establishing a VNC SessionExploiting Client-Side Vulnerabilities and Establishing a VNC Session
Exploiting Client-Side Vulnerabilities and Establishing a VNC SessionVishal Kumar
 
Auditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrackAuditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrackVishal Kumar
 
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsDumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsVishal Kumar
 
Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Vishal Kumar
 
The Fundamental of Electronic Mail (E-mail)
The Fundamental of Electronic Mail (E-mail)The Fundamental of Electronic Mail (E-mail)
The Fundamental of Electronic Mail (E-mail)Vishal Kumar
 
Fundamental of Secure Socket Layer (SSl) | Part - 1
Fundamental of Secure Socket Layer (SSl) | Part - 1Fundamental of Secure Socket Layer (SSl) | Part - 1
Fundamental of Secure Socket Layer (SSl) | Part - 1Vishal Kumar
 
The Fundamental of Secure Socket Layer (SSL)
The Fundamental of Secure Socket Layer (SSL)The Fundamental of Secure Socket Layer (SSL)
The Fundamental of Secure Socket Layer (SSL)Vishal Kumar
 
Hawkeye the Credential Theft Maalware
Hawkeye   the Credential Theft MaalwareHawkeye   the Credential Theft Maalware
Hawkeye the Credential Theft MaalwareVishal Kumar
 
Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threatsVishal Kumar
 
Exploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationExploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationVishal Kumar
 
Mirroring web site using ht track
Mirroring web site using ht trackMirroring web site using ht track
Mirroring web site using ht trackVishal Kumar
 
Collecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterCollecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterVishal Kumar
 
Information gathering using windows command line utility
Information gathering using windows command line utilityInformation gathering using windows command line utility
Information gathering using windows command line utilityVishal Kumar
 
Introduction ethical hacking
Introduction ethical hackingIntroduction ethical hacking
Introduction ethical hackingVishal Kumar
 
Social engineering
Social engineeringSocial engineering
Social engineeringVishal Kumar
 

Mehr von Vishal Kumar (20)

Threat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceThreat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement Matrice
 
The Complete Questionnaires About Firewall
The Complete Questionnaires About FirewallThe Complete Questionnaires About Firewall
The Complete Questionnaires About Firewall
 
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)E-mail Security Protocol - 2 Pretty Good Privacy (PGP)
E-mail Security Protocol - 2 Pretty Good Privacy (PGP)
 
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) Protocol
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) ProtocolE-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) Protocol
E-Mail Security Protocol - 1 Privacy Enhanced Mail (PEM) Protocol
 
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitPrivileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
 
Exploiting Client-Side Vulnerabilities and Establishing a VNC Session
Exploiting Client-Side Vulnerabilities and Establishing a VNC SessionExploiting Client-Side Vulnerabilities and Establishing a VNC Session
Exploiting Client-Side Vulnerabilities and Establishing a VNC Session
 
Auditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrackAuditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrack
 
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsDumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
 
Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2
 
The Fundamental of Electronic Mail (E-mail)
The Fundamental of Electronic Mail (E-mail)The Fundamental of Electronic Mail (E-mail)
The Fundamental of Electronic Mail (E-mail)
 
Fundamental of Secure Socket Layer (SSl) | Part - 1
Fundamental of Secure Socket Layer (SSl) | Part - 1Fundamental of Secure Socket Layer (SSl) | Part - 1
Fundamental of Secure Socket Layer (SSl) | Part - 1
 
The Fundamental of Secure Socket Layer (SSL)
The Fundamental of Secure Socket Layer (SSL)The Fundamental of Secure Socket Layer (SSL)
The Fundamental of Secure Socket Layer (SSL)
 
Hawkeye the Credential Theft Maalware
Hawkeye   the Credential Theft MaalwareHawkeye   the Credential Theft Maalware
Hawkeye the Credential Theft Maalware
 
Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threats
 
Exploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationExploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web application
 
Mirroring web site using ht track
Mirroring web site using ht trackMirroring web site using ht track
Mirroring web site using ht track
 
Collecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterCollecting email from the target domain using the harvester
Collecting email from the target domain using the harvester
 
Information gathering using windows command line utility
Information gathering using windows command line utilityInformation gathering using windows command line utility
Information gathering using windows command line utility
 
Introduction ethical hacking
Introduction ethical hackingIntroduction ethical hacking
Introduction ethical hacking
 
Social engineering
Social engineeringSocial engineering
Social engineering
 

Kürzlich hochgeladen

『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 

Kürzlich hochgeladen (20)

『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 

Deep understanding on Cross-Site Scripting and SQL Injection

  • 1. Presented By: VISHAL KUMAR (CEH | CHFI | CISE | MCP) Deep understanding on Cross-Site Scripting and SQL Injection
  • 2. CROSS SITE SCRIPTING Outline Introduction to XSS Conditions for Cross site scripting Cross site scripting – Risk and Damage Types of XSS Defending against Cross site scripting Practice
  • 3. CROSS SITE SCRIPTING  Cross-site scripting (XSS) is a code injection attack that allows an attac ker to execute malicious JavaScript in another user's browser.  The attacker does not directly target his victim. Instead, he exploits a v ulnerability in a website that the victim visits, in order to get the websit e to deliver the malicious JavaScript for him. To the victim's browser, t he malicious JavaScript appears to be a legitimate part of the website, a nd the website has thus acted as an unintentional accomplice to the atta cker. 1. Introduction to XSS SattirxSecurity Preferred
  • 4. CROSS SITE SCRIPTING Scripting: Web Browsers can execute commands  Embedded in HTML page  Supports different languages (JavaScript, VBScript, ActiveX, etc.)  Most prominent: JavaScript “Cross-Site” means: Foreign script sent via a server to a client  Attacker makes Web-Server deliver malicious script code  Malicious script is executed in Client’s Web Browser Attack:  Steal Access Credentials, Denial-of-Service, Modify Web pages  Execute any command at the client machine 1. Introduction to XSS SattirxSecurity Preferred
  • 5. CROSS SITE SCRIPTING 2. CONDITIONS FOR CROSS-SITE SCRIPTING  A Web application accepts user input:  Many web application accept the inputs from the user like search string,  The input is used to create dynamic content  The input is insufficiently validated SattirxSecurity Preferred
  • 6. Cross-Site Scripting 3. Risk Involve in Cross-Site Scripting Denial-of-Service  Crash Users 'Browser, Pop-Up-Floodding, Redirection Access to authentication credentials for Web application  Cookies, Username and Password  Normal users (Personal data, Business data, Misuse of account)  High privileged users (Control over Web application, web server and database) Access to User`s machine  Use ActiveX objects to control machine  Upload local data to attacker`s machine Spoil public image of company SattirxSecurity Preferred
  • 7. CROSS SITE SCRIPTING 4. Types of Cross Site Scripting - XSS While the goal of an XSS attack is always to execute malicious JavaScript in the victim's browser, there are few fundamentally different ways of achieving that goal. XSS attacks are often divided into three types: 1. Persistent or Stored XSS, where the malicious string originates from the website's d atabase. 2. Reflected XSS, where the malicious string originates from the victim's request. 3. DOM-based XSS, where the vulnerability is in the client-side code rather than the se rver-side code. SattirxSecurity Preferred
  • 8. CROSS SITE SCRIPTING 4.1 Persistent or Stored XSS SattirxSecurity Preferred
  • 9. CROSS SITE SCRIPTING 4.1 Persistent or Stored XSS 1. The attacker uses one of the website's forms to insert a malicious string into the web site's database. 2. The victim requests a page from the website. 3. The website includes the malicious string from the database in the response and sends it to the victim. 4. The victim's browser executes the malicious script inside the response, sending the vi ctim's cookies to the attacker's server. SattirxSecurity Preferred
  • 10. CROSS SITE SCRIPTING 4.2 Reflected XSS In a reflected XSS attack, the malicious string is part of the victim's request to the website. T he website then includes this malicious string in the response sent back to the user. The diagra m below illustrates this scenario: SattirxSecurity Preferred
  • 11. CROSS SITE SCRIPTING 4.2 Reflected XSS 1. The attacker crafts a URL containing a malicious string and sends it to the victim. 2. The victim is tricked by the attacker into requesting the URL from the website. 3. The website includes the malicious string from the URL in the response. 4. The victim's browser executes the malicious script inside the response, sending the victim's cookies to the attacker's server. SattirxSecurity Preferred
  • 12. CROSS SITE SCRIPTING 4.3. DOM-based XSS DOM-based XSS is a variant of both persistent and reflected XSS. In a DOM-based XSS attack, the malicious string is not actually parsed by the victim's browser until the website's legitimate JavaScript i s executed. The diagram below illustrates this scenario for a reflected XSS attack: SattirxSecurity Preferred
  • 13. CROSS SITE SCRIPTING 4.3. DOM-based XSS 1. The attacker crafts a URL containing a malicious string and sends it to the victim. 2. The victim is tricked by the attacker into requesting the URL from the website. 3. The website receives the request, but does not include the malicious string in the response. 4. The victim's browser executes the legitimate script inside the response, causing the malicio us script to be inserted into the page. 5. The victim's browser executes the malicious script inserted into the page, sending the victi m's cookies to the attacker's server. SattirxSecurity Preferred
  • 14. CROSS SITE SCRIPTING 5. Defending against Cross site scripting Recall that an XSS attack is a type of code injection: user input is mistakenly interpreted as mali cious program code. In order to prevent this type of code injection, secure input handling is need ed. For a web developer, there are two fundamentally different ways of performing secure input handling: 1. Encoding, which escapes the user input so that the browser interprets it only as data, not as code. 1. Validation, which filters the user input so that the browser interprets it as code without mal icious commands. SattirxSecurity Preferred
  • 15. CROSS SITE SCRIPTING 5. Defending against Cross site scripting While these are fundamentally different methods of preventing XSS, they share several commo n features that are important to understand when using either of them:  Context: Secure input handling needs to be performed differently depending on where in a p age the user input is inserted.  Inbound/outbound: Secure input handling can be performed either when your website receiv es the input (inbound) or right before your website inserts the input into a page (outbound).  Client/server: Secure input handling can be performed either on the client-side or on the se rver-side, both of which are needed under different circumstances. SattirxSecurity Preferred
  • 16. CROSS SITE SCRIPTING 5.1. Encoding Encoding is the act of escaping user input so that the browser interprets it only as data, not as code. The most recognizable type of encoding in web development is HTML escaping, which conv erts characters like < and > into &lt; and &gt;, respectively. The following pseudocode is an example of how user input could be encoded using HTML escapin g and then inserted into a page by a server-side script: If the user input were the string <script>...</script>, the resulting HTML would be as follows: SattirxSecurity Preferred
  • 17. CROSS SITE SCRIPTING 5.1. Encoding Because all characters with special meaning have been escaped, the browser will not parse any p art of the user input as HTML. SattirxSecurity Preferred
  • 18. CROSS SITE SCRIPTING 5.2. Validation Validation is the act of filtering user input so that all malicious parts of it are removed, without necessarily removing all code in it. One of the most recognizable types of validation in web devel opment is allowing some HTML elements (such as <em> and <strong>) but disallowing others (such as <script>). There are two main characteristics of validation that differ between implementations:  Classification strategyUser: input can be classified using either blacklisting or whitelisting.  Validation outcomeUser: input identified as malicious can either be rejected or sanitized.
  • 19. SQL Injection Outline Introduction to SQL Injection How SQL Injection Work What’s the worst an attacker can do with SQLi? Types of SQL Injection Prevention against SQL Injection Practice
  • 20. SQL Injection 1. Introduction to SQL Injection SQL Injection (SQLi) refers to an injection attack wherein an attacker can ex ecute malicious SQL statements (also commonly referred to as a malicious payl oad) that control a web application’s database server (also commonly referred to as a Relational Database Management System – RDBMS). Since an SQL Inje ction vulnerability could possibly affect any website or web application that ma kes use of an SQL-based database, the vulnerability is one of the oldest, most prevalent and most dangerous of web application vulnerabilities. By leveraging an SQL Injection vulnerability, given the right circumstances, an attacker can use it to bypass a web application’s authentication and SattirxSecurity Preferred
  • 21. SQL Injection 1. Introduction to SQL Injection authorization mechanisms and retrieve the contents of an entire database. SQL Injection can al so be used to add, modify and delete records in a database, affecting data integrity. To such an extent, SQL Injection can provide an attacker with unauthorized access to sensitive data including, customer data, personally identifiable information (PII), trade secrets, intellectu al property and other sensitive information. SattirxSecurity Preferred
  • 22. SQL Injection 2. How SQL Injection works In order to run malicious SQL queries against a database server, an attacker must first find an i nput within the web application that is included inside of an SQL query. In order for an SQL Injection attack to take place, the vulnerable website needs to directly inc lude user input within an SQL statement. An attacker can then insert a payload that will be inclu ded as part of the SQL query and run against the database server. The following server-side pseudo-code is used to authenticate users to the web application. SattirxSecurity Preferred
  • 23. SQL Injection 2. How SQL Injection works The above script is a simple example of authenticating a user with a username and a password ag ainst a database with a table named users, and a username and password column. SattirxSecurity Preferred
  • 24. SQL Injection 2. How SQL Injection works The above script is vulnerable to SQL Injection because an attacker could submit malicious inpu t in such a way that would alter the SQL statement being executed by the database server. A simple example of an SQL Injection payload could be something as simple as setting the passw ord field to password’ OR 1=1. This would result in the following SQL query being run against the database server. SattirxSecurity Preferred
  • 25. SQL Injection 2. How SQL Injection works Once the query executes, the result is returned to the application to be processed, resulting in an authentication bypass. In the event of authentication bypass being possible, the application w ill most likely log the attacker in with the first account from the query result — the first accou nt in a database is usually of an administrative user.
  • 26. SQL Injection 3. What’s the worst an attacker can do with SQL? SQL is a programming language designed for managing data stored in an RDBMS, therefore SQL can be used to access, modify and delete data. Furthermore, in specific cases, an RDBMS could also run commands on the operating system from an SQL statement. Keeping the above in mind, when considering the following, it’s easier to understand how lucrative a s uccessful SQL Injection attack can be for an attacker.  An attacker can use SQL Injection to bypass authentication or even impersonate specific users.  One of SQL’s primary functions is to select data based on a query and output the result of that query. An SQL Injection vulnerability could allow the complete disclosure of data residing on a database server. SattirxSecurity Preferred
  • 27. SQL Injection 3. What’s the worst an attacker can do with SQL?  Since web applications use SQL to alter data within a database, an attacker could use SQL Injection to alter data stored in a database. Altering data affects data integrity and could cause repudiation issues, for instance, issues such as voiding transactions, altering balances and other records.  SQL is used to delete records from a database. An attacker could use an SQL Injection vuln erability to delete data from a database. Even if an appropriate backup strategy is employed, deletion of data could affect an application’s availability until the database is restored.  Some database servers are configured (intentional or otherwise) to allow arbitrary executio n of operating system commands on the database server. Given the right conditions, an attac ker could use SQL Injection as the initial vector in an attack of an internal network that sits behind a firewall. SattirxSecurity Preferred
  • 28. SQL Injection 4. Types of SQL Injection (SQLi) SQL Injection can be used in a range of ways to cause serious problems. By levering SQL Inject ion, an attacker could bypass authentication, access, modify and delete data within a database. SQL Injection can be classified into three major categories – 1. In-band SQLi,  Error-based SQLi  Union-based SQLi. 2. Inferential SQLi and  Blind-boolean-based SQLi  Blind-time-based SQLi 3. Out-of-band SQLi SattirxSecurity Preferred
  • 29. SQL Injection 4.1. In-band SQL injection (Classic SQLi) In-band SQL Injection is the most common and easy-to-exploit of SQL Injection attacks. In-ban d SQL Injection occurs when an attacker is able to use the same communication channel to both l aunch the attack and gather results. The two most common types of in-band SQL Injection are Error-based SQLi and Union-based SQLi.  Error-based SQL injection  Error-based SQLi is an in-band SQL Injection technique that relies on error messages thr own by the database server to obtain information about the structure of the database. In some cases, error-based SQL injection alone is enough for an attacker to enumerate an ent ire database. While errors are very useful during the development phase of a web applicati on, they should be disabled on a live site, or logged to a file with restricted access instead. SattirxSecurity Preferred
  • 30. SQL Injection 4.1. In-band SQL injection (Classic SQLi)  Union-based SQL injection  Union-based SQLi is an in-band SQL injection technique that leverages the UNION SQL operator to combine the results of two or more SELECT statem ents into a single result which is then returned as part of the HTTP response. SattirxSecurity Preferred
  • 31. SQL Injection 4.2. Inferential SQLi (Blind SQLi) Inferential SQL Injection, unlike in-band SQLi, may take longer for an attacker to exploit, how ever, it is just as dangerous as any other form of SQL Injection. In an inferential SQLi attack, no data is actually transferred via the web application and the attacker would not be able to see the result of an attack in-band (which is why such attacks are commonly referred to as “blin d SQL Injection attacks”). Instead, an attacker is able to reconstruct the database structu re by sending payloads, observing the web application’s response and the resulting behavior of the database server. The two types of inferential SQL Injection are Blind-boolean-based SQLi and Blind-time-bas ed SQLi. SattirxSecurity Preferred
  • 32. SQL Injection 4.2. Inferential SQLi (Blind SQLi)  Boolean-based (content-based) Blind SQLi  Boolean-based SQL Injection is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the application to return a di fferent result depending on whether the query returns a TRUE or FALSE result.  Depending on the result, the content within the HTTP response will change, or rema in the same. This allows an attacker to infer if the payload used returned true or f alse, even though no data from the database is returned. This attack is typically slow (especially on large databases) since an attacker would need to enumerate a da tabase, character by character. SattirxSecurity Preferred
  • 33. SQL Injection 4.2. Inferential SQLi (Blind SQLi)  Time-based Blind SQLi  Time-based SQL Injection is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the database to wait for a spec ified amount of time (in seconds) before responding. The response time will indicate to the attacker whether the result of the query is TRUE or FALSE.  Depending on the result, an HTTP response will be returned with a delay, or returne d immediately. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned. This attack is typically sl ow (especially on large databases) since an attacker would need to enumerate a data base character by character. SattirxSecurity Preferred
  • 34. SQL Injection 4.3. Out-of-band SQL Injection Out-of-band SQL Injection is not very common, mostly because it depends on features being en abled on the database server being used by the web application. Out-of-band SQL Injection occ urs when an attacker is unable to use the same channel to launch the attack and gather results. Out-of-band techniques, offer an attacker an alternative to inferential time-based techniques, especially if the server responses are not very stable (making an inferential time-based attack u nreliable). SattirxSecurity Preferred
  • 35. SQL Injection 5. What Can Be Done to Prevent SQL Injection Attacks? The most important precautions are data sanitization and validation, which should already be in place. Sanitization usually involves running any submitted data through a function (such as MyS QL's mysql_real_escape_string() function) to ensure that any dangerous characters (like " ' ") a re not passed to a SQL query in data. Validation: Validation is slightly different, in that it attempts to ensure that the data submitte d is in the form that is expected, the length of a piece of data submitted is not longer than the maximum expected length. But sanitization and validation are far from the whole story. Here are ten ways you can help pre vent or mitigate SQL injection attacks: SattirxSecurity Preferred
  • 36. SQL Injection 5. What Can Be Done to Prevent SQL Injection Attacks?  Trust no-one: Assume all user-submitted data is evil and validate and sanitize everything.  Don't use dynamic SQL when it can be avoided: used prepared statements, parameterize d queries or stored procedures instead whenever possible.  Update and patch: vulnerabilities in applications and databases that hackers can exploit usin g SQL injection are regularly discovered, so it's vital to apply patches and updates as soon a s practical.  Firewall: Consider a web application firewall (WAF) – either software or appliance based – to help filter out malicious data. A WAF can be particularly useful to provide some security pro tection against a particular new vulnerability before a patch is available. SattirxSecurity Preferred
  • 37. SQL Injection 5. What Can Be Done to Prevent SQL Injection Attacks?  Use appropriate privileges: don't connect to your database using an account with admin-leve l privileges unless there is some compelling reason to do so. Using a limited access account is far safer, and can limit what a hacker is able to do.  Keep your secrets secret: Assume that your application is not secure and act accordingly b y encrypting or hashing passwords and other confidential data including connection strings.  Don't divulge more information than you need to: hackers can learn a great deal about dat abase architecture from error messages, so ensure that they display minimal information. Us e the "RemoteOnly" customErrors mode (or equivalent) to display verbose error messages on the local machine while ensuring that an external hacker gets nothing more than the fact tha t his actions resulted in an unhandled error. SattirxSecurity Preferred
  • 38. SQL Injection Real-Time Example 1. Cross-Site-Scripting 2. SQL Injection SattirxSecurity Preferred