28.10.2014 Views

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

350 Chapter 8 • Code-Level <strong>Defense</strong>s<br />

When using whitelist validation you should consider the following points:<br />

■■<br />

■■<br />

■■<br />

■■<br />

Data type Is the data type correct? If the value is supposed to be numeric, is it<br />

numeric? If it is supposed to be a positive number, is it a negative number instead?<br />

Data size If the data is a string, is it of the correct length? Is it less than<br />

the expected maximum length? If it is a binary blob, is it less than the maximum<br />

expected size? If it is numeric, is it of the correct size or accuracy? (For example,<br />

if an integer is expected, is the number that is passed too large to be an<br />

integer value?)<br />

Data range If the data is numeric, is it in the expected numeric range for this<br />

type of data?<br />

Data content Does the data look like the expected type of data? For example,<br />

does it satisfy the expected properties of a ZIP Code if it is supposed to be a ZIP<br />

Code? Does it contain only the expected character set for the data type expected?<br />

If a name value is submitted, only some punctuation (single quotes <strong>and</strong> character<br />

accents) would normally be expected, <strong>and</strong> other characters, such as the less than<br />

sign (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!