Common Web Application Security Concerns
Security problems can appear at different stages of an application's operation. Some are caused by unsafe input handling, while others result from weak authentication, incorrect access controls, insecure configuration, or the accidental exposure of sensitive information.
- Input validation — application input should be checked and handled according to the type of data expected.
- Authentication and access control — users should only be able to access accounts, data, and actions for which they are authorized.
- Session handling — sessions and authentication information need to be protected from unauthorized use.
- Data protection — sensitive information should be handled carefully during storage and transmission.
- Error handling — application errors should help developers diagnose problems without unnecessarily exposing internal information to users.
Security at the Application Level
A secure application does not depend on a single security feature. Security is normally considered throughout the application, from the way requests are received and processed to the way data is stored and displayed.
In a PHP application, this can include validating request data, safely working with databases, controlling file access, managing sessions, and avoiding the accidental disclosure of configuration or error information. Similar principles continue to apply to modern applications built with other server-side technologies.
Browser-Based Application Security
Modern applications often perform part of their work directly in the browser. JavaScript, browser APIs, and other client-side technologies can provide a more interactive experience, but the browser should not be treated as a trusted security boundary.
Client-side checks can improve usability, but important validation and access controls may still need to be enforced by the application or server. Browser features, user input, and data exchanged between the client and server should therefore be considered as part of the application's overall security design.
Security Resources
The following topics cover common security concerns and practices for PHP and web application development:
- A Catalog of Security Vulnerabilities — Bad Security Smells.
- A Catalog of Security Attacks — Attacks against PHP Applications and how to foil them.
- A Catalog of Security Sensitive Functions — A List of PHP functions and their security implications.
- A Catalog of Secure Practices — Best practices for secure applications.
Security and Application Design
Application architecture can influence how security responsibilities are organized. Separating presentation, application logic, and data access can make it easier to understand where validation, authorization, and other security checks belong.
Security should therefore be considered alongside the overall design of an application rather than being added only after the main features have been completed.