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



Download 5,76 Mb.
Pdf ko'rish
bet490/875
Sana01.01.2022
Hajmi5,76 Mb.
#293004
1   ...   486   487   488   489   490   491   492   493   ...   875
Bog'liq
3794 1008 4334

Chapter 9 



Injecting Code



273

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




numeric range and construct a mapping of document contents to identifiers.

Then, when performing the attack described previously, the attacker can con-

sult this map to determine the identifier for each document received from the

application, and thereby retrieve the ASCII value of the character that they

have successfully extracted.

Using an Out-of-Band Channel

In many cases of SQL injection, the application does not return the results of

any injected query to the user’s browser, nor does it return any error messages

generated by the database. In this situation, it may appear that your position is

futile: even if a SQL injection flaw exists, it surely cannot be exploited to extract

arbitrary data or perform any other action. This appearance is false, however,

and there are various techniques that you can use to retrieve data, and verify

that other malicious actions have been successful. 

There are many circumstances in which you may be able to inject an arbi-

trary query but not retrieve its results. Recall the example of the vulnerable

login form, where the username and password fields are vulnerable to SQL

injection:

SELECT * FROM users WHERE username = ‘marcus’ and password = ‘secret’

In addition to modifying the logic of the query to bypass the login, you can

inject an entirely separate subquery using string concatenation to join its

results to the item you control. For example:

foo’ ||  (SELECT 1 FROM dual WHERE (SELECT username FROM all_users WHERE

username = ‘DBSNMP’) = ‘DBSNMP’)--

This will cause the application to perform the following query:

SELECT * FROM users WHERE username = ‘foo’ || (SELECT 1 FROM dual WHERE

(SELECT username FROM all_users WHERE username = ‘DBSNMP’) = ‘DBSNMP’)

The database will execute your arbitrary subquery, append its results to 

foo

and then look up the details of the resulting username. Of course, the login



will fail, but your injected query will have been executed. All you will receive

back in the application’s response is the standard login failure message. What

you then need is a means of retrieving the results of your injected query.

A different situation arises when you are able to employ batch queries

against MS-SQL databases. Batch queries are extremely useful, because they

allow you to execute an entirely separate statement over which you have full

control, using a different SQL verb and targeting a different table. However,

because of the way batch queries are carried out, the results of an injected




Download 5,76 Mb.

Do'stlaringiz bilan baham:
1   ...   486   487   488   489   490   491   492   493   ...   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