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
38 views

PHP null byte exploit through cookie

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
72 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 ...
4
votes
4answers
268 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 ...
0
votes
1answer
37 views

Free tools to run automated security audits for PHP code? [on hold]

I'm looking to scan my code for potential risks of SQL Injection, XSS, etc. Are there any free tools that can analyze code and give the complete reports. Thanks
1
vote
1answer
71 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
76 views

I want to learn hacking but unable to connect to internet [on hold]

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 ...
2
votes
1answer
90 views

Can data coming into my UDP server be sniffed?

I have made a small tracking device. I am trying to reduce the data overhead as much as possible to make the device very cheap to run. We are working on the basis that 1MB = £0.01 (the data price at ...
1
vote
1answer
38 views

Functions in common server-side languages which are used to execute code [closed]

I want to know the list of functions which are used to evaluate strings to code. For example: in PHP we have the eval function which evaluates a string to PHP code. Input passed into eval without ...
2
votes
1answer
42 views

PHP code in filename located in /tmp folder. How worried should I be?

I recently discovered a hidden file in /tmp owned by proftpd that worries me a bit: -rw-r--r-- 1 proftpd nogroup <timestamp> 86 .<?php eval($_REQUEST[cmd]); ?> I ...
0
votes
0answers
82 views

My website is getting this request all day long every minute xmlrpc.php

I am new to web building and I have word-fence blocking this as googling it tells me it's an attack on my server/website. My question is what are they hoping to achieve, it's not causing that much ...
2
votes
1answer
20 views

Is it necessary to sanitize data being passed into the hash_hmac in php?

I have a page that takes in arguments that could possibly be changed by a malicious user. I am checking to make sure that the contents have not been unexpectedly changed by using HMAC. In php, there ...
0
votes
0answers
47 views

null byte injection no response from environ

I have a challenge I'm working and I need some advice please. I found 2 null byte injection points on the web service, both of which gives me the contents of /ets/passwd when I do old ...
0
votes
2answers
58 views

What are the possible security issues when making a checkout system in Javascript?

I'm pretty new to JS and I am currently making a simple step-wise checkout system using purely JS and some Ajax and PHP. I have been wondering about the possible security issues that might pose with ...
0
votes
0answers
4 views

Do file_get_contents and readfile execute PHP code? [migrated]

I was always sure that the PHP functions file_get_contents and readfile execute any PHP code in any files - regardless of file type - that are given to it. I tried this on multiple setups, and it ...
2
votes
1answer
115 views

SQL injection vulnerability when using prepared statements in PHP

I've been studying prepared statements and implemented it in my first login. I used a prepared statement for the SQL query and am wondering if this is enough to ward off most SQL injections? Since ...
0
votes
1answer
105 views

Can there still be SQL injection when storing the password as a hash?

Could there be any SQL injection vulnerability in the code below since it only queries the database for username and bcrypt hash? Would the vulnerability of this code be more on the bcrypt hashing ...
2
votes
0answers
48 views

How secure is PHP IMAP? [closed]

I'm working on a project for one of my customers. They want a web environment where the site searches for specific emails for specific users and makes the attachments of those emails accessible to ...
1
vote
1answer
39 views

How many possible randomly generated salts could be generated using PHP's password_hash() function?

I have two questions here: 1) How many possible randomly generated salts could be generated using PHP's password_hash() function? 2) According to php.net it states that the return value is a ...
4
votes
1answer
91 views

Is this sanitization method secure?

I implemented this sanitization fix: function san($str, $type="full") { switch ($type) { case "full": $str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str); break; ...
-4
votes
1answer
64 views

Sum two SHA256 to get a SHA512 [closed]

I see this code in a web game SHA512(SeedServer + "|" + SeedUser) and I'm trying to reproduce this hash. I tried in PHP: <?php echo hash('SHA512', ...
2
votes
1answer
130 views

Best way to encrypt data using php - I am not sure if I doing it correctly [duplicate]

I want to encrypt some data within my php file when I add the stuff to my mysql database. This is how I do it. I create a static key like: $key = md5("pass"); Then I have two functions called ...
3
votes
2answers
48 views

Securely Erasing Cookies

Is there any sort of officially defined procedure (Eg from IETF) on how to correctly unset a cookie? I've always considered it best practice to unset any session cookies at logout for a web ...
4
votes
2answers
825 views

How secure is AES-256-CBC with user provided password and initialization vector

From my understanding the IV is used as a previous block for the first block only. But since each block is used by the following this adds significant security is a IV is provided and not based on the ...
0
votes
2answers
45 views

Is there a server/website specific malware scanner? [closed]

I have multiple Linux CentOS servers that are scanned with the Google Webmaster Tools, and when it finds some malicious code on my servers(shared/dedicated), the ranking of those site drops. What I am ...
4
votes
1answer
74 views

What is an example of arithmetic and buffer overflows in a php application?

I'm trying to find evidence whether it is possible to have overflows in a php application, whether buffer overflows or arithmetic overflows. I believe it's possible to have these overflows in the ...
0
votes
1answer
27 views

OpenSSL_encrypt returning an incorrect cyphertext?

I am trying to use the openssl_encrypt function in PHP, this is my code: <?php $message = hex2bin("00112233445566778899aabbccddeeff"); $key = hex2bin("000102030405060708090a0b0c0d0e0f"); $method ...
1
vote
1answer
62 views

Was my phpMyAdmin hacked?

On a server of mine I have a current version of phpMyAdmin running. Unfortunately (my bad I knew I hat to delete this folder for security after installation, I simply forgot... dangit) I still had the ...
-5
votes
1answer
84 views

What kind of base64 it is? [closed]

So I have a string that is 123456 then I md5 it and now I have hash e10adc3949ba59abbe56e057f20f883e then I don't know what kind of base64 (this is my thought about base64, mb its not base64 ...
4
votes
2answers
384 views

I think my site was hacked. Can someone explain the “GET / HTTP/1.0” garbage in my Apache log, and what it's doing?

Please see below the log entry from the hack, I have decoded the base_64 code and ultimately some files are dropped onto the server and a directory listing becomes available among other niceties! ...
2
votes
1answer
55 views

php's password_hash with system wide salt [duplicate]

I'm thinking about using password_hash function for generating password hashes. I have read that own salts shouldn't be generated and instead use the default one that the function generates. Own salts ...
3
votes
2answers
121 views

My Apache server is regularly challenged with vulnerability attacks: Do I need to worry?

When I look into my access logs: I find a lot of suspicious activity that looks like attempts to gain administrative access to my system using vulnerabilities from known web software products such as ...
-1
votes
1answer
56 views

Is this MySql query sql-injection protected? [duplicate]

I have small php code, before discovering mysqli real_escape_string i was using a function with some regex rules to clean every user input by symbols, but for an email or a password, this is not a ...
3
votes
2answers
112 views

How can i demonstrate remote file inclusion via get methods

I have been testing my PHP web application for RFI vulnerabilities. While performing scan I was able perform RFI in my web application. Scenario: In my web application RFI works only when the user's ...
6
votes
3answers
287 views

Recreating uploads/linked images with imagecreatefrom* php

As suggested on my StackOverflow question, I am now directing this towards the Information Security group, since no one was able to answer my question despite multiple up-votes. User uploaded images ...
0
votes
2answers
114 views

Is my code using mysqli_real_escape_string and quotes100% safe against SQL Injection?

My code is: SELECT * FROM tlb_members WHERE username="{mysqli_real_escape_string($_GET['test'])}" I'm searching and some people said using quotes in SQL statements is safe. Is this true?
3
votes
1answer
62 views

PHP - Is it safe to file_put_content raw HTML?

I'm planning to create a website to let people edit/customize their stories. Let's say the stories will store a lot of html tags ( paragraph, images & video ) I'm thinking using some javascript ...
3
votes
1answer
68 views

How could an attacker read the content of php session variables?

In my PHP code, I am generating an RSA keypair, sending the public key to the visitor and storing the private key in a session variable. Is it possible that an attacker might somehow be able to read ...
0
votes
2answers
58 views

PHP Image Upload - Security of storing outside root and accessing via readfile()

I recently began storing image uploads outside the webroot and retrieving them via readfile(). I implemented this and it's working fine, but I was curious if there are any further vulnerabilities that ...
4
votes
4answers
161 views

Why there are so many web servers which get exploited by generating obfuscated files?

TL & DR How do those obfuscated files many users complain on this SE-site about get on their systems? And after that, even more interesting how they get executed? Is this caused by the way php ...
2
votes
2answers
62 views

PHP filter_input() not protecting from eval()

I was updating some PHP code following the advice of not using $_GET and $_POST anymore but instead to switch to the safer filter_input() functions. I was thinking that function would save me in this ...
2
votes
0answers
94 views

How could someone trick Norton Safe Web into thinking my website has PHP files that don't exist?

I'm in a bit of a quandary over Norton Safe Web's rating of my company's website. My question is: is it possible for someone to fool Norton Safe Web into thinking that our website has PHP files which ...
24
votes
3answers
3k views

Is it safe to allow www-data to execute privileged commands?

I have noticed several questions on Stack Overflow, like this one, about executing commands with root privileges using PHP. The answer proposed to add the line www-data ALL=(ALL) NOPASSWD: ALL to ...
3
votes
1answer
149 views

Best way to hash passwords in PHP 5.3.5

What is the best way to hash passwords in PHP 5.3.5? Since in this version doesn't have password_hash().
3
votes
0answers
73 views

What is the best way to lock down web service access permissions?

After everything what I did in order to protect my server, i have uploaded webshell (WSO 2.1 Web Shell) , to see how far can hacker go and gues what, I was shocked, because I was able to read very ...
114
votes
2answers
9k views

I found unknown PHP code on my server. How do I de-obfuscate the code?

We've been getting a lot of noise regarding hacked PHP files here, and it's taking a lot of time to answer these questions. In many cases, they are off-topic. We've had a discussion about this on ...
0
votes
1answer
211 views

Please help me understand this PHP hack [duplicate]

We have found this on a hacked PHP webserver. It was in a single file. This file was included from somewhere else with @require. That's what we know: This site is running PHP 5.3 The site had ...
0
votes
1answer
118 views

Secure Image Upload, or Bypassing PHP mime-type Check

When securing image uploads there are basically three approaches I know of (of course, ideally, all three are used): check file extension store uploaded files in non-executable directory outside the ...
69
votes
5answers
15k views

Found suspicious, obfuscated PHP file. Is this a hack attempt on my website? [duplicate]

I just noticed that the top line of my index.php file got changed to what's below. <?php ...
-2
votes
1answer
109 views

Whats the most secure way to send user data from client to server? [closed]

I know there are probably many existing answers to this question but so far I couldn't find a simple detailed answer. On the android app there is two buttons, sign in with facebook and sign in with ...
0
votes
1answer
114 views

Secure implementation of user login

Well, I created login which works pretty fine, but I'm worried about its security. For checking if user is logged in I use only this $auth = $_COOKIE['authorization']; header ...