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

learn more… | top users | synonyms

0
votes
0answers
57 views

Is SaySocket secure?

A friend of mine installed SaySocket onto his personal macbook pro (he intended to prank people, but wanted to try it first). He quickly realized that he had just installed an unknown piece of ...
-1
votes
1answer
61 views

Do I need to detect user's device for “remember me” system?

I'm following solution #1 of this answer. After a while, there will be some redundant rows in the table. Suppose this table: // cookies +---------+-------------------------+------------------+--------...
66
votes
9answers
10k views

Hosting company advised us to avoid PHP for security reasons. Are they right?

I'm doing a redesign for a client who's understandably concerned about security after having been hacked in the past. I had initially suggested using a simple PHP include for header and footer ...
1
vote
0answers
73 views

Obfuscated PHP code found in WordPress core files and plugins

I am running a Wordpress website and I've recently found this php code injected in many of my php files. https://www.unphp.net/decode/fb4715ee71b28135f6807389df42611c/ I tried adding some print_r(...
0
votes
2answers
111 views

Why not have an identical session cookie for different user's devices?

Here is my table structure: // users +----+--------+------------------------+------------------+-------------------------------+ | id | name | email | cookie | /* some ...
-6
votes
2answers
44 views

How to brute force this token in php, if it is possible

it is possible to brute-force this token (MD5 Hash) of the following script (PHP) in a realistic time (0,5h - 24h)? If the answer is YES, how could I do it, for example with PHP or Python? $time = ...
1
vote
0answers
24 views

Allow users to download files from outside of webroot [migrated]

I've got a folder where I'm storing a bunch of confidential documents and I authenticate the user when they log in, but I only want them to be able to download a specific file. How can I retrieve ...
0
votes
2answers
93 views

Store passwords as integers

I just came up with this idea that I can store passwords as integers which take up 4 or 8 bytes as opposed to a hash that takes like 150 bytes or something. I wrote this function that converts a ...
1
vote
4answers
47 views

Remove possibility to read system files with PHP from Apache

When I upload a php file (file.php) with following content on Apache server <?php $file = $_GET['file']; include ( $file); ?> I am able to read any file of Apache using the below URLs http://...
0
votes
2answers
115 views

Can an SQL injection attack happen if the input is only allowed to be hexadecimal characters?

I've set up a login system that works more or less like this: 1) The user enters the data 2) The data is hashed locally using SHA256 (To reduce the risk of someone stealing the password through a ...
4
votes
1answer
75 views

Getting subscribers on website from nowhere?

I have a weird question and I hope I am asking in the right place. Recently I checked some statistics on my website after a while and noticed that the number of email subscribers had jumped from about ...
3
votes
3answers
387 views

Is array injection a vulnerability and what is the proper term for it?

When I'm penetration testing I sometimes notice undesirable behaviour of a PHP script when I inject a single or multidimensional array using the HTTP GET parameters. Possible availability risk This ...
0
votes
0answers
17 views

How can I create many-to-one keys in Doctrine/Zend/PHP?

I'm using Zend with Doctrine 2 to store data in a database. For a given user, I encrypt the data with a randomly-generated key specific to that user, and encrypt the key with that user's password ...
1
vote
1answer
118 views

How can I control all my website's requests? [closed]

I need to manage my website's requests. Because of both I need to detect suspect requests and block that IP and calculate the number of users which visit my website. So I've created a table like this:...
24
votes
2answers
3k views

Is the undesirable conversion of a scientific number a vulnerability?

I noticed in several penetration tests that PHP is converting values like 1e9 to 1000000000 while the max accepted string length of this number is 3 (in the database storage and as maxlength property ...
0
votes
1answer
87 views

Virus suspicion on website built with PHP Codeigniter [duplicate]

I have received a website, which uses Codeigniter, to modify. The problem is, sometimes when I refresh the main page, a strange file named "download" with the Windows icon will start to download. I'm ...
1
vote
1answer
203 views

Using htmlentities() in a BBCode-supporting textarea to stop XSS

I want to have a text area to post stuff to the database with BBCode. So, I downloaded a JavaScript code (to write in the specific BBCode when the image is clicked) but it didn't transform the text. ...
1
vote
0answers
37 views

Bizarre php file appeared in the image gallery folder of my website [duplicate]

Can anyone tell what this is or how it could possibly have made it to the image gallery folder of my website? It appears to be a bunch of variable definitions. Mind you that a period "." is the concat ...
3
votes
2answers
61 views

How to accept user input for use in terminal safely?

I found a vulnerability, and I'm not sure how to patch it. I currently accept input from the user and use it to create a terminal command which I run on the server. Here's the code simplified. // Get ...
4
votes
1answer
119 views

Exploiting MD5/Salt Vulnerability in this PHP form?

I've been practicing security-related subjects and this challenge has befuddled me. Note: I can't access any PHP source code, nor can I edit it. I'm only able to view it. The following is given: I ...
5
votes
1answer
76 views

PHP SQL Injection Vulnerability In UPDATE Statements

Take the following SQL query as an example: UPDATE `sqlinjection2` SET `$vote`=`$vote`+1 Our goal is to increment the vote count by more than one, in one request. We cannot access the code itself. ...
4
votes
2answers
137 views

Is this PHP code vulnerable SQL injection?

Im given control over the $vote variable (in the "challenge" function) Is there any way to sql inject the query? (BTW I can see/read whatever the challenge function returns e.g. the sql errors. I ...
4
votes
0answers
108 views

PHP Session Vulnerability

I'm trying to solve a challenge on a CTF, with PHP sessions. The goal is to make check.php echo $_PASSWORD. I do not have access to the files themselves, and therefore I cannot edit them. My ...
2
votes
1answer
131 views

How to bypass PHP username and password check in this CTF challenge?

I'm preparing for this CTF challenge I'll be participating in next week, and I ran across this problem online which I can't manage to solve. I only have control of the variables $user and $pass that ...
39
votes
7answers
5k views

Exploiting MD5 vulnerability in this PHP form?

I've been practicing in security-related topics and I came upon this problem which I don't understand at all. You receive a form with one input named pass, and this is the code you need to bypass: &...
-4
votes
3answers
62 views

How to pass website firewall, in PHP? [closed]

Recently, I have posted a question, (http://stackoverflow.com/questions/37494896/how-to-save-file-from-url-to-web-server-by-php). And, there is an answer in question. In this answer, he said: "So the ...
1
vote
2answers
75 views

How does a PHP application get nulled and how to avoid it

As so many others, I've been a victim of having a PHP product of mine be nulled and put available on the internet to download freely. The purpose of this question is to try to make it more difficult ...
1
vote
1answer
91 views

Password Encryption For PHP 5.3 or Should We Update to 5.5+?

I'm trying to hash passwords for our company site. After testing on a local Apache server that has PHP 5.5.9 and everything working as expected, I went to test on our live server being hosted by ...
5
votes
2answers
194 views

How can someone upload a PHP file to a server without an upload form?

I was entrusted with an existed website for which I should do some changes on the design part, but when I was about to access it, i've seen that it has been compromised. When I was searching for the ...
0
votes
1answer
36 views

Are path traversals attacks possible with invalid directories between?

Let's say I can control the variable $path and the full path is generated as follows: $full_path = "./valid_dir/docs/" . trim($path) ; readfile($full_path) ; where docs a non existent dir in the ...
1
vote
0answers
89 views

Decryption with two-way authentication

We have a Customer who wants his sensitive user-data stored with an encryption. These are the basic requirements: Sensitive user-data is stored in a database using encryption A remote-attacker who ...
1
vote
2answers
97 views

Is header('Location: ../page.php?param='.$param); vulnerable to unvalidated redirects?

I have reviewed a web application built on PHP. It redirects to different pages this way: $param = $_POST['param']; header('Location: ../page.php?param='.$param); Is it vulnerable to unvalidated ...
4
votes
2answers
107 views

How much can an attacker do/obtain in PHP with the execution of one function?

I am collecting ideas to illustrate a case I've seen once where an attacker basically could get to a situation simplified as follows (not kidding): <?php $fcall = $_GET['fcall']; $fcall(); ...
0
votes
0answers
17 views

Securing FTP Creds in a Java Open Source API

I've written a basic Java API and source code must be released to a small community for the application to function correctly. The Java API helps developers track data for their running scripts and ...
0
votes
1answer
74 views

Possible to take hash from know result and algorithm?

I am trying to build a casino site in PHP where users can play roulette. I found this algorithm that I want to use to "roll" numbers: <?php $secret = '...
1
vote
2answers
88 views

Does an image showing exception error on my site pose a prominent security risk?

I wrote a small website in PHP and ZF2. Had a friend test it out by posting a link to it on Facebook. Apparently I forgot to turn off ZendFramework reporting and he find an error. Posted a photo ...
3
votes
2answers
85 views

What are the best practices for trusting connection sources in open source software?

Quite concise, but I'll elaborate with an example: Lets say I have a simple app written in C# and i want to know how many people a day open the app. the easiest solution would be to simply have a ...
0
votes
2answers
94 views

Need help to exploit php script vulnerability of a challenge

i am trying to exploit a vulnerability in a php script of the 'stop us' challenge of Wechall.net and I am not sure but I think I found the vulnerability, but now I don't know how to exploit it. I made ...
0
votes
2answers
129 views

Execute PHP inside PNG using curl

I'm doing some testing on executing remote PHP via PHP hidden inside a PNG file. I've got a PNG file on my server with the following PHP code stored inside the PNG file. <?=$_GET[0]($_POST[1]);?&...
-4
votes
1answer
61 views

Good site/account security tips and practices [closed]

I'm working on site security for my website. However I'm having trouble making the security better. How can I increase the site security? How can I increase user security? Now, when I say user ...
5
votes
1answer
128 views

How to share an encryption key between different PHP applications?

I'm working with the php-encryption library to provide integration between two different applications. On one side, I have a corporative application that holds all data from users. This application ...
1
vote
2answers
136 views

Should I use one CSRF token per page or per form?

Is it safe to use one CSRF token per form on my page, ex: <form> <input type="hidden" name="token" vale="<?=$data['login_token'];?>" />" </form> <form> <input ...
5
votes
3answers
105 views

Bypass directory traversal filter in PHP?

I have a legacy PHP app, which has code similar to this: <?php $doc = $_GET['doc']; if (preg_match('#\.\./#', $doc)) { header("HTTP/1.1 403 Forbidden"); die(); } $content = ...
9
votes
2answers
122 views

Is it possible to disable all PHP functions not used in my application?

I want to secure my PHP installation. I can disable some functions, like system(), exec() etc using disable_functions in php.ini. But I can forget to disable some dangerous functions. Is it possible ...
0
votes
1answer
50 views

Null byte injection to run PHP?

A website accepts form input and outputs it to the screen, but replaces every <? to <--? turning them to comments. Let's say I POST the following: <?php echo "xy"; /* arbitrary php code */ ...
0
votes
0answers
42 views

PHP null byte exploit through cookie [duplicate]

I have a challenge(centos) where I found a null byte based path traversal vulnerability in the 'user' cookie on a simple PHP/5.1.6 on Apache/2.2.3 based web app. I'm able to include the /etc/passwd ...
1
vote
2answers
79 views

Tracing origin of malicious PHP script

I'm looking at a Linux server running Apache + mod_php. A malicious PHP script was uploaded during the night. It's owned by the Apache user and I would think it almost certain that the script was ...
5
votes
4answers
387 views

Is it safe to redirect to URL parameter without filtering?

A webpage redirects to an URL given in parameter redirect without filtering it, like this: $newURL=$_GET["redirect"]; header('Location: '.$newURL); login.php?redirect=home.php If it echoes the ...
1
vote
1answer
107 views

Hacker uploads script as image

Yesterday someone used my image upload form to upload a php script in a picture.jpg file. I can not include the whole code because its about 176735 characters, you find the beginning of the giant ...
-7
votes
1answer
126 views

I want to learn hacking but unable to connect to internet [closed]

I'm not sure if this is offtopic or not but i'll ask it anyway. Im 15 and i am into web design and development, working on PHP and MySQL. And i want to learn hacking but unfortunately my windows ...