Hackthebox - Topology
Machine ID: 546
tags: hackthebox linux easy
Initial Enumeration
nmap
sql
1 | # Nmap 7.93 scan initiated Sun Jun 11 19:01:25 2023 as: nmap -sC -sV -oN nmap/topology 10.10.11.217 |
Web
We find a potential users as lklein vdasisley abd dabrahams
We also see a subdomain as latex.topology.htb
Visiting Latex Equation Generator we ee this.
And Visting the index we see directory listing is enabled
Checking the logs file we see we are using pdfTeX, Version 3.14159265-2.6-1.40.20
Trying Injection on that we get
vim
1 | \newread\file |
Trying WriteFile also lead to
livescript
1 | \newwrite\outfile |
Running a command and monitoring /tempfiles we se
Trying to use fileConetnts to write to a file
latex
1 | \documentclass{article} |
we get input too long
latex
1 | \begin{filecontents*}{myFile.txt} |
Using this file is created but blank
After trying the same locally we figure out that newline is mandatory
So we urlencode the payload and we can write to a file
and can run command
Ref: https://texdoc.org/serve/latex2e.pdf/0
www-data Shell
Privilege Escalation
Running pspy64 we see
We create a plt file as
routeros
1 | set encoding iso_8859_1 |