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

learn more… | top users | synonyms

0
votes
2answers
26 views

Ways to secure administrative pages of a portable site

I made a CMS (using PHP) that is basically drag and drop to be live (under linux/apache hosts), now I need the communications between the administrative/login pages of said CMS and the client (recent ...
-4
votes
1answer
49 views

How to make my PHP website vulnerable to SQL injection [duplicate]

For training purposes, I want to make a demo website vulnerable to SQL injection. I went to the .htaccess file in the server and added these 2 lines: php_flag magic_quotes_gpc Off php_flag ...
0
votes
1answer
44 views

How to pick an encryption algorithm (cipher) and mode for PHP's mcrypt, for encrypting passwords?

There are numerous algorithms listed in the PHP documentation: http://php.net/manual/en/mcrypt.ciphers.php How strong is each one and what criteria to use when picking one? Also the ...
0
votes
2answers
83 views

How can I stop rails exposing its routes?

Today my site was probed maliciously. I have searched through the knowledge base for advice on how to block cg-bin requests but have not been able to find specific advice. A portion of the log of the ...
1
vote
0answers
22 views

Having trouble reproducing PHP heap based buffer overflow in quoted_printable_encode [on hold]

I am trying to follow the test script provided here. I've installed an apache web server with PHP version 5.3.25 and created a script with the following code: <?php // file: test.php $str = ...
-1
votes
0answers
10 views

About session and cookie [migrated]

it is possible to set cookie and session only with username or something like that? $_SESSION['username'] = $row['username']; setcookie('username', $row['username'], time() + (60 * 60 * ...
1
vote
0answers
98 views

Deobfuscated Malicious PHP Code Comprehensively [closed]

I found 3 php files in a htaccess-password-protected upload folder on my server: 1. default_folders.php 2. factory.php 3. HMAC.php Each of them contains a variable string, eg: ...
7
votes
4answers
3k views

What does this malicious PHP script do? [closed]

Somebody hacked my site and uploaded this script (template46.php) to my webroot and its content is: <?php $vIIJ30Y = Array('1'=>'F', '0'=>'j', '3'=>'s', '2'=>'l', '5'=>'M', ...
0
votes
1answer
71 views

How does PHP's password_hash() BCRYPT cost factor translate into cracking computation times

I am trying to fully understand the relationship between BCRYPT's COST factors and how much more time it would take a machine to crack a password with PHP 5.5's password_hash() The encryption times I ...
11
votes
3answers
654 views

Drupal server compromised - I want to investigate the attack technique / compromise

I've got a drupal site running on an up to date CentOS 7 LAMP AWS EC2 instance (freshly installed a couple of months ago) and I've just found out that somehow, probably through a poorly coded 3rd ...
0
votes
0answers
14 views

How to help devs use HMAC safely with multiple data values?

I work on an open source web app framework whose users (developers) need to generate "security tokens" (MACs) for various purposes. Since they've traditionally been using vulnerable methods like ...
13
votes
3answers
1k views

FTP hacked, planted file [closed]

Can anyone help me to understand what this does? Someone has planted a file with this piece of code on my server.It is shortened because it cannot fit the question, but just to have some idea what ...
2
votes
2answers
390 views

PHP: Am I free from SQL Injection? [duplicate]

Let me preface this by saying this is my first attempt to understand input sanitation, and at the moment I'm still a newbie to PHP. I've put together a quick register/log in website to test some ...
0
votes
2answers
105 views

Is my hashing function good enough

Is there an obvious flaw with this hashing function (written in PHP)? function hash($password) { sleep(1); // Make hashing slow $hash = ""; $iterations = strlen($password); for ( $i = 0; $i ...
1
vote
0answers
44 views

I want to figure out how cookies/ session variables interact to validate a user session [migrated]

---I have been experimenting on cookies/ session ids and have a little trouble digesting in the concepts. I'm working on a Debian distro. Using Burp to capture/alter requests/ responses. What I know ...
2
votes
2answers
100 views

After trying successful SQL injection why the result isn't getting displayed on the webpage?

Below is the PHP code I wrote that allows SQL injection with one parameter ie 'id' in this case. On trying SQL injection via putting this 2' ORDER BY 1;--' in the parameter (id field ), I get ...
44
votes
6answers
6k views

Should I be concerned if my website throws stack information?

I have a simple login form on my web page and the URL looks like this: example.com/signup/signup.php?q=1 If I try something like this: example.com/signup/signup.php?q=1&() I'm redirected to ...
1
vote
2answers
87 views

XSS via REQUEST_URI

Is there any situation where an XSS attack can be performed via the PHP $_SERVER['REQUEST_URI'] variable? For those unfamiliar with it: It contains the complete URL used to access that website, ...
1
vote
0answers
24 views

Security issues IIS 7.5 with PHP 5.3 [duplicate]

We are facing alot of weird php files all over our WordPress websites on our IIS 7.5 server. The file look like XSS script and maybe that php code that the hacker use to send spam emails or something ...
1
vote
1answer
82 views

Security issue with form action $_SERVER['PHP_SELF']

I read that there is a potential securty issue with forms like this (action $_SERVER['PHP_SELF']) <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input ...
2
votes
2answers
162 views

Hack: anymonous URL on my Joomla Website[Resolve] [closed]

My website has been hacked again. There are many foreign URLs such as here. I've checked the database and there is nothing strange in my database. Does anyone know what kind of hack attack is like ...
2
votes
2answers
208 views

What is a current best practice example of basic encryption and decryption in PHP?

I have a good working knowledge of basic security best practices (password hashing, preventing sql injection, CSRF, etc.) but am completely at a loss for finding a solution to common-case encryption ...
0
votes
1answer
67 views

Is enough to remove “..” from strings to avoid directory traversal attack?

Lets say I want to build a simple PHP script that let me access files inside a folder: $path = $_GET['path']; $path = str_replace('..', '', $path); $path = "./static/" . $path; readfile($path); Is ...
-3
votes
1answer
47 views

Creating blacklist on login page [closed]

I am working on how to secure login page from tautology attack. Can anybody help me on how to create blackist of SQL keywords in php ?
-2
votes
1answer
96 views

Possible Injection to PHP PDO

Expert says that PDO is one of secure scripting from mysql injection. I have read the manual about it and do some little research. And here, I'm trying to get ID value from URL paramater, as in: ...
1
vote
1answer
337 views

What does this PHP injected-code do?

I've just found out that all of my websites on one of my server has been hacked. Some seemingly malicous code was injected into all index.php files: /*EngineWork*/ if(!defined("FDSJERIUI234FSDF")){ ...
1
vote
0answers
38 views

IIS | Block execution of files in directory

I am dealing with user uploads via a PHP application. I want to secure the server so no exploits are available to the user, such as uploading a php shell and executing it. I have set it so all ...
0
votes
1answer
39 views

PHP and other files on the server, their visibility and access [closed]

Let's say I would like to protect my PHP files that are on the public server and are used as a part of the website. Does anyone can easily access these files just like HTML/JS/CSS files through ...
4
votes
3answers
188 views

Demonstrating SQL injection

I want to do a demo for a login page that is vulnerable to SQL injection for training purposes. I already tried to build one using PHP and MySQL. I commented the code sanitation to make the page ...
0
votes
1answer
66 views

php- is my code secured enough to protect from remote command execution when using shell_exec()?

I am using shell_exec function on the following variables to execute commands on the shell: fname (characters only) fpack(characters only) email (a valid email address) My code is: <?php ...
2
votes
0answers
20 views

Understanding how openx cache was infected

I have a system that uses openx for serving banners. I have recently noticed that several cache file in /var/cache contain infected code. The code contains sql queries that create several php files in ...
10
votes
4answers
1k views

What is Net-Worm.PHP.Mongiko trying to do?

I found several lines of this request in my web server access log: Source IP Dest IP Request Stat User agent 217.172.190.19 ...
-2
votes
2answers
106 views

Password hashing and blowfish [duplicate]

What I'm about to say is probably going to make me look like an idiot but it's better to be wrong and learn than have unanswered questions. Ever since I started dealing with passwords I wondered what ...
4
votes
3answers
146 views

PHP | Security for allowing user uploads

My Sittuation: I am creating a web application with PHP which allows users to scan their files for viruses. It allows the user to upload their files via the html "file" input type or via a URL. I ...
1
vote
2answers
103 views

How to test the php vulnerability CVE-2014-3515

How to test if I'm vulnerable regarding CVE-2014-3515? My vendor supplied me with a patch and verified that it installed however I would like to verify that I am no longer vulnerable. My vendor ...
1
vote
0answers
39 views

Unidentified contents injected in include file [closed]

This code was injected into a "include" file on my server. http://pastebin.com/Eueu8unY Any file that included this gave a 301 Moved Permanently error. I wish to know: Is this due to an insecure ...
2
votes
1answer
89 views

Using INTO OUTFILE with INSERT

I have some free time so I'm testing various local vulnerable machines. In one particular lab machine, you first have to gain administration panel, and then use the available "insert" command and ...
3
votes
1answer
150 views

Root server hacked via httpd - consequences and future prevention

Since before mid 2014, my root server was targeted by hackers and recently they gained limited access. I disabled all services once I realized the server has been compromised and started ...
0
votes
2answers
68 views

PHP Plugin Security

I've been working on a Home Automation system now for a little more than a year and I've added a plugin system to it. I've also added so others can submit their plugins and if I accept them then ...
0
votes
0answers
226 views

Codeigniter RESTful web api creation for mobile and web applications general guidelines

I'm having application with running good in codeigniter, mysql and jquery. Currently we are planning to evaluate our web application with mobile application. So we planned to develop web application, ...
7
votes
1answer
160 views

What is the name for this type of URL attack?

Say a PHP page accepts URL path as a POST parameter (like the answer to this question): $path = $_POST['url_path']; file_get_contents('http://example.com' . $path); A maliicious user POSTs ...
2
votes
2answers
611 views

Preventing SQL Injections

So I'm pretty new to SQL so I'm not too familiar with how to prevent any SQL injections. I have 1 main form that's being used as a poll and it currently only has 1 text field. At the moment I think ...
1
vote
2answers
110 views

SQL Injection Issue Multi-line query

I am currently doing a SQL Injection attack against a website in school(that the tech created) sadly I can't point anyone to the site in question, the teacher has allowed us to gain knowledge as ...
-1
votes
1answer
56 views

Is there a way to bypass the inbuilt php functions for sqlinjection

If there is a way to bypass the built-in functions of PHP to protect against SQL injection or I should rely on some other filters rather than depending on built-in functions?
2
votes
3answers
138 views

How to prevent adding malicious code, found in hacked Wordpress website?

I have a website created using Wordpress and used WooCommerce as the cart plugin. Recently I found it hacked, as it responded to an ajax request with a HTML code, which should receive a JSON object as ...
0
votes
0answers
27 views

Improve the security of a website implementing the least privilege principle [duplicate]

I am a beginner and I am trying to program a secure website to improve my skills and knowledge. I am under Linux and I am using LAMP with php. My website is similar to a social network so people will ...
18
votes
1answer
474 views

How to encrypt in PHP, properly?

How do I encrypt data in PHP, properly, using symmetric-key encryption? I have a message M and a secret S. I'm looking for a solution that uses cryptography properly without making any of the usual ...
0
votes
0answers
105 views

Improve the security of a website implementing the least privilege principle

I am a beginner and I am trying to program a secure website to improve my skills and knowledge. I am under Linux and I am using LAMP with php. My website is similar to a social network so people will ...
19
votes
8answers
2k views

PHP malware/shell keeps resurrecting [duplicate]

So I've been fighting this problem for months now and decided that it's beyond my limited (if at all) server skills, and that I need help from the pros. I have a VPS (with root access) which hosts ...
2
votes
0answers
47 views

Offering a privacy scenario with PHP mcrypt library

first of all, sorry if my question is not clear, because English is not my first language. Anyway, let-me explain the concept I'm struggling to solve as the best solution. I have some guys, and they ...