Run shell commands from PHP pages

0

Posted by fred | Posted in CMS, Drupal, Linux, Security, tutorial | Posted on 16-02-2012

Tags: , , ,

1. Shell in a Drupal website

A very useful Drupal module that will give you a command line directly in your site:
1. Install Shell module (can be download here)
2. Activate the module
3. Logged as an administrator, go to your site.com/shell
4. Run your commands just like in a shell.

Important security note: Set permissions to Administrators only, and I would recommend to disable the module when you don’t use it.

 

2. On any other php sites

 

Here is a simple php script to upload to your website (with FTP). Once uploaded, launch the page www.mysite.com/run.php and run some commands.

To download the file: http://php-html.net/tutorials/wp-content/uploads/2009/07/simple-run.zip

More information on http://php-html.net/tutorials/how-to-write-a-php-script-to-run-shell-commands-from-browser/

Important security note: Delete or change the extension of the run.php file when not using it!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

How to keep all your password safe? #keepass

0

Posted by fred | Posted in Security, Software | Posted on 15-01-2012

 

Updating my password database, I have realized that, even though it is mentioned in my software list, I had never blogged about KeePass, a tool that I have been using for many years in order to store all my passwords.

 

According to their website:

KeePass is a free open source password manager, which helps you to manage your passwords in a secure way. You can put all your passwords in one database, which is locked with one master key or a key file. So you only have to remember one single master password or select the key file to unlock the whole database. The databases are encrypted using the best and most secure encryption algorithms currently known (AES and Twofish).

 

There is a lot of nice features in KeePass but one of them that I find pretty useful is the file attachment feature. I personally use it to attach config files  for the website I am managing.

 

When closing a project, I generally create a new database with all the system passwords (master password, database credentials…) and store it along with the projects documents. By experience, it’s quite useful, especially for knowledge transfer to the product manager.

 

For security reasons, I would recommend as an authentication mechanism to use both a strong password and a key file that you will store on another medium (USB key for instance). Renaming the key file and changing its extension can add as well some extra security layers. Modify the key file on a regular basis and don’t forget to back it up!

 

More information on http://keepass.info/

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Malware issue on WordPress (and other php) websites

2

Posted by fred | Posted in Application, Security, Wordpress | Posted on 25-10-2011

I recently noticed that the following hidden links were added to the bottom of some web pages of one of my website:

Searching from where this code was generated, I noticed that the following piece of code was included at the top of almost every php files of my website:

Browsing some websites, I have found that some other webmasters had the same problem on their sites. Here is the best description of the symptoms related to this malware:

http://www.marinbezhanov.com/web-development/6/malware-alert-september-2011-sshell-v.1.0/

and here is a php script that was developed by PHP Beginners to clean up all the infected pages (http://www.php-beginners.com/solve-wordpress-malware-script-attack-fix.html).

If you found the malware in your sites, copy the cleaner.php to the root of each of your websites and run it with (http://mysite.com/myinfectedsite/cleaner.php).

You should as well find and delete the following files if they exist on your server:

    wp-thumb-creator.php
    b7a.php
    a95b.php

Hoping that this will make the full cleanup, last but not least it is strongly advised to change all your passwords (sites, database and FTP).

I suspect that this malware is coming from on of the wordpress plugin but cannot confirm it for the moment. I will keep you posted when I find the patient zero.

Good luck!

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)