At Privacy Australia, we look at all the privacy services on the market today, and review each and every one of them. We’ll review the best, the worst, and everything in between, taking a look at usability, speed tests and digging deep into their terms of service, logging policies and more.
Learn More
Our goal is to educate and inform Australians about their data privacy rights and empower them to protect it. Our reviews are objective, research backed and
community driven. We encourage all our readers to leave a review.
Learn More
We’re constantly looking for new minds to join our growing team of IT and security specialists. Location – Privacy Australia is located in Adelaide, South Australia. ❤️ 🇦🇺 We work in cities throughout Australia helping local businesses be more secure. Contact Us to learn more, or reach me directly: will[at]privacyaustralianet.net
Learn More
This document will list possible security threats to the Web application, explanation and preventive measures. Following are free software that will scan and list potential threats to the system as per the software coding standard and server configuration. Disable
certain usernames from being used like 'test', 'test123', 'admin', and 'root'Web Application Security
Introduction
How to know if a site is Vulnerable?
Best Practices for Web Application Security
Use automated test code [Eg. PHP QuickCheck]
Be mindful while creating project structure. Make sure to put upload dir outside of Webroot to prevent public access.
Use Package or Library available in packagist.org instead of creating a new one.
Maintain user login table [log in date, time, IP].
Run the manual test in a certain period of time or after a significant update.
Disable unused PHP module [eg. shell_exec
, system
, passthru
] from php.ini for performance and security.
Put a .htaccess with the following content in upload directory to prevent the execution of PHP file. Instead, it will download the file.
Always set uploaded file permission to a minimum or non-executable [0644].
Scramble uploaded file names and extensions
PHP Backdoors
PHP hidden scripts such as c99, c99madshell, and r57 for bypassing all authentication and access the server on demand are called PHP Backdoors script. This will give them almost every access like download, upload, control to the server, database, and mail server.
To prevent this follow all preventive measure and search for those script in your server time to time.
grep -iR 'c99' /var/www/html/ grep -iR 'r57' /var/www/html/ find /var/www/html/ -name \*.php -type f -print0 | xargs -0 grep c99 grep -RPn "[passthru|shell_exec|system|base64_decode|fopen|fclose|eval]" /var/www/html/
Resources
Follow OWASP secure coding practices and their checklist for testing for any vulnerabilities [ //www.owasp.org].
PHPSC [ //phpsec.org/] group of PHP experts dedicated to promoting secure programming practices within the PHP community. Members of the PHPSC seek to educate PHP developers about security through a variety of resources, including documentation, tools, and standards.
Tác giả: Dương Nguyễn Phú Cường
Ngày đăng: Hồi xưa đó
Potential security threats
They are basically two groups of people that can attack your system
- Hackers – with the intent to gain access to unauthorized data or disrupt the application
- Users – they may innocently enter wrong parameters in forms which can have negative effects on a website or web application.
The following are the kinds of attacks that we need to look out for. SQL Injection – This type of attack appends harmful code to SQL statements. This is done using either user input forms or URLs that use variables. The appended code comments the condition in the WHERE clause of an SQL statement. The appended code can also;
- insert a condition that will always be true
- delete data from a table
- update data in a table
- This type of attack is usually used to gain unauthorized access to an application.
Cross-site scripting – this type of attack inserts harmful code usually JavaScript. This is done using user input forms such as contact us and comments forms. This is done to;
- Retrieve sensitive information such as cookies data
- Redirect the user to a different URL.
- Other threats can include – PHP code injection, Shell Injection, Email Injection, Script Source Code Disclosure etc.
PHP Application Security Best Practices
Let’s now look at some of the PHP Security best practices that we must consider when developing our applications.
The strip_tags functions removes HTML, JavaScript or PHP tags from a string. This function is useful when we have to protect our application against attacks such as cross site scripting. Let’s consider an application that accepts comments from users.
Assuming you have saved comments.php in the phptuts folder, browse to the URL //localhost/phptuts/comments.php
Let’s assume you receive the following as the user input alert['Your site sucks!'];