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


environment variable instead, which contains the whitespace



Download 5,76 Mb.
Pdf ko'rish
bet536/875
Sana01.01.2022
Hajmi5,76 Mb.
#293004
1   ...   532   533   534   535   536   537   538   539   ...   875
Bog'liq
3794 1008 4334

environment variable instead, which contains the whitespace

field separators.

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




Preventing OS Command Injection

In general, the best way to prevent OS command injection flaws from arising

is to avoid calling out directly to operating system commands at all. Virtually

any conceivable task that a web application may need to carry out can be

achieved using built-in APIs that cannot be manipulated to perform additional

commands than the one intended.

If it is considered unavoidable to embed user-supplied data into command

strings that are passed to an operating system command interpreter, the appli-

cation should enforce rigorous defenses to prevent a vulnerability arising. If

possible, a white list should be used to restrict user input to a specific set of

expected values. Alternatively, the input should be restricted to a very narrow

character set — for example, alphanumeric characters only. Input containing

any other data, including any conceivable metacharacter or whitespace should

be rejected.

As a further layer of protection, the application should use command APIs

that launch a specific process via its name and command-line parameters,

rather than passing a command string to a shell interpreter that supports com-

mand chaining and redirection. For example, the Java API 

Runtime.exec

and


the ASP.NET API 

Process.Start

do not support shell metacharacters and if

properly used can ensure that only the command intended by the developer

will be executed. See Chapter 18 for more details of command execution APIs.


Download 5,76 Mb.

Do'stlaringiz bilan baham:
1   ...   532   533   534   535   536   537   538   539   ...   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