Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How secure is PHP?

I am somewhat new to PHP coding and I am aware that malicious users can hack a website if you have not sanitized your PHP code. What I am wondering is whether they need a data entry box (like for file submissions, or user-name/password entry fields)?.

Do commands like "include (header.php)" also need some sort of security or are they innately safe?

like image 938
slimbo Avatar asked Oct 06 '09 18:10

slimbo


People also ask

What makes PHP insecure?

However, a lot of code written in PHP is insecure, and the reason for that is simple - PHP has relatively low barrier of entry, which means a lot of people that know little about security write in PHP.

Which one is secure method in PHP?

PHP Md5 and PHP sha1 Md5 is the acronym for Message Digest 5 and sha1 is the acronym for Secure Hash Algorithm 1. They are both used to encrypt strings. Once a string has been encrypted, it is tedious to decrypt it. Md5 and sha1 are very useful when storing passwords in the database.

What is a PHP vulnerability?

PHP Object Injection is an application level vulnerability that could allow an attacker to perform different kinds of malicious attacks, such as Code Injection, SQL Injection, Path Traversal and Application Denial of Service, depending on the context.

What is PHP in cyber security?

PHP: PHP language is a server-side programming language that is used to generate websites. Powering most of the best 10 million websites, PHP is the usual powerful server-side language on the web. Experience in PHP, therefore, will allow you to understand how to protect against invaders.


2 Answers

Just like any other language, PHP code is as secure as the programmer writes it.

Also like any other language, individual (and even common) security risks are too numerous and detailed to include in a StackOverflow answer.

Find a book which covers Secure PHP coding.

like image 161
Steven Avatar answered Oct 04 '22 08:10

Steven


Don't trust the user.

include "a/literal/file.php"; 

is quite safe

include $someFile; 

means you want to think about how $someFile gets set. If you use any data that was given to you by a user to set $someFile's value, you'd better sanitize it.

like image 44
timdev Avatar answered Oct 04 '22 08:10

timdev