11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

370 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sCountermeasuresTo counter SQL injection attacks, be sure to:● Constrain <strong>and</strong> sanitize input data.● Use type safe SQL parameters for data access. These parameters can be used withstored procedures or dynamically constructed SQL comm<strong>and</strong> strings. Parametersperform type <strong>and</strong> length checks <strong>and</strong> also ensure that injected code is treated asliteral data, not executable statements in the database.● Use an account that has restricted permissions in the database. Ideally, you shouldonly grant execute permissions to selected stored procedures in the database <strong>and</strong>provide no direct table access.Disclosure of Configuration DataThe most sensitive configuration data used by data access code is the databaseconnection string. If a compromised connection string includes a user name <strong>and</strong>password, the consequences can be greater still.VulnerabilitiesThe following vulnerabilities increase the security risk associated with compromisedconfiguration data:● Use of SQL authentication, which requires credentials to be specified in theconnection string● Embedded connection strings in code● Clear text connection strings in configuration files● Failure to encrypt a connection stringCountermeasuresTo prevent disclosure of configuration data:● Use Windows authentication so that connection strings do not contain credentials.● Encrypt the connection strings <strong>and</strong> restrict access to the encrypted data.Disclosure of Sensitive <strong>Application</strong> DataMany applications store sensitive data, such as customer credit card numbers. It isessential to protect the privacy <strong>and</strong> integrity of this type of data.VulnerabilitiesCoding practices that can lead to the disclosure of sensitive application data include:● Storing data with no encryption● Weak authorization● Weak encryption

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

Saved successfully!

Ooh no, something went wrong!