This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
FORBIDDEN FUNCTIONS: Add shell_exec()
, exec()
, passthru()
, and system()
#35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR forbids the use of a considered non-secure function,
shell_exec()
.Take the following PHP script as an example:
Using the following query string:
?cmd=id
This results in the currently logged-in user's identity being displayed in the browser.
Example taken from: Hacker's Grimoire
With
shell_exec()
added to the list of forbidden functions, the user would get the following error notification:As an alternative to these functions Symfony's Process Component can be used.
Although the
backtick
operator has been forbidden for readability reasons (PR 28), and refers toshell_exec()
as alternative, theshell_exec()
function is identical and hence poses the same security risk.