The Web Application Hacker’s Handbook Discovering and Exploiting Security Flaws



Download 5,76 Mb.
Pdf ko'rish
bet431/875
Sana01.01.2022
Hajmi5,76 Mb.
#293004
1   ...   427   428   429   430   431   432   433   434   ...   875
Bog'liq
3794 1008 4334

Chapter 9 



Injecting Code



241

70779c09.qxd:WileyRed  9/14/07  3:13 PM  Page 241




Now, consider what happens when a user searches for all books published

by O’Reilly. This causes the application to perform the following query:

SELECT author,title,year FROM books WHERE publisher = ‘O’Reilly’

In this case, the query interpreter reaches the string data in the same way as

before. It parses this data, which is encapsulated within single quotation

marks, and obtains the value 

O

. It then encounters the expression 



Reilly’

,

which is not valid SQL syntax and so generates an error:



Incorrect syntax near ‘Reilly’.

Server: Msg 105, Level 15, State 1, Line 1

Unclosed quotation mark before the character string ‘

When an application behaves in this way, it is wide open to SQL injection.

An attacker can supply input containing a quotation mark to terminate the

string that he controls, and can then write arbitrary SQL to modify the query

that the developer intended the application to execute. In this situation, for

example, the attacker can modify the query to return every single book in the

retailer’s catalog, by entering the search term:

Wiley’ OR 1=1--

This causes the application to perform the following query:

SELECT author,title,year FROM books WHERE publisher = ‘Wiley’ OR 1=1--‘

This modifies the 

WHERE


clause of the developer’s query to add a second con-

dition. The database will check every row within the books table and extract

each record where the 

publisher

column has the value 

Wiley


or where 1 is

equal to 1. Because 1 is always equal to 1, the database will return every record

within the books table.


Download 5,76 Mb.

Do'stlaringiz bilan baham:
1   ...   427   428   429   430   431   432   433   434   ...   875




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish