SlideShare a Scribd company logo
BOOK
CEH Certified Ethical Hacker Study Guide
By
Graves, Kimberly
Chapter: 9
Attacking Applications: SQL Injection and Buffer Overflows
What is SQL injection?
● SQL injection is a hacking method used to attack SQL databases.
● There are always some vulnerabilities in an application.
● SQL injection try to attack on those vulnerabilities.
● SQL injection occurs when an application processes user-provided data to create
a SQL statement without first validating the input.
● Generally, the purpose of SQL injection is to convince the application to run SQL
code that was not intended.
● During a web application SQL injection attack, malicious code is inserted into a
web form field or the website’s code to make a system execute a command shell
or other arbitrary commands
Understand the steps to conduct SQL injection
Username:
Password:
hacker
ethical123
Username:
Password:
ok or 1=1 - -
Ok or 1=1 - -
Valid SQL:
SELECT * FROM USER
WHERE username=hacker and password=ethical123
Injected SQL:
SELECT * FROM USER
WHERE username=ok or 1=1 - -
and
password=ok or 1=1 - -
Injected SQL may return all the data from the “USER” table at once and
Attacker gets valuable data like username, password, credit card number.
The Purpose of SQL Injection
● Identifying SQL Injection Vulnerability
● Performing Database Finger-Printing
● Determining Database Schema
● Extracting Data
● Adding or Modifying Data
● Performing Denial of Service
● Evading Detection
● Bypassing Authentication
● Executing Remote Commands
● Performing Privilege Escalation
Describe SQL injection countermeasures
● A countermeasure is a measure or action taken to counter or offset another
one.
● The SQL vulnerabilities occur mainly for not validating the user input.
→ Steps could be taken to defense the SQL Injection:
● Rejecting known bad input
● Sanitizing and validating the input field
● Disable verbose and explanatory messages
Buffer overflows
● A buffer is a sequential section of memory allocated to contain anything from a
character string to an array of integers
● A buffer overflow exploit causes a system to fail by overloading memory or
executing a command shell or arbitrary code on the target system.
● A buffer overflow vulnerability is caused by a lack of bounds checking or a lack of
input-validation sanitization in a variable field (such as on a web form).
● If the application doesn’t check or validate the size or format of a variable before
sending it to be stored in memory, an overflow vulnerability exit.
● Attacks usually targets at user input fields
Type of Buffer Overflow
→ There are mainly two type of buffer overflow
1. Stack based
2. Heap based
Overview of stack-based buffer overflows
The following are the steps a hacker uses to execute a stack-based buffer
overflow:
1. Enter a variable into the buffer to exhaust the amount of memory in the stack.
2. Enter more data than the buffer has allocated in memory for that variable, which causes
the memory to overflow or run into the memory space for the next process. Then, add
another variable, and overwrite the return pointer that tells the program where to return
to after executing the variable.
3. A program executes this malicious code variable and then uses the return pointer to get
back to the next line of executable code. If the hacker successfully overwrites the
pointer, the program executes the hacker’s code instead of the program code
Ethical hacking (sql injection and butter overflow)
Buffer Overflow Countermeasures
● A hacker must know the exact memory address and the size of the stack in
order to make the return pointer execute their code.
● A hacker can send NOP (No Operation) instruction.
● Intrusion detection system (IDS) can be used to detect malicious code.
● Attacker tries to send a series of NOP instruction.
● Programmers should not use the built-in strcpy(), strcat(), and streadd()
C/C++ functions because they are susceptible to buffer overflows
● Java can be used as the programming language since Java is not susceptible
to buffer overflows
Thanks All

Recommended

W3AF|null
W3AF|null
Prajwal Panchmahalkar
 
Web application attack and audit framework (w3af)
Web application attack and audit framework (w3af)
Abhishek Choksi
 
Exception handling
Exception handling
Harry Potter
 
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
FFRI, Inc.
 
RIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya Prabhune
Johannes Hoppe
 
ieee
ieee
Radheshyam Dhakad
 
Sql injection & command injection
Sql injection & command injection
Lahore Garrison University
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1
Anand kalla
 
An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
TechSecIT
 
csf_ppt.pptx
csf_ppt.pptx
0567Padma
 
IRJET - Buffer Overflows Attacks & Defense
IRJET - Buffer Overflows Attacks & Defense
IRJET Journal
 
2071
2071
Brave Sithu
 
Golf teamlearnerlecture
Golf teamlearnerlecture
kairistiona
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
Writing Secure Code – Threat Defense
Writing Secure Code – Threat Defense
amiable_indian
 
Control hijacking
Control hijacking
Prachi Gulihar
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReport
Philip Salem
 
Sql injection
Sql injection
Nitish Kumar
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
Bernardo Damele A. G.
 
antoanthongtin_Lesson 3- Software Security (1).pptx
antoanthongtin_Lesson 3- Software Security (1).pptx
23162024
 
Protect Your Database_ SQL Injection Attack Prevention.pdf
Protect Your Database_ SQL Injection Attack Prevention.pdf
Sachin FromDev
 
Ceh v5 module 20 buffer overflow
Ceh v5 module 20 buffer overflow
Vi Tính Hoàng Nam
 
Buffer overflow
Buffer overflow
Abu Juha Ahmed Muid
 
Buffer overflows
Buffer overflows
Sandun Perera
 
Buffer overflow attacks
Buffer overflow attacks
Joe McCarthy
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
ahmed8790
 
Built-in Security Mindfulness for Software Developers
Built-in Security Mindfulness for Software Developers
Phú Phùng
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 

More Related Content

Similar to Ethical hacking (sql injection and butter overflow) (20)

An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
TechSecIT
 
csf_ppt.pptx
csf_ppt.pptx
0567Padma
 
IRJET - Buffer Overflows Attacks & Defense
IRJET - Buffer Overflows Attacks & Defense
IRJET Journal
 
2071
2071
Brave Sithu
 
Golf teamlearnerlecture
Golf teamlearnerlecture
kairistiona
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
Writing Secure Code – Threat Defense
Writing Secure Code – Threat Defense
amiable_indian
 
Control hijacking
Control hijacking
Prachi Gulihar
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReport
Philip Salem
 
Sql injection
Sql injection
Nitish Kumar
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
Bernardo Damele A. G.
 
antoanthongtin_Lesson 3- Software Security (1).pptx
antoanthongtin_Lesson 3- Software Security (1).pptx
23162024
 
Protect Your Database_ SQL Injection Attack Prevention.pdf
Protect Your Database_ SQL Injection Attack Prevention.pdf
Sachin FromDev
 
Ceh v5 module 20 buffer overflow
Ceh v5 module 20 buffer overflow
Vi Tính Hoàng Nam
 
Buffer overflow
Buffer overflow
Abu Juha Ahmed Muid
 
Buffer overflows
Buffer overflows
Sandun Perera
 
Buffer overflow attacks
Buffer overflow attacks
Joe McCarthy
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
ahmed8790
 
Built-in Security Mindfulness for Software Developers
Built-in Security Mindfulness for Software Developers
Phú Phùng
 
An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
An Introduction of SQL Injection, Buffer Overflow & Wireless Attack
TechSecIT
 
csf_ppt.pptx
csf_ppt.pptx
0567Padma
 
IRJET - Buffer Overflows Attacks & Defense
IRJET - Buffer Overflows Attacks & Defense
IRJET Journal
 
Golf teamlearnerlecture
Golf teamlearnerlecture
kairistiona
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
Writing Secure Code – Threat Defense
Writing Secure Code – Threat Defense
amiable_indian
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReport
Philip Salem
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
Bernardo Damele A. G.
 
antoanthongtin_Lesson 3- Software Security (1).pptx
antoanthongtin_Lesson 3- Software Security (1).pptx
23162024
 
Protect Your Database_ SQL Injection Attack Prevention.pdf
Protect Your Database_ SQL Injection Attack Prevention.pdf
Sachin FromDev
 
Ceh v5 module 20 buffer overflow
Ceh v5 module 20 buffer overflow
Vi Tính Hoàng Nam
 
Buffer overflow attacks
Buffer overflow attacks
Joe McCarthy
 
Buffer overflow attacks
Buffer overflow attacks
Sandun Perera
 
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
fjfh mjgkj jkhglkjh jhlkh lhlkkhl kjhjkhjk
ahmed8790
 
Built-in Security Mindfulness for Software Developers
Built-in Security Mindfulness for Software Developers
Phú Phùng
 

Recently uploaded (20)

Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
INDUCTIVE EFFECT slide for first prof pharamacy students
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
How to Add New Item in CogMenu in Odoo 18
How to Add New Item in CogMenu in Odoo 18
Celine George
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
2025 Completing the Pre-SET Plan Form.pptx
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
INDUCTIVE EFFECT slide for first prof pharamacy students
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
How to Add New Item in CogMenu in Odoo 18
How to Add New Item in CogMenu in Odoo 18
Celine George
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
2025 Completing the Pre-SET Plan Form.pptx
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 

Ethical hacking (sql injection and butter overflow)

  • 1. BOOK CEH Certified Ethical Hacker Study Guide By Graves, Kimberly Chapter: 9 Attacking Applications: SQL Injection and Buffer Overflows
  • 2. What is SQL injection? ● SQL injection is a hacking method used to attack SQL databases. ● There are always some vulnerabilities in an application. ● SQL injection try to attack on those vulnerabilities. ● SQL injection occurs when an application processes user-provided data to create a SQL statement without first validating the input. ● Generally, the purpose of SQL injection is to convince the application to run SQL code that was not intended. ● During a web application SQL injection attack, malicious code is inserted into a web form field or the website’s code to make a system execute a command shell or other arbitrary commands
  • 3. Understand the steps to conduct SQL injection Username: Password: hacker ethical123 Username: Password: ok or 1=1 - - Ok or 1=1 - - Valid SQL: SELECT * FROM USER WHERE username=hacker and password=ethical123 Injected SQL: SELECT * FROM USER WHERE username=ok or 1=1 - - and password=ok or 1=1 - - Injected SQL may return all the data from the “USER” table at once and Attacker gets valuable data like username, password, credit card number.
  • 4. The Purpose of SQL Injection ● Identifying SQL Injection Vulnerability ● Performing Database Finger-Printing ● Determining Database Schema ● Extracting Data ● Adding or Modifying Data ● Performing Denial of Service ● Evading Detection ● Bypassing Authentication ● Executing Remote Commands ● Performing Privilege Escalation
  • 5. Describe SQL injection countermeasures ● A countermeasure is a measure or action taken to counter or offset another one. ● The SQL vulnerabilities occur mainly for not validating the user input. → Steps could be taken to defense the SQL Injection: ● Rejecting known bad input ● Sanitizing and validating the input field ● Disable verbose and explanatory messages
  • 6. Buffer overflows ● A buffer is a sequential section of memory allocated to contain anything from a character string to an array of integers ● A buffer overflow exploit causes a system to fail by overloading memory or executing a command shell or arbitrary code on the target system. ● A buffer overflow vulnerability is caused by a lack of bounds checking or a lack of input-validation sanitization in a variable field (such as on a web form). ● If the application doesn’t check or validate the size or format of a variable before sending it to be stored in memory, an overflow vulnerability exit. ● Attacks usually targets at user input fields
  • 7. Type of Buffer Overflow → There are mainly two type of buffer overflow 1. Stack based 2. Heap based
  • 8. Overview of stack-based buffer overflows The following are the steps a hacker uses to execute a stack-based buffer overflow: 1. Enter a variable into the buffer to exhaust the amount of memory in the stack. 2. Enter more data than the buffer has allocated in memory for that variable, which causes the memory to overflow or run into the memory space for the next process. Then, add another variable, and overwrite the return pointer that tells the program where to return to after executing the variable. 3. A program executes this malicious code variable and then uses the return pointer to get back to the next line of executable code. If the hacker successfully overwrites the pointer, the program executes the hacker’s code instead of the program code
  • 10. Buffer Overflow Countermeasures ● A hacker must know the exact memory address and the size of the stack in order to make the return pointer execute their code. ● A hacker can send NOP (No Operation) instruction. ● Intrusion detection system (IDS) can be used to detect malicious code. ● Attacker tries to send a series of NOP instruction. ● Programmers should not use the built-in strcpy(), strcat(), and streadd() C/C++ functions because they are susceptible to buffer overflows ● Java can be used as the programming language since Java is not susceptible to buffer overflows