Python 2.7 For iOS Filter Bypass

Type packetstorm
Reporter Benjamin Kunz Mejri
Modified 2016-03-31T00:00:00


Document Title:  
Python v2.7 v1.5.4 iOS - Filter Bypass & Persistent Vulnerability  
References (Source):  
Release Date:  
Vulnerability Laboratory ID (VL-ID):  
Common Vulnerability Scoring System:  
Product & Service Introduction:  
Python 2.7 for iOS is a Python 2.7.3 environment for the iOS. The Python  
2.7 series is scheduled to be the last major version in  
the 2.x series before 2.x moves into an extended maintenance period. The  
2.7 series contains many of the features that were  
first released in Python 3.1. Improvements in this release include:  
(Copy of the Homepage: )  
Abstract Advisory Information:  
The vulnerability laboratory core research team discovered a filter  
bypass issue and a persistent input validation vulnerability in the  
Python v2.7 v1.5.4 iOS mobile application.  
Vulnerability Disclosure Timeline:  
2016-03-31: Public Disclosure (Vulnerability Laboratory)  
Discovery Status:  
Affected Product(s):  
Jonathan Hosmer  
Product: Python (2.7) - iOS Mobile (Web-Application) 1.5.4  
Note: Other version may be affected as well. (3.x)  
Exploitation Technique:  
Severity Level:  
Technical Details & Description:  
A persistent input validation and mail encoding vulnerability has been  
discovered in the Python v2.7 v1.5.4 iOS application.  
The persistent web vulnerability allows to inject malicious script codes  
to the application-side of the vulnerable modules.  
The basic validation of the code formular and mask allows to include any  
type of script codes or programming language without  
offensive input restrictions. Attackers can inject code to a project to  
share it with another source. In the moment the code  
of the project is generated to the email body, a persistent script code  
execution occurs.  
There are two options to exploit, first is to send the malicious mail to  
the author of the program by the `Mail Author` function.  
Another possibility to execute code in the email body context is to  
share it with another code editor by email. In both email body  
message context the injected wrong filtered script code execution  
occurs. The internal encoding of the formular is correctly done  
but in case of sharing by qr or via message body email the execution occurs.  
The vulnerability is located on the application-side of the iOS  
application and the request method to inject requires physical device  
access or access to the share function. The bug is not only present in  
the python 2.7 version of the mobile client because other versions  
do support the same incorrect way of validation in the sharing process.  
Attackers can for example generate a QR code with malicious context that  
is executed in the message code were the code is mainly displayed  
by the iOS application.  
The security risk of the application-side vulnerability is estimated as  
medium with a cvss (common vulnerability scoring system) count of 3.6.  
Exploitation of the persistent web vulnerability requires a low  
privileged ios device user account with restricted access and low user  
Successful exploitation of the vulnerabilities results in persistent  
phishing mails, session hijacking, persistent external redirect to  
sources and application-side manipulation of affected or connected  
module context.  
Vulnerable Module(s):  
[+] Share to Authors  
[+] Share by Email  
[+] Share via QR Code  
Vulnerable Function(s):  
[+] Console  
[+] Python  
Proof of Concept (PoC):  
The persistent vulnerability and mail encoding bug can be exploited by  
remote attackers with low privileged device user account and low user  
For security demonstration or to reproduce the vulnerability follow the  
provided information and steps below to continue.  
Manual steps to reproduce the vulnerability ...  
1. Install the Python app to your apple iOS device  
2. Start the mobile application  
3. Include to the first variable in the demo code java or html script  
code and save the entry  
4. Open the saved entry again and click the top right arrow menu  
5. Now choose Create QR or Share the Code  
6. Opento message `Mail to Author` or the default `iOS Mail App` button  
7. Now the code of the formular gets transfered to the email message  
body context  
Note: The encoding does not parse or encode any inserted values  
8. The email arrives to the target inbox  
9. Open the email and the code executes directly in the message body or  
next to the generated qr code  
10. Successful reproduce of the filter and validation vulnerability in  
Note: The bug can be exploited by sending to the author, by sending to  
another target mail or by transfer of a qr code.  
PoC: Python  
aa = raw_input("hacki23:");  
print("><iframe>%20"><iframe src="x">);  
Solution - Fix & Patch:  
The vulnerability can be patched by a secure parse and encode of the  
python 2.7 project code. Encode and parse on convert to send by email.  
Restrict the input and disallow usage of html tags in the code line, as  
far as it is used filter thus inputs to prevent a persistent execution  
on the application-side.  
Security Risk:  
The security risk of the filter bypass issue and persistent input  
validation web vulnerability in the python ios app is estimated as  
medium. (CVSS 3.6)  
Credits & Authors:  
Vulnerability Laboratory [Research Team] - Benjamin Kunz Mejri  
( []  
Disclaimer & Information:  
The information provided in this advisory is provided as it is without  
any warranty. Vulnerability Lab disclaims all warranties, either  
expressed or implied,  
including the warranties of merchantability and capability for a  
particular purpose. Vulnerability-Lab or its suppliers are not liable in  
any case of damage,  
including direct, indirect, incidental, consequential loss of business  
profits or special damages, even if Vulnerability-Lab or its suppliers  
have been advised  
of the possibility of such damages. Some states do not allow the  
exclusion or limitation of liability for consequential or incidental  
damages so the foregoing  
limitation may not apply. We do not approve or encourage anybody to  
break any licenses, policies, deface websites, hack into databases or  
trade with stolen data.  
Domains: -   
Contact: - -  
Section: - -  
Social: - -  
Feeds: - -  
Programs: - -  
Any modified copy or reproduction, including partially usages, of this  
file requires authorization from Vulnerability Laboratory. Permission to  
redistribute this alert in its unmodified form is granted. All other  
rights, including the use of other media, are reserved by  
Vulnerability-Lab Research Team or  
its suppliers. All pictures, texts, advisories, source code, videos and  
other information on this website is trademark of vulnerability-lab team  
& the specific  
authors or managers. To record, list, modify, use or edit our material  
contact (admin@ or to get a ask permission.  
Copyright © 2016 | Vulnerability Laboratory -  
[Evolution Security GmbH]™