Code Security of PHP
Code Security of PHP
WEB CIBERSECURITY
Danger of PHP Code Injection Vulnerability
ABSTRACT
This work demonstrates that the use of laboratories for the development of curricular work in the area of
information technology exclusively supported by cloud computing technology does not decrease the level
of learning and assessment objects on the part of students. This scenario arose due to the need to
interrupt face-to-face classes in physical laboratories due to the COVID-19 Pandemic. The study had as
universe a master's degree in Computer Science.
Keywords: Cloud Computing; Azure; Distance learning; WEB App, Virtual Labs.
1 Introduction
Currently, cybersecurity is an extremely important topic and covers all professional areas. However, there
are areas that are much more at risk than others. All companies or organizations that are permanently
connected to the Internet through their activities are obviously more exposed to risks. Within this group
there is also a subgroup more exposed to risks, it is the organizations that, in addition to being
permanently or systematically connected to the Internet, have public web servers. This type of
infrastructures is subject to permanent attacks within the scope of Cybersecurity.
This work focused more specifically on the analysis of one of the most common and most dangerous
vulnerabilities of web servers, which by default use the HTTP protocol, programs or scripts that run on
these platforms. We do not focus on relevant issues such as the technological protection of web servers,
but more on how programs that run on these servers may have errors that facilitate the existence of
vulnerabilities.
The aim of this paper is to demonstrate that inadequate programming for the Web can result in serious
vulnerabilities. We have analysed in detail the issue of code injection in PHP files that are executed on
web servers and that, due to their characteristics, become vulnerabilities by themselves.
DOI: 10.14738/tmlai.85.9051
Publication Date: 01st Nov, 2020
URL: http://dx.doi.org/10.14738/tmlai.85.9051
Pedro Ramos Brandao; WEB CIBERSECURITY Danger of PHP Code Injection Vulnerability. Transactions on Machine
Learning and Artificial Intelligence, Volume 8 No 5 Aug (2020); pp: 65-68
This language has its own characteristics, it is a language of interpretation, that is, it is executed without
the need for compilation (1).
As we said, this language is totally devoted to being used on the Internet and with its own and unique
configurations, however, PHP Scripts can perform actions that almost all other Web applications execute
normally, for example they execute any command coming from another GET type application and POST
or REQUEST, execute cookies at all levels, and can create active online variables sent via line commands.
One of the most common and most dangerous vulnerabilities that can be found in PHP Scripts is the
Source Code Injection. A malicious user who in any way can access a machine in a DMZ or a network can
run Scripts on one of the servers on that network, as long as they operate in PHP or through PHP. If the
PHP parameters are not strongly configured, the malicious user can, through the Request command, inject
the execution of something into any PHP file.
URL:http://dx.doi.org/10.14738/tmlai.85.9051 66
Transactions on Machine Learning and Artificial Intelligence Volume 8, Issue 5, August 2020
Third: if in the default configurations of the PHP config there are any kind of remote access enable.
Programming languages with interpretation and using strings that contain all types of characters including
null characters, this can be a problem.
We tried to run an include script ("./$name/file.php"), we acted like a normal programmer and it was
believed that the interpreter included and ran only FILE.PHP. But what actually happened was the script
found the null terminator as a string name: name = temp.txt% 00?
The PHP interpreter opened and executed the ./temp.txt\0/file.pnp file in which \ o is the null character,
this string has been changed to include (), and this is a very serious problem in terms of security. The result
was to include in the ./temp.txt execution, the code injection was done.
Finally, we demonstrate how the PHP interpreter can easily execute all types of scripts:
Consider http: //localhost/45/22.php
File: <? echo file ("a-b-c x: y: w");
$ e = "test";
6 Conclusion
We assume that if there was no care on the part of programmers in the configuration of PHP files on a
server, this could enable and facilitate attacks of a certain type.
The most dangerous type of attack was specified.
A PHP site was simulated on a WEB Server with a common pattern of configurations, without taking into
account the specific care of security.
An injection attack was attempted.
The attack was successful, and it proved why.
So, we can conclude that if the settings of a PHP site have not been improved and very well implemented,
it is easy to attack by injection a PHP site.
REFERENCES
[1] NIXON, R.. (2018). Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning PHP, MYSQL,
Javascript, CSS & HTML5. O'Reilly Media
[2] TATROE, K. (2020). Programming PHP: Creating Dynamic Web Page. O'Reilly Media.
[3] WELLING, L. (2016). PHP and MySQL Web Development. Addison-Wesley Professional.
[4] LOCKHART, J. (2015). Modern PHP: New Features and Good Practices. O'Reilly Media.
[5] AJZELE, A. (2017). Mastering PHP 7: Design, configure, build, and test professional web applications. Packt
Publishing.
[6] POWERS, D. (2019). PHP 7 Solutions: Dynamic Web Design Made Easy. Apress.
[7] SNYDER, C. (2010). Pro PHP Security: From Application Security Principles to the Implementation of XSS
Defenses. Apress.
URL:http://dx.doi.org/10.14738/tmlai.85.9051 68