BH US 08 Smith Ames Meta-Post Exploitation PDF
BH US 08 Smith Ames Meta-Post Exploitation PDF
Slide: 1
Valsmith
– Affiliations:
a o s
• Offensive Computing
• Metasploit
• cDc
– Work:
• Malware Analyst
• Reverse Engineer
• P
Penetration
i TTester
• Exploit developer
Slide: 2
Colin Ames
– Security Researcher, Offensive Computing
– Steganography
g g p y Research
– Penetration Testing
– Reverse Engineering
– Malware Analysis
Slide: 3
• What
Wh t is
i this?
thi ?
– Follow up to Val’s and HD Moore’s
Tactical Exploitation talk from
f last year
– A talk about the use of automation
andd ttactical
ti l ttools
l post-exploitation
t l it ti
– Applied techniques
– Good for LARGE environments
– Different perspectives: some old,
some forgotten, some new
Slide: 4
Post Exploitation Concepts Overview
Slide: 5
Wh t Is
What I Post
P t Exploitation?
E l it ti ?
Slide: 6
Wh t Is
What I Post
P t Exploitation?
E l it ti ?
Slide: 8
Wh Password
Why P d Management?
M t?
Slide: 9
P
Password
d Management
M t Goals
G l
Slide: 11
Manual Password Management
• Existing Tools
– L0phtCrack
• Stores passwords in session files
– Cain&Abel
• Static table, difficult to export / use / automate
• Password Classification (NTLM(NTLM, Cisco
Cisco, SQL
SQL, md5)
– Core Impact
• Good for automated reuse of passwords against many hosts
• No real storage / management capability
– Text file / John the Ripper
• Many people’s method
• Quick and dirty
dirty, not easily scalable
Slide: 12
Slide: 13
• MetaPass
• Demos
Slide: 14
Persistence
Slide: 15
A word on Stealth vs Persistence
– In
I the
th old
ld d
days a rootkit
tkit h
helped
l d you maintain
i t i roott
– Today rootkits are all about hiding
– These two concepts still go hand in hand
Slide: 16
P i t
Persistence
• Stages of Persistence
– Initial access:
• E
Exploit
l it
• Stolen password, etc.
– Decisions: What tool to use
• FUZZY – OS, Environment, Target dependent
– Setup
– Re-accessing of target
– Cleanup: Don’t be a slob, it will get you caught
• When you no longer need the target
target, leave no trace
Slide: 18
P i t
Persistence
• Existing tools
– Rootkits
– Backdoors
– Trojans
– Port knockers
– Adding accounts
– Things
Thi like
lik netcat
t t backdoors,
b kd inetd
i td
modifications, process injection, stealing
credentials, etc.
Slide: 19
Persistence
Slide: 20
Persistence
Slide: 21
Persistence
• Example:
• Machine has VNC installed
• Replace installed VNC with vulnerable version
– Authentication bypass
• Copy registry password so target doesn’t realize
• Persistence with no backdoors or rootkits to get
detected
Slide: 22
Persistence
Slide: 23
Persistence
• www.target.com/cgi-bin/app.cgi?lang=|cmd|
• Code will execute yyour commands
• Who needs to bind a shell to a port?
• Unlikelyy to ever be detected
– Especially good in big apps
– Code review can’t even be sure of maliciousness
– Some sites replace code every X time period
• No rootkits to install
• Tripwire
T i i probably
b bl won’t’t see thi
this
Slide: 25
Persistence
Slide: 26
Persistence
• Covert Accounts
– Add an account / renable
– Modify local account policies to allow access
• Ex. SUPPORT_3848576b1, guest
– Add it to the admin group (net localgroup)
• Only use AT to run your commands
• Persistence without adding files, new accounts
– Unlikely to be discovered
Slide: 28
• DEMOS
Slide: 29
Stealth / Evading Detection
Slide: 30
Stealth / Evading Detection
Slide: 31
Stealth / Evading Detection
• Why Stealth?
– If yyou g
get caught,
g , yyou g
get stopped
pp
– The longer you can operate undetected, the more you
can accomplish
– Admin’s won’t fix problems they don’t know exist
(helps persistence)
– On a pen test you should also be testing the
organizations detection and response capabilities
Slide: 32
Stealth / Evading Detection
• Goals
– Keep system operable
• If it breaks you can’t use it
• Someone will come fix it
– Operate without fear of detection
– Robustness
• Hiding shouldn’t require constant attention
– DON
DON’T
T LOOK MALICIOUS!
Slide: 33
Stealth / Evading Detection
Slide: 34
Stealth / Evading Detection
• Different Perspective
– DON’T BE AN ANOMALY!
– Hide in plain sight
• Many tools have ONLY malicious uses
• Make your intent hard to determine
– Be noisy on one to divert attention from
another
Slide: 35
Stealth / Evading Detection
• Different Perspective
– Know the targets environment better than
they do
• If they
th don’t
d ’t use encryption,
ti maybe
b you shouldn’t
h ld ’t either
ith
• Change strategies to match environment's normal
behavior
– Don’t always default to exploits
• See Tactical Exploitation talk
• IDS
IDS’ss can
can’tt see normal behavior that is malicious
Slide: 36
Stealth / Evading Detection
Slide: 37
• DEMOS
– Kaspersky squeals like a pig
Slide: 38
User Identity Theft
Slide: 39
User Identity Theft
Slide: 40
User Identity Theft
Slide: 41
User Identity Theft
• Existing tools
– Incognito (metasploit)
• Enumerate / hijack tokens
– FU/FUTO
• Enable SYSTEM privileges
• Change process privileges DKOM
– SU / SUDO / KSU
– Process injection
– Hijack
j domain credentials
Slide: 42
User Identity Theft
• What we want
– Privileges or SID’s
SID s
• What we get
– Access,
Access Access,
Access Access
• How we get it
– Incognito vs
vs. FUto
Slide: 43
• DEMOS
Slide: 44
Feature Modification
Slide: 45
Feature Modification
Slide: 46
Feature Modification
Slide: 47
Feature Modification
Slide: 48
Feature Modification
• Enabling psexec
– Psexec was great,
great awesome remote
shell/command tool
– Everybody now disables clipbook which
psexec requires l4m3
– Lets re-enable
re enable it !
Slide: 49
Feature Modification
• Enabling psexec
y
• Use the system control tool sc.exe
– Net use \\target\ipc$ username /user:password
– Sc \\target config netdde start= auto
– S \\target
Sc \\t t config
fi netddedsdm
tdd d d start=
t t auto
t
– Sc \\target config clipsrv start= auto
– Sc \\
\\target
a ge sstart
a netdde
e dde
– Sc \\target start netddedsdm
– Sc \\target start clipserv
Slide: 50
Feature Modification
• Enabling VNC (from command line)
– Go get VNC (check out guh.nu!)
– Make a folder on the target
g for the vnc files
– Copy the following files to target folder:
• Winvnc.exe
• Vnc.reg Vnc.reg file contents:
• Vnchooks.dll
[HKEY_LOCAL_MACHINE\SOFTWARE\ORL\WinVNC3\Default]
• Omnithread_rt.dll
"SocketConnect"=dword:00000001
"AutoPortSelect"=dword:00000001
– Regedit –s vnc.reg "InputsEnabled"=dword:00000001
"LocalInputsDisabled"=dword:00000000
– Winvncc –install
sa "IdleTimeout"=dword:00000000
"Q
"QuerySetting"=dword:00000002
S tti " d d 00000002
"QueryTimeout"=dword:0000000a
– Net start “vnc server” "PollUnderCursor"=dword:00000000
"PollForeground"=dword:00000001
– Winvnc "PollFullScreen"=dword:00000000
"OnlyPollConsole"=dword:00000001
"OnlyPollOnEvent"=dword:00000000
OnlyPollOnEvent dword:00000000
– Password is “infected” "Password"=hex:10,4d,89,3d,5a,e1,55,f8
Slide: 51
Feature Modification
Slide: 53
Feature Modification
• Enabling Remote Desktop remotely
– Create another file named enable_ts.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
"fDenyTSConnections"=dword:00000000
"TSEnabled"=dword:00000001
"TSUserEnabled"=dword:00000000
Slide: 55
Abusing The Scheduler
Slide: 56
Abusing The Scheduler
Slide: 57
Abusing The Scheduler
Slide: 58
Abusing The Scheduler
Slide: 60
Abusing The Scheduler
Slide: 62
Massive Automation
Slide: 63
Massive Automation
Slide: 64
Massive Automation
Slide: 65
• DEMOS
Slide: 66
• Related talks you should see
– Beyond EIP – The theoretical / tool
development end of things (spoonm & skape)
– Security Implications of Windows Access
Tokens (Luke Jennings)
Slide: 67
• Acknowledgements
– Thanks to
• All the people from #offensivecomputing, nologin,
uninformed IRC and SILC channels
• HD Moore especially for support and mentorship
• Danny Quist, krbklepto, Egypt, spoonm, skape
• Luke Jennings for his awesome work
Slide: 68
• Questions ?
• Presentation available at
www.offensivecomputing.net
ff i ti t
Slide: 69